/**
 * Gallery — masonry grid + minimal lightbox
 */

.sv-page--gallery {
    background-color: var(--sv-color-ink);
    color: var(--sv-color-surface);
    min-height: 100vh;
    padding-top: var(--sv-header-height);
}

.sv-gallery-header {
    position: sticky;
    top: var(--sv-header-height);
    z-index: var(--sv-z-elevated);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sv-space-4);
    padding: var(--sv-space-5) var(--sv-space-gutter);
    background: rgba(28, 27, 25, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sv-gallery-header__label {
    font-family: var(--sv-font-body);
    font-size: var(--sv-text-eyebrow);
    font-weight: 500;
    letter-spacing: var(--sv-tracking-eyebrow);
    text-transform: uppercase;
    color: var(--sv-color-bronze-light);
    margin: 0;
}

.sv-gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sv-space-2);
}

.sv-gallery-filter {
    font-family: var(--sv-font-body);
    font-size: var(--sv-text-caption);
    font-weight: 500;
    letter-spacing: var(--sv-tracking-wide);
    text-transform: uppercase;
    color: rgba(255, 252, 248, 0.55);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--sv-radius-sm);
    padding: 0.55em 1.1em;
    cursor: pointer;
    transition:
        color var(--sv-duration-fast) var(--sv-ease-luxury),
        border-color var(--sv-duration-fast) var(--sv-ease-luxury),
        background-color var(--sv-duration-fast) var(--sv-ease-luxury);
}

.sv-gallery-filter:hover {
    color: var(--sv-color-surface);
}

.sv-gallery-filter.is-active {
    color: var(--sv-color-ink);
    background: var(--sv-color-surface);
    border-color: var(--sv-color-surface);
}

.sv-gallery-filter:focus-visible {
    outline: 2px solid var(--sv-color-focus-ring);
    outline-offset: 2px;
}

.sv-gallery-masonry {
    column-count: 1;
    column-gap: var(--sv-space-3);
    padding: var(--sv-space-6) var(--sv-space-gutter) var(--sv-space-section);
}

@media (min-width: 640px) {
    .sv-gallery-masonry {
        column-count: 2;
        column-gap: var(--sv-space-4);
    }
}

@media (min-width: 1024px) {
    .sv-gallery-masonry {
        column-count: 3;
        column-gap: var(--sv-space-5);
    }
}

@media (min-width: 1400px) {
    .sv-gallery-masonry {
        column-count: 4;
    }
}

.sv-gallery-masonry .sv-gallery-item {
    break-inside: avoid;
    margin-bottom: var(--sv-space-4);
    opacity: 1;
    transform: scale(1);
    transition:
        opacity var(--sv-duration-base) var(--sv-ease-luxury),
        transform var(--sv-duration-base) var(--sv-ease-luxury);
}

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

.sv-gallery-item__trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    overflow: hidden;
    border-radius: var(--sv-radius-sm);
}

.sv-gallery-item__trigger img {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: middle;
    transition: transform var(--sv-duration-cinematic) var(--sv-ease-luxury);
}

@media (prefers-reduced-motion: no-preference) {
    .sv-gallery-item__trigger:hover img {
        transform: scale(1.03);
    }
}

.sv-gallery-item--tall .sv-gallery-item__trigger img {
    min-height: 22rem;
    object-fit: cover;
}

.sv-gallery-empty {
    column-span: all;
    text-align: center;
    padding: var(--sv-space-20);
    color: rgba(255, 252, 248, 0.5);
    font-size: var(--sv-text-body);
}

/* ─── Lightbox ────────────────────────────────────────────────── */

.sv-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 8, 7, 0.96);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--sv-duration-fast) var(--sv-ease-luxury),
        visibility var(--sv-duration-fast) var(--sv-ease-luxury);
}

.sv-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.sv-lightbox__close {
    position: absolute;
    top: var(--sv-space-6);
    right: var(--sv-space-gutter);
    z-index: 2;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--sv-color-surface);
    cursor: pointer;
    transition: background var(--sv-duration-fast) var(--sv-ease-luxury);
}

.sv-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sv-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--sv-color-surface);
    cursor: pointer;
    transition: background var(--sv-duration-fast) var(--sv-ease-luxury);
}

.sv-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sv-lightbox__nav--prev {
    left: var(--sv-space-gutter);
}

.sv-lightbox__nav--next {
    right: var(--sv-space-gutter);
}

.sv-lightbox__stage {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    margin: 0 auto;
    padding: var(--sv-space-12) var(--sv-space-16);
}

.sv-lightbox__image {
    max-width: 100%;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    user-select: none;
}

.sv-lightbox__counter {
    position: absolute;
    bottom: var(--sv-space-6);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--sv-font-body);
    font-size: var(--sv-text-caption);
    letter-spacing: var(--sv-tracking-wide);
    text-transform: uppercase;
    color: rgba(255, 252, 248, 0.45);
    margin: 0;
}

@media (max-width: 640px) {
    .sv-lightbox__nav {
        display: none;
    }

    .sv-lightbox__stage {
        padding: var(--sv-space-10) var(--sv-space-4);
    }
}
