/* ==========================================================================
   Kiên Magic · page layer
   scrollcraft.css is the engine floor and stays untouched. This file sets the
   tokens and draws the page. Nothing here restyles .sc-stage or [data-sc-*].
   ========================================================================== */

:root {
  /* grounds: three steps of one warm black, cut hard between chapters */
  --deep: #070706;
  --hall: #0d0c0a;
  --lift: #161512;

  /* ink: chalk white and two warm greys from the same ramp */
  --ink: #f2eee6;
  --ink-soft: #b4aea3;
  --ink-faint: #8f897e;   /* 5.3:1 on the lift ground */

  /* The yellow of the 1 ball and of the 9 ball's stripe. It owns two chapter
     grounds, the rail of the table, the name, and the numbers that won. */
  --accent: #ffc81a;
  --accent-ink: #12100a;    /* ink on the yellow, 12:1 */
  --accent-soft: #4a3d0c;   /* second ink on the yellow, 6.9:1 */
  --lamp: #ffe08c;

  --hair: color-mix(in oklab, var(--ink) 12%, transparent);
  --hair-strong: color-mix(in oklab, var(--ink) 22%, transparent);

  /* paper for the result sheet */
  --paper: #f2eee4;
  --paper-ink: #17150f;
  --paper-soft: #5f594d;

  /* the table in chapter 5: a black cloth under one lamp, in a yellow rail */
  --felt: #11100d;
  --felt-lit: #221f18;
  --felt-edge: #090807;
  --felt-soft: #bdb6a8;   /* 8:1 on the brightest cloth, under the lamp */
  --rail: var(--accent);
  --sight: #1d1806;

  /* balls: the real set; the 1 and the 9 carry the page's yellow */
  --b1: var(--accent); --b2: #2f5fd0; --b3: #d23a2e; --b4: #6a4bb5; --b5: #ee7a2a;
  --b6: #1f8a55; --b7: #8e2a33; --b8: #16181b; --b9: var(--accent);
  --cue: #f1ede4;
  --dot: #c8372d;
  --disc: #f4f1ea;

  /* engine tokens */
  --sc-canvas: var(--deep);
  --sc-surface: var(--lift);
  --sc-ink: var(--ink);
  --sc-ink-soft: var(--ink-soft);
  --sc-accent: var(--accent);
  --sc-accent-ink: var(--accent-ink);
  --sc-shadow-color: 40 25% 2%;
  --sc-font-display: "Big Shoulders Display", "Barlow Condensed", "Arial Narrow", sans-serif;
  --sc-font-text: "Be Vietnam Pro", system-ui, sans-serif;
  --sc-font-mono: var(--sc-font-text);

  --display: var(--sc-font-display);
  --text: var(--sc-font-text);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --gutter: clamp(16px, 5vw, 88px);
  --rack-room: 0px;
}
@media (min-width: 861px) {
  :root { --rack-room: 72px; }
}

/* a dark-only page: scrollbars and other browser-drawn parts follow it */
:root { color-scheme: dark; }
body {
  background: var(--deep);
  font-size: clamp(1rem, 0.97rem + 0.16vw, 1.0625rem);
  line-height: 1.7;
  letter-spacing: 0;
}

h1, h2, h3, p, dl, dd, figure, blockquote { margin: 0; }

.wrap {
  width: 100%;
  max-width: calc(76rem + var(--rack-room));
  margin-inline: auto;
  padding-inline: var(--gutter) calc(var(--gutter) + var(--rack-room));
}

.skip {
  position: fixed; z-index: 100; left: 16px; top: 16px;
  padding: 8px 16px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 500; text-decoration: none;
  transform: translateY(-180%);
  transition: transform 200ms var(--ease);
}
.skip:focus-visible { transform: none; }

/* ------------------------------------------------------------------ balls */
.ball {
  --d: 20px;
  --c: var(--b1);
  position: relative;
  display: inline-grid; place-items: center; flex: none;
  width: var(--d); height: var(--d);
  border-radius: 50%;
  background: var(--c);
  box-shadow:
    inset calc(var(--d) * -0.1) calc(var(--d) * -0.14) calc(var(--d) * 0.2) rgb(0 0 0 / 0.34),
    0 calc(var(--d) * 0.06) calc(var(--d) * 0.12) rgb(0 0 0 / 0.45);
  overflow: hidden;
}
.ball::after, .cue::after {
  content: ""; position: absolute; pointer-events: none;
  left: 22%; top: 14%; width: 22%; height: 13%;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.5);
  transform: rotate(-28deg);
}
.ball > b {
  display: grid; place-items: center;
  width: 50%; height: 50%;
  border-radius: 50%;
  background: var(--disc);
  color: #17191c;
  font: 600 calc(var(--d) * 0.27) / 1 var(--text);
  letter-spacing: 0;
}
.ball--1 { --c: var(--b1); }
.ball--2 { --c: var(--b2); }
.ball--3 { --c: var(--b3); }
.ball--4 { --c: var(--b4); }
.ball--5 { --c: var(--b5); }
.ball--6 { --c: var(--b6); }
.ball--7 { --c: var(--b7); }
.ball--8 {
  --c: var(--b8);
  box-shadow:
    inset calc(var(--d) * -0.1) calc(var(--d) * -0.14) calc(var(--d) * 0.2) rgb(0 0 0 / 0.5),
    inset 0 0 0 1px rgb(255 255 255 / 0.14),
    0 calc(var(--d) * 0.06) calc(var(--d) * 0.12) rgb(0 0 0 / 0.45);
}
.ball--9 { --c: var(--b9); background: linear-gradient(var(--disc) 0 22%, var(--c) 22% 78%, var(--disc) 78%); }
.ball--s { --d: 20px; }
.ball--s > b { font-size: 0; }          /* at 20px the number is a disc, the colour carries it */
.ball--m { --d: 44px; }
.ball--xl { --d: clamp(112px, 15vw, 200px); }

.cue {
  --d: 20px;
  position: relative; display: block; flex: none;
  width: var(--d); height: var(--d);
  border-radius: 50%;
  background: var(--cue);
  box-shadow:
    inset calc(var(--d) * -0.1) calc(var(--d) * -0.14) calc(var(--d) * 0.22) rgb(40 30 10 / 0.3),
    0 calc(var(--d) * 0.06) calc(var(--d) * 0.14) rgb(0 0 0 / 0.5);
  overflow: hidden;
}
.cue__dot {
  position: absolute; left: 38%; top: 38%; width: 24%; height: 24%;
  border-radius: 50%;
  background: var(--dot);
}

/* -------------------------------------------------------------------- rack
   The folio. Lane one holds the balls still to be read and the cue ball
   rolling down to them; lane two is the trough the read ones drop into.    */
.rack {
  --axis: y;
  --rd: 20px;
  --pitch: 30px;
  --lane: 26px;
  position: fixed; z-index: 60;
  right: clamp(12px, 1.6vw, 28px);
  top: 50%;
  translate: 0 -50%;
  width: calc(var(--rd) + var(--lane) + 3px);
  padding-top: calc(var(--pitch) * 1.7);
}
.rack__trough {
  position: absolute;
  left: calc(var(--lane) - 3px);
  top: calc(var(--pitch) * 1.7 + 2px);
  bottom: 2px;
  width: calc(var(--rd) + 6px);
  border-radius: var(--rd);
  background: #050504;
  box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.7), 0 0 0 1px var(--hair);
}
.rack__dock {
  position: absolute; left: 0;
  top: calc(var(--pitch) * 0.3);
  width: var(--rd); height: var(--rd);
}
.rack__list { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-rows: var(--pitch); }
.rack__slot { position: relative; }
.rack__link {
  position: absolute; inset: 0 -4px;
  display: block;
  border-radius: 8px;
  color: inherit; text-decoration: none;
}
.rack__spot, .rack__link > .ball {
  position: absolute;
  left: 4px; top: calc(50% - var(--rd) / 2);
}
.rack__spot { width: var(--rd); height: var(--rd); }
.rack__link > .ball { --d: var(--rd); }
.rack__link::before {
  content: attr(data-label);
  position: absolute; right: calc(100% + 8px); top: 50%;
  translate: 0 -50%;
  white-space: nowrap;
  padding: 4px 8px; border-radius: 6px;
  background: var(--deep);
  box-shadow: 0 0 0 1px var(--hair-strong);
  color: var(--accent);
  font-size: 0.8125rem; line-height: 1.4;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms var(--ease);
}
.rack__link:hover::before, .rack__link:focus-visible::before { opacity: 1; }
.rack__cue { position: absolute; left: 0; top: 0; --d: var(--rd); will-change: transform; }

@media (max-width: 860px) {
  .rack {
    --axis: x;
    --rd: 14px;
    --pitch: 24px;   /* each ball is a 24px target, the WCAG 2.2 minimum */
    --lane: 16px;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 8px;
    translate: none;
    width: auto;
    padding: 6px 6px 6px calc(var(--pitch) * 1.5 + 6px);
    background: color-mix(in oklab, var(--deep) 90%, transparent);
    border: 1px solid var(--hair);
    border-radius: 12px;
  }
  .rack__list {
    grid-auto-flow: column;
    grid-auto-columns: var(--pitch);
    grid-auto-rows: calc(var(--rd) + var(--lane) + 4px);
  }
  .rack__link { inset: -4px 0; }
  .rack__spot, .rack__link > .ball { left: calc(50% - var(--rd) / 2); top: 6px; }
  .rack__trough {
    left: calc(var(--pitch) * 1.5 + 4px); right: 4px;
    top: calc(4px + var(--lane));
    bottom: auto; width: auto;
    height: calc(var(--rd) + 6px);
  }
  .rack__dock { left: 16px; top: 12px; }
  .rack__link::before { display: none; }
  /* the plate covers the top 56px; anchor jumps and keyboard focus land below it */
  html { scroll-padding-top: 64px; }
}

/* -------------------------------------------------------------------- hero
   A still cover, one screen tall. The hall's lamps hang along the top; the
   name and the lede stand at the foot of the screen, where chapter 1 cuts in. */
.hero { background: var(--deep); }
.hero__stage {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: grid; align-content: end;
  padding: clamp(112px, 22svh, 240px) calc(var(--gutter) + var(--rack-room)) clamp(48px, 9svh, 104px) var(--gutter);
  background: linear-gradient(180deg, #13110b 0%, var(--deep) 62%);
  overflow: clip;
}

.hall { position: absolute; inset: 0; pointer-events: none; }
.hall__lamp {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--w); height: 3px; border-radius: 2px;
  background: var(--lamp); opacity: calc(var(--o) * 2.2);
}
.hall__lamp::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 3px;
  height: calc(var(--w) * 0.55);
  background: linear-gradient(var(--lamp), transparent);
  opacity: 0.12;
  clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
}

.hero__head { position: relative; z-index: 2; }
.hero__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(4.5rem, 1rem + 13vw, 14rem);
  /* the height caps it too, so the name and the lede fit a short screen */
  font-size: min(clamp(4.5rem, 1rem + 13vw, 14rem), 24svh);
  line-height: 0.96;
  letter-spacing: 0;
  color: var(--accent);
  text-wrap: balance;
}
.hero__lede {
  margin-top: clamp(16px, 2.4svh, 28px);
  max-width: 38rem;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: balance;
}

/* ---------------------------------------------------------------- chapters */
.ch { position: relative; padding-block: clamp(88px, 11vw, 168px); }
.ch--after-pin { padding-top: clamp(56px, 6vw, 96px); }
.ch--deep { background: var(--deep); }
.ch--hall { background: var(--hall); }
.ch--lift { background: var(--lift); }
/* Two chapters stand on the yellow itself, in black ink: the slogan (2) and
   the two names in one jersey (8). Every role is re-derived from the yellow,
   so nothing on it is grey, and focus and selection turn black here. */
.ch--accent {
  --ink: var(--accent-ink);
  --ink-soft: var(--accent-soft);
  --ink-faint: var(--accent-soft);
  --hair: rgb(18 16 10 / 0.2);
  --hair-strong: rgb(18 16 10 / 0.5);
  --sc-accent: var(--accent-ink);
  --sc-accent-ink: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.ch__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px 64px;
}
@media (min-width: 1024px) {
  .ch__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas: "head head" "body media";
    align-items: start;
  }
  .ch__head { grid-area: head; }
  .ch__body { grid-area: body; }
  .ch__media { grid-area: media; }
}

.ch__head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 16px;
}
.ch__title {
  grid-column: 1 / -1;
  margin-top: 16px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.75rem, 1.5rem + 4.4vw, 5.75rem);
  line-height: 1.06;
  letter-spacing: 0;
  text-wrap: balance;
}
.ch__title--quiet { font-size: clamp(2.25rem, 1.6rem + 2.2vw, 3.5rem); }
/* a score never splits across lines */
.nb { white-space: nowrap; }
/* in a title, the score he won is lit and the one he lost is not */
.ch__title .is-win { color: var(--accent); }
.ch__title .is-loss { color: var(--ink-soft); }

.lead {
  max-width: 34ch;
  font-size: clamp(1.1875rem, 1rem + 0.7vw, 1.5rem);
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}
.prose { max-width: 62ch; color: var(--ink-soft); text-wrap: pretty; }
.ch__body > * + * { margin-top: 24px; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0 32px;
  max-width: 40rem;
  padding-top: 8px;
}
.facts > div { padding: 12px 0; border-top: 1px solid var(--hair); }
.facts dt { font-size: 0.8125rem; color: var(--ink-faint); }
.facts dd { margin-top: 2px; color: var(--ink); font-weight: 500; }

/* photo slots: a fallback still life until a real photo arrives */
.photo__frame {
  position: relative; overflow: hidden;
  border-radius: 6px;
  aspect-ratio: 4 / 5;
  background: var(--felt-edge);
}
.photo--wide .photo__frame { aspect-ratio: 3 / 2; }
.photo__fallback {
  position: absolute; inset: 0;
  background: radial-gradient(90% 80% at 42% 40%, var(--felt-lit), var(--felt) 55%, var(--felt-edge));
}
.photo__fallback .ball { position: absolute; left: 50%; top: 52%; translate: -50% -50%; }
.photo__shadow {
  position: absolute; left: 50%; top: 52%;
  width: calc(clamp(112px, 15vw, 200px) * 1.45);
  height: calc(clamp(112px, 15vw, 200px) * 0.42);
  translate: -46% 70%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(0 0 0 / 0.5), transparent);
}
.photo__pocket {
  position: absolute; right: -6%; top: -8%;
  width: 26%; aspect-ratio: 1; border-radius: 50%;
  background: #030303;
  box-shadow: 0 0 0 10px #1b1914;   /* a dark rail: the waiting frame stays quiet */
}
.photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  object-fit: cover;
  opacity: 0;
  transition: opacity 600ms var(--ease);
}
.photo.is-loaded img { opacity: 1; }
/* The caption keeps its line from the start and shows with its photo. A
   caption that appeared later would push the page down under the engine's
   measured acts. */
.photo__cap { margin-top: 12px; font-size: 0.8125rem; color: var(--ink-faint); text-wrap: pretty; visibility: hidden; }
.photo.is-loaded .photo__cap { visibility: visible; }

/* chapter 4 hangs a second, narrower frame lower in the column */
.photo-pair__second { margin-top: clamp(40px, 6vw, 88px); }
@media (min-width: 1024px) {
  .photo-pair__second { width: 84%; margin-left: auto; }
}
.side > * + * { margin-top: 48px; }

/* --------------------------------------------------------------- chapter 2 */
.slogan {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}
.slogan__big {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(4rem, 1rem + 10vw, 11.5rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-wrap: balance;
}
.slogan__second {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 1.2rem + 3vw, 4rem);
  line-height: 1.05;
  color: var(--ink-soft);
}
.dotball {
  justify-self: start;
  display: grid; place-items: center;
  width: clamp(208px, 30vw, 386px); aspect-ratio: 1;
}
.cue--xl { --d: clamp(160px, 23vw, 296px); }
.cue--xl .cue__dot { box-shadow: inset -2px -3px 4px rgb(0 0 0 / 0.25); }
.slogan__text > * + * { margin-top: 16px; }
@media (min-width: 1024px) {
  .slogan {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas: "head head" "big ball" "second ball" "text ball";
    column-gap: 64px;
    align-items: start;
  }
  .slogan__head { grid-area: head; }
  .slogan__big { grid-area: big; }
  .slogan__second { grid-area: second; }
  .slogan__text { grid-area: text; }
  .dotball { grid-area: ball; justify-self: end; align-self: center; }
}

/* --------------------------------------------------------------- chapter 3 */
.bignum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.bignum__n {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(5rem, 2.5rem + 8vw, 10rem);
  line-height: 1;
  color: var(--accent);
}
.bignum__u { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); color: var(--ink-soft); max-width: 18ch; line-height: 1.45; }

.sheet {
  align-self: start;
  padding: clamp(24px, 3vw, 40px);
  border-radius: 4px;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 28px 56px -18px rgb(0 0 0 / 0.75);
  rotate: -1.2deg;
}
.sheet__title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.875rem, 1.4rem + 1.4vw, 2.5rem);
  line-height: 1.1;
}
/* meta lines break evenly; notes and sources never end on one lone word */
.sheet__meta { margin-top: 4px; font-size: 0.875rem; color: var(--paper-soft); text-wrap: balance; }
.sheet__table { width: 100%; margin-top: 24px; border-collapse: collapse; }
.sheet__table th, .sheet__table td {
  padding: 12px 0;
  border-top: 1px solid rgb(23 21 15 / 0.14);
  text-align: left; vertical-align: baseline;
}
.sheet__table th { width: 44%; font-weight: 400; color: var(--paper-soft); }
.sheet__table td { font-weight: 500; }
.sheet__table .is-win td { font-weight: 600; }
/* the winner's name, marked on the sheet with a yellow highlighter */
.sheet mark {
  padding: 0.08em 0.3em; margin-inline: -0.3em;
  border-radius: 2px;
  background: var(--accent);
  color: inherit;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.sheet__src { margin-top: 16px; font-size: 0.8125rem; color: var(--paper-soft); text-wrap: pretty; }

/* ---------------------------------------------------------- chapters 4, 6 */
.log { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 48px; }
.log__name {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.625rem, 1.3rem + 1vw, 2.25rem);
  line-height: 1.15;
}
.log__meta { margin: 4px 0 16px; font-size: 0.875rem; color: var(--ink-faint); text-wrap: balance; }
.log__note { margin-top: 12px; font-size: 0.875rem; color: var(--ink-faint); text-wrap: pretty; }
.games { list-style: none; margin: 0; padding: 0; max-width: 36rem; }
.games li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 16px; align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
}
.games li:last-child { border-bottom: 1px solid var(--hair); }
.lead + .games { margin-top: 40px; }
.games__res { font-size: 0.875rem; color: var(--ink-soft); }
.games li:not(.is-loss) .games__res { color: var(--accent); font-weight: 500; }
.games__opp { color: var(--ink); font-weight: 500; }
.games__opp small { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--ink-faint); }
.games__score {
  font-family: var(--display); font-weight: 600;
  font-size: 1.75rem; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.games .is-loss .games__score, .games .is-loss .games__opp { color: var(--ink-soft); }

.kind { align-self: start; padding-top: 24px; border-top: 1px solid var(--hair-strong); }
.kind__label { margin-bottom: 8px; font-size: 0.875rem; color: var(--ink-faint); }
.kind__text { max-width: 34ch; font-size: 1.125rem; line-height: 1.6; color: var(--ink); text-wrap: pretty; }

/* --------------------------------------------------------------- chapter 7 */
.card {
  max-width: 26rem;
  padding: 24px;
  border-radius: 12px;
  background: var(--lift);
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--ink) 8%, transparent), 0 0 0 1px var(--hair);
}
.card__label { font-size: 0.8125rem; color: var(--ink-faint); }
.card__name {
  margin-top: 8px;
  font-family: var(--display); font-weight: 600;
  font-size: 2.25rem; line-height: 1.1;
}
.card__alias { color: var(--ink); font-weight: 500; }
.card__line { margin-top: 16px; font-size: 0.9375rem; color: var(--ink-soft); }
.note { font-size: 0.875rem; color: var(--ink-faint); }

/* --------------------------------------------------------------- chapter 8 */
.team {
  margin-top: 48px;
  padding-block: clamp(24px, 4vw, 56px);
  border-block: 1px solid var(--hair-strong);
}
.team__meta { margin-bottom: 16px; font-size: 0.9375rem; color: var(--ink-soft); text-wrap: balance; }
.team__names {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.75rem, 0.8rem + 6.4vw, 8rem);
  line-height: 1.04;
  text-wrap: balance;
}
.team__and { font-family: var(--text); font-weight: 400; font-size: 0.32em; color: var(--ink-soft); vertical-align: 0.6em; }
.team__text { margin-top: 40px; }
.team__text > * + * { margin-top: 16px; }

/* --------------------------------------------------------------- colophon */
.colophon { padding-bottom: clamp(96px, 12vw, 176px); }
.colophon__cta {
  margin: 32px 0 64px;
  max-width: 40ch;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.55;
}
.colophon__cta a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.24em; }
.colophon__cta a:hover { color: var(--accent); }
.sources__title { font-size: 1rem; font-weight: 500; }
.sources__list {
  margin: 12px 0 0; padding-left: 1.25rem;
  display: grid; gap: 8px;
  max-width: 72ch;
  font-size: 0.875rem; line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.colophon__fine { margin-top: 48px; max-width: 56ch; font-size: 0.8125rem; color: var(--ink-faint); text-wrap: pretty; }

/* ================================================================ chapter 5 */
.ch5 { background: var(--deep); }
.silence {
  min-height: 100svh;
  display: grid; align-items: center;
  padding-inline: var(--gutter) calc(var(--gutter) + var(--rack-room));
}
.silence__line {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.5rem);
  line-height: 1.1;
  color: var(--ink-soft);
}

.peak__stage {
  display: grid;
  padding: clamp(12px, 4svh, 44px) calc(clamp(12px, 3vw, 48px) + var(--rack-room)) clamp(12px, 4svh, 44px) clamp(12px, 3vw, 48px);
}
.felt {
  --rw: clamp(14px, 1.7vw, 26px);
  --pk: clamp(26px, 2.5vw, 40px);
  --inset: calc(var(--rw) + clamp(16px, 3vw, 48px));   /* where the heading and scenes start */
  --title: clamp(1.75rem, 1.2rem + 1.8vw, 3rem);
  position: relative;
  width: 100%; max-width: 1440px; margin-inline: auto;
  border-radius: clamp(14px, 1.8vw, 26px);
  /* the rail is flat yellow: the table is framed in the page's own colour */
  background: var(--rail);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.4),
    inset 0 -2px 0 rgb(0 0 0 / 0.14),
    0 40px 90px -30px rgb(0 0 0 / 0.9);
}
.felt__cloth {
  position: absolute; inset: var(--rw);
  border-radius: 6px;
  background: radial-gradient(72% 70% at 50% 40%, var(--felt-lit), var(--felt) 58%, var(--felt-edge));
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.22), inset 0 12px 28px rgb(0 0 0 / 0.32);
}
.pocket {
  position: absolute;
  width: var(--pk); aspect-ratio: 1;
  border-radius: 50%;
  background: #030405;
  box-shadow: inset 0 3px 8px rgb(0 0 0 / 0.9);
}
.pocket--tl { left: calc(var(--rw) - var(--pk) * 0.62); top: calc(var(--rw) - var(--pk) * 0.62); }
.pocket--tr { right: calc(var(--rw) - var(--pk) * 0.62); top: calc(var(--rw) - var(--pk) * 0.62); }
.pocket--bl { left: calc(var(--rw) - var(--pk) * 0.62); bottom: calc(var(--rw) - var(--pk) * 0.62); }
.pocket--br { right: calc(var(--rw) - var(--pk) * 0.62); bottom: calc(var(--rw) - var(--pk) * 0.62); }
.pocket--tm { left: calc(50% - var(--pk) / 2); top: calc(var(--rw) - var(--pk) * 0.7); }
.pocket--bm { left: calc(50% - var(--pk) / 2); bottom: calc(var(--rw) - var(--pk) * 0.7); }
.sights {
  position: absolute; left: var(--rw); right: var(--rw);
  height: 6px;
  /* tiles centred on the rail: dots land on every eighth, pockets cover 0, 50, 100% */
  background: radial-gradient(circle, var(--sight) 0 1.8px, transparent 2.4px) 50% 50% / 12.5% 100% repeat-x;
  opacity: 0.7;
}
.sights--a { top: calc(var(--rw) / 2 - 3px); }
.sights--b { bottom: calc(var(--rw) / 2 - 3px); }

/* The 9 waits level with the chapter ball, at the far end of the heading row,
   so it never sits inside the scenes. The heading is one title line and one
   venue line (2px apart) at every width that uses this. */
.felt__nine {
  --d: clamp(28px, 2.6vw, 42px);
  position: absolute; z-index: 1;
  right: calc(var(--rw) + 10%);
  top: calc(var(--inset) + (var(--title) * 1.05 + 2px + 0.875rem * 1.7 - var(--d)) / 2);
}

.felt__content {
  position: absolute; z-index: 2;
  inset: var(--inset);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(16px, 3svh, 32px);
}
.peak__head { display: flex; align-items: center; gap: 16px; }
.peak__title {
  font-family: var(--display); font-weight: 600;
  font-size: var(--title);
  line-height: 1.05;
  text-wrap: balance;   /* on a narrow phone it takes two even lines */
}
.peak__meta { margin-top: 2px; font-size: 0.875rem; color: var(--felt-soft); text-wrap: balance; }

.peak__scenes { position: relative; min-height: 0; }
.scene {
  position: absolute; inset: 0;
  display: grid; align-content: center;
  gap: clamp(16px, 2.4svh, 28px);
}
.scene__big {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(3.25rem, 1.4rem + 6.4vw, 8.5rem);
  line-height: 1;
}
.scene__text {
  max-width: 44ch;
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.3125rem);
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}
.scene__label { font-size: clamp(0.9375rem, 0.9rem + 0.3vw, 1.125rem); color: var(--felt-soft); }

/* scene b: the line */
.scene--b { grid-template-columns: minmax(0, 1fr); align-content: center; }
.ladder { position: relative; height: clamp(192px, 30svh, 300px); max-width: 32rem; }
.ladder__zone {
  position: absolute; left: 0;
  font-size: 0.875rem; color: var(--felt-soft);
}
.ladder__zone--in { top: 0; }
.ladder__zone--out { bottom: 0; }
/* The line carries its label at the far end, level with it, so a chip of any
   width passes above or below the label instead of into it. */
.ladder__rule {
  position: absolute; left: 0; right: 0; top: calc(50% - 8px); height: 16px;
  display: flex; align-items: center; gap: 12px;
}
.ladder__line {
  flex: 1; min-width: 0;
  height: 2px;
  background: var(--ink);
  transform-origin: 0 50%;
}
.ladder__tag {
  font-size: 0.8125rem; line-height: 1; color: var(--felt-soft);
  white-space: nowrap;
}
.chip {
  position: absolute; left: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px 8px 12px;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.4);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.14);
  white-space: nowrap;
}
.chip--long { top: calc(50% - 60px); }
.chip--kien { top: calc(50% + 16px); box-shadow: 0 0 0 1.5px var(--accent); }
.chip__name { font-weight: 500; color: var(--ink); }
.chip__rank { font-size: 0.875rem; color: var(--felt-soft); }
.cue--chip { --d: 18px; }

.conds { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.cond {
  display: grid; grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px; align-items: start;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  line-height: 1.5;
}
.cond__mark {
  position: relative;
  width: 22px; height: 22px; margin-top: 2px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--felt-soft);
}
.cond__mark::after {
  content: ""; position: absolute; inset: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(var(--k, 1));
}
.conds__done { margin-top: 16px; font-weight: 500; }
@media (min-width: 1024px) {
  .scene--b {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(32px, 5vw, 96px);
  }
}

/* scenes c, d: scoreboards */
.scene--c, .scene--d { justify-items: center; text-align: center; }
.score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 2vw, 32px);
  width: 100%;
}
.score__name { font-size: clamp(1rem, 0.9rem + 0.6vw, 1.5rem); font-weight: 500; }
.score__name:first-child { text-align: right; }
.score__name:last-child { text-align: left; }
.score__n, .score__sep {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(5rem, 2rem + 11vw, 14rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score__sep { color: var(--felt-soft); font-weight: 500; }
/* his side of the board is lit in the yellow, the other side stays chalk */
.score__n--win { color: var(--accent); }
.roll { display: inline-block; height: 1em; overflow: hidden; }
.roll__track { display: flex; flex-direction: column; }
.roll__track > span { display: block; height: 1em; line-height: 1; }
.caps { position: relative; width: min(100%, 40rem); min-height: 5.2em; }
.cap {
  position: absolute; left: 0; right: 0; top: 0;
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.3125rem);
  line-height: 1.6;
}

/* scene e: the number */
.scene--e { justify-items: start; }
.prize {
  display: flex; align-items: baseline; gap: 0.16em;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(3.4rem, 1rem + 9.6vw, 12.5rem);
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.prize__u { font-size: 0.46em; }
.quote { max-width: 40rem; }
/* the opening mark hangs in the margin, so the words line up with the text above */
.quote p { font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem); line-height: 1.5; color: var(--ink); text-indent: -0.37em; }
.quote footer { margin-top: 8px; font-size: 0.875rem; color: var(--felt-soft); }
.scene__photo { display: none; }
@media (min-width: 1024px) {
  .scene__photo.is-loaded {
    display: block;
    position: absolute; right: 0; top: 50%;
    width: min(30%, 340px);
    translate: 0 -50%;
  }
  .scene__photo .photo__cap { color: var(--felt-soft); }
}

@media (max-width: 860px) {
  .felt { --rw: 12px; --pk: 24px; }
  .pocket--tm { left: calc(var(--rw) - var(--pk) * 0.7); top: calc(50% - var(--pk) / 2); }
  .pocket--bm { left: auto; right: calc(var(--rw) - var(--pk) * 0.7); bottom: calc(50% - var(--pk) / 2); }
  .sights { background-size: 25% 100%; }
  /* centred while a scene fits; a scene taller than the cloth starts at the top instead */
  .scene { align-content: start; align-content: safe center; padding-top: 8px; }
  .score { grid-template-columns: auto auto auto; grid-template-areas: "a . b" "n1 s n2"; row-gap: 8px; justify-content: center; }
  .score__name:first-child { grid-area: a; text-align: center; }
  .score__name:last-child { grid-area: b; text-align: center; }
  .score > .score__n:nth-of-type(2) { grid-area: n1; }
  .score > .score__sep { grid-area: s; }
  .score > .score__n:nth-of-type(4) { grid-area: n2; }
  .ladder { height: 180px; }
}
/* A narrow phone has no room beside the heading, so the 9 waits near the
   bottom corner, clear of the text. */
@media (max-width: 639px) {
  .felt__nine { right: calc(var(--rw) + 12%); top: auto; bottom: calc(var(--rw) + 5%); }
}
/* Short phones, and any short landscape screen. The ladder drops its zone
   labels and the ranks inside the chips (the tag still names the line, and
   the text gives both places), and the type tightens, so scene b fits the
   cloth. */
@media (max-width: 860px) and (max-height: 720px), (max-height: 500px) and (orientation: landscape) {
  .ladder { height: 112px; }
  .ladder__zone, .chip__rank { display: none; }
  .chip { padding: 6px 12px 6px 8px; }
  .chip--long { top: calc(50% - 48px); }
  .chip--kien { top: calc(50% + 8px); }
  .scene { gap: 12px; }
  .scene__text, .cond { font-size: 0.9375rem; line-height: 1.45; }
  .conds { margin-top: 8px; gap: 8px; }
  .conds__done { margin-top: 8px; }
}
/* Short landscape screens. The name is set from the height and the lede runs
   wider in two lines, so both fit the first screen. On the cloth the line
   sits beside its text, the score keeps one row, and the big figures are set
   from the height, so every scene fits a short, wide table. */
@media (max-height: 500px) and (orientation: landscape) {
  .hero__title { font-size: 20svh; }
  .hero__lede { max-width: 48rem; font-size: 0.9375rem; line-height: 1.55; }
  .scene { gap: 8px; padding-top: 0; }
  .scene__text { max-width: 64ch; }
  .scene--b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; column-gap: 32px; }
  .score { grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr); grid-template-areas: none; row-gap: 0; }
  .score__name:first-child, .score__name:last-child,
  .score > .score__n:nth-of-type(2), .score > .score__sep, .score > .score__n:nth-of-type(4) { grid-area: auto; }
  .score__name:first-child { text-align: right; }
  .score__name:last-child { text-align: left; }
  .score__n, .score__sep { font-size: 26svh; }
  .cap { font-size: 0.9375rem; line-height: 1.45; }
  .caps { min-height: 4.4em; }
  .prize { font-size: 20svh; }
  .quote p { font-size: 1rem; }
  .scene__big { font-size: 16svh; }
}

/* ----------------------------------------------------------- reduced motion
   The engine already stills cues and reveals; the page script stills its
   own layer.  */
@media (prefers-reduced-motion: reduce) {
  .skip { transition: none; }
}
