@layer components {
    html.article-gallery-open { overflow: hidden; scrollbar-gutter: stable; }
    .article-body a[data-article-image] { cursor: zoom-in; }
    .article-gallery {
        width: min(1380px, calc(100% - 32px));
        height: calc(100% - 32px);
        height: calc(100dvh - 32px);
        max-width: none;
        max-height: none;
        margin: auto;
        padding: 20px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: var(--panel);
        color: var(--ink);
        box-shadow: var(--panel-shadow);
    }
    .article-gallery[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px; }
    .article-gallery::backdrop { background: #0a0d16d9; }
    .article-gallery__toolbar, .article-gallery__navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .article-gallery__counter { font-size: 14px; font-weight: 650; }
    .article-gallery__button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        min-height: 46px;
        padding: 10px 16px;
        border: 1px solid var(--line);
        border-radius: 10px;
        color: var(--ink);
        background: var(--subtle);
        font-weight: 650;
        font-size: 14px;
    }
    .article-gallery__button:hover { background: var(--button); color: var(--button-ink); border-color: var(--button); }
    .article-gallery__button:focus-visible { outline-offset: 2px; }
    .article-gallery__figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; min-height: 0; margin: 0; }
    .article-gallery__stage { display: grid; place-items: center; min-height: 0; touch-action: pan-y pinch-zoom; }
    .article-gallery__image { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
    .article-gallery__caption { max-height: 18dvh; overflow-y: auto; color: var(--muted); font-size: 14px; line-height: 1.55; text-align: center; white-space: pre-line; }
    .article-gallery__status { max-width: 50ch; text-align: center; line-height: 1.7; }
    .article-gallery__status a { color: var(--accent); text-underline-offset: 3px; }
}
@layer responsive {
    @media (max-width: 600px) {
        .article-gallery { width: calc(100% - 16px); height: calc(100dvh - 16px); padding: 12px; border-radius: 12px; }
        .article-gallery[open] { gap: 10px; }
        .article-gallery__button { padding: 10px 12px; gap: 8px; }
        .article-gallery__caption { font-size: 13px; }
    }
}
