/* ==========================================================================
   Gallery — shared by /gallery and the homepage gallery preview
   Premium · Warm · Editorial. Builds on the tokens in css/site.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BREADCRUMBS
   -------------------------------------------------------------------------- */
.breadcrumbs {
    --crumb-fg: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--crumb-fg);
}

.breadcrumbs li+li::before {
    content: '';
    width: 5px;
    height: 5px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.6;
}

.breadcrumbs a {
    color: var(--crumb-fg);
    text-decoration: none;
    transition: color 0.25s ease;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
    color: var(--accent);
}

.breadcrumbs [aria-current="page"] {
    color: var(--accent);
    font-weight: 600;
}

/* Dark-surface variant (used above the fold, on imagery) */
.breadcrumbs--overlay {
    --crumb-fg: rgba(255, 255, 255, 0.78);
}

/* --------------------------------------------------------------------------
   2. GALLERY HERO
   -------------------------------------------------------------------------- */
.gallery-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(440px, 62vh, 620px);
    padding: calc(var(--header-h) + 72px) 0 68px;
    overflow: hidden;
    isolation: isolate;
}

.gallery-hero__media {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--bg-secondary);
}

.gallery-hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 55%;
    transform: scale(1.04);
    animation: galleryHeroDrift 26s ease-in-out infinite alternate;
}

@keyframes galleryHeroDrift {
    from {
        transform: scale(1.04) translate3d(0, 0, 0);
    }

    to {
        transform: scale(1.12) translate3d(0, -1.5%, 0);
    }
}

/* Warm, cinematic scrim — keeps the gold accents glowing without a flat veil */
.gallery-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(10, 10, 10, 0.88) 0%, rgba(10, 10, 10, 0.34) 34%, rgba(10, 10, 10, 0.82) 78%, var(--bg) 100%),
        radial-gradient(120% 80% at 12% 100%, rgba(212, 175, 55, 0.16), transparent 60%);
}

.gallery-hero__inner {
    position: relative;
    width: 100%;
}

.gallery-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--accent);
}

.gallery-hero__eyebrow::after {
    content: '';
    width: 46px;
    height: 1px;
    background: var(--accent);
    opacity: 0.7;
}

.gallery-hero__title {
    font-family: var(--font-heading);
    font-size: clamp(2.7rem, 7vw, 5rem);
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 20px;
    text-wrap: balance;
}

.gallery-hero__title em {
    display: block;
    font-size: 0.46em;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.gallery-hero__lede {
    max-width: 640px;
    font-size: clamp(0.98rem, 1.6vw, 1.08rem);
    font-weight: 300;
    line-height: 1.75;
    color: var(--text-secondary);
}

.gallery-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 34px;
    padding: 0;
    list-style: none;
}

.gallery-hero__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 22px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gallery-hero__stat b {
    font-family: var(--font-heading);
    font-size: 1.24rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--accent);
}

.gallery-hero__stat span {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   3. FILTER BAR
   -------------------------------------------------------------------------- */
.gallery-toolbar {
    position: sticky;
    top: var(--header-h);
    z-index: 60;
    padding: 18px 0;
    background: rgba(10, 10, 10, 0.86);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    transition: box-shadow 0.3s ease;
}

.gallery-toolbar.is-stuck {
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}

.gallery-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 2px 0 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-soft) transparent;
    -webkit-overflow-scrolling: touch;
    list-style: none;
}

.gallery-filters::-webkit-scrollbar {
    height: 4px;
}

.gallery-filters::-webkit-scrollbar-thumb {
    background: var(--accent-soft);
    border-radius: 999px;
}

.gallery-filter {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.28s ease, border-color 0.28s ease, background 0.28s ease, transform 0.28s ease;
}

.gallery-filter:hover {
    color: var(--text);
    border-color: var(--border);
    transform: translateY(-1px);
}

.gallery-filter__count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    transition: color 0.28s ease, background 0.28s ease;
}

.gallery-filter[aria-selected="true"] {
    color: #0a0a0a;
    background: linear-gradient(135deg, var(--accent), #b8941f);
    border-color: transparent;
    box-shadow: 0 8px 24px -8px var(--accent-glow);
}

.gallery-filter[aria-selected="true"] .gallery-filter__count {
    color: #0a0a0a;
    background: rgba(0, 0, 0, 0.16);
}

.gallery-blurb {
    margin: 14px 0 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
    min-height: 1.4em;
    transition: opacity 0.3s ease;
}

/* --------------------------------------------------------------------------
   4. MASONRY GRID
   Columns keep each photo at its true aspect ratio, so no plate, face or
   table-top is ever cropped to make a rectangle fit.
   -------------------------------------------------------------------------- */
.gallery-grid {
    column-count: 3;
    column-gap: 22px;
    padding: 46px 0 0;
}

.gallery-grid--preview {
    column-count: 4;
    padding-top: 0;
}

.gallery-card {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 22px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
    opacity: 0;
    transform: translateY(26px) scale(0.985);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1), border-color 0.4s ease, box-shadow 0.4s ease;
}

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

.gallery-card.is-in {
    opacity: 1;
    transform: none;
}

.gallery-card:hover,
.gallery-card:focus-visible {
    border-color: var(--border);
    box-shadow: 0 22px 48px -18px rgba(0, 0, 0, 0.8), 0 0 34px -14px var(--accent-glow);
    outline: none;
}

.gallery-card__frame {
    position: relative;
    display: block;
    overflow: hidden;
    background-color: var(--bg-card);
    background-size: cover;
    background-position: center;
}

.gallery-card__img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transform: scale(1.01);
    transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1), filter 0.6s ease;
}

.gallery-card__img.is-loaded {
    opacity: 1;
}

.gallery-card:hover .gallery-card__img,
.gallery-card:focus-visible .gallery-card__img {
    transform: scale(1.07);
    filter: saturate(1.06) contrast(1.02);
}

/* Hover veil + caption */
.gallery-card__veil {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 18px;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0) 38%, rgba(10, 10, 10, 0.55) 72%, rgba(10, 10, 10, 0.92) 100%);
    opacity: 0;
    transition: opacity 0.45s ease;
}

.gallery-card:hover .gallery-card__veil,
.gallery-card:focus-visible .gallery-card__veil {
    opacity: 1;
}

.gallery-card__zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #0a0a0a;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.6) rotate(-25deg);
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.gallery-card:hover .gallery-card__zoom,
.gallery-card:focus-visible .gallery-card__zoom {
    opacity: 1;
    transform: none;
}

.gallery-card__zoom svg {
    width: 17px;
    height: 17px;
}

.gallery-card__meta {
    display: block;
    width: 100%;
    min-width: 0;
    transform: translateY(10px);
    transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.gallery-card:hover .gallery-card__meta,
.gallery-card:focus-visible .gallery-card__meta {
    transform: none;
}

.gallery-card__title {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    text-wrap: balance;
}

.gallery-card__tag {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 10px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #0a0a0a;
    background: var(--accent);
    border-radius: 999px;
}

/* Touch devices have no hover — keep captions permanently visible */
@media (hover: none) {
    .gallery-card__veil {
        opacity: 1;
        background: linear-gradient(180deg, rgba(10, 10, 10, 0) 52%, rgba(10, 10, 10, 0.88) 100%);
    }

    .gallery-card__meta {
        transform: none;
    }
}

/* Skeleton shimmer while a photo is still arriving */
.gallery-card__frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.055) 45%, transparent 70%);
    background-size: 220% 100%;
    animation: galleryShimmer 1.5s linear infinite;
    opacity: 1;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.gallery-card.is-loaded .gallery-card__frame::after {
    opacity: 0;
}

@keyframes galleryShimmer {
    from {
        background-position: 140% 0;
    }

    to {
        background-position: -40% 0;
    }
}

/* Branded fallback if a photo file ever fails to load */
.gallery-card.is-error .gallery-card__frame {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 2;
    background: linear-gradient(140deg, #1b1710, #0f0f0f);
    border: 1px dashed var(--border);
}

.gallery-card.is-error .gallery-card__frame::after {
    display: none;
}

.gallery-card__error {
    display: none;
    padding: 20px;
    text-align: center;
}

.gallery-card.is-error .gallery-card__error {
    display: block;
}

.gallery-card__error b {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.98rem;
    color: var(--accent);
    margin-bottom: 4px;
}

.gallery-card__error span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.gallery-empty {
    padding: 70px 0 90px;
    text-align: center;
    color: var(--text-muted);
}

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

/* --------------------------------------------------------------------------
   5. LIGHTBOX
   -------------------------------------------------------------------------- */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    grid-template-rows: 1fr auto;
    padding: clamp(12px, 3vw, 32px);
    background: rgba(6, 6, 6, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

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

.gallery-lightbox__stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 0;
    touch-action: pan-y;
}

.gallery-lightbox__figure {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.gallery-lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background: #111;
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(212, 175, 55, 0.16);
    opacity: 0;
    transform: scale(0.975);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.gallery-lightbox__img.is-loaded {
    opacity: 1;
    transform: none;
}

.gallery-lightbox__spinner {
    position: absolute;
    width: 42px;
    height: 42px;
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: gallerySpin 0.85s linear infinite;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-lightbox__figure.is-loading .gallery-lightbox__spinner {
    opacity: 1;
}

@keyframes gallerySpin {
    to {
        transform: rotate(360deg);
    }
}

.gallery-lightbox__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 18px;
}

.gallery-lightbox__caption {
    min-width: 0;
}

.gallery-lightbox__title {
    font-family: var(--font-heading);
    font-size: clamp(1rem, 2.2vw, 1.24rem);
    font-weight: 600;
    line-height: 1.35;
    color: #fff;
    text-wrap: balance;
}

.gallery-lightbox__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.gallery-lightbox__meta span+span::before {
    content: '·';
    margin-right: 10px;
    color: var(--accent);
}

.gallery-lightbox__counter {
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.gallery-lightbox__btn {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: var(--text);
    background: rgba(20, 20, 20, 0.78);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.gallery-lightbox__btn:hover,
.gallery-lightbox__btn:focus-visible {
    color: #0a0a0a;
    background: var(--accent);
    border-color: transparent;
    transform: scale(1.06);
    outline: none;
}

.gallery-lightbox__btn svg {
    width: 22px;
    height: 22px;
}

.gallery-lightbox__btn--close {
    top: 0;
    right: 0;
    width: 46px;
    height: 46px;
}

.gallery-lightbox__btn--prev {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.gallery-lightbox__btn--next {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.gallery-lightbox__btn--prev:hover,
.gallery-lightbox__btn--prev:focus-visible,
.gallery-lightbox__btn--next:hover,
.gallery-lightbox__btn--next:focus-visible {
    transform: translateY(-50%) scale(1.06);
}

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

body.gallery-lightbox-open {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   6. HOMEPAGE GALLERY PREVIEW
   -------------------------------------------------------------------------- */
.gallery-preview-cta {
    display: flex;
    justify-content: center;
    margin-top: 46px;
}

.gallery-preview-cta .btn-primary {
    padding: 16px 42px;
    font-size: 1.02rem;
}

.gallery-preview-cta .btn-primary svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
}

.gallery-preview-cta .btn-primary:hover svg {
    transform: translateX(4px);
}

.gallery-preview-note {
    margin-top: 18px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* --------------------------------------------------------------------------
   7. GALLERY FOOTER CTA + NO-JS
   -------------------------------------------------------------------------- */
.gallery-cta {
    padding: 84px 0 96px;
    text-align: center;
    background:
        radial-gradient(70% 100% at 50% 0%, rgba(212, 175, 55, 0.12), transparent 70%),
        var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
}

.gallery-cta__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 34px;
}

.gallery-noscript {
    padding: 60px 0;
    text-align: center;
    color: var(--text-secondary);
}

.gallery-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .gallery-grid,
    .gallery-grid--preview {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        min-height: clamp(400px, 56vh, 520px);
        padding-bottom: 52px;
    }

    .gallery-toolbar {
        top: 0;
        padding: 14px 0;
    }

    .gallery-grid,
    .gallery-grid--preview {
        column-gap: 16px;
    }

    .gallery-card {
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .gallery-card__veil {
        padding: 12px;
    }

    .gallery-card__title {
        font-size: 0.86rem;
    }

    .gallery-card__tag {
        font-size: 0.58rem;
        padding: 2px 8px;
    }

    .gallery-card__zoom {
        display: none;
    }

    .gallery-lightbox {
        padding: 10px;
    }

    .gallery-lightbox__img {
        max-height: calc(100vh - 168px);
    }

    .gallery-lightbox__btn {
        width: 44px;
        height: 44px;
    }

    .gallery-lightbox__btn--close {
        width: 42px;
        height: 42px;
    }

    .gallery-lightbox__bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .gallery-cta {
        padding: 64px 0 74px;
    }
}

@media (max-width: 560px) {
    .gallery-grid,
    .gallery-grid--preview {
        column-count: 1;
    }

    .gallery-filter {
        padding: 9px 15px;
        font-size: 0.8rem;
    }

    .gallery-hero__stat {
        padding: 10px 16px;
    }

    .gallery-hero__stat b {
        font-size: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    .gallery-card,
    .gallery-card__img,
    .gallery-card__veil,
    .gallery-card__meta,
    .gallery-card__zoom,
    .gallery-lightbox__img {
        transition-duration: 0.001ms !important;
    }

    .gallery-card {
        opacity: 1;
        transform: none;
    }

    .gallery-hero__media img {
        animation: none;
        transform: none;
    }

    .gallery-card__frame::after {
        animation: none;
    }
}
