/* The story page (5b "notes in the margins"): a sticky stage with the app window, chapters
   scrolling over it with notes in the margins, the finale, then the rest of the site. */
body{transition:background-color var(--story-motion-theme),color var(--story-motion-theme)}
.story-site{background:var(--bg);color:var(--text);font-family:var(--font-sans)}

/* Stage */
.scene{position:relative}
/* Without scripts the stage shows the hero's window below the hero text (scripts size it to the screen). */
.stage{--scale:.57;--stage-shift:translateY(240px);position:sticky;top:var(--story-header-height);height:calc(100vh - var(--story-header-height));overflow:hidden;z-index:1;display:flex;align-items:center;justify-content:center;perspective:2200px;perspective-origin:50% 40%}
.stage-in{transform-style:preserve-3d;display:flex;align-items:center;justify-content:center}
.stage .aw-stack{flex:none}
.lead{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:6;opacity:0;transition:opacity var(--story-motion-lead)}
.lead rect,.lead path{fill:none;stroke:var(--eyebrow)}
.lead rect{stroke-width:2}.lead path{stroke-width:1.5}
.lead .lead-a{fill:var(--eyebrow)}
.lead .lead-t{fill:var(--bg);stroke:var(--eyebrow);stroke-width:2}

/* Chapters */
.flow{position:relative;z-index:2;margin-top:calc(-100vh + var(--story-header-height));pointer-events:none}
.mn{min-height:calc(100vh - var(--story-header-height));display:flex;align-items:center;padding:40px var(--story-gutter)}
.mn .tx{pointer-events:auto;width:var(--gut,280px);display:flex;flex-direction:column;gap:var(--story-note-gap)}
.mn.R{justify-content:flex-end}
.mn.top{align-items:flex-start;justify-content:center;text-align:center;padding-top:7vh}
.mn.top .tx{width:min(var(--story-hero-max),92%);align-items:center}
.kick2{font-family:var(--font-mono);font-size:var(--story-kicker-size);color:var(--eyebrow)}
.h1{margin:0;font-size:var(--story-h1-size);line-height:var(--story-h1-leading);letter-spacing:var(--story-h1-tracking);font-weight:var(--story-weight-display)}
.h2{margin:0;font-size:var(--story-title-size);line-height:var(--story-title-leading);letter-spacing:var(--story-title-tracking);font-weight:var(--story-weight-display);scroll-margin-top:var(--story-header-height)}
.h1 em,.h2 em,.t-h em{font-style:normal;color:var(--eyebrow)}
.h1:focus{outline:none}
.body{margin:0;font-size:var(--story-body-size);line-height:var(--story-body-leading);color:var(--text-2);max-width:500px}
.mn.top .body{font-size:var(--story-hero-body-size);max-width:660px}
.pts{list-style:none;margin:4px 0 0;padding:0;display:flex;flex-direction:column;gap:8px}
.pts li{display:flex;gap:10px;font-size:var(--story-point-size);color:var(--text-2);line-height:1.45}
.pts li::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--amber);margin-top:8px;flex:none}
.tease{margin:14px 0 0;font-family:var(--font-mono);font-size:var(--story-tease-size);color:var(--eyebrow)}
.try{margin:0;display:flex;align-items:center;gap:10px;font-size:14px;color:var(--text)}
.try i{width:22px;height:22px;border-radius:50%;background:color-mix(in srgb,var(--amber) 22%,transparent);display:flex;align-items:center;justify-content:center;color:var(--eyebrow);flex:none}
.cta{display:flex;gap:12px;flex-wrap:wrap;align-items:center;justify-content:center;margin-top:6px}
:is(.tier a,.cards a,.t-row a):focus-visible{outline:2px solid var(--ring);outline-offset:3px}
.tiers{display:flex;flex-direction:column;gap:8px}
.tier{border:1px solid var(--line);border-radius:var(--story-radius-card);padding:12px 14px;background:var(--surface);display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-2)}
.tier.free{border-color:var(--amber)}
.tier b{font-size:15px;color:var(--text)}
.tier .mono{font-size:12px;color:var(--eyebrow)}

/* The theme picker a chapter can offer */
.pick{width:100%;max-width:640px}
.pick .tcards{grid-template-columns:repeat(auto-fill,minmax(112px,1fr));text-align:left}

/* Finale */
.fin{border-top:1px solid var(--line);padding:120px var(--story-gutter) 110px;background:var(--bg);position:relative;z-index:3}
.fin-in{max-width:var(--story-content-max);margin:0 auto;display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:56px;align-items:center}
.fin-l{display:flex;flex-direction:column;gap:18px}
.t-h{margin:0;font-size:var(--story-section-size);line-height:.98;letter-spacing:-.05em;font-weight:var(--story-weight-display);max-width:900px}
.fin .t-h{font-size:var(--story-finale-size)}
.t-p{margin:0;font-size:18px;line-height:1.55;color:var(--text-2);max-width:640px}
.tw{border-radius:var(--story-radius-window);border:1px solid var(--line);background:var(--field);box-shadow:0 40px 90px var(--story-shadow-soft);overflow:hidden}
.tw-h{height:38px;display:flex;align-items:center;gap:14px;padding:0 14px;border-bottom:1px solid var(--line);background:var(--surface);font-family:var(--font-mono);font-size:12.5px;color:var(--muted)}
.tw-h .ttl{margin:0 auto;transform:translateX(-26px)}
.tw-b{padding:22px 22px 26px;font-family:var(--font-term);font-size:15px;line-height:1.6;color:var(--text);word-break:break-all}
.tw-b code{font:inherit}
.tw-b .pr{color:var(--prompt);margin-right:10px;word-break:normal}
.tw-b .tcur{margin-left:4px}
.tw-f{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px 12px 22px;border-top:1px solid var(--line);background:var(--surface)}
.steps{list-style:none;margin:64px auto 0;padding:0;max-width:var(--story-content-max);display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.steps li{border-top:2px solid var(--amber);padding-top:16px;display:flex;flex-direction:column;gap:8px;font-size:15.5px;line-height:1.5;color:var(--text-2)}
.steps b{font-size:19px;color:var(--text);letter-spacing:-.01em}
.steps .mono{font-size:12.5px;color:var(--eyebrow)}
.again{max-width:var(--story-content-max);margin:44px auto 0;font-size:15px;color:var(--muted)}
.again b{color:var(--text);font-weight:600}

/* The rest of the site */
.tail{border-top:1px solid var(--line);padding:110px var(--story-gutter)}
.tail-in{max-width:var(--story-content-max);margin:0 auto;display:flex;flex-direction:column;gap:22px}
.kick{color:var(--eyebrow);font-size:14px}
.plans{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:18px}
.plan{border:1px solid var(--line);border-radius:var(--story-radius-plan);padding:28px;background:var(--surface);display:flex;flex-direction:column;gap:12px}
.plan[data-free="true"]{border-color:var(--amber);box-shadow:0 0 0 1px var(--amber)}
.plan h3{margin:0;font-size:24px;letter-spacing:-.02em}
.plan .lbl{font-family:var(--font-mono);font-size:13px;color:var(--eyebrow)}
.price{font-size:44px;font-weight:var(--story-weight-display);letter-spacing:-.04em}
.price small{font-size:15px;font-weight:500;color:var(--muted);letter-spacing:0}
.plan ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:9px;flex:1}
.plan li{display:flex;gap:10px;font-size:15px;color:var(--text-2);line-height:1.4}
.plan li::before{content:'';flex:none;width:10px;height:6px;margin:5px 2px 0;border-left:2px solid var(--t-green);border-bottom:2px solid var(--t-green);transform:rotate(-45deg)}
.t-row{display:flex;justify-content:space-between;align-items:baseline;gap:16px;flex-wrap:wrap}
.t-row a{font-family:var(--font-mono);font-size:14px;text-decoration:none;color:var(--text-2)}
.t-h2{margin:0;font-size:var(--story-section-small);letter-spacing:-.04em;font-weight:var(--story-weight-display)}
.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.cards a{display:flex;flex-direction:column;gap:12px;text-decoration:none;border-radius:16px}
.cov{height:170px;border-radius:14px;background:var(--surface);border:1px solid var(--line);display:flex;align-items:center;justify-content:center;font-family:var(--font-term);font-size:26px;color:var(--text)}
.cards .cat{font-family:var(--font-mono);font-size:12.5px;color:var(--muted)}
.cards strong{font-size:18px;line-height:1.3;letter-spacing:-.01em}

/* Narrow screens: the stage is the top 46% of the screen and the notes scroll under it. */
@media(max-width:899px){
  /* ...so keyboard focus and in-page links stop below the stage too. */
  html[data-js]:has([data-stage]):not(:has([data-stage] :focus)){scroll-padding-top:calc(var(--story-header-height) + 46vh + 16px)}
  .stage{--scale:.3;--stage-shift:translateY(0);height:46vh;border-bottom:1px solid var(--line);background:var(--bg);z-index:3}
  .lead{display:none}
  .flow{margin-top:0}
  .mn,.mn.top{min-height:66vh;padding:32px var(--story-gutter-narrow);align-items:center;justify-content:flex-start;text-align:left}
  .mn .tx,.mn.top .tx{width:100%;align-items:stretch}
  .cta{justify-content:flex-start}
  .fin{padding:72px var(--story-gutter-narrow)}
  .fin-in,.steps{grid-template-columns:1fr;gap:28px}
  .tail{padding:72px var(--story-gutter-narrow)}
  .plans,.cards{grid-template-columns:minmax(0,1fr)}
}

/* Without scripts the window can't follow the chapters, so at every width the page stacks as on
   narrow screens: the first chapter's window, then the notes, with nothing overlapping. */
:root:not([data-js]) .stage{position:relative;top:auto;height:calc(660px * var(--scale) + 48px);--stage-shift:translateY(0)}
:root:not([data-js]) .flow{margin-top:0}
:root:not([data-js]) .mn{min-height:0;padding-block:48px;justify-content:center}
:root:not([data-js]) .mn .tx{width:min(640px,100%)}
/* The whole window fits the narrowest phones (at .3 it is wider than 380px once tilted). */
@media(max-width:380px){:root:not([data-js]) .stage{--scale:.24}}
