/* Scenes — a dark title card that resolves into an ivory spread on scroll.
 * Derived from the Maman Corp scene grammar (01_REFERENCES/04_MAMAN_CORP_2026-11-17),
 * rebuilt on normal scrolling: keyboard, deep links and no-JS all work.
 *
 * Sharpness rule (client request, 18 Nov): an image is never drawn larger than its own
 * pixels. Each scene carries --nat (its source width); media boxes cap at that width and
 * keep the 16:9 source ratio, so nothing is cropped-and-enlarged. No zoom effects:
 * motion is clip-path, opacity and the panel wipe only.
 */
.scene{--nat:1024px;--ch-pad:var(--page-pad);--ch-header:72px;position:relative;background:var(--paper);color:var(--ink)}

/* ---------- Static layout (no JS, phones, reduced motion) ---------- */
.scene-pin{position:relative;display:grid;grid-template-columns:minmax(0,1fr);padding:clamp(56px,8vw,110px) var(--ch-pad) clamp(40px,5vw,70px);gap:clamp(28px,4vw,48px)}
.scene-media{position:relative;margin:0;width:min(100%,var(--nat));aspect-ratio:16/9;overflow:hidden;background:var(--ivory)}
.scene-media img{display:block;width:100%;height:100%;object-fit:cover}
.scene-media::after{content:"";position:absolute;left:0;bottom:0;width:clamp(48px,7vw,104px);aspect-ratio:1;background:var(--gold);transform-origin:bottom}
.scene-credit{position:absolute;right:12px;bottom:12px;z-index:1;max-width:70%;padding:6px 10px;font-size:12px;line-height:1.3;letter-spacing:.2px;color:var(--paper);background:color-mix(in oklab,var(--ink-deep) 72%,transparent);border-radius:2px}
.scene-wipe,.scene-shade,.scene-panel,.scene-cue,.scene-corner,.scene-lines{display:none}
.scene-copy{max-width:780px}
.scene-label{display:flex;align-items:baseline;gap:14px;margin:0 0 18px;font-size:13px;font-weight:700;letter-spacing:2.2px;text-transform:uppercase;color:var(--gold)}
.scene-label span{font-size:13px;letter-spacing:1px;color:var(--muted);font-weight:400}
.scene :is(h1,h2){margin:0;font-weight:400;font-size:clamp(40px,5.6vw,88px);line-height:1.02;letter-spacing:-.03em;text-wrap:balance}
.scene :is(h1,h2) em{color:var(--gold)}
.scene-text{margin:22px 0 0;max-width:46ch;font-size:clamp(17px,1.35vw,20px);line-height:1.6;color:var(--ink);text-wrap:pretty}

/* Section that follows a chapter loses its top spacing: the chapter is its heading. */
.has-chapter.section-space{padding-top:clamp(36px,4vw,64px)}
.about.has-chapter{grid-template-columns:minmax(0,1fr);max-width:none}
.about.has-chapter .about-copy{max-width:860px;margin-left:auto}

/* Static reveal (JS adds .scenes-ready + .is-in). */
.scenes-ready .scene .scene-media{transition:clip-path 1000ms var(--ease-in-out)}
.scenes-ready .scene:not(.is-in) .scene-media{clip-path:inset(0 0 100% 0)}
.scenes-ready .scene .scene-media::after{transition:transform 700ms var(--ease-out) 600ms}
.scenes-ready .scene:not(.is-in) .scene-media::after{transform:scaleY(0)}

/* ---------- Live mode (wide screens, motion allowed) ---------- */
.scene-live{height:200vh;
  /* media width: never above the source pixels, 54vw, or what fits the viewport height */
  --mw:min(var(--nat),54vw,calc((100dvh - var(--ch-header) - 150px) * 16 / 9))}
.scene-live .scene-pin{position:sticky;top:var(--ch-header);height:calc(100dvh - var(--ch-header));min-height:560px;padding:0;display:block;overflow:hidden;isolation:isolate;background:var(--ink-deep)}

.scene-live .scene-panel{display:block;position:absolute;inset:0;z-index:1;background:var(--paper);transform:translateX(-101%);transition:transform 900ms var(--ease-in-out)}
.scene-live .scene-media{position:absolute;z-index:2;right:var(--ch-pad);top:50%;width:var(--mw);translate:0 -50%;clip-path:inset(0 0 0 0);transition:clip-path 1100ms var(--ease-in-out)}
.scene-live .scene-media::after{transform:scaleY(0);transition:transform 700ms var(--ease-in-out)}

.scene-live .scene-lines{display:block;position:absolute;inset:0;z-index:2;pointer-events:none}
.scene-live .scene-lines i{position:absolute;top:0;bottom:0;width:1px;background:color-mix(in oklab,var(--paper) 22%,transparent);transform:scaleY(0);transform-origin:top;transition:transform 1200ms var(--ease-in-out),background-color 600ms ease}
.scene-live .scene-lines i:first-child{left:calc(var(--ch-pad) - 28px)}
.scene-live .scene-lines i:last-child{right:calc(var(--ch-pad) + var(--mw) + 28px);transition-delay:150ms}

.scene-live .scene-copy{position:absolute;z-index:3;left:var(--ch-pad);top:50%;translate:0 -50%;width:calc(100% - var(--mw) - var(--ch-pad) * 2 - 64px);max-width:640px}
.scene-live :is(h1,h2){font-size:clamp(40px,3.9vw,70px);color:var(--paper);transform:translateY(4vh);transition:transform 1000ms var(--ease-in-out),color 600ms ease 150ms}
.scene-live :is(h1,h2) em{color:var(--gold-light);transition:color 600ms ease 150ms}
.scene-live .scene-label{color:var(--gold-light);transition:color 600ms ease 150ms}
.scene-live .scene-label span{color:color-mix(in oklab,var(--paper) 70%,transparent)}
.scene-live .scene-text{opacity:0;transform:translateY(20px);transition:opacity 500ms ease,transform 600ms var(--ease-out)}
.scene-live .scene-cue{display:flex;align-items:center;gap:12px;position:absolute;z-index:3;left:var(--ch-pad);bottom:34px;font-size:13px;letter-spacing:2px;text-transform:uppercase;color:color-mix(in oklab,var(--paper) 80%,transparent);transition:opacity 300ms ease}
.scene-live .scene-cue::before{content:"";width:1px;height:34px;background:currentColor}

/* Entrance before the chapter is reached (variants rotate per chapter). */
.scene-live:not(.is-in) .scene-media{clip-path:inset(100% 0 0 0)}
.scene-live[data-variant="wipe"]:not(.is-in) .scene-media{clip-path:inset(0 0 0 100%)}
.scene-live[data-variant="window"]:not(.is-in) .scene-media{clip-path:inset(18% 18% 18% 18%)}
.scene-live:not(.is-in) .scene-copy{opacity:0}
.scene-live .scene-copy{transition:opacity 700ms ease 350ms}
.scene-live.is-in .scene-lines i{transform:scaleY(1)}

/* Spread state: ivory wipes in from the left, the gold corner rises on the image. */
.scene-live.is-spread .scene-panel{transform:none}
.scene-live.is-spread .scene-media::after{transform:none;transition-delay:450ms}
.scene-live.is-spread .scene-lines i{background:color-mix(in oklab,var(--ink) 12%,transparent)}
.scene-live.is-spread :is(h1,h2){color:var(--ink);transform:none}
.scene-live.is-spread :is(h1,h2) em,.scene-live.is-spread .scene-label{color:var(--gold)}
.scene-live.is-spread .scene-label span{color:var(--muted)}
.scene-live.is-spread .scene-text{opacity:1;transform:none;transition-delay:450ms,450ms}
.scene-live.is-spread .scene-cue{opacity:0}
.scene-live:not(.is-spread) .scene-panel{transition-duration:650ms}
.scene-live:not(.is-spread) .scene-text{transition-delay:0ms}

@media (max-width:899px){
  .scene-credit{right:8px;bottom:8px}
  .scene :is(h1,h2){font-size:clamp(38px,10vw,56px)}
}
@media (prefers-reduced-motion:reduce){
  .scenes-ready .scene .scene-media,.scenes-ready .scene .scene-media::after{transition:none;clip-path:none!important;transform:none!important}
}
@media print{.scene-live{height:auto}.scene-live .scene-pin{position:relative;height:auto}}

/* ---------- Inner-page hero scenes ---------- */
.scene-crumb{display:inline-flex;gap:6px;margin:0 0 26px;font-size:13px;color:var(--muted);text-decoration:none}
.scene-crumb span{color:var(--ink)}
.scene-hero .scene-pin{padding-top:clamp(28px,4vw,48px)}
.scene-hero.scene-live{height:185vh}
.scene-live .scene-crumb{color:color-mix(in oklab,var(--paper) 72%,transparent);transition:color 600ms ease}
.scene-live .scene-crumb span{color:var(--paper);transition:color 600ms ease}
.scene-live.is-spread .scene-crumb{color:var(--muted)}
.scene-live.is-spread .scene-crumb span{color:var(--ink)}
/* A page hero is already in view on load: show the card at once, no entrance wipe. */
.scene-hero.scene-live:not(.is-in) .scene-media{clip-path:inset(0 0 0 0)}
.scene-hero.scene-live:not(.is-in) .scene-copy{opacity:1}
.scene-hero + .page-jump{position:relative;z-index:5}

/* ---------- Picture pairs (between sections) ---------- */
.scene-band{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:clamp(10px,1.4vw,20px);margin:clamp(28px,4vw,64px) auto;padding-inline:var(--page-pad);max-width:calc(2 * 1024px + 20px + 2 * var(--page-pad))}
.scene-band figure{position:relative;margin:0;aspect-ratio:16/9;overflow:hidden;background:var(--ivory)}
.scene-band img{display:block;width:100%;height:100%;object-fit:cover}
.scene-band figcaption{position:absolute;right:10px;bottom:10px;max-width:80%;padding:5px 9px;font-size:12px;line-height:1.3;color:var(--paper);background:color-mix(in oklab,var(--ink-deep) 72%,transparent);border-radius:2px}
.scene-band-corner{position:absolute;left:0;bottom:0;width:clamp(44px,5vw,84px);aspect-ratio:1;background:var(--gold);transform-origin:bottom}
@media (max-width:700px){.scene-band{grid-template-columns:minmax(0,1fr)}}
/* The clip sits on the image, not the observed element: Chrome's IntersectionObserver
 * treats a fully clipped target as not intersecting, so the reveal would never fire. */
.scenes-ready .scene-band img{clip-path:inset(0 0 0 0);transition:clip-path 1000ms var(--ease-in-out)}
.scenes-ready .scene-band figure:nth-child(2) img{transition-delay:120ms}
.scenes-ready .scene-band:not(.is-in) img{clip-path:inset(0 0 0 100%)}
.scenes-ready .scene-band .scene-band-corner{transition:transform 700ms var(--ease-out) 600ms}
.scenes-ready .scene-band:not(.is-in) .scene-band-corner{transform:scaleY(0)}
@media (prefers-reduced-motion:reduce){.scenes-ready .scene-band img,.scenes-ready .scene-band:not(.is-in) img{clip-path:none;transition:none}.scenes-ready .scene-band-corner{transform:none!important;transition:none}}
