.gallery-page {
    --gallery-base: #171717;
    --gallery-surface: rgba(255, 255, 255, 0.04);
    --gallery-line: rgba(255, 255, 255, 0.1);
    --gallery-muted: #9f9d9d;
    --gallery-ink: #f5f2f2;
}

html[data-theme="light"] .gallery-page {
    --gallery-base: #f5f4f0;
    --gallery-surface: #eae8e3;
    --gallery-line: #e6e4df;
    --gallery-muted: #737373;
    --gallery-ink: #1a1a1a;
}

.gallery-page .site-shell {
    width: min(100%, 1600px);
}

.gallery-page-main {
    padding: 72px 56px 96px;
    background: var(--gallery-base);
}

.gallery-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 48px;
    padding-bottom: 72px;
    border-bottom: 1px solid var(--gallery-line);
}

.gallery-copy {
    display: grid;
    gap: 28px;
    max-width: 920px;
}

.gallery-eyebrow {
    margin: 0;
    color: var(--gallery-muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.gallery-title {
    margin: 0;
    color: var(--gallery-ink);
    font-family: "Newsreader", serif;
    font-size: clamp(4rem, 8vw, 8rem);
    font-weight: 400;
    line-height: 0.9;
    letter-spacing: -0.05em;
}

.gallery-summary {
    margin: 0;
    max-width: 30ch;
    color: var(--gallery-muted);
    font-family: "Inter", sans-serif;
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.7;
}

.gallery-page .button-secondary.gallery-back,
.gallery-page .button-secondary.gallery-load-more {
    min-height: 56px;
    padding: 0 24px;
    border-radius: 999px;
    border-color: var(--gallery-line);
}

.gallery-page .button-secondary.gallery-back:hover,
.gallery-page .button-secondary.gallery-load-more:hover {
    border-color: var(--accent);
}

.photo-grid-section {
    padding-top: 72px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 56px 24px;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    gap: 18px;
    content-visibility: auto;
    contain-intrinsic-size: 320px 460px;
}

.gallery-item.is-hidden {
    display: none;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4 / 5;
    border-radius: 18px;
    background: var(--gallery-surface);
    transition: transform 700ms ease;
    cursor: pointer;
}

.gallery-item:hover img {
    transform: scale(1.03);
}

.gallery-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--gallery-line);
}

.gallery-date {
    color: var(--gallery-ink);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.gallery-item::after {
    content: counter(gallery-item, decimal-leading-zero);
    display: none;
}

.gallery-caption::after {
    content: counter(gallery-card, decimal-leading-zero);
}

.photo-grid {
    counter-reset: gallery-card;
}

.photo-grid .gallery-item {
    counter-increment: gallery-card;
}

.photo-grid .gallery-item .gallery-caption::after {
    color: var(--gallery-muted);
    font-family: "Inter", sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0;
}

.gallery-load-more-row {
    display: flex;
    justify-content: center;
    margin-top: 72px;
}

.gallery-load-more[hidden] {
    display: none;
}

.gallery-footer {
    border-top: 1px solid var(--border);
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1400;
    justify-content: center;
    align-items: center;
    background: rgba(17, 16, 13, 0.92);
    backdrop-filter: blur(12px);
}

.lightbox-content {
    position: relative;
    max-width: min(1080px, 88vw);
    max-height: 84vh;
    margin: auto;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    object-fit: contain;
}

.lightbox-caption {
    padding-top: 12px;
    color: rgba(255, 255, 255, 0.76);
    text-align: center;
    font-family: "Inter", sans-serif;
}

.lightbox-close,
.lightbox-nav {
    position: fixed;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.lightbox-close {
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
}

.lightbox-nav {
    top: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 24px;
}

.lightbox-next {
    right: 24px;
}

@media (max-width: 1180px) {
    .gallery-page-main {
        padding-left: 40px;
        padding-right: 40px;
    }

    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .gallery-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .gallery-summary {
        max-width: 34ch;
    }
}

@media (max-width: 720px) {
    .gallery-page-main {
        padding: 40px 18px 72px;
    }

    .gallery-title {
        font-size: clamp(3rem, 18vw, 5rem);
    }

    .photo-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .gallery-page .button-secondary.gallery-back,
    .gallery-page .button-secondary.gallery-load-more {
        width: 100%;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .lightbox-prev {
        left: 12px;
    }

    .lightbox-next {
        right: 12px;
    }

    .lightbox-close {
        top: 12px;
        right: 12px;
    }
}
