/* ==========================================================================
   Editions anatomy — appends to base/hero/sections, does not replace them.
   Per chapter: full-bleed motion door (100svh, left-aligned H1)
   → black content column (2-col header / 16:9 stage / 3-col 4:3 cards /
   3-col itemised grid). Chrome: sticky nav + bottom pill naming the chapter.
   ========================================================================== */

/* ---------- hero index strip (chapter jump list, in flow at the foot of the hero) ---------- */
.hero-index{
  position:relative;z-index:4;
  width:min(760px,calc(100vw - 2*var(--edge)));
  margin:clamp(20px,3.4vh,40px) auto 0;
  display:grid;grid-template-columns:1.25fr .95fr .95fr .85fr;gap:clamp(14px,2.4vw,34px);
  align-items:start;opacity:0;transition:opacity .9s var(--ease) .2s;
  font-size:12.5px;line-height:1.45;
}
.hero-inner{opacity:1}
/* make room for the index strip inside the pinned hero */
.hero{padding-bottom:clamp(14px,2.2vh,26px)}
.hero .ring-stage{min-height:clamp(120px,22vh,260px)}
body.ready .hero-index{opacity:1}
@media(prefers-reduced-motion:reduce){.hero-index{opacity:1}}
.hero-index .hi-lead{margin:0;color:rgba(255,255,255,.72);max-width:22ch}
.hero-index ul{list-style:none;margin:0;padding:0;display:grid;gap:5px}
.hero-index a{
  color:rgba(255,255,255,.62);text-decoration:underline;text-underline-offset:2px;
  text-decoration-thickness:1px;text-decoration-color:rgba(255,255,255,.22);
  transition:color .25s,text-decoration-color .25s;
}
.hero-index a:hover,.hero-index a:focus-visible{color:#fff;text-decoration-color:#fff}
.hero-index ul li:first-child a{color:#fff;text-decoration-color:rgba(255,255,255,.55)}
@media(max-width:900px){
  .hero-index{grid-template-columns:1fr 1fr;gap:12px 22px;font-size:12px;margin-top:18px}
  .hero-index .hi-lead{grid-column:1/-1;max-width:34ch}
}
@media(max-width:560px){
  .hero-index{margin:22px auto 0;width:calc(100vw - 2*var(--edge));grid-template-columns:1fr 1fr}
}

/* ---------- chapter door: full-bleed motion hero ----------
   --door-h mirrors .chap-door's height so the arc and the copy clearance can be
   computed in real lengths (a percentage in padding resolves against WIDTH, not height). */
.chap{position:relative;z-index:1;--door-h:100svh;--arc:calc(var(--door-h) * .22);--door-floor:150px}
.chap-door{
  position:relative;height:var(--door-h);min-height:560px;display:grid;align-items:end;
  overflow:hidden;isolation:isolate;
  background:radial-gradient(120% 90% at 22% 8%,#191922 0%,#0b0b0e 58%,#090909 100%);
}
.chap-door .liquid{position:absolute;inset:-14%;z-index:0;opacity:.92}
.chap-door .liquid i{animation-duration:calc(var(--t,16s) * 1.35)}
.chap-door .liquid::after{
  background:radial-gradient(90% 70% at 30% 12%,rgba(255,255,255,.22),transparent 58%),
             linear-gradient(to top,rgba(9,9,9,.92) 4%,rgba(9,9,9,.35) 46%,transparent 78%);
  mix-blend-mode:normal;
}
/* concave horizon arc, as the reference uses between chapters */
.chap-door::after{
  content:"";position:absolute;left:-10%;right:-10%;bottom:-2px;height:var(--arc);
  background:#090909;border-radius:50% 50% 0 0/100% 100% 0 0;z-index:2;
}
.door-grain{
  position:absolute;inset:0;z-index:1;pointer-events:none;opacity:.5;
  background-image:radial-gradient(rgba(255,255,255,.16) .5px,transparent .6px);
  background-size:3px 3px;
}
/* scrim so the title always reads over the brightest part of the field */
.door-inner::before{
  content:"";position:absolute;left:calc(var(--edge) * -1);right:calc(var(--edge) * -1);
  bottom:-40px;top:-70px;z-index:-1;pointer-events:none;
  background:linear-gradient(to top,rgba(9,9,9,.86) 0%,rgba(9,9,9,.55) 46%,transparent 100%);
}
.door-inner{position:relative;z-index:3;padding-bottom:calc(var(--arc) + 3.5vh + 74px)}
.door-eyebrow{display:block;margin-bottom:14px;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:rgba(255,255,255,.78)}
.door-title{
  font-family:var(--display);font-weight:400;letter-spacing:-.055em;line-height:.88;
  font-size:clamp(56px,11.2vw,168px);margin:0;
}
.door-sub{margin:18px 0 0;font-size:clamp(17px,1.9vw,26px);line-height:1.2;letter-spacing:-.02em;color:rgba(255,255,255,.82);max-width:24ch}

/* ---------- chapter body ---------- */
.chap-body{background:#090909;position:relative;z-index:2;padding-block:clamp(56px,9vh,120px) clamp(72px,12vh,150px)}
.chan{width:100%;max-width:1120px;margin:0 auto;padding-inline:var(--edge);display:grid;gap:clamp(40px,6vw,80px)}

/* 2-column header: H2 left ~55%, body + link right ~35% */
.duo{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,.95fr);gap:clamp(20px,4vw,56px);align-items:start}
.duo-h{
  font-family:var(--display);font-weight:400;font-size:clamp(30px,4.1vw,52px);
  line-height:1.02;letter-spacing:-.045em;max-width:22ch;margin:0;text-wrap:balance;
}
.duo-side p{font-size:clamp(14px,1.15vw,16px);line-height:1.55;color:rgba(255,255,255,.72);max-width:44ch;margin:0}
.duo-link{display:inline-block;margin-top:16px;font-size:14px;color:#fff;border-bottom:1px solid rgba(255,255,255,.4);padding-bottom:2px}
.duo-link:hover{border-color:#fff}
@media(max-width:820px){.duo{grid-template-columns:1fr;gap:16px}}

/* 16:9 stage */
.stage{margin:0}
.stage-frame{
  position:relative;aspect-ratio:16/9;min-height:340px;border-radius:16px;overflow:hidden;
  display:grid;place-items:center;background:#101014;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}
.stage-bg{position:absolute;inset:0;z-index:0}
.stage-bg::after{background:linear-gradient(to top,rgba(9,9,9,.75),rgba(9,9,9,.15) 60%,transparent);mix-blend-mode:normal}
.stage-frame .phone{
  position:relative;z-index:1;width:min(300px,42%);max-height:86%;height:auto;min-height:0;
  background:#0d0d0e;border-radius:24px;
  box-shadow:0 0 0 1px rgba(255,255,255,.16) inset,0 50px 90px -50px rgba(0,0,0,.9);
}
.stage-cap{margin-top:14px;font-size:12.5px;color:rgba(255,255,255,.55);line-height:1.5}
@media(max-width:820px){
  .stage-frame{aspect-ratio:auto;min-height:0;padding:22px 0;border-radius:12px}
  .stage-frame .phone{width:min(300px,78%)}
}

/* 3-column 4:3 card grid */
.cardgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(10px,1.4vw,16px)}
.ecard{
  display:flex;flex-direction:column;gap:10px;min-width:0;
  background:#111114;border-radius:12px;padding:14px 14px 18px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.07);
}
.ecard-vis{
  position:relative;aspect-ratio:4/3;border-radius:8px;background:#0b0b0e;overflow:hidden;
  display:grid;place-items:center;box-shadow:inset 0 0 0 1px rgba(255,255,255,.05);
}
.ecard h4{font-weight:500;font-size:14.5px;line-height:1.25;letter-spacing:-.012em;margin:4px 0 0}
.ecard p{font-size:12.5px;line-height:1.5;color:rgba(255,255,255,.62);margin:0;max-width:46ch}
@media(max-width:820px){.cardgrid{grid-template-columns:1fr 1fr}}
@media(max-width:560px){.cardgrid{grid-template-columns:1fr}}

/* card visuals — CSS only, no image payload */
.ecard-vis .wv{display:inline-flex;gap:3px;align-items:center;height:56px}
.ecard-vis .wv i{width:3px;height:var(--h);border-radius:2px;background:rgba(255,255,255,.75)}
.ecard-vis .sl{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;width:62%;font-size:9px;color:rgba(255,255,255,.5)}
.ecard-vis .sl i{aspect-ratio:4/5;border-radius:3px;background:rgba(255,255,255,.1);display:grid;place-items:center;font-style:normal}
.ecard-vis .sl i:first-child{background:rgba(255,255,255,.9);color:#090909}
.ecard-vis .tl{position:relative;display:block;width:70%;height:34px;border-radius:4px;background:rgba(255,255,255,.08)}
.ecard-vis .tl i{position:absolute;top:0;bottom:0;border-radius:4px;background:rgba(255,255,255,.8)}
.ecard-vis .rings,.ecard-vis .ring-ico{position:relative;width:52px;height:52px;border-radius:50%;background:rgba(255,255,255,.1);display:grid;place-items:center;font-size:11px;color:rgba(255,255,255,.65)}
.ecard-vis .ring-ico::before{content:"";position:absolute;inset:-8px;border-radius:50%;border:1px solid rgba(255,255,255,.16);animation:pulse-ring 3.4s ease-out infinite}
@keyframes pulse-ring{0%{transform:scale(.9);opacity:.9}70%{transform:scale(1.35);opacity:0}100%{opacity:0}}
.ecard-vis .ring-ico b{font-weight:400;color:#fff}
.ecard-vis .rows{display:grid;gap:7px;width:76%;font-size:10.5px}
.ecard-vis .rows i{display:flex;justify-content:space-between;gap:10px;padding-bottom:6px;border-bottom:1px solid rgba(255,255,255,.1);font-style:normal;color:rgba(255,255,255,.6)}
.ecard-vis .rows i:last-child{border:0;padding:0}
.ecard-vis .rows b{font-weight:400;color:rgba(255,255,255,.86)}
.ecard-vis .bars{display:grid;gap:9px;width:72%}
.ecard-vis .bars i{height:5px;border-radius:3px;background:rgba(255,255,255,.72);width:var(--w)}
.ecard-vis .stars{font-size:15px;letter-spacing:.16em;color:rgba(255,255,255,.9)}
.ecard-vis .rep{display:flex;align-items:flex-end;gap:5px;height:52%;width:68%}
.ecard-vis .rep i{flex:1;height:var(--h);border-radius:2px 2px 0 0;background:rgba(255,255,255,.55)}

/* 3-column itemised grid — plain text, no pills */
.itemgrid{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
  gap:0 clamp(20px,3vw,44px);
  border-top:1px solid rgba(255,255,255,.14);
}
.itemgrid span{
  display:block;padding:15px 0;font-size:13px;line-height:1.4;color:rgba(255,255,255,.8);
  border-bottom:1px solid rgba(255,255,255,.08);
}
@media(max-width:820px){.itemgrid{grid-template-columns:1fr 1fr;font-size:12.5px}}
@media(max-width:560px){.itemgrid{grid-template-columns:1fr}}

/* ---------- bottom pill: names the chapter you are in ---------- */
.pill{opacity:1}
.pill:not(.show){transform:translate(-50%,180%)}
.pill-btn span{overflow:hidden;text-overflow:ellipsis;max-width:126px;text-align:left}
#pillLabel{display:block}
@media(max-width:560px){
  .pill{left:12px;right:12px;transform:none;justify-content:space-between;width:auto}
  .pill.show{transform:none}
  .pill:not(.show){transform:translateY(180%)}
  .pill-box{flex:1;min-width:0}
  /* header already carries the CTA on phones — one button, not two */
  .pill-cta{display:none}
  /* scrim so content never slices through under the floating pill */
  body::after{
    content:"";position:fixed;left:0;right:0;bottom:0;height:104px;z-index:99;pointer-events:none;
    background:linear-gradient(to top,#090909 22%,rgba(9,9,9,.86) 52%,rgba(9,9,9,0) 100%);
  }
}

/* ---------- section rhythm touch-ups for the light panel ---------- */
#how{border-radius:24px}
#how .sec-head .row{display:block}
#result{padding-block:clamp(56px,10vh,120px)}
#result h2{max-width:26ch;letter-spacing:-.04em}

/* reduced motion: no parallax-ish drift on doors */
/* nav needs a scrim over bright fields */
.nav::before{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(to bottom,rgba(9,9,9,.55),rgba(9,9,9,.18) 60%,transparent);
}
.nav .brand,.nav .nav-btn{text-shadow:0 1px 10px rgba(0,0,0,.45)}
@media(prefers-reduced-motion:reduce){
  .chap-door .liquid i{animation:none}
  .ecard-vis .ring-ico::before{animation:none}
}

/* ==========================================================================
   QA pass (2026-11-13) — measured fixes only, no layout or colour redesign
   ========================================================================== */
/* (door copy vs arc clearance is handled by --arc on .chap / .door-inner above) */
/* 12px eyebrow measured 3.9-4.1:1 over the bright field at .78 alpha */
.door-eyebrow{color:#fff}
/* nav links measured 1.5-4.3:1 over the bright hero. Scrim now feathers over
   ~90px instead of ending in a hard line just below the bar. */
.nav::before{
  inset:-1px 0 -92px;
  background:linear-gradient(to bottom,
    rgba(9,9,9,.80) 0,
    rgba(9,9,9,.74) 34px,
    rgba(9,9,9,.58) 42%,
    rgba(9,9,9,.34) 68%,
    rgba(9,9,9,.14) 86%,
    transparent 100%);
}
/* stacked hero: the kicker sits above the hero's own bottom gradient (measured 2.9:1) */
@media(max-width:900px){
  .hero-inner::before{
    content:"";position:absolute;inset:-64px 0 0;z-index:-1;pointer-events:none;
    background:linear-gradient(to bottom,transparent 0,rgba(9,9,9,.46) 64px,rgba(9,9,9,.46) 45%,transparent 100%);
  }
}
/* .pill.show was inheriting the old demo rule .show{padding-bottom:40px}: 40px dead click strip, pill 56px up */
.pill.show{padding-bottom:0}
/* a hidden pill must not take keyboard focus off-screen: editions.js keeps it inert while hidden.
   If focus does land inside it (Tab from the header), it slides into view instead of staying off-screen. */
.pill:not(.show){pointer-events:none}
.pill:not(.show):focus-within{transform:translate(-50%,0);pointer-events:auto}
@media(max-width:560px){ .pill:not(.show):focus-within{transform:none} }
.pill-list a:focus-visible{color:#090909}
/* composer: the textarea has outline:none, so make the field's own focus ring unmistakable */
.composer:focus-within{box-shadow:0 0 0 2px #fff inset,0 0 0 3px rgba(211,191,230,.55)}
/* keep some scrim behind the eyebrow at the top of the door copy (worst pixel measured 4.4:1) */
.door-inner::before{background:linear-gradient(to top,rgba(9,9,9,.86) 0%,rgba(9,9,9,.58) 50%,rgba(9,9,9,.32) 84%,transparent 100%)}

/* short viewports: the door grows with its copy instead of clipping it.
   --door-h drives the arc, and the copy clearance is derived from it. */
@media (max-height:720px){
  .chap{--door-h:max(640px,100svh);--arc:calc(640px * .16)}
  .chap-door{padding-top:56px}
  .door-title{font-size:clamp(48px,8.5vw,110px)}
}

/* reduced motion: final safety block */
@media (prefers-reduced-motion:reduce){ .hero-index{opacity:1!important} .chap-door .liquid i{animation:none!important} .ecard-vis .ring-ico::before{animation:none!important} .pill{transition:none} }

/* build 1114c — 2026-11-14 */
