/* Native Screenshots: ohne zusätzlichen Geräterahmen und ohne Bildbeschnitt. */
.screenshot-gallery { scroll-margin-top: 100px; }
[data-screenshot-gallery] { min-width: 0; }
[data-device-panel][hidden], [data-gallery-controls][hidden] { display: none !important; }

.device-switch {
    display: flex;
    justify-content: center;
    width: fit-content;
    margin: 0 auto 2rem;
    padding: 4px;
    gap: 4px;
    border-radius: var(--r-pill);
    background: var(--fill);
}
.device-switch button {
    min-width: 110px;
    min-height: 44px;
    padding: 10px 22px;
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--label-secondary);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.device-switch button[aria-pressed="true"] {
    background: var(--bg-card);
    color: var(--blue);
    box-shadow: var(--shadow-card);
}
.device-switch button:hover { color: var(--blue); }
.gallery-device-title { margin: 0 0 1.25rem; }
[data-device-panel] + [data-device-panel] { margin-top: 2.5rem; }
[data-device-panel][hidden] + [data-device-panel] { margin-top: 0; }

.screenshot-track {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 6px 4px 1.25rem;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 4px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--label-tertiary) transparent;
    -webkit-overflow-scrolling: touch;
}
.screenshot-track::-webkit-scrollbar { height: 6px; }
.screenshot-track::-webkit-scrollbar-thumb {
    background: var(--label-tertiary);
    border-radius: var(--r-pill);
}
.screenshot-card {
    flex: 0 0 calc((100% - 3.75rem) / 4);
    min-width: 0;
    margin: 0;
    scroll-snap-align: start;
}
[data-device-panel="ipad"] .screenshot-card {
    flex-basis: calc((100% - 2.5rem) / 3);
}
.screenshot-card a {
    display: block;
    border-radius: var(--r-md);
    transition: transform 0.2s;
}
.screenshot-card a:hover { transform: translateY(-2px); }
.screenshot-card img {
    width: 100%;
    height: auto;
    border: 1px solid var(--separator);
    border-radius: var(--r-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}
.screenshot-card img.transparent-device {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.screenshot-card figcaption {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding-top: 1rem;
    color: var(--label);
    font-size: 15px;
    line-height: 1.4;
}
.screenshot-number {
    flex: 0 0 auto;
    min-width: 28px;
    padding: 2px 5px;
    border-radius: 7px;
    background: var(--tint-blue);
    color: var(--blue);
    font-family: var(--font-rounded);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.gallery-hint {
    margin-top: 1rem;
    color: var(--label-secondary);
    font-size: 14px;
    text-align: center;
}
.device-switch button:focus-visible,
.screenshot-card a:focus-visible,
.screenshot-dialog button:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 4px;
}

/* Der native Dialog liegt auch über dem Cookie-Hinweis im Top Layer. */
body.screenshot-preview-open { overflow: hidden; }
.screenshot-dialog {
    width: fit-content;
    max-width: min(1120px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 16px;
    overflow: auto;
    border: 1px solid var(--separator);
    border-radius: var(--r-lg);
    background: var(--bg-card);
    color: var(--label);
    box-shadow: var(--shadow-phone);
}
.screenshot-dialog[open] {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.screenshot-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.screenshot-dialog [data-close-preview] {
    align-self: flex-end;
    min-height: 44px;
    padding: 8px 18px;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--tint-blue);
    color: var(--blue);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.screenshot-dialog figure { margin: 0; }
.screenshot-dialog [data-preview-image] {
    width: auto;
    height: auto;
    max-width: min(1080px, calc(100vw - 4.25rem));
    max-height: calc(100vh - 11rem);
    max-height: calc(100dvh - 11rem);
    margin: 0 auto;
    object-fit: contain;
    border-radius: var(--r-sm);
}
.screenshot-dialog figcaption {
    max-width: 42rem;
    margin: 12px auto 0;
    font-size: 15px;
    line-height: 1.4;
    text-align: center;
}

@media (max-width: 968px) {
    .screenshot-card { flex-basis: calc((100% - 2.5rem) / 3); }
    [data-device-panel="ipad"] .screenshot-card { flex-basis: calc((100% - 1.25rem) / 2); }
}
@media (max-width: 640px) {
    .device-switch { margin-bottom: 1.5rem; }
    .screenshot-track { gap: 1rem; }
    .screenshot-card { flex-basis: 72%; }
    [data-device-panel="ipad"] .screenshot-card { flex-basis: 88%; }
    .screenshot-dialog {
        max-width: calc(100% - 1.5rem);
        padding: 12px;
        border-radius: var(--r-md);
    }
    .screenshot-dialog [data-preview-image] {
        max-width: calc(100vw - 3.25rem);
        max-height: calc(100vh - 10rem);
        max-height: calc(100dvh - 10rem);
    }
}
@media (prefers-reduced-motion: reduce) {
    .device-switch button, .screenshot-card a { transition: none; }
}
