:root {
    --surface: rgba(10, 18, 34, 0.82);
    --surface-soft: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --title: #f8fafc;
    --muted: #94a3b8;
    --accent: #9f7aea;
    --accent-soft: rgba(159, 122, 234, 0.22);
    --accent-glow: rgba(159, 122, 234, 0.38);
    --shadow: 0 32px 80px rgba(2, 6, 23, 0.45);
}


[data-gallery] img {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
}

.page-shell {
    width: min(96rem, calc(100% - 2rem));
    padding: 2.4rem 0;
}

.gallery {
    background: white;
    border: 1px solid var(--border);
    border-radius: 3rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
    padding: clamp(1.6rem, 2vw, 2.4rem);
}

.gallery-stage {
    position: relative;
    min-height: clamp(28rem, 60vw, 62rem);
    display: grid;
    align-items: center;
    padding: clamp(5.6rem, 7vw, 7.2rem) clamp(1.6rem, 7vw, 6rem)
    clamp(2rem, 4vw, 3.2rem);
    border-radius: 2.4rem;
    background:
            radial-gradient(circle at 50% 32%, var(--accent-soft), transparent 34%),
            linear-gradient(
                    180deg,
                    rgba(255, 255, 255, 0.05),
                    rgba(255, 255, 255, 0.02)
            );
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.gallery-stage::before {
    content: "";
    position: absolute;
    inset: auto auto -6rem -6rem;
    width: 22rem;
    height: 22rem;
    border-radius: 50%;
    background: var(--accent-glow);
    filter: blur(80px);
    opacity: 0.6;
    pointer-events: none;
}

.gallery-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #f7941e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.main-figure {
    position: relative;
    z-index: 1;
}

.main-image {
    width: min(100%, 56rem);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    object-fit: contain;
    transform: rotate(var(--image-tilt, -7deg));
    filter: drop-shadow(0 3rem 5rem rgba(15, 23, 42, 0.42));
}

.main-image.is-animating {
    animation: image-enter 360ms ease;
}

.image-meta {
    display: flex;
    justify-content: center;
    margin-top: 1.2rem;
    color: var(--muted);
    font-size: 1.4rem;
    letter-spacing: 0.08rem;
}

.nav-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 4.6rem;
    height: 4.6rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: rgba(8, 17, 32, 0.75);
    color: var(--title);
    cursor: pointer;
    transform: translateY(-50%);
    transition:
            transform 180ms ease,
            background 180ms ease,
            border-color 180ms ease;
}

.nav-button:hover,
.nav-button:focus-visible {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.04);
}

.nav-button-prev {
    left: 1.6rem;
}

.nav-button-next {
    right: 1.6rem;
}

/* ── Thumbnail slider wrapper ── */
.thumbnail-slider {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.4rem;
}

.thumb-nav {
    flex-shrink: 0;
    width: 3.2rem;
    height: 3.2rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: rgba(8, 17, 32, 0.75);
    color: var(--title);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
            background 180ms ease,
            border-color 180ms ease,
            opacity 180ms ease;
}

.thumb-nav:hover,
.thumb-nav:focus-visible {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Scrollable viewport — clips everything outside the visible window */
.thumbnail-viewport {
    flex: 1;
    overflow: hidden;          /* no scrollbar visible */
    overflow-x: hidden;
}

.thumbnail-strip {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    /* no wrap — single row that scrolls */
}

.thumbnail {
    flex: 0 0 calc(20% - 0.8rem);   /* 5 visible at a time */
    border: 1px solid transparent;
    border-radius: 1.8rem;
    background: var(--surface-soft);
    padding: 0.8rem;
    cursor: pointer;
    transition:
            transform 180ms ease,
            border-color 180ms ease,
            background 180ms ease;
}

.thumbnail img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 1.2rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
}

.thumbnail:hover,
.thumbnail:focus-visible,
.thumbnail.is-active {
    transform: translateY(-0.2rem);
    border-color: rgba(255, 255, 255, 0.14);
}

.thumbnail.is-active {
    box-shadow: inset 0 0 0 0.1rem var(--accent);
}

.sr-only {
    position: absolute;
    width: 0.1rem;
    height: 0.1rem;
    padding: 0;
    margin: -0.1rem;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

:focus-visible {
    outline: 0.2rem solid rgba(255, 255, 255, 0.9);
    outline-offset: 0.3rem;
}

@keyframes image-enter {
    0% {
        opacity: 0;
        transform: translateY(1.2rem) scale(0.96) rotate(var(--image-tilt, -7deg));
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(var(--image-tilt, -7deg));
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100%, calc(100% - 1.2rem));
        padding: 0.6rem 0;
    }

    .gallery {
        border-radius: 2.2rem;
        padding: 1.2rem;
    }

    .gallery-stage {
        min-height: 34rem;
        padding: 6.8rem 1.2rem 6.4rem;
    }

    .nav-button {
        top: auto;
        bottom: 1.4rem;
        transform: none;
    }

    .nav-button:hover,
    .nav-button:focus-visible {
        transform: scale(1.04);
    }

    .nav-button-prev {
        left: calc(50% - 5.2rem);
    }

    .nav-button-next {
        right: calc(50% - 5.2rem);
    }

    .thumbnail {
        flex: 0 0 calc(33.33% - 0.68rem); /* 3 visible on mobile */
    }
}

@media (max-width: 400px) {
    html {
        font-size: 56.25%;
    }

    .gallery-badge {
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 2.4rem);
        text-align: center;
    }

    .thumbnail-strip {
        gap: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}