.gallery-page {
    --gallery-gap: clamp(1rem, 3vw, 1.75rem);
}

.gallery-hero {
    background: linear-gradient(120deg, rgba(8, 28, 48, 0.95), rgba(12, 57, 36, 0.9)),
        url('/assets/images/20260315053546-5902.webp') center/cover;
    color: #fff;
    padding: clamp(2rem, 8vw, 4rem);
    border-radius: var(--radius-4);
}

.gallery-hero .lede {
    color: rgba(255, 255, 255, 0.85);
}

.gallery-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--size-4);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.gallery-meta strong {
    font-size: 1.25rem;
    color: #fff;
}

.gallery-collection {
    background: #fff;
    border-radius: var(--radius-4);
    padding: clamp(2rem, 7vw, 3.5rem);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gallery-gap);
}

.gallery-item {
    display: grid;
    gap: var(--size-2);
}

.gallery-thumb {
    border: none;
    padding: 0;
    background: none;
    border-radius: var(--radius-3);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: var(--shadow-2);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 200ms ease, filter 200ms ease;
}

.gallery-thumb::after {
    content: "View";
    position: absolute;
    inset: auto 0 0;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.gallery-item figcaption {
    display: grid;
    gap: 0.2rem;
    font-size: 0.95rem;
}

.gallery-item figcaption span {
    color: var(--site-text-muted);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    place-items: center;
    z-index: 999;
}

.gallery-lightbox:not([hidden]) {
    display: grid;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 15, 0.85);
    backdrop-filter: blur(6px);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    max-width: min(900px, 90vw);
    width: 100%;
    background: #0b1118;
    color: #fff;
    border-radius: var(--radius-4);
    padding: clamp(1rem, 3vw, 2rem);
    box-shadow: var(--shadow-5);
}

.lightbox-dialog figure {
    margin: 0;
    display: grid;
    gap: 1rem;
}

.lightbox-dialog img {
    width: 100%;
    border-radius: var(--radius-3);
    object-fit: contain;
    max-height: min(70vh, 520px);
    background: #000;
}

.lightbox-title {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.lightbox-caption {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
}

.lightbox-controls {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.lightbox-nav {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border-radius: 999px;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    cursor: pointer;
}

.lightbox-count {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 640px) {
    .gallery-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .lightbox-dialog {
        padding: 1.25rem;
    }

    .lightbox-controls {
        flex-direction: column;
    }

    .lightbox-nav {
        width: 100%;
    }
}
