/* Screenshot gallery shared by the app pages.
   Uses each page's own --accent, --border, --surface and --text variables. */

.gallery {
    position: relative;
    /* Break out of the 720px text column, up to 1100px, never wider than the viewport. */
    margin: 0 calc(50% - min(550px, 50vw - 16px)) 4rem;
}

.gallery-track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 4px;
    padding: 8px 4px 24px;
    scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-track button {
    flex: 0 0 auto;
    width: calc((100% - 3 * 24px) / 4);
    min-width: 220px;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    scroll-snap-align: start;
    border-radius: 28px;
}

.gallery-track button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.gallery-track img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1320 / 2868;
    object-fit: cover;
    border-radius: 28px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

.gallery-track button:hover img {
    transform: translateY(-4px);
}

.gallery-nav {
    position: absolute;
    top: calc(50% - 24px);
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(20, 20, 24, 0.85);
    color: var(--text);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: opacity 0.2s, background 0.2s;
}

.gallery-nav:hover {
    background: rgba(40, 40, 48, 0.95);
}

.gallery-nav[disabled] {
    opacity: 0;
    pointer-events: none;
}

.gallery-prev { left: -8px; }
.gallery-next { right: -8px; }

.gallery-lightbox {
    margin: auto; /* pages reset * { margin: 0 }, which un-centers <dialog> */
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
}

.gallery-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
}

.gallery-lightbox img {
    display: block;
    max-height: 92vh;
    max-width: 92vw;
    width: auto;
    border-radius: 32px;
}

.gallery-lightbox form {
    position: fixed;
    top: 16px;
    right: 16px;
}

.gallery-lightbox .gallery-close {
    position: static;
    margin: 0;
}

@media (max-width: 600px) {
    .gallery-track {
        gap: 16px;
    }

    .gallery-track button {
        width: 72%;
        min-width: 0;
    }

    .gallery-nav {
        display: none;
    }
}
