/* esoteria.ai v2: chapter.css, the shell every chapter shares (B0). Load order: base.css, chapter.css, then the chapter's own CSS.
   Contract (CONTRACT in js/chapter.js): pages are .layer[data-layer] in order; js/chapter.js owns the pager, layers (.on, .played),
   cue, rail, sheet and footer. The last page is the end page (CP10: .layer.endpage, the Close words on the left with the Coming soon
   line, the next job's door on the right; door.css styles the card). ?embed=1 shows one act inside the home's reel (CONTRACT, embed).
   Only transform and opacity animate here (tools/css-audit.mjs). */

/* ---------- the document: one fixed screen, the pages stacked as layers (as the home) ---------- */
.chapter { overflow: hidden; }
.chapter .track section { height: 100vh; height: 100lvh; }
/* a page leaves as one piece (its words also leave on their own, base.css); it arrives at once, its parts in their own beats */
.chapter .layer { opacity: 0; transition: opacity .26s cubic-bezier(.4, 0, 1, 1), visibility 0s linear .26s; }
.chapter .layer.on { opacity: 1; transition: none; }
.chapter.reduced .layer { transition: opacity .15s linear, visibility 0s linear .15s; }
.chapter .layers { transition: transform var(--move, .8s) cubic-bezier(.45, 0, .15, 1); }

/* ---------- masthead: three quiet words between the lockup and Download (desktop); on phones they live in the sheet ---------- */
.chap-words { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: calc(26px * var(--k)); pointer-events: auto; }
.chap-words a { position: relative; font-size: 13px; font-weight: 500; letter-spacing: .01em; color: var(--t3); text-decoration: none; padding: 12px 2px; }
.chap-words a:hover, .chap-words a:focus-visible { color: var(--t1); }
.chap-words a[aria-current="page"] { color: var(--t1); }
.phone .chap-words { display: none; }
/* R66: phone chapters: the nav in the pill's place, 13 px words 14 px apart, each a 44 px tap area; tablets keep it centred, as desktop */
.tablet .chap-words { display: flex; } .tablet .chap-words a { display: inline-flex; justify-content: center; min-width: 44px; }
.phone:not(.tablet) .chap-words { display: flex; position: static; transform: none; gap: 0; margin-right: -7px; }
.phone:not(.tablet) .chap-words a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 7px; }
.phone:not(.tablet) .chapter .mast .pill { display: none; }
.cf-chap { display: none; }
.phone .cf-chap { display: flex; justify-content: center; gap: 28px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.cf-chap a { font-size: 14px; font-weight: 500; color: var(--t3); text-decoration: none; padding: 10px 2px; }
.cf-chap a[aria-current="page"] { color: var(--t1); }

/* ---------- the orb still (assets/orb-still@1x.webp 640 px, @2x 1280 px; the orb fills 36% of the square, so a still
   of side S shows an orb of about 0.36 S). Used on M1 and on every Close only, 32 px clear of any card (DESIGN-SPEC 0) ---------- */
.orbst, .orb-still { position: absolute; aspect-ratio: 1; pointer-events: none; background: image-set(url("assets/orb-still@1x.webp") 1x, url("assets/orb-still@2x.webp") 2x) center / contain no-repeat; }

/* ---------- labels and rows ---------- */
.partners { font-size: 13px; line-height: 1.4; color: var(--t3); }


/* ---------- the demo label: one per page, 12 px ink-4, under its scene ---------- */
.chapter .demo { font-size: 12px; color: var(--t3); }   /* R44: text under 18 px is ink-3 or brighter */

/* ---------- ?perf: a corner readout (frame p95, last move's longest frame); nothing leaves the page ---------- */
.perf-hud { position: fixed; z-index: 60; left: 8px; bottom: 8px; width: 120px; height: 40px; padding: 5px 7px; border-radius: 8px; background: rgba(9, 9, 13, .86); box-shadow: inset 0 0 0 1px var(--line); font: 500 12px/1.35 "Satoshi", system-ui, sans-serif; color: var(--t2); font-variant-numeric: tabular-nums; pointer-events: none; white-space: pre; }

/* ---------- Close (the home's, verbatim): words left at 36% on desktop; on phones in the lower band over the foot scrim ---------- */
.chapter .copy.close { left: calc(88px * var(--k)); top: 36%; width: min(calc(600px * var(--k)), 42vw); }   /* 42vw: clear of the still at 4:3 */
.phone .chapter .copy.close { left: 20px; right: 20px; width: auto; top: auto; bottom: 80px; }
@media (max-height: 700px) { .phone .chapter .copy.close { bottom: 66px; } }


/* ---------- shared card type (DESIGN-SPEC 0, nothing under 12 px): use these instead of local sizes ---------- */
.c-title { font-size: 20px; font-weight: 500; line-height: 1.25; letter-spacing: -0.012em; color: var(--t1); }
.c-body { font-size: 15px; line-height: 1.45; color: var(--t2); }
.c-meta { font-size: 13px; line-height: 1.4; color: var(--t3); }
.c-cap, .c-label { font-size: 12px; line-height: 1.35; color: var(--t3); }
.c-label { font-weight: 500; letter-spacing: .02em; }
.phone .c-body { font-size: 14px; }

/* ---------- chapter type (DESIGN-SPEC 0): h1 56/1.02 (40 phone), h2 40/1.05 (30 phone); the Close keeps the home's h1 ---------- */
.chapter .h1 { font-size: calc(56px * var(--k)); line-height: 1.02; }
.chapter .h2 { font-size: calc(40px * var(--k)); line-height: 1.05; }
.phone .chapter .h1 { font-size: 40px; }
.phone .chapter .h2 { font-size: 30px; }
.chapter [data-layer="close"] .h1 { font-size: calc(74px * var(--k)); line-height: 1; }
.phone .chapter [data-layer="close"] .h1 { font-size: 40px; }


/* ---------- R25 the lit field: one static radial field behind every page, dithered (white, 0 to 1.5 levels) so it never bands; stops set so CP4's measures hold (720,320 at 14 to 19; corners at 10); html stays the void ---------- */
body.chapter::before, body.chapter::after { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; }
body.chapter::before { background: radial-gradient(ellipse 75% 60% at 50% 40%, #12121A 0%, #0E0E15 42%, #09090D 90%); }
body.chapter::after { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .006 0 0 0 0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- R26 one light, one raise. <i class="glow" data-book="grow|save|done"> first in a scene: a halftone of dots, plum while the
   layer is .working, the book colour at rest (two layers cross-fading by opacity). .raise on one card: lifted, a deeper shadow ---------- */
[data-scene]:has(> .glow) { isolation: isolate; }
.glow { position: absolute; inset: -22%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .42s var(--ease);
  -webkit-mask-image: radial-gradient(closest-side, #000 0, transparent 100%); mask-image: radial-gradient(closest-side, #000 0, transparent 100%); }
.glow::before, .glow::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, var(--c) 1.5px, transparent 2px) 0 0 / 12px 12px; transition: opacity .42s var(--ease); }
.glow::before { --c: #A970B6; opacity: 0; }
.glow[data-book="grow"]::after { --c: #6C85FF; } .glow[data-book="save"]::after { --c: #D06B73; } .glow[data-book="done"]::after { --c: rgba(237, 235, 240, .5); }
.layer.on.played .glow { opacity: .42; } .phone .layer.on.played .glow { opacity: .34; }
.layer.working .glow::before { opacity: 1; } .layer.working .glow::after { opacity: 0; }
.layer.on.played .raise { transform: translateY(calc(-4px * var(--k))); }
.raise::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .42s var(--ease);
  box-shadow: 0 44px 80px -36px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .07); }
.layer.on.played .raise::after { opacity: 1; }

/* ---------- R27 the yes waits: the key lights (a pre-drawn ring), a 2 px line fills as a held Option+Space, the key sinks on the yes ---------- */
.wait::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none; box-shadow: 0 0 0 1.5px rgba(237, 235, 240, .6); animation: lit .3s var(--ease) both; }
@keyframes lit { from { opacity: 0; } }
.yes-fill { position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
[data-yes].down { transform: translateY(3px); }

/* ---------- R49 short desktop windows: under 720 tall the stage is the 720 design, zoomed by --sz (as tablets zoom by --tz). The masthead,
   cue, rail, footer, download sheet and the field are not zoomed. html.short (720 to 799) is for the pages' own drops ---------- */
.shortz .chapter .layers { zoom: var(--sz); inset: auto; left: 0; top: 0; width: calc(100vw / var(--sz)); height: calc(100vh / var(--sz)); }

/* ---------- CP10 embed (page.html?embed=1#act inside the home's reel): only the act's scene shows, on a transparent page ---------- */
html.embed, html.embed body { background: transparent !important; }
html.embed body.chapter::before, html.embed body.chapter::after { display: none; }
html.embed .mast, html.embed .cue, html.embed .rail, html.embed .foot, html.embed .skip, html.embed [data-confirm], html.embed .cscrim, html.embed .perf-hud { display: none !important; }
html.embed .copy { visibility: hidden; }   /* never display: none; phone scenes hang from the headline block's box */
html.snap *, html.snap *::before, html.snap *::after { transition: none !important; animation: none !important; }


/* ---------- CP10 the end page (R85 on): the Close words and buttons on the left, the Coming soon line under them, the next job's door on
   the right under the orb (the hero's shape); door.css styles the card, chapter.js gives it the home's behaviour ---------- */
.soon-line { margin: calc(48px * var(--k)) 0 0; width: min(calc(640px * var(--k)), 44vw); }
.soon-line .soon-chip { height: 24px; font-size: 13px; padding: 0 11px 0 9px; margin-right: 10px; vertical-align: 2px; }
.soon-items { font-size: 15px; line-height: 1.6; color: var(--t3); text-wrap: pretty; }
.soon-items > span { display: inline-block; white-space: nowrap; }   /* a title never breaks; the line wraps between titles */
.soon-items > span:not(:last-child) { margin-right: .5em; }
.soon-items > span:not(:last-child)::after { content: "\00B7"; margin-left: .5em; }   /* R97 A3: the dot ends its item, so no line starts with one */
.end-next { position: absolute; left: 72%; top: 50%; transform: translate(-50%, -50%); width: calc(292px * var(--k)); display: flex; flex-direction: column; }
.end-next .end-orb { display: none; }   /* R96 A2: no end-page orb at any size; the card and its label stand alone */
.end-next .end-demo { margin: 12px 0 0; white-space: nowrap; }
.phone .end-next { left: 20px; right: 20px; top: 84px; width: auto; transform: none; }
.phone .end-next .jx-pic { height: 96px; }
.phone .end-next .jx-rec { font-size: 15px; }
.phone .soon-line { width: auto; margin-top: 20px; }
.phone .soon-line .soon-chip { display: flex; width: max-content; margin: 0 0 8px; }
.phone .soon-items { display: block; font-size: 14px; line-height: 1.5; }
@media (max-height: 700px) { .phone .end-next .jx-pic { display: none; } }
/* phones and tablets: the footer lifts the whole stage, so the door steps out with the Close words (R12) rather than run off the top */
.end-next { transition: opacity .3s var(--ease); }
.phone body.foot-on .end-next { opacity: 0; }