/* ================================================================
   AI Gallery — Big-Tech Polish
   Light: Claude (parchment + terracotta)
   Dark : Binance (deep canvas + yellow)
   ----------------------------------------------------------------
   Design pillars:
   - Pinterest-style true CSS Grid masonry (JS computes --span;
     fail-soft via aspect-ratio fallback when JS hasn't run).
   - Sticky glassy toolbar that shrinks on scroll.
   - Multi-layer cards with glass badges, hover gradient, quick-fav.
   - Immersive modal: scale-in, gradient info panel, zoomable media,
     swipe gestures, code-block prompt, bubble comments.
   - Stagger entrance via IntersectionObserver, all motion gated by
     prefers-reduced-motion.
   ================================================================ */

/* ── 1. Local design tokens ─────────────────────────────────── */

.gallery-page,
.gallery-single,
.gallery-modal-overlay {
    --gp-ease:        cubic-bezier(0.2, 0.8, 0.2, 1);
    --gp-ease-snap:   cubic-bezier(0.34, 1.56, 0.64, 1);
    --gp-radius-lg:   20px;
    --gp-radius-md:   16px;
    --gp-radius-sm:   12px;
    --gp-row:         8px;
    --gp-gap:         clamp(12px, 1.4vw, 22px);
    --gp-toolbar-top: 16px;
    --gp-card-bg:     var(--bn-surface-soft-light, #faf9f5);
    --gp-card-shadow:        0 1px 0 rgba(0,0,0,.04), 0 12px 32px -16px rgba(0,0,0,0);
    --gp-card-shadow-hover:  0 1px 0 rgba(0,0,0,.06), 0 24px 56px -22px rgba(0,0,0,.22);
    --gp-glass-bg:    rgba(20, 20, 19, .55);
    --gp-glass-stroke:rgba(255, 255, 255, .14);
    --gp-glass-text:  #faf9f5;
    --gp-modal-radius:24px;
}

[data-bs-theme="dark"] .gallery-page,
[data-bs-theme="dark"] .gallery-single,
[data-bs-theme="dark"] .gallery-modal-overlay {
    --gp-card-bg:           #1e2329;
    --gp-card-shadow:       0 0 0 1px rgba(255,255,255,.04), 0 12px 32px -16px rgba(0,0,0,0);
    --gp-card-shadow-hover: 0 0 0 1px rgba(252,213,53,.12), 0 24px 56px -22px rgba(0,0,0,.6);
}


/* ── 2. Page layout ─────────────────────────────────────────── */

.gallery-page {
    width: min(100% - 48px, 1680px);
    max-width: none;
    margin: 0 auto;
    padding: 0 0 80px;
}


/* ── 3. Hero ────────────────────────────────────────────────── */

.gallery-hero {
    position: relative;
    text-align: center;
    padding: clamp(48px, 7vw, 96px) 0 clamp(28px, 3vw, 40px);
    overflow: hidden;
}

.gallery-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 50% 0%, rgba(201, 100, 66, .08), transparent 60%),
        radial-gradient(40% 40% at 80% 30%, rgba(45, 189, 182, .05), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

[data-bs-theme="dark"] .gallery-hero::before {
    background:
        radial-gradient(60% 50% at 50% 0%, rgba(252, 213, 53, .08), transparent 60%),
        radial-gradient(40% 40% at 80% 30%, rgba(59, 130, 246, .05), transparent 70%);
}

.gallery-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin: 0 0 16px;
    background: var(--bn-hairline-on-light);
    color: var(--bn-muted);
    border-radius: 999px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.gallery-hero-eyebrow::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bn-primary);
    box-shadow: 0 0 0 4px rgba(201, 100, 66, .15);
    animation: gp-pulse 2.4s ease-in-out infinite;
}

@keyframes gp-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(201, 100, 66, .15); }
    50%      { box-shadow: 0 0 0 8px rgba(201, 100, 66, .05); }
}

[data-bs-theme="dark"] .gallery-hero-eyebrow {
    background: #2b3139;
    color: #929aa5;
}

[data-bs-theme="dark"] .gallery-hero-eyebrow::before {
    background: var(--bn-primary);
    box-shadow: 0 0 0 4px rgba(252, 213, 53, .18);
    animation-name: gp-pulse-dark;
}

@keyframes gp-pulse-dark {
    0%, 100% { box-shadow: 0 0 0 4px rgba(252, 213, 53, .18); }
    50%      { box-shadow: 0 0 0 8px rgba(252, 213, 53, .04); }
}

.gallery-title {
    font-family: Georgia, 'Anthropic Serif', serif;
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--bn-ink);
    margin: 0 0 12px;
}

.gallery-title-accent {
    background: linear-gradient(135deg, var(--bn-primary) 0%, #d97757 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

[data-bs-theme="dark"] .gallery-title-accent {
    background: linear-gradient(135deg, #fcd535 0%, #f0b90b 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.gallery-subtitle {
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: clamp(15px, 1.2vw, 18px);
    font-weight: 400;
    line-height: 1.6;
    color: var(--bn-muted);
    margin: 0 auto;
    max-width: 560px;
}


/* ── 4. Toolbar (sticky + glass) ────────────────────────────── */

.gallery-toolbar {
    position: sticky;
    top: var(--gp-toolbar-top);
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(280px, 520px) minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    margin: 0 0 28px;
    padding: 14px clamp(12px, 1.4vw, 18px);
    background: rgba(245, 244, 237, .7);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-md);
    box-shadow: 0 1px 0 rgba(0,0,0,.02);
    transition:
        padding .25s var(--gp-ease),
        border-radius .25s var(--gp-ease),
        box-shadow .25s var(--gp-ease),
        background-color .25s var(--gp-ease);
}

@supports (background: color-mix(in srgb, red, blue)) {
    .gallery-toolbar {
        background: color-mix(in srgb, var(--bs-body-bg, #f5f4ed) 78%, transparent);
    }
}

.gallery-toolbar.is-shrunk {
    padding: 8px 12px;
    border-radius: var(--gp-radius-sm);
    box-shadow: 0 8px 28px -16px rgba(0,0,0,.18);
}

[data-bs-theme="dark"] .gallery-toolbar {
    background: rgba(11, 14, 17, .72);
    border-color: #2b3139;
}

@supports (background: color-mix(in srgb, red, blue)) {
    [data-bs-theme="dark"] .gallery-toolbar {
        background: color-mix(in srgb, #0b0e11 78%, transparent);
    }
}

[data-bs-theme="dark"] .gallery-toolbar.is-shrunk {
    box-shadow: 0 8px 28px -16px rgba(0,0,0,.6);
}


/* ── 5. Search box ──────────────────────────────────────────── */

.gallery-search-wrap {
    width: 100%;
    margin: 0;
}

.gallery-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
    transition: border-color .2s var(--gp-ease), box-shadow .2s var(--gp-ease);
}

.gallery-search-box:focus-within {
    border-color: var(--bn-primary);
    box-shadow: 0 0 0 3px rgba(201, 100, 66, .15);
}

.gallery-search-icon {
    position: absolute;
    left: 16px;
    color: var(--bn-muted-strong);
    pointer-events: none;
    flex-shrink: 0;
    transition: color .2s var(--gp-ease);
}

.gallery-search-box:focus-within .gallery-search-icon {
    color: var(--bn-primary);
}

.gallery-search-box .gallery-search-input,
.gallery-page input.gallery-search-input[type="text"] {
    width: 100% !important;
    padding: 14px 44px 14px 48px !important;
    border: none !important;
    background: transparent !important;
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif !important;
    font-size: 15px !important;
    font-weight: 400;
    line-height: 1.25;
    color: var(--bn-ink);
    outline: none;
    box-shadow: none !important;
}

.gallery-search-box .gallery-search-input::placeholder {
    color: var(--bn-muted-strong);
}

.gallery-search-clear {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: var(--bn-hairline-on-light);
    border-radius: 50%;
    color: var(--bn-ink);
    cursor: pointer;
    transition: background-color .15s, transform .15s var(--gp-ease);
}

.gallery-search-clear:hover {
    background: var(--bn-border-strong);
    transform: rotate(90deg);
}


/* ── 6. Filter bar ──────────────────────────────────────────── */

.gallery-filters {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    margin: 0;
}

.gallery-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.gallery-filter-selects {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.gallery-filter-selects--triple {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
}

.gallery-filter-selects--triple .gallery-filter-select {
    flex: 0 1 180px;
    min-width: min(140px, 30vw);
}

.gallery-filter-select {
    min-width: 140px;
    padding: 8px 32px 8px 14px;
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: 999px;
    background: transparent;
    color: var(--bn-ink);
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    outline: none;
    appearance: none;
    box-sizing: border-box;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234d4c48' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color .15s var(--gp-ease), background-color .15s var(--gp-ease);
    color-scheme: light;
}

.gallery-filter-select:hover {
    border-color: var(--bn-border-strong);
    background-color: var(--bn-hairline-on-light);
}

.gallery-filter-select:focus {
    border-color: var(--bn-primary);
    box-shadow: 0 0 0 3px rgba(201, 100, 66, .12);
}

.gallery-filter-select option {
    background-color: #fff;
    color: var(--bn-ink);
}

[data-bs-theme="dark"] .gallery-filter-select {
    border-color: #2b3139;
    color: #eaecef;
    color-scheme: dark;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23929aa5' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

[data-bs-theme="dark"] .gallery-filter-select:hover {
    background-color: #2b3139;
    border-color: #363c46;
}

[data-bs-theme="dark"] .gallery-filter-select:focus {
    border-color: var(--bn-primary);
    box-shadow: 0 0 0 3px rgba(252, 213, 53, .15);
}

[data-bs-theme="dark"] .gallery-filter-select option {
    background-color: #1e2329;
    color: #eaecef;
}

/* ── 7. Grid (true CSS Grid masonry) ────────────────────────── */

.gallery-grid {
    display: grid;
    gap: var(--gp-gap);
    margin-top: 28px;
    contain: layout paint;
}

/* Column modes: 7-bar (dense) vs 5-bar (roomier). Mobile stays 2 columns. */
.gallery-grid.is-cols7 {
    --gp-gap: clamp(10px, 1.2vw, 18px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-grid.is-cols5 {
    --gp-gap: clamp(12px, 1.4vw, 22px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .gallery-grid.is-cols7 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .gallery-grid.is-cols5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .gallery-grid.is-cols7 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
    .gallery-grid.is-cols5 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .gallery-grid.is-cols7 {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    .gallery-grid.is-cols5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .gallery-grid.is-cols7 {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}


/* Masonry mode is enabled by JS once cards have computed --span values.
 * Until then, cards stack via aspect-ratio (fail-soft for noscript). */
.gallery-grid.is-masonry-ready {
    grid-auto-rows: var(--gp-row, 8px);
    grid-auto-flow: dense;
}


/* ── 8. Cards ───────────────────────────────────────────────── */

.gallery-card {
    position: relative;
    background: var(--gp-card-bg);
    border: none;
    border-radius: var(--gp-radius-md);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--gp-card-shadow);
    transition:
        transform .35s var(--gp-ease),
        box-shadow .35s var(--gp-ease);
    /* Stagger entrance state (JS toggles .is-in via IntersectionObserver) */
    opacity: 0;
    transform: translateY(8px);
    /* Wave 7.3.16: will-change is only beneficial during entrance.
     * After .is-in animates in, drop the hint to release the layer. */
    will-change: transform, opacity;
}

.gallery-card.is-in {
    opacity: 1;
    transform: none;
    will-change: auto;
    transition:
        opacity .55s var(--gp-ease),
        transform .55s var(--gp-ease),
        box-shadow .35s var(--gp-ease);
}

/* When JS hasn't run, ensure cards are visible */
html:not(.gp-stagger-ready) .gallery-card {
    opacity: 1;
    transform: none;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--gp-card-shadow-hover);
}

.gallery-card.is-masonry .gallery-card-media,
.gallery-grid.is-masonry-ready .gallery-card .gallery-card-media {
    /* In masonry mode, media fills the spanning grid row */
    aspect-ratio: auto;
    height: 100%;
}

.gallery-grid.is-masonry-ready .gallery-card {
    grid-row-end: span var(--span, 30);
}

.gallery-card-media {
    position: relative;
    overflow: hidden;
    line-height: 0;
    aspect-ratio: var(--ar, 1);
    background: rgba(0, 0, 0, .04);
    border-radius: var(--gp-radius-md);
    isolation: isolate;
}

[data-bs-theme="dark"] .gallery-card-media {
    background: #14171c;
}

/* Smart-fill: same-image blurred backdrop. The --bn-img value is set
   by bn-smart-fill.js after the foreground <img> resolves its src. */
.gallery-card-media::before {
    content: "";
    position: absolute;
    inset: -8%;
    background-image: var(--bn-img, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(28px) saturate(1.15) brightness(.92);
    transform: scale(1.15);
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
}

[data-bs-theme="dark"] .gallery-card-media::before {
    filter: blur(28px) saturate(1.05) brightness(.6);
}

.gallery-card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, .55) 100%);
    opacity: .55;
    transition: opacity .3s var(--gp-ease);
    pointer-events: none;
    border-radius: inherit;
    z-index: 2;
}

.gallery-card:hover .gallery-card-media::after {
    opacity: .85;
}

.gallery-card-media img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    border-radius: inherit;
    opacity: 0;
    transition: opacity .25s ease-out, transform .6s var(--gp-ease);
}

.gallery-card-media img.is-loaded,
.gallery-card-media img[data-bn-loaded="1"] {
    opacity: 1;
}

.gallery-card:hover .gallery-card-media img {
    transform: scale(1.04);
}

.gallery-card-media.is-vip-blurred img,
.gallery-carousel-track .carousel-slide.is-vip-blurred img,
.gallery-single-media .gallery-single-media-item.is-vip-blurred img {
    filter: blur(14px) saturate(.85);
}

.gallery-card-media.is-vip-blurred img,
.gallery-single-media .gallery-single-media-item.is-vip-blurred img {
    transform: scale(1.06);
}

.gallery-card:hover .gallery-card-media.is-vip-blurred img,
.gallery-single-media .gallery-single-media-item.is-vip-blurred:hover img {
    transform: scale(1.08);
}

.gallery-vip-blur-hint {
    position: absolute;
    inset: auto 12px 12px;
    z-index: 4;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.gallery-vip-blur-hint span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(20, 20, 19, .68);
    color: #faf9f5;
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .02em;
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 12px 30px -18px rgba(0, 0, 0, .45);
}

.gallery-vip-blur-hint--modal {
    inset: auto 20px 20px;
}

.gallery-vip-blur-hint--single {
    inset: auto 18px 18px;
}

[data-bs-theme="dark"] .gallery-vip-blur-hint span {
    background: rgba(11, 14, 17, .72);
    color: #fcd535;
    border-color: rgba(252, 213, 53, .2);
}

/* Glassy badge & play button */
.gallery-card-badge,
.gallery-card-play,
.gallery-card-quickfav {
    position: absolute;
    z-index: 2;
    background: var(--gp-glass-bg);
    color: var(--gp-glass-text);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid var(--gp-glass-stroke);
}

.gallery-card-badge {
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 999px;
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .02em;
}

.gallery-card-badge svg {
    flex-shrink: 0;
}

.gallery-card-play {
    bottom: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: transform .25s var(--gp-ease-snap), background-color .2s var(--gp-ease);
}

.gallery-card:hover .gallery-card-play {
    transform: scale(1.08);
    background: rgba(201, 100, 66, .85);
}

[data-bs-theme="dark"] .gallery-card:hover .gallery-card-play {
    background: rgba(252, 213, 53, .9);
    color: #181a20;
}

/* Quick favourite (bottom-right) */
.gallery-card-quickfav {
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transform: translateY(6px) scale(.92);
    transition:
        opacity .25s var(--gp-ease),
        transform .25s var(--gp-ease),
        background-color .2s var(--gp-ease);
}

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

.gallery-card-quickfav:hover {
    background: rgba(201, 100, 66, .85);
}

.gallery-card-quickfav.is-fav {
    background: var(--bn-primary);
    color: #faf9f5;
    border-color: rgba(255,255,255,.18);
}

[data-bs-theme="dark"] .gallery-card-quickfav:hover {
    background: rgba(252, 213, 53, .85);
    color: #181a20;
}

[data-bs-theme="dark"] .gallery-card-quickfav.is-fav {
    background: var(--bn-primary);
    color: #181a20;
}

@keyframes gp-heart-pop {
    0%, 100% { transform: scale(1); }
    30%      { transform: scale(.78); }
    60%      { transform: scale(1.22); }
}

.gallery-card-quickfav.is-pop {
    animation: gp-heart-pop .5s var(--gp-ease-snap);
}

/* Floating heart triggered by double-click */
.gallery-card-heartburst {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.gallery-card-heartburst svg {
    color: #ffffff;
    filter: drop-shadow(0 4px 18px rgba(0,0,0,.5));
    animation: gp-heart-burst .9s var(--gp-ease-snap) forwards;
}

@keyframes gp-heart-burst {
    0%   { opacity: 0; transform: scale(.4); }
    20%  { opacity: 1; transform: scale(1.3); }
    60%  { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.4) translateY(-30px); }
}

/* Card overlay (title + model) — shown on hover */
.gallery-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 56px;
    padding: 32px 14px 14px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s var(--gp-ease), transform .3s var(--gp-ease);
    pointer-events: none;
}

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

.gallery-card-title {
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #faf9f5;
    line-height: 1.3;
    letter-spacing: -.005em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 8px rgba(0,0,0,.45);
}

.gallery-card-model {
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: rgba(250, 249, 245, .85);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,.35);
}


/* ── 9. Skeleton placeholders ───────────────────────────────── */

@keyframes gp-skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gallery-card.is-skeleton {
    opacity: 1;
    transform: none;
    box-shadow: none;
}

.gallery-card.is-skeleton .gallery-card-media {
    background: linear-gradient(110deg,
        rgba(0,0,0,.04) 8%,
        rgba(0,0,0,.07) 18%,
        rgba(0,0,0,.04) 33%);
    background-size: 200% 100%;
    animation: gp-skeleton 1.4s linear infinite;
}

[data-bs-theme="dark"] .gallery-card.is-skeleton .gallery-card-media {
    background: linear-gradient(110deg, #1e2329 8%, #2b3139 18%, #1e2329 33%);
    background-size: 200% 100%;
}

.gallery-card.is-skeleton .gallery-card-media img,
.gallery-card.is-skeleton .gallery-card-media::after,
.gallery-card.is-skeleton .gallery-card-overlay,
.gallery-card.is-skeleton .gallery-card-badge,
.gallery-card.is-skeleton .gallery-card-play,
.gallery-card.is-skeleton .gallery-card-quickfav { display: none; }


/* ── 10. Loading / Empty / End ──────────────────────────────── */

.gallery-loading,
.gallery-empty,
.gallery-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 0;
    gap: 14px;
    color: var(--bn-muted-strong);
    font-family: Inter, 'Anthropic Sans', system-ui, sans-serif;
    font-size: 14px;
}

.gallery-end {
    flex-direction: row;
    gap: 16px;
    padding: 64px 16px;
    color: var(--bn-muted);
    font-size: 13px;
    letter-spacing: .04em;
}

.gallery-end::before,
.gallery-end::after {
    content: "";
    flex: 1;
    height: 1px;
    max-width: 120px;
    background: linear-gradient(90deg, transparent, var(--bn-border-strong), transparent);
}

.gallery-empty svg {
    color: var(--bn-border-strong);
    animation: gp-float 3.5s ease-in-out infinite;
}

@keyframes gp-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.gallery-empty p {
    margin: 0;
}

.gallery-empty-title {
    color: var(--bn-ink);
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
}

.gallery-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bn-hairline-on-light);
    border-top-color: var(--bn-primary);
    border-radius: 50%;
    animation: gallerySpin .7s linear infinite;
}

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

[data-bs-theme="dark"] .gallery-loading,
[data-bs-theme="dark"] .gallery-empty,
[data-bs-theme="dark"] .gallery-end {
    color: #707a8a;
}

[data-bs-theme="dark"] .gallery-empty-title { color: #eaecef; }
[data-bs-theme="dark"] .gallery-spinner {
    border-color: #2b3139;
    border-top-color: var(--bn-primary);
}


/* ── 11. Toast ──────────────────────────────────────────────── */

.gallery-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(28px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(20, 20, 19, .92);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    color: #faf9f5;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .08);
    font-size: 14px;
    font-weight: 500;
    z-index: 100001;
    opacity: 0;
    box-shadow: 0 18px 48px -16px rgba(0, 0, 0, .35);
    transition: opacity .3s var(--gp-ease), transform .3s var(--gp-ease-snap);
    pointer-events: none;
}

.gallery-toast::before {
    content: "";
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex-shrink: 0;
}

.gallery-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

[data-bs-theme="dark"] .gallery-toast {
    background: rgba(43, 49, 57, .92);
    color: #eaecef;
    border-color: rgba(255, 255, 255, .04);
}


/* ── 12. Modal overlay & container ──────────────────────────── */

.gallery-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(11, 14, 17, .55);
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    backdrop-filter: blur(18px) saturate(120%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    animation: gp-overlay-in .25s var(--gp-ease) both;
}

@keyframes gp-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gallery-modal {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: var(--gp-modal-radius);
    overflow: hidden;
    box-shadow:
        0 30px 80px -20px rgba(0, 0, 0, .4),
        0 0 0 1px rgba(255, 255, 255, .06);
    animation: gp-modal-in .35s var(--gp-ease) both;
}

@keyframes gp-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

[data-bs-theme="dark"] .gallery-modal-overlay {
    background: rgba(0, 0, 0, .8);
}

[data-bs-theme="dark"] .gallery-modal {
    background: #0b0e11;
    box-shadow:
        0 40px 100px -20px rgba(0, 0, 0, .8),
        0 0 0 1px #2b3139;
}

.gallery-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(11, 14, 17, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    color: #faf9f5;
    cursor: pointer;
    transition:
        background-color .2s var(--gp-ease),
        transform .25s var(--gp-ease-snap);
}

.gallery-modal-close:hover {
    background: rgba(11, 14, 17, .85);
    transform: rotate(90deg);
}


/* ── 13. Modal body layout ──────────────────────────────────── */

.gallery-modal-body {
    display: flex;
    height: 85vh;
    max-height: 85vh;
}

.gallery-modal-media {
    flex: 1 1 60%;
    min-width: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    -webkit-user-select: none;
    user-select: none;
}

.gallery-modal-media.is-zoom { cursor: zoom-out; }
.gallery-modal-media.is-grab { cursor: grabbing; }

.gallery-modal-info {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--bn-hairline-on-light);
    background: linear-gradient(180deg,
        var(--bn-surface-soft-light) 0%,
        var(--bn-canvas-light) 100%);
}

[data-bs-theme="dark"] .gallery-modal-info {
    border-left-color: #2b3139;
    background: linear-gradient(180deg, #1e2329 0%, #0b0e11 100%);
}

.gallery-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

/* Zoom hint that fades after first interaction */
.gallery-zoom-hint {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    padding: 6px 12px;
    background: rgba(11, 14, 17, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #faf9f5;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .03em;
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s var(--gp-ease), transform .35s var(--gp-ease);
    z-index: 6;
}

.gallery-modal-media:hover .gallery-zoom-hint,
.gallery-modal-media.show-hint .gallery-zoom-hint {
    opacity: 1;
}

.gallery-modal-media.is-zoom .gallery-zoom-hint,
.gallery-modal-media.is-grab .gallery-zoom-hint {
    opacity: 0;
}


/* ── 14. Carousel ───────────────────────────────────────────── */

.gallery-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-carousel-track {
    display: flex;
    transition: transform .4s var(--gp-ease);
    height: 100%;
    align-items: center;
    width: 100%;
}

.gallery-carousel-track .carousel-slide {
    position: relative;
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow: hidden;
}

.gallery-carousel-track img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: transform .35s var(--gp-ease);
    transform-origin: var(--zx, 50%) var(--zy, 50%);
}

.gallery-carousel-track .carousel-slide.is-zoomed img {
    transform: scale(2);
}

.gallery-carousel-track .carousel-slide.is-zoomed.is-panning img {
    transition: none;
}

.gallery-carousel-track video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.gallery-carousel-prev,
.gallery-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(11, 14, 17, .45);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    color: #faf9f5;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity .25s var(--gp-ease),
        background-color .2s var(--gp-ease),
        transform .25s var(--gp-ease-snap);
}

.gallery-modal-media:hover .gallery-carousel-prev,
.gallery-modal-media:hover .gallery-carousel-next,
.gallery-modal-media:focus-within .gallery-carousel-prev,
.gallery-modal-media:focus-within .gallery-carousel-next {
    opacity: 1;
}

.gallery-carousel-prev { left: 14px; }
.gallery-carousel-next { right: 14px; }

.gallery-carousel-prev:hover,
.gallery-carousel-next:hover {
    background: rgba(11, 14, 17, .8);
}

.gallery-carousel-prev:active,
.gallery-carousel-next:active {
    transform: translateY(-50%) scale(.94);
}

@media (hover: none) {
    .gallery-carousel-prev,
    .gallery-carousel-next {
        opacity: .9;
    }
}

.gallery-carousel-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
    padding: 6px 10px;
    background: rgba(11, 14, 17, .35);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 999px;
}

.gallery-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(250, 249, 245, .45);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background-color .2s var(--gp-ease), width .25s var(--gp-ease);
}

.gallery-carousel-dot:hover { background: rgba(250, 249, 245, .8); }

.gallery-carousel-dot.active {
    background: #faf9f5;
    width: 22px;
    border-radius: 999px;
}

.gallery-carousel-counter {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 5px 12px;
    background: rgba(11, 14, 17, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #faf9f5;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .08);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    z-index: 5;
}


/* ── 15. Modal meta + sections ──────────────────────────────── */

.gallery-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.gallery-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: var(--bn-hairline-on-light);
    color: var(--bn-ink);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
}

.gallery-meta-date {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    color: var(--bn-muted-strong);
    font-size: 12px;
    font-weight: 500;
}

[data-bs-theme="dark"] .gallery-meta-tag {
    background: #2b3139;
    color: #eaecef;
}

[data-bs-theme="dark"] .gallery-meta-date {
    color: #707a8a;
}

.gallery-source-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--bn-info, #3b82f6);
    text-decoration: none;
    border-radius: 999px;
    transition: color 0.15s ease, background-color 0.15s ease, text-decoration 0.15s ease;
}

.gallery-source-link:hover {
    color: #2563eb;
    text-decoration: underline;
    background: rgba(59, 130, 246, 0.08);
}

.gallery-source-link svg {
    flex-shrink: 0;
    opacity: 0.9;
}

[data-bs-theme="dark"] .gallery-source-link {
    color: #5ea3ff;
}

[data-bs-theme="dark"] .gallery-source-link:hover {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.12);
}

.gallery-modal-section {
    margin-bottom: 24px;
}

.gallery-modal-section-title {
    font-family: Georgia, 'Anthropic Serif', serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--bn-ink);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-bs-theme="dark"] .gallery-modal-section-title { color: #eaecef; }


/* ── 16. Prompt area (code-block aesthetic) ─────────────────── */

.gallery-prompt-wrap {
    position: relative;
}

.gallery-prompt-text {
    position: relative;
    font-family: 'JetBrains Mono', 'IBM Plex Mono', 'Courier New', ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.7;
    color: var(--bn-ink);
    background: #ffffff;
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
    padding: 16px 18px;
    word-break: break-word;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@supports (background: color-mix(in srgb, red, blue)) {
    .gallery-prompt-text {
        background: color-mix(in srgb, var(--bn-canvas-dark, #141413) 4%, #ffffff);
    }
}

[data-bs-theme="dark"] .gallery-prompt-text {
    background: #14171c;
    border-color: #2b3139;
    color: #eaecef;
}

.gallery-prompt-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--bn-hairline-on-light);
    background: var(--bn-surface-soft-light);
    color: var(--bn-ink);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    transition:
        background-color .15s var(--gp-ease),
        border-color .15s var(--gp-ease),
        transform .25s var(--gp-ease-snap);
    overflow: visible;
}

.gallery-prompt-copy:hover {
    background: var(--bn-primary);
    border-color: var(--bn-primary);
    color: #faf9f5;
}

[data-bs-theme="dark"] .gallery-prompt-copy {
    background: #1e2329;
    border-color: #2b3139;
    color: #eaecef;
}

[data-bs-theme="dark"] .gallery-prompt-copy:hover {
    background: var(--bn-primary);
    color: #181a20;
    border-color: var(--bn-primary);
}

.gallery-prompt-copy.is-ripple {
    position: absolute;
}

.gallery-prompt-copy.is-ripple::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 2px solid var(--bn-primary);
    animation: gp-ring .7s var(--gp-ease) forwards;
    pointer-events: none;
}

@keyframes gp-ring {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.gallery-prompt-empty {
    color: var(--bn-muted-strong);
    font-size: 14px;
    margin: 0;
    padding: 16px;
    text-align: center;
    background: var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
}

.gallery-prompt-label {
    font-family: Inter, system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--bn-muted-strong);
    margin-bottom: 6px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.gallery-prompt-mask {
    position: relative;
    overflow: hidden;
    max-height: 88px;
    margin-bottom: 12px;
    border-radius: var(--gp-radius-sm);
}

.gallery-prompt-mask .gallery-prompt-text {
    border-radius: 0;
    border: none;
    background: transparent;
}

.gallery-prompt-mask::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--bn-surface-soft-light));
    pointer-events: none;
}

[data-bs-theme="dark"] .gallery-prompt-mask::after {
    background: linear-gradient(transparent, #1e2329);
}

[data-bs-theme="dark"] .gallery-prompt-empty {
    background: #14171c;
    color: #707a8a;
}

/* Lock card (for paywalled prompts/refs) */
.gallery-prompt-lock-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 20px;
    background: linear-gradient(135deg,
        rgba(201, 100, 66, .04) 0%,
        rgba(45, 189, 182, .03) 100%);
    border: 1px dashed var(--bn-border-strong);
    border-radius: var(--gp-radius-md);
    text-align: center;
}

[data-bs-theme="dark"] .gallery-prompt-lock-card {
    background: linear-gradient(135deg,
        rgba(252, 213, 53, .05) 0%,
        rgba(59, 130, 246, .04) 100%);
    border-color: #2b3139;
}

.gallery-prompt-lock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bn-primary);
    color: #faf9f5;
    border-radius: 50%;
    box-shadow: 0 8px 24px -8px rgba(201, 100, 66, .5);
}

[data-bs-theme="dark"] .gallery-prompt-lock-icon {
    color: #181a20;
    box-shadow: 0 8px 24px -8px rgba(252, 213, 53, .55);
}

.gallery-prompt-lock-text {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--bn-muted);
}

.gallery-prompt-lock-text strong {
    color: var(--bn-primary);
    font-weight: 600;
}

[data-bs-theme="dark"] .gallery-prompt-lock-text {
    color: #929aa5;
}

.gallery-prompt-unlock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 28px;
    border: none;
    border-radius: 999px;
    background: var(--bn-primary);
    color: #faf9f5;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 8px 22px -10px rgba(201, 100, 66, .55);
    transition:
        background-color .2s var(--gp-ease),
        transform .25s var(--gp-ease-snap),
        box-shadow .25s var(--gp-ease);
}

.gallery-prompt-unlock:hover {
    background: #b5573a;
    color: #faf9f5;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -12px rgba(201, 100, 66, .55);
}

[data-bs-theme="dark"] .gallery-prompt-unlock {
    background: var(--bn-primary);
    color: #181a20;
    box-shadow: 0 8px 22px -10px rgba(252, 213, 53, .5);
}

[data-bs-theme="dark"] .gallery-prompt-unlock:hover {
    background: #f0b90b;
    color: #181a20;
}


/* ── 17. Reference grid ─────────────────────────────────────── */

.gallery-ref-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gallery-ref-lock-wrap { width: 100%; }

.gallery-ref-teaser {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--bn-muted);
}

.gallery-ref-item {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.gallery-ref-dl {
    font-size: 11px;
    font-weight: 600;
    color: var(--bn-primary);
    text-decoration: none;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.gallery-ref-dl:hover {
    color: #b5573a;
    text-decoration: underline;
}

[data-bs-theme="dark"] .gallery-ref-dl { color: var(--bn-primary); }
[data-bs-theme="dark"] .gallery-ref-dl:hover { color: #f0b90b; }

.gallery-ref-thumb {
    width: 76px;
    height: 76px;
    border-radius: var(--gp-radius-sm);
    object-fit: cover;
    border: 1px solid var(--bn-hairline-on-light);
    cursor: pointer;
    transition: transform .25s var(--gp-ease), box-shadow .25s var(--gp-ease);
}

.gallery-ref-thumb:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .25);
}

[data-bs-theme="dark"] .gallery-ref-thumb { border-color: #2b3139; }

.gallery-ref-media {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bn-surface-soft-light);
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
    font-size: 13px;
    color: var(--bn-ink);
    cursor: pointer;
    transition: background-color .15s var(--gp-ease), border-color .15s var(--gp-ease);
}

.gallery-ref-media:hover {
    background: var(--bn-hairline-on-light);
    border-color: var(--bn-border-strong);
}

[data-bs-theme="dark"] .gallery-ref-media {
    background: #14171c;
    border-color: #2b3139;
    color: #eaecef;
}

[data-bs-theme="dark"] .gallery-ref-media:hover {
    background: #2b3139;
    border-color: #363c46;
}

.gallery-ref-media svg {
    flex-shrink: 0;
    color: var(--bn-muted-strong);
}

.gallery-ref-audio {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bn-surface-soft-light);
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
}

[data-bs-theme="dark"] .gallery-ref-audio {
    background: #14171c;
    border-color: #2b3139;
}

.gallery-ref-audio audio { max-width: 100%; vertical-align: middle; }
.gallery-ref-audio-title { font-size: 13px; color: var(--bn-ink); }
[data-bs-theme="dark"] .gallery-ref-audio-title { color: #eaecef; }


/* ── 18. Action buttons ─────────────────────────────────────── */

.gallery-modal-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.gallery-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color .2s var(--gp-ease),
        color .2s var(--gp-ease),
        border-color .2s var(--gp-ease),
        transform .25s var(--gp-ease-snap),
        box-shadow .25s var(--gp-ease);
}

.gallery-action-btn:active { transform: scale(.96); }

.gallery-action-btn svg {
    width: 16px;
    height: 16px;
    transition: transform .25s var(--gp-ease-snap);
}

.gallery-action-fav {
    background: var(--bn-hairline-on-light);
    color: var(--bn-ink);
    border-color: var(--bn-hairline-on-light);
}

.gallery-action-fav:hover {
    background: var(--bn-surface-soft-light);
    border-color: var(--bn-primary);
    color: var(--bn-primary);
}

.gallery-action-fav.is-fav {
    background: var(--bn-primary);
    color: #faf9f5;
    border-color: var(--bn-primary);
    box-shadow: 0 6px 18px -8px rgba(201, 100, 66, .5);
}

.gallery-action-fav.is-fav svg {
    animation: gp-heart-pop .55s var(--gp-ease-snap);
}

[data-bs-theme="dark"] .gallery-action-fav {
    background: #2b3139;
    color: #eaecef;
    border-color: #2b3139;
}

[data-bs-theme="dark"] .gallery-action-fav:hover {
    border-color: var(--bn-primary);
    color: var(--bn-primary);
}

[data-bs-theme="dark"] .gallery-action-fav.is-fav {
    background: var(--bn-primary);
    color: #181a20;
    border-color: var(--bn-primary);
    box-shadow: 0 6px 18px -8px rgba(252, 213, 53, .55);
}

.gallery-action-share {
    background: var(--bn-hairline-on-light);
    color: var(--bn-ink);
    border-color: var(--bn-hairline-on-light);
}

.gallery-action-share:hover {
    background: var(--bn-border-strong);
}

[data-bs-theme="dark"] .gallery-action-share {
    background: #2b3139;
    color: #eaecef;
    border-color: #2b3139;
}

[data-bs-theme="dark"] .gallery-action-share:hover { background: #363c46; }

.gallery-action-download {
    background: var(--bn-ink);
    color: #faf9f5;
    border-color: var(--bn-ink);
    box-shadow: 0 8px 22px -10px rgba(20, 20, 19, .35);
}

.gallery-action-download:hover {
    background: #2a2a26;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -12px rgba(20, 20, 19, .35);
}

[data-bs-theme="dark"] .gallery-action-download {
    background: var(--bn-primary);
    color: #181a20;
    border-color: var(--bn-primary);
    box-shadow: 0 8px 22px -10px rgba(252, 213, 53, .45);
}

[data-bs-theme="dark"] .gallery-action-download:hover {
    background: #f0b90b;
    box-shadow: 0 14px 30px -12px rgba(252, 213, 53, .55);
}

.gallery-action-download-lock {
    background: var(--bn-hairline-on-light);
    color: var(--bn-ink);
    border: 1px dashed var(--bn-border-strong);
    text-decoration: none;
}

.gallery-action-download-lock:hover {
    background: var(--bn-primary);
    color: #faf9f5;
    border-color: var(--bn-primary);
    border-style: solid;
}

[data-bs-theme="dark"] .gallery-action-download-lock {
    background: #14171c;
    color: #eaecef;
    border-color: #2b3139;
}

[data-bs-theme="dark"] .gallery-action-download-lock:hover {
    background: var(--bn-primary);
    color: #181a20;
    border-color: var(--bn-primary);
}


/* ── 19. Comments ───────────────────────────────────────────── */

.gallery-comment-count {
    font-family: Inter, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--bn-muted-strong);
}

[data-bs-theme="dark"] .gallery-comment-count { color: #707a8a; }

.gallery-comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.gallery-comment-item {
    display: flex;
    gap: 12px;
}

.gallery-comment-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow:
        0 0 0 2px var(--bn-canvas-light, #f5f4ed),
        0 0 0 3px var(--bn-hairline-on-light);
}

[data-bs-theme="dark"] .gallery-comment-avatar {
    box-shadow:
        0 0 0 2px #1e2329,
        0 0 0 3px #2b3139;
}

.gallery-comment-body { flex: 1; min-width: 0; }

.gallery-comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.gallery-comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--bn-ink);
}

.gallery-comment-date {
    font-size: 11px;
    color: var(--bn-muted-strong);
}

[data-bs-theme="dark"] .gallery-comment-author { color: #eaecef; }
[data-bs-theme="dark"] .gallery-comment-date   { color: #707a8a; }

.gallery-comment-content {
    font-size: 13px;
    line-height: 1.55;
    color: var(--bn-ink);
    background: var(--bn-hairline-on-light);
    padding: 10px 14px;
    border-radius: 4px 14px 14px 14px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

[data-bs-theme="dark"] .gallery-comment-content {
    color: #eaecef;
    background: #2b3139;
}

.gallery-comment-input-wrap {
    display: flex;
    gap: 8px;
}

.gallery-comment-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
    background: #ffffff;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--bn-ink);
    outline: none;
    resize: vertical;
    min-height: 44px;
    max-height: 200px;
    transition: border-color .15s var(--gp-ease), box-shadow .15s var(--gp-ease);
}

.gallery-comment-input:focus {
    border-color: var(--bn-primary);
    box-shadow: 0 0 0 3px rgba(201, 100, 66, .12);
}

.gallery-comment-input::placeholder { color: var(--bn-muted-strong); }

[data-bs-theme="dark"] .gallery-comment-input {
    background: #14171c;
    border-color: #2b3139;
    color: #eaecef;
}

[data-bs-theme="dark"] .gallery-comment-input:focus {
    border-color: var(--bn-primary);
    box-shadow: 0 0 0 3px rgba(252, 213, 53, .15);
}

[data-bs-theme="dark"] .gallery-comment-input::placeholder { color: #707a8a; }

.gallery-comment-submit {
    flex-shrink: 0;
    align-self: flex-start;
    padding: 11px 20px;
    border: none;
    border-radius: var(--gp-radius-sm);
    background: var(--bn-primary);
    color: #faf9f5;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color .2s var(--gp-ease),
        transform .25s var(--gp-ease-snap),
        box-shadow .25s var(--gp-ease);
    box-shadow: 0 6px 18px -8px rgba(201, 100, 66, .5);
}

.gallery-comment-submit:hover {
    background: #b5573a;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -10px rgba(201, 100, 66, .5);
}

.gallery-comment-submit:active { transform: scale(.96); }
.gallery-comment-submit:disabled { opacity: .6; cursor: progress; }

[data-bs-theme="dark"] .gallery-comment-submit {
    background: var(--bn-primary);
    color: #181a20;
    box-shadow: 0 6px 18px -8px rgba(252, 213, 53, .55);
}

[data-bs-theme="dark"] .gallery-comment-submit:hover {
    background: #f0b90b;
    box-shadow: 0 10px 22px -10px rgba(252, 213, 53, .55);
}

.gallery-comments-empty {
    color: var(--bn-muted-strong);
    font-size: 13px;
    text-align: center;
    margin: 0;
    padding: 28px 0;
}

[data-bs-theme="dark"] .gallery-comments-empty { color: #707a8a; }

.gallery-comment-reply-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 6px;
    padding: 0;
    border: none;
    background: none;
    color: var(--bn-muted-strong);
    font-family: Inter, system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .15s var(--gp-ease);
}

.gallery-comment-reply-btn:hover { color: var(--bn-primary); }
[data-bs-theme="dark"] .gallery-comment-reply-btn { color: #707a8a; }
[data-bs-theme="dark"] .gallery-comment-reply-btn:hover { color: var(--bn-primary); }

.gallery-comment-replies {
    margin-left: 48px;
    padding-left: 14px;
    border-left: 2px solid var(--bn-hairline-on-light);
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

[data-bs-theme="dark"] .gallery-comment-replies { border-left-color: #2b3139; }

.gallery-comment-reply .gallery-comment-avatar {
    width: 28px;
    height: 28px;
}

.gallery-reply-form-inline {
    margin-top: 10px;
    margin-bottom: 4px;
    padding: 12px 14px;
    background: var(--bn-surface-soft-light);
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-sm);
    animation: gp-replyform-in .25s var(--gp-ease) both;
}

@keyframes gp-replyform-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

[data-bs-theme="dark"] .gallery-reply-form-inline {
    background: #14171c;
    border-color: #2b3139;
}

.gallery-reply-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 12px;
    color: var(--bn-muted);
}

.gallery-reply-form-header strong { color: var(--bn-ink); font-weight: 600; }
[data-bs-theme="dark"] .gallery-reply-form-header { color: #707a8a; }
[data-bs-theme="dark"] .gallery-reply-form-header strong { color: #eaecef; }

.gallery-reply-cancel {
    border: none;
    background: none;
    color: var(--bn-muted-strong);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background-color .15s, color .15s;
}

.gallery-reply-cancel:hover {
    background: var(--bn-hairline-on-light);
    color: var(--bn-ink);
}

[data-bs-theme="dark"] .gallery-reply-cancel { color: #707a8a; }
[data-bs-theme="dark"] .gallery-reply-cancel:hover { background: #2b3139; color: #eaecef; }

.gallery-comment-login-hint {
    text-align: center;
    padding: 18px;
    color: var(--bn-muted);
    font-size: 13px;
    background: var(--bn-surface-soft-light);
    border: 1px dashed var(--bn-border-strong);
    border-radius: var(--gp-radius-sm);
}

.gallery-comment-login-hint a {
    color: var(--bn-primary);
    text-decoration: none;
    font-weight: 600;
}

.gallery-comment-login-hint a:hover { text-decoration: underline; }

[data-bs-theme="dark"] .gallery-comment-login-hint {
    background: #14171c;
    border-color: #2b3139;
    color: #707a8a;
}


/* ── 20. Single-post page (sister of modal) ─────────────────── */

.gallery-single {
    width: min(100% - 48px, 1280px);
    margin: 0 auto;
    padding: 32px 0 80px;
}

.gallery-single-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 10px;
    background: var(--bn-hairline-on-light);
    color: var(--bn-ink);
    border-radius: 999px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition:
        background-color .2s var(--gp-ease),
        transform .25s var(--gp-ease-snap);
}

.gallery-single-back:hover {
    background: var(--bn-border-strong);
    color: var(--bn-ink);
    transform: translateX(-2px);
}

[data-bs-theme="dark"] .gallery-single-back {
    background: #2b3139;
    color: #eaecef;
}

[data-bs-theme="dark"] .gallery-single-back:hover { background: #363c46; }

.gallery-single-hero {
    margin: 16px 0 28px;
}

.gallery-single-title {
    font-family: Georgia, 'Anthropic Serif', serif;
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -.02em;
    color: var(--bn-ink);
    margin: 16px 0 12px;
}

[data-bs-theme="dark"] .gallery-single-title { color: #eaecef; }

.gallery-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-single-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: flex-start;
}

.gallery-single-media {
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-radius: var(--gp-radius-md);
    overflow: hidden;
}

.gallery-single-media figure,
.gallery-single-media .gallery-single-media-item {
    position: relative;
    margin: 0;
    border-radius: var(--gp-radius-md);
    overflow: hidden;
    background: rgba(0, 0, 0, .04);
    cursor: zoom-in;
}

[data-bs-theme="dark"] .gallery-single-media figure,
[data-bs-theme="dark"] .gallery-single-media .gallery-single-media-item {
    background: #14171c;
}

.gallery-single-media img,
.gallery-single-media video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: inherit;
    transition: transform .5s var(--gp-ease);
}

.gallery-single-media figure:hover img {
    transform: scale(1.015);
}

.gallery-single-side {
    position: sticky;
    top: 84px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    background: var(--bn-surface-soft-light);
    border: 1px solid var(--bn-hairline-on-light);
    border-radius: var(--gp-radius-md);
}

[data-bs-theme="dark"] .gallery-single-side {
    background: #1e2329;
    border-color: #2b3139;
}

.gallery-single-side .gallery-modal-section,
.gallery-single-side .gallery-modal-actions {
    margin-bottom: 0;
}

.gallery-single-comments {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--bn-hairline-on-light);
}

[data-bs-theme="dark"] .gallery-single-comments { border-top-color: #2b3139; }

/* WordPress comments styling override (for single page) */
.gallery-single-comments .comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gallery-single-comments .comment-respond {
    margin-top: 16px;
}

.gallery-single-comments h2,
.gallery-single-comments h3 {
    font-family: Georgia, 'Anthropic Serif', serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--bn-ink);
    margin: 0 0 16px;
}

[data-bs-theme="dark"] .gallery-single-comments h2,
[data-bs-theme="dark"] .gallery-single-comments h3 {
    color: #eaecef;
}


/* ── 21. Responsive ─────────────────────────────────────────── */

@media (min-width: 1600px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 1199.98px) {
    .gallery-page {
        width: min(100% - 32px, 100%);
    }
}

@media (max-width: 991.98px) {
    .gallery-toolbar {
        position: static;
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 24px;
    }

    .gallery-filters {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .gallery-filter-selects--triple {
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    .gallery-filter-selects {
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .gallery-modal-body {
        flex-direction: column;
        height: auto;
        max-height: none;
    }

    .gallery-modal {
        max-height: 95vh;
        overflow-y: auto;
    }

    .gallery-modal-media {
        flex: none;
        height: 50vh;
        min-height: 240px;
        max-height: 55vh;
        cursor: default;
    }

    .gallery-modal-info {
        flex: 1 1 auto;
        min-height: 40vh;
        border-left: none;
        border-top: 1px solid var(--bn-hairline-on-light);
    }

    [data-bs-theme="dark"] .gallery-modal-info {
        border-top-color: #2b3139;
    }

    .gallery-modal-scroll {
        max-height: none;
        padding: 22px;
    }

    .gallery-comment-replies {
        margin-left: 32px;
        padding-left: 10px;
    }

    .gallery-single-grid {
        grid-template-columns: 1fr;
    }

    .gallery-single-side {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .gallery-page {
        width: min(100% - 24px, 100%);
        padding-bottom: 56px;
    }

    .gallery-grid.is-cols7,
    .gallery-grid.is-cols5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .gallery-hero {
        padding: 32px 0 18px;
    }

    .gallery-modal-overlay {
        padding: 0;
    }

    .gallery-modal {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
        display: flex;
        flex-direction: column;
        animation: gp-modal-in-mobile .3s var(--gp-ease) both;
    }

    @keyframes gp-modal-in-mobile {
        from { opacity: 0; transform: translateY(20px); }
        to   { opacity: 1; transform: none; }
    }

    .gallery-modal-body {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .gallery-modal-media {
        height: 40vh;
        min-height: 200px;
        max-height: 40vh;
    }

    .gallery-modal-info {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .gallery-modal-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 18px;
    }

    .gallery-comment-replies {
        margin-left: 24px;
        padding-left: 8px;
    }

    .gallery-modal-actions { flex-wrap: wrap; }

    .gallery-action-btn,
    .gallery-action-download-lock {
        font-size: 12px;
        padding: 8px 14px;
    }

    .gallery-carousel-counter,
    .gallery-zoom-hint { display: none; }

    .gallery-modal-section { margin-bottom: 18px; }

    .gallery-modal-section-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .gallery-comment-item { gap: 10px; }
    .gallery-comment-avatar { width: 30px; height: 30px; }
    .gallery-comment-reply .gallery-comment-avatar { width: 24px; height: 24px; }
    .gallery-comment-author { font-size: 12px; }
    .gallery-comment-content { font-size: 13px; padding: 8px 12px; }
    .gallery-comment-date { font-size: 11px; }
    .gallery-comment-reply-btn { min-height: 28px; padding: 4px 0; }

    .gallery-modal-comments-section {
        margin-bottom: 0;
    }

    .gallery-comment-form {
        position: sticky;
        bottom: 0;
        background: var(--bn-canvas-light, #f5f4ed);
        padding: 10px 18px 18px;
        margin: 0 -18px -18px;
        border-top: 1px solid var(--bn-hairline-on-light);
        z-index: 2;
    }

    [data-bs-theme="dark"] .gallery-comment-form {
        background: #1e2329;
        border-top-color: #2b3139;
    }

    .gallery-comment-input {
        font-size: 13px;
        padding: 10px 14px;
        min-height: 40px;
    }

    .gallery-single { width: min(100% - 24px, 100%); }
    .gallery-single-side { padding: 18px; }
}

@media (max-width: 575.98px) {
    .gallery-page { width: min(100% - 16px, 100%); }

    .gallery-toolbar { padding: 10px; border-radius: var(--gp-radius-sm); }

    .gallery-grid.is-cols7,
    .gallery-grid.is-cols5 {
        gap: 8px;
    }

    .gallery-card { border-radius: var(--gp-radius-sm); }
    .gallery-card-media { border-radius: var(--gp-radius-sm); }
    .gallery-vip-blur-hint { inset: auto 8px 8px; }
    .gallery-vip-blur-hint span {
        min-height: 26px;
        padding: 5px 9px;
        font-size: 11px;
    }

    .gallery-search-box .gallery-search-input,
    .gallery-page input.gallery-search-input[type="text"] {
        font-size: 14px !important;
        padding: 12px 40px 12px 44px !important;
    }

    .gallery-modal-media {
        height: 34vh;
        min-height: 180px;
        max-height: 34vh;
    }

    .gallery-modal-scroll { padding: 14px; }

    .gallery-prompt-unlock { padding: 10px 22px; font-size: 13px; }
    .gallery-prompt-text { font-size: 12px; padding: 12px 14px; }

    .gallery-comment-replies { margin-left: 16px; padding-left: 8px; }

    .gallery-reply-form-inline { padding: 10px 12px; }
    .gallery-comment-input-wrap { flex-direction: column; }
    .gallery-comment-submit,
    .gallery-reply-submit { align-self: flex-end; }

    .gallery-modal-actions { gap: 6px; }
    .gallery-action-btn,
    .gallery-action-download-lock {
        font-size: 12px;
        padding: 7px 12px;
        gap: 4px;
    }

    .gallery-action-btn svg { width: 14px; height: 14px; }
    .gallery-meta-tag { font-size: 11px; padding: 4px 9px; }
    .gallery-carousel-dots { display: none; }
}


/* ── 22. Reduced motion safety ──────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .gallery-page *,
    .gallery-page *::before,
    .gallery-page *::after,
    .gallery-modal-overlay *,
    .gallery-modal-overlay *::before,
    .gallery-modal-overlay *::after {
        animation-duration: .001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001s !important;
    }

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

    .gallery-card:hover {
        transform: none !important;
    }

    .gallery-card:hover .gallery-card-media img {
        transform: none !important;
    }
}

/* ============================================================
 * Wave 7.4.2 — tablet-landscape tier (1024-1279)
 *
 * Gallery grid uses minmax(240px, 1fr) (line 471). At 1024-1279px
 * width that yields 4 columns with cards getting awkwardly wide
 * (~300-360px) and thumbnails losing the dense "wall" feel. Tighten
 * the floor to 220px so we get a stable 4-col layout AND keep room
 * for a comfortable 5th column when the user has the sidebar
 * collapsed.
 * ============================================================ */
@media (min-width: 1024px) and (max-width: 1279.98px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 18px;
    }
    .gallery-modal-content {
        max-width: 1080px;
    }
}
