/* The home page: a text rail on paper, and the tray (a dark stage) held in place beside it. */

.story {
  display: grid; grid-template-columns: minmax(320px, 0.74fr) 1.26fr; gap: 0 3.4vw;
  padding: 0 var(--gutter); position: relative;
}
.stage-wrap { grid-column: 2; grid-row: 1; position: relative; }
.stage {
  position: sticky; top: 72px; height: calc(100svh - 96px); min-height: 460px;
  background: var(--tray); border-radius: var(--radius); overflow: hidden; color: var(--bone);
  touch-action: pan-y;
}
#gl { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.mark { position: absolute; font-size: 13px; line-height: 1; opacity: 0.5; z-index: 2; color: var(--bone); }
.mark.tl { top: 12px; left: 14px; } .mark.tr { top: 12px; right: 14px; }
.mark.bl { bottom: 12px; left: 14px; } .mark.br { bottom: 12px; right: 14px; }
.stage-label { position: absolute; z-index: 2; font-size: 10px; color: var(--bone); background: oklch(14.5% 0.01 255 / 0.78); padding: 4px 7px; border-radius: 6px; }
.stage-label.tl { top: 9px; left: 32px; }
.stage-label.br { bottom: 9px; right: 32px; text-align: right; }
.stage-note { position: absolute; inset: auto 24px 48px 24px; max-width: 46ch; font-size: 14px; color: var(--bone); opacity: 0.85; }

/* Hover chip for a single print */
.chip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 280px; padding: 12px 14px 11px;
  background: var(--bone); color: var(--ink); border-radius: 12px; box-shadow: 0 10px 30px -12px oklch(0% 0 0 / 0.6);
  transform: translate(14px, 14px);
}
.chip-t { font-size: 14px; font-weight: 500; line-height: 1.25; margin-bottom: 6px; }
.chip-m { font-size: 10px; color: var(--ink-2); line-height: 1.5; }

/* The rail: each chapter is tall, and its text holds still while the tray moves */
.rail { grid-column: 1; grid-row: 1; }
.ch { min-height: 170vh; position: relative; }
.ch-hero { min-height: 150vh; }
.ch-in { position: sticky; top: 16vh; padding: 4vh 0 8vh; max-width: 460px; }
.ch-hero .ch-in { top: 12vh; padding-top: 10vh; }
.ch h2 { font-size: clamp(30px, 3.1vw, 46px); font-weight: 400; line-height: 1.04; letter-spacing: -0.028em; margin-bottom: 22px; text-wrap: balance; }
.ch p { margin-bottom: 14px; color: var(--ink); }
.ch .display { font-size: clamp(52px, 5.5vw, 96px); margin: 6px 0 26px; margin-left: -0.04em; white-space: nowrap; }
.ch-hero .ch-in { max-width: 560px; }
.statement { font-size: clamp(20px, 1.9vw, 26px); line-height: 1.3; letter-spacing: -0.015em; max-width: 24ch; }
.hint { color: var(--ink-2) !important; font-size: 15px; max-width: 38ch; margin-top: 26px; }
.scroll-cue { color: var(--ink-2); margin-top: 7vh; display: flex; gap: 10px; align-items: center; }
.scroll-cue::before { content: ""; width: 26px; height: 1px; background: var(--ink); animation: cue 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite; transform-origin: left; }
@keyframes cue { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }
.aside { color: var(--ink-2) !important; line-height: 1.6 !important; font-size: 10.5px !important; margin-top: 18px; }

.stats { margin: 22px 0; border-top: 1px solid var(--line); }
.stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stats dt { color: var(--ink-2); font-size: 15px; }
.stats dd { font-size: 30px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

.cases { list-style: none; margin: 20px 0; border-top: 1px solid var(--line); }
.cases li { display: grid; gap: 2px; padding: 11px 0 11px 22px; border-bottom: 1px solid var(--line); position: relative; cursor: default; transition: padding 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.cases li::before { content: ""; position: absolute; left: 0; top: 17px; width: 10px; height: 10px; border: 1.5px solid var(--grease); border-radius: 50%; }
.cases li:hover, .cases li.on { padding-left: 28px; }
.cases b { font-weight: 500; }
.cases span { color: var(--ink-2); font-size: 14px; }

.ch-find .search { margin: 26px 0 28px; }
.ch-find input { width: 100%; font: inherit; font-size: 24px; letter-spacing: -0.01em; color: var(--ink); background: transparent; border: 0; border-bottom: 1.5px solid var(--ink); padding: 8px 0; border-radius: 0; }
.ch-find input::-webkit-search-cancel-button { display: none; }
.ch-find input:focus { outline: none; border-bottom-color: var(--grease); }
.ch-find label { display: block; color: var(--ink-2); margin-bottom: 8px; }
.results { list-style: none; margin-top: 6px; }
.results li a { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.results li a:hover, .results li a:focus { color: var(--grease); outline: none; }
.results .m { font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.results .fine { font-size: 13px; color: var(--ink-2); padding: 10px 0; }

/* Overlay drawing (SVG over the tray) */
#overlay .axis { stroke: var(--bone); stroke-opacity: 0.3; stroke-width: 1; }
#overlay .grid { stroke: var(--bone); stroke-opacity: 0.08; stroke-width: 1; }
#overlay .zero { stroke: var(--bone); stroke-opacity: 0.45; stroke-dasharray: 2 4; }
#overlay text { font-family: var(--mono); font-size: 10.5px; fill: var(--bone); fill-opacity: 0.82; letter-spacing: 0.03em; text-transform: uppercase; }
/* a thin tray-colored outline keeps labels readable where they cross white prints */
#overlay text { paint-order: stroke; stroke: var(--tray); stroke-width: 3px; stroke-linejoin: round; }
#overlay text.cut-t { stroke-width: 3px; }
#overlay text.ttl { font-family: var(--sans); font-size: 21px; font-weight: 500; letter-spacing: -0.015em; text-transform: none; fill-opacity: 1; }
#overlay text.axl { font-size: 12.5px; font-weight: 500; letter-spacing: 0.05em; fill-opacity: 1; }
@media (max-width: 900px) {
  #overlay text.ttl { font-size: 15px; }
  #overlay text.axl { font-size: 10px; }
}
#overlay text.big { font-family: var(--sans); font-size: 13px; text-transform: none; letter-spacing: 0; fill-opacity: 0.95; }
#overlay .fit { stroke: var(--grease); stroke-width: 2.2; fill: none; stroke-linecap: round; }
#overlay .ring { stroke: var(--grease); stroke-width: 1.8; fill: none; }
#overlay .line-top { stroke: var(--bone); stroke-width: 2; fill: none; }
#overlay .line-bot { stroke: var(--bone); stroke-opacity: 0.55; stroke-width: 2; stroke-dasharray: 5 5; fill: none; }
#overlay .cut { stroke: var(--grease); stroke-dasharray: 3 5; stroke-width: 1.2; }
#overlay .cut-t { fill: var(--grease); fill-opacity: 1; }
#overlay .dot-top { fill: var(--bone); }
#overlay .dot-bot { fill: var(--tray); stroke: var(--bone); stroke-width: 1.5; }

/* After the story */
.after { padding: 18vh var(--gutter) 0; }
.after-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 9vh; }
.annotation { max-width: 30ch; color: var(--ink-2); line-height: 1.6; text-align: right; }
.checks { list-style: none; display: grid; grid-template-columns: 1.15fr 1fr; gap: 0 5vw; }
.checks li { padding: 30px 0 34px; border-top: 1px solid var(--line); position: relative; }
.checks li:nth-child(2) { margin-top: 12vh; }
.checks li:nth-child(4) { margin-top: 12vh; }
.checks .idx { color: var(--grease); }
.checks h3 { font-size: clamp(22px, 2vw, 28px); font-weight: 400; letter-spacing: -0.02em; margin: 12px 0 10px; }
.checks p { color: var(--ink-2); max-width: 46ch; }

.limits { margin: 16vh 0 0; max-width: 820px; }
.limits ul { list-style: none; }
.limits li { padding: 16px 0; border-bottom: 1px solid var(--line); font-size: clamp(17px, 1.4vw, 20px); line-height: 1.45; }
.limits b { font-weight: 500; }

.paper-cta { margin-top: 16vh; background: var(--tray); color: var(--bone); border-radius: var(--radius); padding: clamp(28px, 5vw, 64px); display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: end; position: relative; }
.paper-cta .kicker { color: oklch(93% 0.014 85 / 0.7); }
.paper-cta .big { font-size: clamp(24px, 2.6vw, 38px); line-height: 1.15; letter-spacing: -0.02em; max-width: 26ch; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.paper-cta .pill { background: var(--bone); color: var(--ink); }
.paper-cta .pill.ghost { background: transparent; color: var(--bone); box-shadow: inset 0 0 0 1px var(--line-dark); }
.byline { margin-top: 14vh; max-width: 640px; }
.byline p:not(.kicker) { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.45; }

.split-line { overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }

/* No WebGL: the tray says so, the story still reads */
html.no-webgl .stage-label.br { display: none; }

@media (max-width: 900px) {
  .story { display: block; padding: 0; }
  .stage-wrap { position: sticky; top: 0; z-index: 3; height: 0; }
  .stage { position: relative; top: 0; height: 54svh; min-height: 320px; border-radius: 0 0 var(--radius) var(--radius); }
  .rail { position: relative; z-index: 2; padding: calc(54svh + 16px) var(--gutter) 0; }
  .ch { min-height: 150vh; }
  /* the text holds still in the lower half while the tray above it changes */
  .ch-in { position: sticky; top: calc(54svh + 14px); padding: 2vh 0 4vh; background: var(--paper); }
  .ch-in p, .ch-in li, .stats dt { font-size: 15px; }
  .ch h2 { font-size: 27px; margin-bottom: 12px; }
  .ch-hero .ch-in { position: relative; top: 0; padding-top: 2vh; }
  .ch .display { font-size: clamp(52px, 15vw, 88px); }
  .bar { position: relative; }
  .checks { grid-template-columns: 1fr; }
  .checks li:nth-child(n) { margin-top: 0; }
  .after-head { flex-direction: column; align-items: flex-start; }
  .annotation { text-align: left; }
  .paper-cta { grid-template-columns: 1fr; }
  .cta-row { justify-content: flex-start; }
  .stage-label.br { display: none; }
}
