/* Landing page. The hero and the 3D stage are pinned like a video frame; scrolling plays
   the story on top of them (js/story.js). */

:root {
  --paper: #f5f2ec;
  --ink: #0d0d0c;
  --muted: #57534c;
  --gutter: clamp(20px, 5vw, 104px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

/* The page scrolls (that is how the story plays), but without a visible scrollbar. */
html {
  background: var(--paper);
  scrollbar-width: none;
}

html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  overscroll-behavior: none;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* A whisper of paper grain over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--ink); color: var(--paper); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Layout: objects on the left, words on the right. */
.hero {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100lvh;              /* stable while a phone's toolbar shows and hides */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "copy";
  align-items: center;
  padding: 0 var(--gutter);
}

/* The stage spans the page behind the words, so objects are never clipped by a column.
   landing.js sets --region-* to the area the objects occupy. */
.stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  outline: none;
  cursor: grab;
  touch-action: pan-y;         /* sideways drags turn the objects, vertical swipes scroll */
  user-select: none;
  -webkit-user-select: none;
}

.stage.is-dragging { cursor: grabbing; }

/* Once the story plays, the stage is only a picture: scrolling works everywhere. */
.stage.is-story { pointer-events: none; cursor: auto; }

.stage:focus-visible::after {
  content: "";
  position: absolute;
  left: calc(var(--region-x, 0px) + clamp(10px, 2vw, 24px));
  top: calc(var(--region-y, 0px) + clamp(10px, 2vw, 24px));
  width: calc(var(--region-w, 100%) - 2 * clamp(10px, 2vw, 24px));
  height: calc(var(--region-h, 100%) - 2 * clamp(10px, 2vw, 24px));
  border: 1.5px solid var(--ink);
  border-radius: 28px;
  opacity: .55;
  pointer-events: none;
}

.stage-light, .shadows, .stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stage-light {
  left: calc(var(--region-x, 0px) - var(--region-w, 100vw) * .15);
  top: calc(var(--region-y, 0px) - var(--region-h, 100vh) * .15);
  width: calc(var(--region-w, 100vw) * 1.3);
  height: calc(var(--region-h, 100vh) * 1.3);
  background: radial-gradient(closest-side, rgba(255, 254, 250, .9), rgba(255, 254, 250, .38) 48%, rgba(255, 254, 250, 0));
}

.shadows i {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(36, 30, 22, .3), rgba(36, 30, 22, .1) 55%, rgba(36, 30, 22, 0));
  opacity: 0;
  transform-origin: 50% 50%;
}

.stage canvas { display: block; }

/* Words. */
.copy {
  grid-area: copy;
  position: relative;
  z-index: 2;
  justify-self: center;
  text-align: center;
  padding-bottom: 1.5vh;
}

#headline, .headline-slot {
  margin: 0;
  width: max-content;
  text-align: center;
  font-weight: 800;
  font-size: clamp(42px, min(5.5vw, 10.6vh), 132px);
  line-height: .94;
  letter-spacing: -.042em;
  word-spacing: .06em;
}

.headline-slot { visibility: hidden; }

.line { display: block; white-space: nowrap; }

.word { display: inline-block; transform-origin: 50% 82%; }

#subline {
  margin: clamp(16px, 3.1vh, 36px) auto 0;
  text-align: center;
  font-weight: 400;
  font-size: clamp(16px, min(1.75vw, 3.2vh), 30px);
  line-height: 1.35;
  letter-spacing: -.012em;
  color: var(--muted);
}

.dots span { display: inline-block; }

/* Opening: the headline starts centered and full screen, everything else waits. */
html[data-intro] #headline:not([data-docked]) {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6;
  transform-origin: 0 0;
  opacity: 0;
}

html[data-intro] #subline,
html[data-intro] .stage-light { opacity: 0; }

/* ---------- Every day: three taps under the landing page (js/taps.js) ----------
   Three panels side by side, split by hairlines. One canvas lies under the row and
   taps.js draws each panel's scene into that panel's .tap-view box.
   The landing page is pinned, so this section starts one screen down and slides up
   over it like a sheet of paper. It is at least a screen tall, so it covers the landing
   page completely before the story (which starts where this section ends) begins. */
.taps {
  position: relative;
  z-index: 5;
  margin-top: 100vh;
  margin-top: 100lvh;
  min-height: 100vh;
  min-height: 100lvh;
  background: var(--paper);
  box-shadow: 0 -48px 80px rgba(245, 242, 236, .92), 0 48px 80px rgba(245, 242, 236, .92);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(28px, 5.5vh, 72px);
  padding: clamp(72px, 12vh, 150px) var(--gutter);
}

.taps-title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(34px, min(4.6vw, 8vh), 80px);
  line-height: .98;
  letter-spacing: -.042em;
  text-align: center;
  text-wrap: balance;
}

.taps-row {
  position: relative;
  width: 100%;
  max-width: 1480px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.taps-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s cubic-bezier(.16, 1, .3, 1);
}
.taps.is-ready .taps-canvas { opacity: 1; }

.tap {
  position: relative;
  margin: 0;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 14px;
  padding: 0 clamp(6px, 1.2vw, 20px);
}

/* The hairlines between the panels, as in the sketch. */
.tap + .tap::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6%;
  bottom: 6%;
  width: 1px;
  background: linear-gradient(rgba(13, 13, 12, 0), rgba(13, 13, 12, .14) 22%, rgba(13, 13, 12, .14) 78%, rgba(13, 13, 12, 0));
}

.tap-view {
  width: 100%;
  height: clamp(300px, 54vh, 600px);
}

.tap-say {
  margin: 0;
  font-weight: 600;
  font-size: clamp(17px, 1.45vw, 23px);
  line-height: 1.25;
  letter-spacing: -.015em;
  text-align: center;
  color: var(--muted);
  opacity: .62;
  transition: color .6s ease, opacity .6s ease;
}
.tap-say b { font-weight: 800; color: var(--ink); }
.tap.is-on .tap-say { color: var(--ink); opacity: 1; }

/* Fills while its panel plays, and empties when the three reset. */
.tap-bar {
  width: min(140px, 46%);
  height: 2px;
  border-radius: 2px;
  background: rgba(13, 13, 12, .1);
  overflow: hidden;
}
.tap-bar i {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.taps-pause {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px 0 16px;
  border: 1px solid rgba(13, 13, 12, .18);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease, background-color .25s ease;
}
.taps-pause:hover { color: var(--ink); border-color: var(--ink); }
.taps-pause:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.taps-pause[hidden] { display: none; }

/* Pause: two bars. Play: a triangle. */
.taps-pause i { position: relative; width: 10px; height: 11px; }
.taps-pause i::before, .taps-pause i::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3px;
  height: 11px;
  border-radius: 1px;
  background: currentColor;
}
.taps-pause i::before { left: 1px; }
.taps-pause i::after { right: 1px; }
.taps-pause[aria-pressed="true"] i::before {
  left: 1px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5.5px 0 5.5px 9px;
  border-color: transparent transparent transparent currentColor;
  border-radius: 0;
  background: none;
}
.taps-pause[aria-pressed="true"] i::after { display: none; }

/* Reduced motion: every panel shows its finished scene and stays still. */
.taps.is-still .tap-say { color: var(--ink); opacity: 1; }
.taps.is-still .tap-bar { visibility: hidden; }

/* Without 3D the words stand on their own. */
.taps.is-static .tap-view { height: clamp(40px, 8vh, 80px); }
.taps.is-static .tap-bar { visibility: hidden; }

@media (max-width: 760px) {
  .taps { gap: 28px; }
  .taps-row { grid-template-columns: minmax(0, 1fr); row-gap: 44px; }
  .tap { padding: 0; }
  .tap + .tap { padding-top: 44px; }
  .tap + .tap::before {
    left: 12%;
    right: 12%;
    top: 0;
    bottom: auto;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(13, 13, 12, 0), rgba(13, 13, 12, .14) 22%, rgba(13, 13, 12, .14) 78%, rgba(13, 13, 12, 0));
  }
  .tap-view { height: min(92vw, 56svh); }
  .tap-say { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .taps-canvas, .tap-say { transition: none; }
}

/* ---------- What RFID is: the card intro after the taps (js/intro/) ----------
   A tall section with a sticky stage inside: the stage stays on screen while the page
   scrolls past, and the scroll plays the card's story. Every rule starts with .intro so
   nothing here reaches the landing page or the story. */
.intro {
  --brass: #80623d;
  --night: #111111;
  --light: #fafaf8;
  /* Instrument Serif: a tall, narrow display serif with a real italic (for "work"). */
  --display: "Instrument Serif", Georgia, serif;
  position: relative;
  z-index: 5;
  background: var(--paper);
  color: var(--ink);
  /* The same soft paper edge as the taps: the landing page fades in under it as it leaves. */
  box-shadow: 0 48px 80px rgba(245, 242, 236, .92);
}

.intro [hidden] { display: none !important; }
.intro ::selection { color: #fff; background: var(--brass); }
.intro :focus-visible { outline: 3px solid var(--brass); outline-offset: 5px; }
.intro button { font: inherit; }

.intro .skip-link {
  position: fixed;
  z-index: 10;
  top: 1rem;
  left: 1rem;
  padding: .8rem 1rem;
  border-radius: 4px;
  color: var(--light);
  background: var(--night);
  translate: 0 -180%;
}

.intro .skip-link:focus { translate: 0; }

.intro-stage {
  --gutter: clamp(1.5rem, 6.7vw, 7rem);
  position: relative;
  margin-inline: auto;
  padding: 2.5rem var(--gutter);
}

.intro-stage :where(h1, h2, p) { margin: 0; }
.intro .story-title { font: 400 clamp(4rem, 16vw, 9rem)/1 var(--display); }
.intro :is(.definition, .question, .instruction, .cinema-title) { margin-block: 2rem; }
.intro .definition-lead { max-width: 30ch; font-size: clamp(2rem, 6vw, 4rem); font-weight: 750; line-height: 1; }
.intro-stage .aside { margin-top: .7em; font-size: clamp(1.1rem, 2.1vw, 1.65rem); font-weight: 520; }
.intro .question { max-width: 30ch; font-size: clamp(1.5rem, 4vw, 2.75rem); font-weight: 720; line-height: 1.13; }
.intro .instruction h2 { font-size: clamp(2.75rem, 7vw, 6rem); letter-spacing: -.04em; line-height: .95; font-weight: 770; }
.intro-stage #drag-instruction { margin-top: .85rem; font-size: clamp(1rem, 2.25vw, 1.55rem); font-weight: 580; }
.intro .cinema-title {
  font-family: var(--display);
  font-size: clamp(3rem, min(14.1vw, 25dvh), 14rem);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: .96;
}
.intro .card-poster { position: relative; width: min(70vw, 24rem); }
.intro .card-poster img { display: block; width: 100%; height: auto; }
.intro .card-poster img + img { position: absolute; inset: 0; opacity: var(--xray, 0); }
.intro :is(.frame, .letters, .card-shadow, .signal, .reader, .card-scene, .intro-callouts, .hud) { display: none; }

.intro.enhanced {
  height: calc((var(--scroll-screens) + 1) * 100vh);
  height: calc(100dvh + var(--scroll-screens) * 100svh);
}

.intro.enhanced .intro-stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: clip;
  isolation: isolate;
  background: var(--paper);
}

.intro.enhanced .story-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.intro.enhanced :is(.frame, .letters, .card-shadow, .signal, .reader, .card-scene, .intro-callouts, .hud) {
  display: block;
  position: absolute;
  pointer-events: none;
}

.intro .frame {
  inset: clamp(1.1rem, 3.4dvh, 2.75rem) var(--gutter) clamp(3.9rem, 10.2dvh, 6.6rem);
  border-block: 1px solid currentColor;
  opacity: .16;
}

.intro.enhanced :is(.letters, .signal, .card-scene, .intro-callouts) { inset: 0; width: 100%; height: 100%; }
.intro-stage:not(.has-card) .card-scene { visibility: hidden; }
.intro .has-card .card-poster { visibility: hidden; }
.intro .letters { z-index: 4; color: var(--ink); }
.intro .letter {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: baseline;
  width: max-content;
  transform-origin: top left;
  white-space: nowrap;
  opacity: 0;
}

.intro .letter b {
  font: 800 100px/1 "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: -.045em;
}
.intro .letter > span {
  padding-left: 3px;
  font-size: 69px;
  font-weight: 570;
  line-height: 1;
  letter-spacing: -.04em;
  clip-path: inset(0 var(--conceal, 100%) 0 0);
}

.intro.enhanced :is(.meaning, .definition, .cinema-title, .question, .instruction) {
  position: absolute;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.intro .meaning {
  z-index: 4;
  left: var(--meaning-x, var(--gutter));
  top: var(--meaning-y, 70%);
  max-width: min(25ch, 39vw);
  font-size: clamp(1.05rem, 2.22vw, 1.9rem);
  line-height: 1.14;
  font-weight: 470;
  text-wrap: pretty;
}

.intro .meaning strong { font-weight: 760; }
.intro .definition { z-index: 4; top: var(--definition-y, 29%); left: var(--gutter); width: min(68vw, 61rem); }
.intro.enhanced .definition-lead {
  max-width: 21ch;
  font-size: clamp(1.5rem, min(6.05vw, 10.1dvh), 6.6rem);
  letter-spacing: -.037em;
  font-weight: 760;
  line-height: .99;
  text-wrap: pretty;
}

.intro.enhanced .cinema-title {
  z-index: 1;
  width: calc(100% - 2 * var(--gutter));
  left: 50%;
  top: 26%;
  translate: -50% -50%;
  text-align: center;
  white-space: nowrap;
  color: var(--ink);
}

.intro.enhanced :is(.card-shadow, .card-poster, .reader, .drag-card) {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: center;
}

.intro .card-shadow {
  z-index: 1;
  background: radial-gradient(ellipse at center, #1c1c1c64, transparent 69%);
  filter: blur(10px);
  border-radius: 50%;
}

.intro .signal { z-index: 2; }
.intro .show-callouts .signal { z-index: 4; }
.intro .reader { z-index: 2; opacity: 0; }
.intro .reader img { display: block; width: 100%; height: auto; }
.intro.enhanced .card-poster {
  z-index: 3;
  width: auto;
  pointer-events: none;
  filter: drop-shadow(0 14px 24px #19191933);
}

.intro.enhanced .card-poster img { height: 100%; }
.intro.enhanced .card-poster img:first-child { opacity: calc(1 - var(--xray, 0)); }

.intro .card-scene { z-index: 3; }
.intro .intro-callouts { z-index: 4; }
.intro .intro-callouts span {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--ink);
  font-size: clamp(.9rem, 1.45vw, 1.12rem);
  font-weight: 650;
  white-space: nowrap;
  opacity: 0;
}

.intro.enhanced .question {
  z-index: 4;
  width: min(26vw, 25rem);
  right: var(--gutter);
  bottom: 15%;
  color: var(--ink);
  font-size: clamp(1.3rem, min(3.05vw, 6.7dvh), 3rem);
  letter-spacing: -.033em;
  text-wrap: pretty;
}

.intro .question span, .intro .question strong { display: block; }
.intro .question span {
  margin-bottom: .55em;
  font-size: max(1rem, .74em);
  font-weight: 540;
  letter-spacing: -.015em;
}

.intro .question strong { font-weight: 720; text-wrap: balance; }

.intro .instruction {
  z-index: 4;
  top: 11.5%;
  left: var(--gutter);
  right: var(--gutter);
}

.intro .drag-card {
  z-index: 5;
  background: transparent;
  border: 0;
  border-radius: 1rem;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.intro .dragging .drag-card { cursor: grabbing; }
.intro .drag-card:focus-visible { outline-offset: 2px; }
/* The 3D reader stands in for its picture once the 3D card is ready. */
.intro .has-card .reader { visibility: hidden; }

/* ---- The close-up (js/intro/cinema.js) ----
   It stays on paper, like the rest of the page, until the card and the reader talk (the
   lights go down for that, below). One readout, like a subtitle along the bottom in the
   middle, says one thing at a time; the rest of the page steps back while it shows.
   After the drop it has an arrow on each side: Back on the left, Next on the right.
   It is small and has no box: only its words, numbers and buttons over the background. */
.intro .cine { position: absolute; inset: 0; z-index: 5; pointer-events: none; color: var(--ink); }

.intro .readout {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(.9rem, 3.5dvh, 2rem);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "back words next" "back meters next" "back dots next";
  align-items: center;
  width: min(34rem, calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
  text-align: center;
  /* No box, so a soft halo in the background's colour keeps the words clear of the 3D. */
  text-shadow: 0 0 12px rgba(244, 241, 234, .95), 0 0 3px rgba(244, 241, 234, .8);
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
}

/* The one sentence, and the line of small print under it. */
.intro .readout-words { grid-area: words; }
.intro .readout-text {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.intro .readout-detail {
  min-height: 1.3em;
  margin: .25rem 0 0;
  font-size: .8rem;
  font-weight: 520;
  line-height: 1.3;
  color: var(--muted);
  text-wrap: balance;
}

/* The numbers, under the words: small labels, steady monospaced values, a thin bar under each. */
.intro .readout-meters {
  grid-area: meters;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
  justify-self: center;
  width: min(100%, 22rem);
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px solid rgba(13, 13, 12, .1);
  text-shadow: none;
}
.intro .readout-meter { display: grid; gap: .16rem; min-width: 0; margin: 0; }
.intro .readout-meter small {
  overflow: hidden;
  font-size: .56rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}
.intro .readout-meter b {
  font: 600 .82rem/1.15 "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.intro .readout-meter i {
  position: relative;
  display: block;
  height: 2px;
  margin-top: .22rem;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(13, 13, 12, .08);
}
.intro .readout-meter i::after {
  content: "";
  position: absolute;
  inset: 0 calc((1 - var(--to, 0)) * 100%) 0 calc(var(--from, 0) * 100%);
  border-radius: inherit;
  background: var(--ink);
  transition: inset .25s ease-out;
}
.intro .readout-power i::after { background: #f26a0c; }
/* The frequency's bar is a wave that keeps running. */
.intro .readout-frequency i.readout-wave {
  height: 6px;
  margin-top: .12rem;
  border-radius: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='8'%3E%3Cpath d='M0 4C3 .5 9 .5 12 4s9 3.5 12 0' fill='none' stroke='%23f26a0c' stroke-width='1.7'/%3E%3C/svg%3E") 0 50% / 18px 6px repeat-x;
  animation: readout-wave 1s linear infinite;
}
.intro .readout-frequency i.readout-wave::after { content: none; }
@keyframes readout-wave { to { background-position: 18px 50%; } }

/* After the drop: Back on the left, Next on the right, and where you are along the bottom. */
.intro .readout-nav { display: contents; }
.intro .readout-nav[hidden] { display: none; }
.intro .readout-dots { grid-area: dots; justify-self: center; display: flex; gap: .3rem; margin: .55rem 0 0; padding: 0; list-style: none; }
.intro .readout-dots li {
  width: .32rem;
  height: .32rem;
  border-radius: 99px;
  background: rgba(13, 13, 12, .16);
  transition: width .3s ease, background-color .3s ease;
}
.intro .readout-dots .is-done { background: rgba(13, 13, 12, .45); }
.intro .readout-dots .is-now { width: 1rem; background: var(--ink); }
/* Each dot is a button that jumps to its step, with a bigger target than the dot. */
.intro .readout-dots li { position: relative; }
.intro .readout-dots button {
  position: absolute;
  inset: -.55rem -.15rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.intro .readout-dots button:focus-visible { outline-offset: 2px; }
.intro .readout-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.intro :is(.readout-back, .readout-next) {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  text-shadow: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}
.intro .readout-back { grid-area: back; margin-right: .8rem; }
.intro .readout-next { grid-area: next; margin-left: .8rem; }
.intro :is(.readout-back, .readout-next) svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.intro .readout-back { border: 1px solid rgba(13, 13, 12, .18); color: var(--ink); background: transparent; }
.intro .readout-back:hover:not(:disabled) { background: rgba(13, 13, 12, .06); }
.intro .readout-back:disabled { opacity: .35; cursor: default; }
.intro .readout-next { border: 1px solid var(--ink); color: var(--paper); background: var(--ink); }
.intro .readout-next:hover { background: #2a2926; }

/* ---- The conversation (cinema.js `talk` steps, js/intro/river.js) ----
   The lights go down: a deep, warm dark behind the 3D, and the readout turns dark with it. */
.intro .cine-backdrop {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 85% 75% at 64% 56%, #27221a 0%, #121110 48%, #060606 100%);
}
.intro .readout { transition: color .6s ease, text-shadow .6s ease, right .5s ease; }
.intro .readout.is-dark { color: #f4f1ea; text-shadow: 0 1px 12px rgba(0, 0, 0, .85), 0 0 3px rgba(0, 0, 0, .7); }
.intro .readout.is-dark .readout-detail { color: rgba(244, 241, 234, .66); }
.intro .readout.is-dark .readout-meters { border-top-color: rgba(255, 255, 255, .1); }
.intro .readout.is-dark .readout-meter small { color: rgba(244, 241, 234, .55); }
.intro .readout.is-dark .readout-meter i:not(.readout-wave) { background: rgba(255, 255, 255, .12); }
.intro .readout.is-dark .readout-middle i::after { background: #f4f1ea; }
.intro .readout.is-dark .readout-dots li { background: rgba(255, 255, 255, .18); }
.intro .readout.is-dark .readout-dots .is-done { background: rgba(255, 255, 255, .5); }
.intro .readout.is-dark .readout-dots .is-now { background: #f4f1ea; }
.intro .readout.is-dark .readout-back { border-color: rgba(255, 255, 255, .24); color: #f4f1ea; }
.intro .readout.is-dark .readout-back:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.intro .readout.is-dark .readout-next { border-color: #f4f1ea; color: var(--ink); background: #f4f1ea; }
.intro .readout.is-dark .readout-next:hover { background: #fff; }
/* Ask: the visitor's turn to play the reader. It glows in the question's colour. */
.intro .readout .readout-next.is-ask {
  border-color: #ff7d1f;
  color: #fff;
  background: #f26a0c;
  animation: ask-pulse 1.8s ease-out infinite;
}
.intro .readout .readout-next.is-ask:hover { background: #ff7d1f; }
.intro .readout .readout-next[aria-disabled="true"] { opacity: .55; cursor: progress; animation: none; }
@keyframes ask-pulse {
  from { box-shadow: 0 0 0 0 rgba(255, 125, 31, .6); }
  to { box-shadow: 0 0 0 16px rgba(255, 125, 31, 0); }
}
/* The message's label (paintFilm in main.js), at the top in the middle while a message is
   on the air. No box: which way it goes in small capitals, the words, the signal as the
   receiver feels it (drawn as it comes in), and each byte once its bits are in. */
.intro .talk-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: .4rem;
  margin: 0;
  font: 600 clamp(.92rem, 1.3vw, 1.1rem)/1.1 "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .65);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.intro .talk-tag.is-shown { opacity: 1; }
.intro .talk-note {
  font: 650 .6rem/1 "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .56);
}
.intro .talk-note:empty { display: none; }
.intro .talk-words { font-weight: inherit; }
.intro .talk-signal { position: relative; width: min(18rem, 76vw); height: 1.45rem; }
.intro .talk-trace { display: block; width: 100%; height: 100%; }
.intro :is(.talk-track, .talk-line) { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.intro .talk-track { stroke: rgba(255, 255, 255, .13); stroke-width: 1; }
.intro .talk-line { stroke: #ff8a3d; stroke-width: 1.3; }
.intro .talk-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: #ffd2ad;
  box-shadow: 0 0 9px 2px rgba(255, 138, 61, .85);
  transition: opacity .3s ease;
}
.intro .talk-tag[data-kind="answer"] .talk-line { stroke: #5aa7ff; }
.intro .talk-tag[data-kind="answer"] .talk-dot { background: #d6e8ff; box-shadow: 0 0 9px 2px rgba(90, 167, 255, .85); }
.intro .talk-bytes { position: relative; width: min(18rem, 76vw); height: 1em; font-size: .64rem; color: rgba(255, 255, 255, .72); }
.intro .talk-bytes span { position: absolute; top: 0; translate: -50% 0; opacity: 0; transition: opacity .45s ease; }
.intro .talk-bytes span.is-in { opacity: 1; }
.intro .talk-bytes span.is-check { color: rgba(255, 255, 255, .4); }
.intro .talk-tag:is([data-kind="ask"], [data-kind="answer"]) { left: 50%; top: clamp(1rem, 6dvh, 3.5rem); translate: -50% 0; }
/* While the reader checks: the ID alone, just above the reader's chip. */
.intro .talk-tag[data-kind="check"] { translate: -50% calc(-100% - 14px); font-size: .9rem; }
.intro .talk-tag[data-kind="check"] :is(.talk-signal, .talk-bytes) { display: none; }
/* Just above the readout, in the middle. */
/* While it plays by itself, a ring round the right arrow fills until the next step. */
.intro .readout-next { position: relative; }
.intro .readout-next::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(#ff8a3d calc(var(--auto, 0) * 1turn), rgba(255, 255, 255, .12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.intro .readout-next.is-timing::after { opacity: 1; }

/* Play or pause it, top right. */
.intro .cine-auto {
  position: absolute;
  top: clamp(.9rem, 4dvh, 2rem);
  right: var(--gutter);
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.25rem;
  padding: .3rem .85rem .3rem .7rem;
  border: 1px solid rgba(13, 13, 12, .16);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 650;
  color: var(--ink);
  background: rgba(244, 241, 234, .7);
  cursor: pointer;
  pointer-events: auto;
  transition: color .4s ease, background-color .4s ease, border-color .4s ease;
}
.intro .cine-auto i { position: relative; width: .7rem; height: .7rem; }
/* Pause: two bars. Play: a triangle. */
.intro .cine-auto.is-on i::before, .intro .cine-auto.is-on i::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: .2rem; border-radius: 1px; background: currentColor;
}
.intro .cine-auto.is-on i::before { left: .08rem; }
.intro .cine-auto.is-on i::after { right: .08rem; }
.intro .cine-auto:not(.is-on) i::before {
  content: ""; position: absolute; inset: 0 0 0 .1rem; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.intro .cine-auto.is-dark { color: #f4f1ea; border-color: rgba(255, 255, 255, .22); background: rgba(20, 18, 16, .55); }

/* The parts a step names: small words beside each, with a thin line to it. */
.intro .cine-labels { position: absolute; inset: 0; pointer-events: none; }
.intro .cine-leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.intro .cine-leaders line {
  stroke: rgba(255, 226, 196, .55);
  stroke-width: 1;
  opacity: 0;
  transition: opacity .45s ease;
}
.intro .cine-leaders line.is-shown { opacity: 1; }
.intro .cine-label {
  position: absolute;
  left: 0;
  top: 0;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
  color: #fff1e2;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .9), 0 0 3px rgba(0, 0, 0, .8);
  opacity: 0;
  transition: opacity .45s ease;
}
.intro .cine-label.is-shown { opacity: 1; }

/* ---- The lab, "Try it yourself" (cinema.js `lab` step, lab-model.js) ----
   A dark glass panel on the right, over the close-up's dark: readings, a chart, the
   controls, the card's ID, Ask, and situations to try. On a phone it sits at the top. */
.intro .try {
  position: absolute;
  z-index: 6;
  top: clamp(4.4rem, 10dvh, 5.6rem);
  right: var(--gutter);
  bottom: clamp(1rem, 3dvh, 1.75rem);
  width: min(21rem, 31vw);
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: .95rem 1rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #f4f1ea;
  background: rgba(22, 20, 17, .74);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 1rem;
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateX(1rem);
  transition: opacity .45s ease, transform .45s ease;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.intro .try.is-shown { opacity: 1; transform: none; }
/* In the lab the readout moves into the space left of the panel, under the close-up. */
.intro .intro-stage.is-lab .readout {
  right: calc(min(21rem, 31vw) + var(--gutter) + 1rem);
  width: min(32rem, calc(100% - min(21rem, 31vw) - 3 * var(--gutter)));
}
.intro .try-title { margin: 0; font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(244, 241, 234, .7); }
.intro .try-readings { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .8rem; margin: 0; }
.intro .try-reading { min-width: 0; }
.intro .try-reading dt { font-size: .64rem; letter-spacing: .05em; text-transform: uppercase; color: rgba(244, 241, 234, .55); }
.intro .try-reading dd { margin: .12rem 0 0; }
.intro .try-reading b { font: 700 1.05rem/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.intro .try-reading.is-good b { color: #ffc56b; }
.intro .try-reading.is-low b { color: #ff8f7a; }
/* A bar with a mark where the chip's need sits. */
.intro .try-bar { position: relative; display: block; height: .3rem; margin-top: .3rem; border-radius: 1rem; background: rgba(255, 255, 255, .12); }
.intro .try-bar span { position: absolute; inset: 0 auto 0 0; width: calc(var(--to, 0) * 100%); border-radius: inherit; background: #ffb52e; transition: width .15s linear; }
.intro .try-reading.is-low .lab-bar span { background: #ff8f7a; }
.intro .try-bar em { position: absolute; top: -.2rem; bottom: -.2rem; left: calc(var(--need, 0) * 100%); width: 2px; background: #f4f1ea; border-radius: 1px; }
.intro .try-chart { display: grid; gap: .35rem; }
.intro .try-tabs { display: inline-flex; gap: .25rem; justify-self: start; padding: .15rem; border-radius: 999px; background: rgba(255, 255, 255, .07); }
.intro .try-tabs button {
  padding: .25rem .7rem; border: 0; border-radius: 999px; font: inherit; font-size: .72rem; font-weight: 650;
  color: rgba(244, 241, 234, .7); background: transparent; cursor: pointer;
}
.intro .try-tabs button[aria-pressed="true"] { color: #141210; background: #f4f1ea; }
.intro .try-plot { width: 100%; height: 7.2rem; display: block; }
.intro .try-controls { display: grid; gap: .55rem; }
.intro .try-control { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .1rem .5rem; font-size: .8rem; font-weight: 600; }
.intro .try-control output { font: 650 .8rem ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: #ffc56b; font-variant-numeric: tabular-nums; }
.intro .try-control input { grid-column: 1 / -1; width: 100%; margin: .15rem 0 0; accent-color: #ffb52e; height: 1.4rem; cursor: pointer; }
.intro .try-id { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .6rem; }
.intro .try-id label { display: grid; gap: .25rem; font-size: .8rem; font-weight: 600; }
.intro .try-id input {
  width: 100%; padding: .45rem .6rem; border: 1px solid rgba(255, 255, 255, .18); border-radius: .5rem;
  font: 650 .95rem ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase;
  color: #f4f1ea; background: rgba(255, 255, 255, .06);
}
.intro .try-id input[aria-invalid="true"] { border-color: #ff8f7a; }
.intro .try-check { margin: 0 0 .5rem; font-size: .72rem; color: rgba(244, 241, 234, .6); white-space: nowrap; }
.intro .try-check b { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: #f4f1ea; }
.intro .try-actions { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.intro .try-actions button, .intro .try-presets button {
  min-height: 2.4rem; padding: .4rem .9rem; border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 650; cursor: pointer;
}
.intro .try-ask { border: 0; color: #141210; background: #ff8a2a; }
.intro .try-ask:disabled { opacity: .5; cursor: default; }
.intro .try-reset { border: 1px solid rgba(255, 255, 255, .22); color: #f4f1ea; background: transparent; }
.intro .try-presets { display: flex; flex-wrap: wrap; gap: .35rem; }
.intro .try-presets button { min-height: 2rem; padding: .25rem .7rem; font-size: .74rem; border: 1px solid rgba(255, 255, 255, .16); color: #f4f1ea; background: rgba(255, 255, 255, .05); }
.intro .try-presets button:hover, .intro .try-reset:hover { background: rgba(255, 255, 255, .12); }
.intro .try :focus-visible { outline: 2px solid #ffc56b; outline-offset: 2px; }

.intro .cine-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + .8rem);
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(244, 241, 234, .62);
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
.intro .cine-hint.is-shown { opacity: 1; transition-delay: 1.4s; }
/* After the drop, the stage itself can be dragged to turn the camera (sideways on a phone,
   so the page still scrolls up and down). */
.intro .intro-stage.is-docked { cursor: grab; touch-action: pan-y; }
.intro .intro-stage.is-orbiting { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) {
  .intro .readout .readout-next.is-ask { animation: none; }
}

/* The check mark: the green disc grows, then the tick draws itself. --draw runs 0 to 1. */
.intro .cine-check {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(56px, 7vw, 96px);
  height: auto;
  opacity: 0;
  overflow: visible;
  filter: drop-shadow(0 0 18px rgba(47, 191, 113, .5));
}
.intro .cine-check circle {
  fill: #2fbf71;
  transform-box: fill-box;
  transform-origin: center;
  scale: min(1, calc(var(--draw, 0) * 1.7));
}
.intro .cine-check path {
  fill: none;
  stroke: #fff;
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - clamp(0, (var(--draw, 0) - .35) * 1.54, 1));
}

/* The explanation, on paper again once the lights come up. */
.intro .cine-explain {
  position: absolute;
  left: 56%;
  top: 50%;
  width: min(36vw, 30rem);
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  color: var(--ink);
  pointer-events: auto;
}
.intro .cine-explain.is-shown { visibility: visible; }
.intro .cine-explain h3 {
  margin: .35rem 0 .9rem;
  font-size: clamp(2rem, 4.2vw, 3.6rem);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.04em;
}
.intro .cine-explain p { margin: 0 0 .7rem; font-size: clamp(1rem, 1.45vw, 1.2rem); font-weight: 500; line-height: 1.42; }
.intro .cine-explain .cine-fine { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.intro .cine-explain .status {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #1f9d5c;
}
.intro .status:empty { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
.intro .feedback { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.3rem; }
.intro :is(.retry, .replay) {
  min-height: 2.75rem;
  padding: .35rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}
.intro .replay { color: var(--paper); background: var(--ink); }
.intro .retry:hover { color: var(--paper); background: var(--ink); }
.intro .replay:hover { background: #2a2926; }

.intro.enhanced .hud {
  z-index: 6;
  bottom: clamp(1rem, 3.25dvh, 2.75rem);
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.125rem;
  color: var(--ink);
  user-select: none;
}

.intro .scroll-guide {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  white-space: nowrap;
  font-weight: 650;
}

.intro .scroll-guide img { opacity: .82; }

.intro .progress {
  position: relative;
  flex: 0 1 clamp(5.5rem, 17vw, 14rem);
  height: 2px;
  margin-left: auto;
  background: color-mix(in srgb, currentColor 20%, transparent);
}

.intro .progress span {
  position: absolute;
  inset: 0;
  scale: var(--progress, 0) 1;
  transform-origin: left center;
  background: currentColor;
}

.intro.enhanced #try-it { position: absolute; bottom: 0; }

@media (max-width: 700px), (max-aspect-ratio: 17/20) {
  .intro.enhanced .definition { width: calc(100% - 2 * var(--gutter)); }
  .intro.enhanced .definition-lead { max-width: 19ch; font-size: clamp(1.55rem, min(9.7vw, 7dvh), 4.8rem); }
  .intro .meaning { max-width: min(27ch, 75vw); }
  .intro.enhanced .cinema-title {
    top: 50%;
    height: 50dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    font-size: clamp(3.2rem, min(20vw, 15.5dvh), 8.5rem);
  }
  .intro.enhanced .question {
    width: min(82vw, 25rem);
    bottom: 19%;
    font-size: clamp(1.38rem, min(5.8vw, 5.4dvh), 2.6rem);
  }
  /* The close-up on a phone: the readout across the bottom, the parts above it. */
  .intro .readout {
    bottom: clamp(.6rem, 2dvh, 1.25rem);
    grid-template-areas: "back words next" "meters meters meters" "dots dots dots";
  }
  /* While the card is dragged the reader sits low, so until the drop the readout takes
     the instructions' place at the top. */
  .intro .readout:not(.is-docked) { top: clamp(.75rem, 2.5dvh, 1.5rem); bottom: auto; }
  .intro .readout-text { font-size: clamp(.98rem, 4.2vw, 1.15rem); }
  .intro .readout-detail { font-size: .76rem; }
  .intro .readout-meters { gap: .6rem; margin-top: .5rem; }
  .intro .readout-meter small { font-size: .54rem; letter-spacing: .06em; }
  .intro .readout-dots { margin-top: .5rem; }
  .intro .cine-label { font-size: .7rem; }
  .intro .cine-auto { top: .6rem; right: .6rem; min-height: 2rem; padding: .2rem .7rem .2rem .6rem; font-size: .72rem; }
  .intro .talk-tag:is([data-kind="ask"], [data-kind="answer"]) { top: 3.1rem; }
  .intro .readout-back { margin-right: .5rem; }
  .intro .readout-next { margin-left: .5rem; }
  .intro .cine-explain { left: var(--gutter); right: var(--gutter); top: 5%; width: auto; transform: none; }
  /* The lab on a phone: across the top, scrolling, with the close-up below it. */
  .intro .try { top: .5rem; left: .5rem; right: .5rem; bottom: auto; width: auto; max-height: 47dvh; gap: .55rem; padding: .75rem .8rem .8rem; transform: translateY(-.75rem); }
  .intro .try-readings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
  .intro .try-reading dt { font-size: .54rem; }
  .intro .try-reading b { font-size: .86rem; }
  .intro .try-plot { height: 5.6rem; }
  .intro .intro-stage.is-lab .readout { right: 0; width: min(34rem, calc(100% - 2 * var(--gutter))); }
  /* While the lab talks on a phone, the message's label sits under its panel. */
  .intro .intro-stage.is-lab .talk-tag:is([data-kind="ask"], [data-kind="answer"]) { top: calc(47dvh + 1.1rem); }
  .intro .cine-explain h3 { font-size: clamp(1.8rem, 8.4vw, 2.6rem); }
  .intro .cine-explain p { font-size: clamp(.95rem, 4vw, 1.08rem); }
}

@media (max-height: 480px) {
  .intro .instruction { top: 9%; }
  .intro .instruction h2 { font-size: min(7vw, 13dvh); }
  .intro-stage #drag-instruction { margin-top: .35rem; }
}

/* ---------- The story ---------- */

/* Gives the page its scroll length: the hero screen plus the story's screens. */
.track { height: calc((var(--story-length, 4.9) + 1) * 100vh); }

.story {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* Labels on the open key fob, joined to their parts by hairlines. */
.callout-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  stroke: var(--ink);
  stroke-width: 1;
  fill: var(--ink);
}

.callout-lines path { fill: none; stroke-opacity: .5; }

.callouts { position: absolute; inset: 0; }

.callout {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 230px;
  opacity: 0;
}

.callout b {
  display: block;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.callout span {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--muted);
}

/* The one sentence: top left, big, the same place in every scene, clear of the models.
   Each new sentence fades in over the last. */
.say {
  position: absolute;
  left: var(--gutter);
  top: clamp(56px, 11vh, 120px);
  width: min(42vw, 620px);
  margin: 0;
  font-weight: 800;
  font-size: clamp(30px, min(3.4vw, 6.2vh), 64px);
  line-height: 1.02;
  letter-spacing: -.036em;
  text-wrap: balance;
}
.say.is-new { animation: say-in .55s cubic-bezier(.16, 1, .3, 1); }
@keyframes say-in { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } }

/* The battery's handle: a ring over the battery that invites a drag. */
.battery-handle {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  border: 1.5px dashed rgba(13, 13, 12, .55);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  animation: handle 1.6s ease-in-out infinite;
}
.battery-handle.is-dragging { cursor: grabbing; animation: none; border-style: solid; }
.battery-handle:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
@keyframes handle { 50% { box-shadow: 0 0 0 10px rgba(13, 13, 12, .06); } }

/* ---------- The lab (scenes 4 and 5) ---------- */
.lab {
  --copper: #b8652a;
  --green: #1f7a4a;
  --red: #b3261e;
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, visibility 0s linear .5s;
}
.lab.is-on { opacity: 1; visibility: visible; transition: opacity .5s ease; }
.lab-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* The tag's handle: drag it up and down. Arrow keys move it too. */
.lab-grab {
  position: absolute;
  left: 0;
  top: 0;
  width: 140px;
  height: 92px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}
.lab:not(.is-on) .lab-grab { pointer-events: none; }
.lab-grab.is-dragging { cursor: grabbing; }
.lab-grab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.lab-meter {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 64px;
  font-size: 10px;
  text-align: center;
  color: var(--muted);
}
.lab-meter div { position: relative; width: 10px; height: 96px; border-radius: 6px; background: rgba(13, 13, 12, .08); overflow: visible; }
.lab-meter i { position: absolute; inset: 0; border-radius: 6px; background: rgba(13, 13, 12, .4); transform-origin: 50% 100%; transform: scaleY(0); }
.lab-meter.is-awake i { background: var(--copper); }
.lab-meter em { position: absolute; left: -6px; right: -6px; height: 1.5px; background: var(--ink); font-style: normal; font-size: 0; }
.lab-meter em::after { content: "Wake"; position: absolute; left: 22px; top: -7px; font-size: 10px; color: var(--ink); }
.lab-fine { position: absolute; right: var(--gutter); bottom: 56px; margin: 0; font-size: 11px; color: var(--muted); }
.lab-meter span { font-size: 11px; font-weight: 600; color: var(--ink); }

/* Under the reader: what it feels, and the ID it read. Both appear with the reply. */
.lab-trace, .lab-id {
  position: absolute;
  left: 0;
  top: 0;
  width: 300px;
  margin: 0;
  opacity: 0;
  transition: opacity .5s ease;
}
.lab.is-replying .lab-trace, .lab.is-replying .lab-id { opacity: 1; }
.lab-trace { display: grid; gap: 4px; justify-items: center; }
.lab-trace span { font-size: 12px; font-weight: 600; color: var(--muted); }
.lab-trace canvas { width: 300px; height: 52px; }
.lab-id { display: flex; justify-content: center; align-items: baseline; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lab-id b { font: 600 22px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .04em; color: var(--ink); }
.lab-id.is-ok b { color: var(--green); }
.lab-id.is-ok b::after { content: " ✓"; }

/* Break it: three plain buttons under the sentence. */
.lab-buttons {
  position: absolute;
  left: var(--gutter);
  top: calc(clamp(56px, 11vh, 120px) + clamp(30px, min(3.4vw, 6.2vh), 64px) * 2.4 + 20px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease;
}
.lab.is-breaking .lab-buttons { opacity: 1; visibility: visible; pointer-events: auto; }
.lab-buttons button {
  padding: 11px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.lab-buttons button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lab-buttons button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* The slow-down badge, and the ghost hand. */
.lab-badge {
  position: absolute;
  right: var(--gutter);
  top: clamp(56px, 11vh, 120px);
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(13, 13, 12, .06);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0;
  transition: opacity .5s ease;
}
.lab-badge.is-on { opacity: 1; }
.lab-hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 46px;
  fill: rgba(255, 255, 255, .7);
  stroke: rgba(13, 13, 12, .45);
  stroke-width: 1.6;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.lab-hand.is-on { opacity: 1; }

/* A quiet invitation to scroll, under the hero. */
.scroll-cue {
  position: absolute;
  left: var(--gutter);
  bottom: 74px;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
}

.scroll-cue i {
  width: 1px;
  height: 36px;
  background: linear-gradient(var(--ink), var(--ink)) 0 0 / 1px 40% no-repeat, rgba(13, 13, 12, .14);
  animation: cue 1.8s cubic-bezier(.65, 0, .35, 1) infinite;
}

@keyframes cue {
  from { background-position: 0 -40%; }
  to { background-position: 0 140%; }
}

/* Chapters, like a video's scrubber. */
.chapters {
  position: absolute;
  left: 50%;
  bottom: 18px;
  display: flex;
  gap: clamp(14px, 2.4vw, 34px);
  padding-top: 12px;
  transform: translateX(-50%);
  pointer-events: auto;
  transition: opacity .6s ease;
}

html[data-intro] .chapters { opacity: 0; pointer-events: none; }

.chapters-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: rgba(13, 13, 12, .14);
  overflow: hidden;
}

.chapters-fill {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.chapters button {
  appearance: none;
  padding: 6px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  opacity: .62;
  cursor: pointer;
  transition: opacity .3s ease, color .3s ease;
}

.chapters button:hover, .chapters button[aria-current] { color: var(--ink); opacity: 1; }
.chapters button:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 4px; border-radius: 4px; }

/* Phones and tall windows: words on top, objects below. */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "copy" ".";
    align-items: stretch;
    padding: calc(env(safe-area-inset-top) + clamp(36px, 8svh, 120px)) 0 env(safe-area-inset-bottom);
  }

  .copy {
    justify-self: stretch;
    padding: 0 var(--gutter);
  }

  #headline, .headline-slot { font-size: clamp(38px, min(12.6vw, 7.4svh), 104px); }

  #subline {
    margin-top: clamp(12px, 2.2svh, 28px);
    font-size: clamp(16px, min(4.4vw, 2.5svh), 26px);
  }

  .callout { max-width: 150px; }
  .callout b { font-size: 12.5px; }
  .callout span { display: none; }

  .scroll-cue { bottom: 64px; }
  .chapters { bottom: calc(env(safe-area-inset-bottom) + 10px); }

  /* Six chapter names don't fit: the current one, and a dot for each of the others. */
  .chapters { gap: 10px; align-items: center; }
  .chapters button:not([aria-current]) {
    width: 7px;
    height: 7px;
    padding: 0;
    border-radius: 50%;
    background: currentColor;
    font-size: 0;
    opacity: .35;
  }
  .chapters button:not([aria-current])::after { content: ""; position: absolute; inset: -12px; }
  .chapters button { position: relative; }

  .lab-fine { display: none; }
}

/* ---------- Part 2: take it apart ---------- */
/* It scrolls up over the pinned film, on its own paper. */
.deep {
  --copper: #b8652a;
  --green: #1f7a4a;
  --red: #b3261e;
  position: relative;
  z-index: 11;
  background: var(--paper);
  padding: clamp(72px, 12vh, 140px) var(--gutter) 96px;
  box-shadow: 0 -40px 80px rgba(245, 242, 236, .9);
}
.deep-head { max-width: 980px; margin: 0 auto clamp(56px, 9vh, 110px); }
.deep-head h2 {
  margin: 14px 0 0;
  font-weight: 800;
  font-size: clamp(36px, min(5.4vw, 9vh), 96px);
  line-height: .96;
  letter-spacing: -.042em;
  text-wrap: balance;
}
.deep-head p:last-child { max-width: 58ch; margin: 20px 0 0; font-size: clamp(17px, 1.4vw, 21px); line-height: 1.5; color: var(--muted); }
.deep-part {
  max-width: 1180px;
  margin: clamp(48px, 8vh, 96px) auto 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(13, 13, 12, .16);
  font-weight: 800;
  font-size: clamp(22px, 2.2vw, 34px);
  letter-spacing: -.025em;
}
.deep-part span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.plate {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(28px, 5vh, 56px) 0;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  border-bottom: 1px solid rgba(13, 13, 12, .08);
}
.plate-words { display: grid; gap: 12px; align-content: start; }
.plate-num { margin: 0; font: 600 13px "JetBrains Mono", ui-monospace, monospace; color: var(--copper); }
.plate h3 { margin: 0; font-weight: 800; font-size: clamp(26px, 2.4vw, 38px); line-height: 1.02; letter-spacing: -.03em; text-wrap: balance; }
.plate-words > p { margin: 0; max-width: 46ch; font-size: clamp(15px, 1.15vw, 18px); line-height: 1.5; color: var(--muted); }
.plate-gate { font-style: italic; color: var(--ink) !important; }
.plate-controls { display: grid; gap: 12px; margin-top: 6px; font-size: 14px; font-weight: 600; }
.plate-controls label { display: grid; grid-template-columns: auto 1fr; gap: 4px 6px; align-items: baseline; }
.plate-controls label > input[type="range"], .plate-controls label > input[type="text"] { grid-column: 1 / -1; }
.plate-controls output { font-weight: 500; color: var(--muted); }
.plate-controls output::before { content: "· "; }
.plate-controls input[type="range"] { width: 100%; accent-color: var(--ink); }
.plate-controls input[type="text"] { width: 3.2em; padding: 6px 8px; border: 1px solid rgba(13, 13, 12, .3); border-radius: 8px; background: transparent; font: 600 18px "JetBrains Mono", monospace; text-align: center; }
.plate-check, .plate-switch label { display: flex !important; align-items: center; gap: 8px; }
.plate-switch { display: flex; flex-wrap: wrap; gap: 18px; }
.plate-controls button {
  justify-self: start;
  padding: 9px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.plate-controls button:hover { background: var(--ink); color: var(--paper); }
.plate-controls input:focus-visible, .plate-controls button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.plate-readout { min-height: 3em; color: var(--ink) !important; font-weight: 600; }
.plate-real { font-size: 13px !important; }
/* A canvas's own pixel size must never widen its column (it is resized to fit every frame). */
.plate > * { min-width: 0; }
.plate-canvas { width: 100%; max-width: 100%; min-width: 0; height: clamp(300px, 46vh, 460px); display: block; }

.plate-river { display: grid; gap: 14px; }
.plate-river .plate-canvas { height: clamp(150px, 22vh, 220px); }
.chat { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; max-height: 300px; overflow: auto; }
.chat li { display: flex; }
.chat button {
  max-width: 78%;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  animation: chat-in .35s ease;
}
.chat small { display: none; font: 500 11px "JetBrains Mono", monospace; opacity: .75; }
.chat li.is-open small { display: block; }
.chat-phone button { background: var(--ink); color: var(--paper); }
.chat-card { justify-content: flex-end; }
.chat-card button { background: #ead8c7; color: var(--ink); }
.chat-app { justify-content: center; }
.chat-app button { background: transparent; color: var(--muted); font-style: italic; }
.chat li.is-stolen button { background: #f3d6d3; color: var(--red); }
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } }

.deep-end { max-width: 980px; margin: clamp(64px, 10vh, 120px) auto 0; }
.deep-last { margin: 0 0 18px; font-weight: 800; font-size: clamp(30px, 3.6vw, 56px); line-height: 1; letter-spacing: -.035em; }
.deep-end p { max-width: 62ch; color: var(--muted); line-height: 1.55; }
.deep-end a { color: var(--ink); }
.deep-fine { font-size: 13px; }

@media (max-width: 860px) {
  .plate { grid-template-columns: minmax(0, 1fr); }
  .plate-canvas { height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- The film's frame ----------
   The film is laid out on one design frame, 1440 × 900 on wide screens and 390 × 844 on
   phones, scaled by one factor to fit the window (landing.js sets --u, one design pixel, and
   --fx, --fy, the frame's corner). Every size below is in design pixels, so each screen of the
   same shape shows exactly the same picture. */
.say {
  left: calc(var(--fx, 0px) + 110 * var(--u, 1px));
  top: calc(var(--fy, 0px) + 100 * var(--u, 1px));
  width: calc(700 * var(--u, 1px));
  font-size: calc(76 * var(--u, 1px));
  line-height: 1;
}
.lab-buttons {
  left: calc(var(--fx, 0px) + 110 * var(--u, 1px));
  top: calc(var(--fy, 0px) + 300 * var(--u, 1px));
  gap: calc(12 * var(--u, 1px));
}
.lab-buttons button {
  padding: calc(14 * var(--u, 1px)) calc(24 * var(--u, 1px));
  border-width: calc(2 * var(--u, 1px));
  font-size: calc(21 * var(--u, 1px));
}
.lab-badge {
  right: auto;
  left: calc(var(--fx, 0px) + 110 * var(--u, 1px));
  top: calc(var(--fy, 0px) + 782 * var(--u, 1px));
  padding: calc(7 * var(--u, 1px)) calc(14 * var(--u, 1px));
  font-size: calc(16 * var(--u, 1px));
}
.lab-meter { width: calc(80 * var(--u, 1px)); gap: calc(6 * var(--u, 1px)); }
.lab-meter div { width: calc(14 * var(--u, 1px)); height: calc(150 * var(--u, 1px)); border-radius: calc(8 * var(--u, 1px)); }
.lab-meter i { border-radius: calc(8 * var(--u, 1px)); }
.lab-meter em { left: calc(-8 * var(--u, 1px)); right: calc(-8 * var(--u, 1px)); height: calc(2 * var(--u, 1px)); }
.lab-meter em::after { left: calc(30 * var(--u, 1px)); top: calc(-9 * var(--u, 1px)); font-size: calc(14 * var(--u, 1px)); }
.lab-meter span { font-size: calc(16 * var(--u, 1px)); }
.lab-trace, .lab-id { width: calc(420 * var(--u, 1px)); }
.lab-trace { gap: calc(6 * var(--u, 1px)); }
.lab-trace span { font-size: calc(17 * var(--u, 1px)); }
.lab-trace canvas { width: calc(420 * var(--u, 1px)); height: calc(76 * var(--u, 1px)); }
.lab-id { gap: calc(12 * var(--u, 1px)); font-size: calc(16 * var(--u, 1px)); }
.lab-id b { font-size: calc(36 * var(--u, 1px)); }
.lab-hand { width: calc(52 * var(--u, 1px)); height: calc(60 * var(--u, 1px)); }
.lab-fine { right: auto; left: calc(var(--fx, 0px) + 112 * var(--u, 1px)); bottom: auto; top: calc(var(--fy, 0px) + 832 * var(--u, 1px)); font-size: calc(13 * var(--u, 1px)); }
.story .callout b { font-size: calc(20 * var(--u, 1px)); }
.story .callout { max-width: calc(260 * var(--u, 1px)); }

@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .say {
    left: calc(var(--fx, 0px) + 22 * var(--u, 1px));
    top: calc(var(--fy, 0px) + 64 * var(--u, 1px));
    width: calc(346 * var(--u, 1px));
    font-size: calc(38 * var(--u, 1px));
  }
  .lab-buttons {
    left: calc(var(--fx, 0px) + 22 * var(--u, 1px));
    right: auto;
    top: calc(var(--fy, 0px) + 752 * var(--u, 1px));
    width: calc(346 * var(--u, 1px));
    justify-content: center;
  }
  .lab-buttons button { padding: calc(11 * var(--u, 1px)) calc(16 * var(--u, 1px)); font-size: calc(16 * var(--u, 1px)); }
  .lab-badge { left: calc(var(--fx, 0px) + 268 * var(--u, 1px)); top: calc(var(--fy, 0px) + 22 * var(--u, 1px)); font-size: calc(13 * var(--u, 1px)); }
  .lab-meter { width: calc(64 * var(--u, 1px)); }
  .lab-meter div { height: calc(110 * var(--u, 1px)); }
  .lab-trace, .lab-id { width: calc(320 * var(--u, 1px)); }
  .lab-trace canvas { width: calc(320 * var(--u, 1px)); height: calc(60 * var(--u, 1px)); }
  .lab-trace span { font-size: calc(15 * var(--u, 1px)); }
  .lab-id b { font-size: calc(30 * var(--u, 1px)); }
  .lab-fine { display: none; }
  .story .callout b { font-size: calc(15 * var(--u, 1px)); }
  .story .callout { max-width: calc(150 * var(--u, 1px)); }
}

/* Presenter mode (js/present.js): while the page plays itself, a small note says how to stop it. */
.presenting {
  position: fixed;
  left: 50%;
  top: .7rem;
  z-index: 50;
  margin: 0;
  padding: .3rem .8rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  color: #f4f1ea;
  background: rgba(13, 13, 12, .62);
  transform: translateX(-50%);
  pointer-events: none;
}
