/* ========================================
   MEDIA PAGE — "Exhibit A"
   The evidence room: a numbered, captioned
   press dossier. Every asset is an exhibit.
   ======================================== */

/* ---------- Exhibit counter ----------
   Numbering is pure CSS counters so CMS-reordered
   or CMS-added assets stay correctly numbered. */
[data-page="gallery"] body {
    counter-reset: exhibit;
}

/* ---------- Exhibit plate (signature component) ---------- */
.exhibit-plate {
    counter-increment: exhibit;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-family: var(--font-sans);
    text-align: left;
}
.exhibit-no::before {
    content: "EX. " counter(exhibit, decimal-leading-zero);
}
.exhibit-no {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--page-accent, var(--red));
    white-space: nowrap;
}
.exhibit-caption {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
}
.exhibit-loc {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ---------- 1. Dossier Hero ---------- */
.dossier-hero {
    position: relative;
    padding: 160px 0 72px;
    overflow: hidden;
}
.dossier-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 18% 0%, var(--glow-color) 0%, transparent 60%);
    pointer-events: none;
}
.dossier-hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    gap: 56px;
    align-items: end;
}
.dossier-kicker {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--page-accent, var(--red));
    margin-bottom: 20px;
}
.dossier-title {
    font-family: var(--font-serif);
    font-size: clamp(3.25rem, 9vw, 6.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}
.dossier-subhead {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 18px;
}
.dossier-dek {
    font-family: var(--font-sans);
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    font-weight: 300;
    line-height: 1.65;
    color: var(--text-secondary);
    max-width: 540px;
    margin-bottom: 32px;
}
.dossier-dek::before {
    content: 'THE PROOF, FILED —';
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Ruled verification strip */
.dossier-verify-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    margin-bottom: 32px;
    max-width: 640px;
}
.verify-fact {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
    white-space: nowrap;
}
.verify-fact + .verify-fact::before {
    content: '\00B7';
    color: var(--page-accent, var(--red));
    font-weight: 800;
    margin: 0 14px;
}
.dossier-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 28px;
}
.dossier-jump {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 3px;
    transition: color 0.3s, border-color 0.3s;
}
.dossier-jump:hover {
    color: var(--page-accent, var(--red));
    border-color: var(--page-accent, var(--red));
}

/* Portrait — Exhibit 01 */
.dossier-portrait {
    margin: 0;
    max-width: 400px;
    justify-self: end;
    width: 100%;
}
.dossier-portrait .photo-placeholder {
    margin-bottom: 12px;
}
.dossier-portrait .exhibit-plate .exhibit-caption {
    font-size: 0.68rem;
}

/* ---------- 2. The Screening Room ---------- */
.screening-room {
    padding: 110px 0;
    background: var(--bg-elevated);
}
.screening-room .section-header {
    margin-bottom: 56px;
}
.screening-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}
.screening-primary,
.screening-item {
    margin: 0;
}
.reel-frame {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    margin-bottom: 12px;
}
.reel-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}
.screening-side {
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.screening-side .reel-frame {
    border-radius: var(--radius);
}

/* ---------- 3. On the Record ---------- */
.record-section {
    padding: 110px 0;
}
.press-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 56px;
}
.press-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s, transform 0.4s;
}
.press-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%), var(--glow-color) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.press-card:hover::before {
    opacity: 1;
}
.press-card:hover {
    border-color: var(--border-hover);
}
.press-outlet {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--page-accent, var(--red));
    margin-bottom: 12px;
}
.press-desc {
    font-family: var(--font-sans);
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
}
.press-quote {
    margin: 0;
    border: 0;
    padding: 0;
}
.press-quote p {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 12px;
}
.press-quote footer {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* "Also covered by" ruled line */
.press-also {
    margin-top: 40px;
    padding: 18px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 2;
}
.press-also a {
    color: var(--text-secondary);
    transition: color 0.3s;
}
.press-also a:hover {
    color: var(--page-accent, var(--red));
}
.press-also-label {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--page-accent, var(--red));
    margin-right: 14px;
}
.press-also-sep {
    color: var(--page-accent, var(--red));
    margin: 0 10px;
}

/* ---------- 4. The Photo Record ---------- */
.gallery-page-section {
    padding: 110px 0;
    background: var(--bg-elevated);
}
.photo-record-header {
    text-align: center;
    margin-bottom: 48px;
}

/* Filter tabs — anchored inside the section header as the Exhibit Index */
.filter-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 28px;
    flex-wrap: wrap;
}
.exhibit-index-label {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 6px;
}
.filter-tab {
    padding: 0.55rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: transparent;
    color: inherit;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s, color 0.3s;
}
.filter-tab:hover,
.filter-tab.active {
    background: var(--page-accent, var(--red));
    border-color: var(--page-accent, var(--red));
    color: #fff;
}

/* Masonry grid — plates give the rhythm, so rows grow to fit them */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 300px;
    gap: 1.5rem 1rem;
}
.masonry-item {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
/* These tiles also carry the legacy .gallery-item class, whose aspect-ratio:1
   (style.css) forces each tile square off its column width. On the wide
   span-2-col tiles that makes them ~568px tall inside a single 300px row track,
   so the tile overflows the row and its caption plate drops onto the tiles
   below (the "NBA Finals" / "Stanley Cup" overlap). Neutralize the inherited
   square so the tile height comes from the grid row track(s): the media flexes
   to fill and the caption plate keeps its reserved space below, never spilling
   into a neighbour. Higher specificity so it wins regardless of load order. */
.masonry-grid .masonry-item {
    aspect-ratio: auto;
    overflow: visible;
}
.masonry-media {
    position: relative;
    flex: 1;
    min-height: 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.masonry-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.masonry-item .exhibit-plate {
    margin-top: 10px;
}
.masonry-item .exhibit-caption {
    font-size: 0.7rem;
}
.masonry-item .exhibit-loc {
    font-size: 0.66rem;
}

/* Span classes (kept from the original grid) */
.masonry-item.span-2-col { grid-column: span 2; }
.masonry-item.span-2-row { grid-row: span 2; }
.masonry-item.span-2-both { grid-column: span 2; grid-row: span 2; }

/* Filter state */
.masonry-item.hidden {
    display: none;
}

/* ---------- 5. Corroborating Witnesses ---------- */
.witness-section {
    padding: 110px 0;
}
.witness-section .section-header {
    margin-bottom: 56px;
}
.witness-lead {
    margin: 0 auto 64px;
    max-width: 860px;
}
.witness-lead blockquote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(2.75rem, 8vw, 5.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
    color: var(--text);
}
.witness-stack {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 36px;
}
.witness-entry {
    margin: 0;
    border-left: 2px solid var(--page-accent, var(--red));
    padding-left: 24px;
}
.witness-entry p {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 10px;
}
.witness-entry footer {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ---------- 6. Case Closed CTA ---------- */
.case-closed {
    position: relative;
    padding: 120px 0;
    overflow: hidden;
    text-align: center;
}
/* .book-cameron-cta-bg (style.css) supplies the animated red gradient */
.case-closed-inner {
    position: relative;
    z-index: 1;
}
.case-closed-tag {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 8px 20px;
    margin-bottom: 28px;
}
.case-closed-title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 1.08;
    color: #fff;
    margin-bottom: 16px;
}
.case-closed-line {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: rgba(255,255,255,0.9);
    margin-bottom: 40px;
}
.case-closed-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px 32px;
}
.case-closed-btn {
    background: #fff;
    color: var(--red);
    font-weight: 700;
    border-radius: 50px;
    padding: 16px 40px;
    display: inline-block;
    transition: transform 0.3s, box-shadow 0.3s;
}
.case-closed-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.case-closed-media-link {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.4);
    padding-bottom: 3px;
    transition: border-color 0.3s;
}
.case-closed-media-link:hover {
    border-color: #fff;
}

/* ---------- First-paint fail-safe (load-order hardening) ----------
   Every content block on this page starts HIDDEN by the shared, JS-driven reveal
   system: `.reveal` begins at opacity:0 and `.clip-reveal` (the section titles)
   begins clip-path-hidden, each waiting for an IntersectionObserver in script.js /
   cms.js to add `.visible` / `.clip-visible`. On a cold first load those observers
   can miss elements — script parsing stalled behind the Supabase + cms.js bundles,
   the cms.js re-observe pass running late, or a back/forward (bfcache) restore —
   which leaves whole sections blank (including the photo grid, which is a SINGLE
   `.reveal`) until the visitor manually reloads. That is the reported
   "media page was broken until I reloaded / re-uploaded."

   These animations are a pure-CSS guarantee that the content paints regardless of
   observer timing. Each keyframe set has only a `to` frame, so its implicit 0% is
   the element's own underlying value: when the observers fire normally they reveal
   the element well before the delay elapses, so the animation runs 1->1 / 0-inset
   ->0-inset and is a visual NO-OP. Only when JS fails to reveal in time do these
   force the element visible. Scroll-reveal animation is preserved for the normal
   case. Delay is comfortably longer than a healthy observer callback (~100ms). */
@keyframes exhibit-reveal-failsafe { to { opacity: 1; transform: none; } }
@keyframes exhibit-clip-failsafe   { to { clip-path: inset(0 0 0 0); } }

.dossier-hero .reveal,
.screening-room .reveal,
.record-section .reveal,
.gallery-page-section .reveal,
.witness-section .reveal,
.case-closed .reveal {
    animation: exhibit-reveal-failsafe 0.6s ease 2s forwards;
}
.dossier-hero .clip-reveal,
.screening-room .clip-reveal,
.record-section .clip-reveal,
.gallery-page-section .clip-reveal,
.witness-section .clip-reveal {
    animation: exhibit-clip-failsafe 0.6s cubic-bezier(0.23, 1, 0.32, 1) 2.1s forwards;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .case-closed .book-cameron-cta-bg {
        animation: none;
    }
    .dossier-jump,
    .press-card,
    .filter-tab,
    .masonry-item,
    .case-closed-btn {
        transition: none;
    }
    /* No entrance motion — but content must never be left hidden waiting on JS.
       Force the revealed end-state immediately. */
    .dossier-hero .reveal,
    .screening-room .reveal,
    .record-section .reveal,
    .gallery-page-section .reveal,
    .witness-section .reveal,
    .case-closed .reveal {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .dossier-hero .clip-reveal,
    .screening-room .clip-reveal,
    .record-section .clip-reveal,
    .gallery-page-section .clip-reveal,
    .witness-section .clip-reveal {
        animation: none;
        clip-path: inset(0 0 0 0);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .masonry-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 260px;
    }
    .press-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dossier-hero-grid {
        gap: 40px;
    }
}
@media (max-width: 900px) {
    .dossier-hero {
        padding-top: 140px;
    }
    .dossier-hero-grid {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .dossier-portrait {
        justify-self: start;
        max-width: 380px;
    }
    .screening-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 230px;
    }
    .masonry-item.span-2-col { grid-column: span 2; }
    .masonry-item.span-2-both { grid-column: span 2; grid-row: span 1; }
    .press-grid {
        grid-template-columns: 1fr;
    }
    .screening-room,
    .record-section,
    .gallery-page-section,
    .witness-section {
        padding: 80px 0;
    }
}
@media (max-width: 480px) {
    .masonry-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 280px;
    }
    .masonry-item.span-2-col,
    .masonry-item.span-2-both { grid-column: span 1; }
    .masonry-item.span-2-row { grid-row: span 1; }
    .verify-fact + .verify-fact::before {
        margin: 0 10px;
    }
    .exhibit-plate {
        gap: 4px 10px;
    }
    .exhibit-loc {
        margin-left: 0;
        width: 100%;
    }
    .dossier-portrait {
        max-width: 100%;
    }
}
