/* guru.blends · Raw Materials-led direction
   The chapter key is a fade: a steel value ramp from skin (light) to length (ink),
   broken once by the Showtime signal. Type: Climate Crisis (display moments only),
   Spline Sans Mono (navigation, data, measurement), Atkinson Hyperlegible Next (reading). */

@font-face {
  font-family: "Climate Crisis";
  src: url("fonts/climate-crisis-year.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Spline Sans Mono";
  src: url("fonts/spline-sans-mono-wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #101314;
  --white: #ffffff;
  --signal: #d0f53b;
  /* the fade: 00 skin → 07 length */
  --c0: #edf0f0;
  --c1: #d2d8da;
  --c2: #b4bdc0;
  --c3: #929da1;
  --c4: #5f6a6e;
  --c5: #3c4549;
  --c6: var(--signal);
  --c7: #101314;
  --row: #1b2022;
  --row-open: #262d30;
  --row-edge: #3c4549;

  --display: "Climate Crisis", "Arial Black", "Helvetica Neue", sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --read: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --r: 6px;
  --rail-w: 13.5rem;
  --dock: 0px;
  --pad-x: clamp(20px, 4vw, 56px);

  color-scheme: light;
}

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

html {
  background: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 12px;
  scrollbar-color: var(--c4) var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--read);
  font-synthesis: none;
  caret-color: currentColor;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }

img { display: block; max-width: 100%; height: auto; }

p, h1, h2, h3, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, dd, li { text-wrap: pretty; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 3px solid var(--focus, var(--ink)); outline-offset: 3px; }
main:focus { outline: none; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.i {
  width: 1.25em;
  height: 1.25em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 12px 18px;
  border-radius: var(--r);
  background: var(--signal);
  color: var(--ink);
  font: 700 1rem/1 var(--read);
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

/* ---------- chapter fields ---------- */
.ch--0, .tab--0 { --bg: var(--c0); --fg: var(--ink); --focus: var(--ink); --cms-bg: color-mix(in srgb, var(--ink) 9%, var(--c0)); --cut: 1979; }
.ch--1, .tab--1 { --bg: var(--c1); --fg: var(--ink); --focus: var(--ink); --cms-bg: color-mix(in srgb, var(--ink) 9%, var(--c1)); --cut: 1979; }
.ch--2, .tab--2 { --bg: var(--c2); --fg: var(--ink); --focus: var(--ink); --cms-bg: color-mix(in srgb, var(--ink) 9%, var(--c2)); --cut: 1987; }
.ch--3, .tab--3 { --bg: var(--c3); --fg: var(--ink); --focus: var(--ink); --cms-bg: color-mix(in srgb, var(--ink) 10%, var(--c3)); --cut: 1994; }
.ch--4, .tab--4 { --bg: var(--c4); --fg: var(--white); --focus: var(--signal); --cms-bg: color-mix(in srgb, var(--ink) 32%, var(--c4)); --cut: 2001; }
.ch--5, .tab--5 { --bg: var(--c5); --fg: var(--white); --focus: var(--signal); --cms-bg: color-mix(in srgb, var(--ink) 34%, var(--c5)); --cut: 2008; }
.ch--6, .tab--6 { --bg: var(--c6); --fg: var(--ink); --focus: var(--ink); --cms-bg: color-mix(in srgb, var(--ink) 9%, var(--c6)); --cut: 1979; }
.ch--7, .tab--7, .colophon { --bg: var(--c7); --fg: var(--white); --focus: var(--signal); --cms-bg: color-mix(in srgb, var(--white) 11%, var(--c7)); --cut: 2014; }

.to--1 { --nbg: var(--c1); --nfg: var(--ink); }
.to--2 { --nbg: var(--c2); --nfg: var(--ink); }
.to--3 { --nbg: var(--c3); --nfg: var(--ink); }
.to--4 { --nbg: var(--c4); --nfg: var(--white); }
.to--5 { --nbg: var(--c5); --nfg: var(--white); }
.to--6 { --nbg: var(--c6); --nfg: var(--ink); }
.to--7 { --nbg: var(--c7); --nfg: var(--white); }

/* ---------- frame: rail + deck ---------- */
.frame {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.deck { min-width: 0; }

.ch {
  position: relative;
  container-type: inline-size;
  padding: 48px var(--pad-x) 40px;
  background: var(--bg);
  color: var(--fg);
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
}

/* ---------- the rail: stacked, color-keyed chapter cards ---------- */
.rail {
  --focus: var(--signal);
  position: sticky;
  top: 0;
  z-index: 10;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  height: 100dvh;
  padding: 12px 10px 12px 12px;
  background: var(--ink);
}

.rail-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-list > li {
  flex: 1 1 0;
  display: flex;
  min-height: 44px;
  transition: flex-grow 0.45s var(--ease-out);
}
.rail-list > li:has(> .tab[aria-current]) { flex-grow: 2.4; }

.tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 8px 26px 9px 12px;
  border: 2px solid transparent;
  border-radius: var(--r);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.tab--7 { --bg: #283033; }
.tab:hover:not([aria-current]) {
  background: transparent;
  color: var(--white);
  border-color: var(--bg);
}
.tab--7:hover:not([aria-current]) { border-color: var(--c4); }

.tab-n {
  font: 500 0.75rem/1.35 var(--mono);
  font-variant-numeric: tabular-nums;
}
.tab-l {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 500 0.9375rem/1.35 var(--mono);
  white-space: nowrap;
}
.tab[aria-current] .tab-l { font-weight: 700; }

.tab-dot {
  position: absolute;
  top: calc(12px + (100% - 32px) * var(--p, 0));
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.tab[aria-current] .tab-dot { opacity: 1; }

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--signal);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tab-count[hidden] { display: none; }
.tab-count.is-bumped { animation: bump 0.5s var(--ease-out); }
@keyframes bump {
  from { transform: scale(1.35); }
  to { transform: scale(1); }
}

.rail-book { display: none; }

/* ---------- shared pieces ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--r);
  font: 700 1rem/1.35 var(--read);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn .i { transition: transform 0.3s var(--ease-out); }
.btn:hover .i { transform: translateX(3px); }

.btn--signal { background: var(--signal); color: var(--ink); }
.btn--signal:hover { background: var(--ink); color: var(--signal); border-color: var(--ink); }
.ticket .btn--signal:hover { background: transparent; color: var(--signal); border-color: var(--signal); }


.btn--line { background: transparent; color: var(--fg); border-color: currentColor; }
.btn--line:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--fg); border-color: currentColor; }
.btn:disabled:hover .i { transform: none; }

.next {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-top: clamp(48px, 7cqi, 88px);
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--nbg);
  color: var(--nfg);
  font: 500 0.875rem/1.35 var(--mono);
  text-decoration: none;
}
.next-ch { font-weight: 700; }
.next-n { margin-left: auto; font-variant-numeric: tabular-nums; }
.next .i { transition: transform 0.3s var(--ease-out); }
.next:hover .i { transform: translateY(3px); }

.cms {
  padding: 0.32em 0.62em;
  border-radius: 3px;
  background: var(--cms-bg);
  font: 500 0.875rem/2.05 var(--mono);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.cms b { margin-right: 0.4em; font-weight: 700; }

.block-h {
  margin: 0 0 14px;
  font: 700 clamp(1.25rem, 2.1cqi, 1.625rem)/1.35 var(--read);
  letter-spacing: -0.01em;
}

.ch-intro {
  max-width: 46ch;
  margin-bottom: clamp(28px, 4cqi, 44px);
  font: 400 clamp(1.125rem, 1.8cqi, 1.375rem)/1.45 var(--read);
}

/* toggles: native checkboxes that collect material for Showtime */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 16px 9px 10px;
  border: 2px solid currentColor;
  border-radius: var(--r);
  font: 600 0.9375rem/1.35 var(--read);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle-box {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 4px;
}
.toggle-box .i { width: 16px; height: 16px; stroke-width: 3; opacity: 0; }
.toggle:hover { background: color-mix(in srgb, var(--fg) 12%, transparent); }
.toggle:has(input:checked) { background: var(--signal); color: var(--ink); border-color: var(--signal); }
.toggle:has(input:checked) .toggle-box .i { opacity: 1; }
.toggle:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.toggle--sm { min-height: 40px; padding: 8px 12px 8px 8px; font-size: 0.875rem; }

/* ---------- 00 · stage ---------- */
.stage {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3.4cqi, 40px);
  min-height: 100vh;
  min-height: 100svh;
}

.stage-facts {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font: 500 clamp(1rem, 1.7cqi, 1.375rem)/1.35 var(--read);
}

.fade {
  --fs: clamp(2.1rem, calc((100cqi - 8rem) / 8.6), 6rem);
  display: grid;
  grid-template-columns: max-content auto;
  justify-content: start;
  align-items: start;
  gap: 0 clamp(16px, 2.4cqi, 32px);
  margin-block: auto;
}

.fade-mark {
  display: grid;
  font-family: var(--display);
  font-size: var(--fs);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0;
}
.fm-line {
  display: block;
  margin: 0;
  font: inherit;
  white-space: nowrap;
  font-variation-settings: "YEAR" var(--to);
}
.fm-1 { --to: 1979; --i: 3; }
.fm-2 { --to: 2003; --i: 2; }
.fm-3 { --to: 2027; --i: 1; }
.fm-4 { --to: 2050; --i: 0; }

.fade-key {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 500 0.8125rem/1.35 var(--mono);
}
.fade-key li {
  display: flex;
  align-items: center;
  height: calc(var(--fs) * 0.9);
}

@media (prefers-reduced-motion: no-preference) {
  .js .fade-mark:not(.is-cutting) .fm-line { font-variation-settings: "YEAR" 1979; }
  .js .fade-mark.is-cutting .fm-line {
    animation: take-down 1.6s var(--ease-out) both;
    animation-delay: calc(var(--i) * 170ms + 120ms);
  }
}
@keyframes take-down {
  from { font-variation-settings: "YEAR" 1979; }
  to { font-variation-settings: "YEAR" var(--to); }
}

.stage-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px 40px;
}
.stage-lead {
  max-width: 30ch;
  font: 500 clamp(1.125rem, 2cqi, 1.5rem)/1.35 var(--read);
}
.stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.peek-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  font: 700 1rem/1.35 var(--read);
}
.peek-link img {
  width: 44px;
  height: 58px;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.4s var(--ease-out);
}
.peek-link span { margin-left: 6px; }
.peek-link:hover img:first-child { transform: translateY(-4px) rotate(-4deg); }
.peek-link:hover img:nth-child(2) { transform: translateY(-2px) rotate(3deg); }

.replay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  font: 500 0.875rem/1.35 var(--mono);
}
.replay:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }

/* ---------- chapter plates ---------- */
.plate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "w n" "line line";
  align-items: end;
  gap: 14px 24px;
  margin-bottom: clamp(32px, 4.4cqi, 52px);
  padding-top: clamp(40px, 8cqi, 104px);
}
.plate-w {
  grid-area: w;
  font-family: var(--display);
  font-size: clamp(1.8rem, 10cqi, 6rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0;
  font-variation-settings: "YEAR" var(--cut, 1979);
}
.plate-n {
  grid-area: n;
  align-self: start;
  font: 300 clamp(1.75rem, 7cqi, 5.5rem)/0.8 var(--mono);
  font-variant-numeric: tabular-nums;
}
.plate-line {
  grid-area: line;
  max-width: 36ch;
  font: 500 clamp(1.125rem, 2.2cqi, 1.625rem)/1.35 var(--read);
}

/* ---------- 01 · cuts ---------- */
.index {
  display: grid;
  gap: 8px;
  margin: 0 0 clamp(48px, 7cqi, 88px);
  padding: 0;
  list-style: none;
}
.index-item {
  position: relative;
  isolation: isolate;
  perspective: 1100px;
}
.cut-peek {
  position: absolute;
  z-index: -1;
  top: 2px;
  right: clamp(64px, 11cqi, 150px);
  width: 54px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.55s var(--ease-out);
  pointer-events: none;
}
.index-item:has(.cut-row:hover) .cut-peek,
.index-item:has(.cut-row:focus-visible) .cut-peek {
  transform: translateY(-74%) rotate(-6deg);
}
.index-item:has(details[open]) .cut-peek { transform: none; }
body[data-state="cut-open"] .cut-peek { display: none; }

.cut-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) minmax(0, auto) 1.5rem;
  align-items: center;
  gap: 8px 20px;
  min-height: 76px;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--r);
  background: var(--row);
  color: var(--white);
  list-style: none;
  cursor: pointer;
  transform-origin: 50% 100%;
  transition: transform 0.5s var(--ease-out), background-color 0.3s ease, border-color 0.3s ease;
  --focus: var(--signal);
}
.cut-row::-webkit-details-marker { display: none; }
.cut-row::marker { content: ""; }
.cut-row:hover { transform: rotateX(10deg); }
details[open] > .cut-row { border-radius: var(--r) var(--r) 0 0; transform: none; }

.cut-n { font: 500 0.875rem/1.35 var(--mono); font-variant-numeric: tabular-nums; }
.cut-name { font: 700 clamp(1.125rem, 2cqi, 1.5rem)/1.35 var(--read); }
.cut-tags { justify-self: end; text-align: right; font: 400 0.9375rem/1.35 var(--mono); }
.cut-toggle { transition: transform 0.35s var(--ease-out); }
details[open] .cut-toggle { transform: rotate(45deg); }

.cut-row--pending {
  grid-template-columns: 2.5rem minmax(0, 1fr) minmax(0, 1.6fr);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--fg);
  cursor: default;
}
.cut-row--pending .cms { justify-self: end; }

.study {
  --fg: var(--white);
  --bg: var(--row-open);
  --focus: var(--signal);
  --cms-bg: color-mix(in srgb, var(--white) 10%, var(--row-open));
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 24px clamp(24px, 4cqi, 48px);
  padding: 24px 20px 28px;
  border-radius: 0 0 var(--r) var(--r);
  background: var(--row-open);
  color: var(--white);
}
.study-photo img {
  width: 240px;
  max-width: 100%;
  border-radius: 4px;
}
.study-photo figcaption {
  margin-top: 10px;
  font: 400 0.75rem/1.4 var(--mono);
}
.study .toggle { grid-column: 2; justify-self: start; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
}
.facts dt {
  margin-bottom: 4px;
  font: 500 0.8125rem/1.35 var(--mono);
}
.facts dd { max-width: 44ch; }

.read-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px clamp(20px, 3cqi, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.read-list li { max-width: 60ch; }
.read-list strong {
  display: block;
  margin-bottom: 4px;
  font: 700 1.125rem/1.25 var(--read);
}

/* ambient state: a study is open, the chapter drops to ink and the other cuts step back to outlines */
body[data-state="cut-open"] .ch--1 {
  --bg: var(--c7);
  --fg: var(--white);
  --focus: var(--signal);
  --cms-bg: color-mix(in srgb, var(--white) 11%, var(--c7));
}
body[data-state="cut-open"] .ch--1 details:not([open]) > .cut-row {
  background: transparent;
  border-color: var(--row-edge);
}
body[data-state="cut-open"] .ch--1 details[open] > .cut-row { background: var(--row-open); }
body[data-state="cut-open"] .ch--1 .cut-row--pending { background: transparent; border-color: var(--row-edge); }

/* ---------- 02 · craft ---------- */
.statement {
  max-width: 21ch;
  margin-bottom: clamp(48px, 8cqi, 96px);
  font: 600 clamp(1.625rem, 4.2cqi, 3rem)/1.32 var(--read);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.statement mark {
  padding: 0 0.14em;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.scale {
  --year: 2012;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  grid-template-areas: "head head" "spec read" "guards guards" "foot foot";
  align-items: end;
  gap: 20px clamp(24px, 4cqi, 56px);
  margin-bottom: clamp(48px, 7cqi, 88px);
}
.scale-head { grid-area: head; max-width: 40ch; }
.scale-head .block-h { margin-bottom: 6px; }

.specimen {
  grid-area: spec;
  font-family: var(--display);
  font-size: clamp(3.4rem, 15cqi, 6rem);
  line-height: 0.9;
  font-variation-settings: "YEAR" var(--year);
  transition: font-variation-settings 0.6s var(--ease-out);
}
.scale:has(#g-skin:checked) { --year: 2050; }
.scale:has(#g-0:checked) { --year: 2043; }
.scale:has(#g-05:checked) { --year: 2036; }
.scale:has(#g-1:checked) { --year: 2028; }
.scale:has(#g-15:checked) { --year: 2020; }
.scale:has(#g-2:checked) { --year: 2012; }
.scale:has(#g-3:checked) { --year: 2004; }
.scale:has(#g-4:checked) { --year: 1996; }
.scale:has(#g-6:checked) { --year: 1988; }
.scale:has(#g-8:checked) { --year: 1979; }

.guards {
  grid-area: guards;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.guards input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.guards label {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: var(--h);
  padding: 8px 2px 12px;
  border-radius: 4px 4px 2px 2px;
  background: color-mix(in srgb, var(--ink) 11%, transparent);
  font: 600 0.875rem/1.35 var(--mono);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.guards label:hover { background: color-mix(in srgb, var(--ink) 22%, transparent); }
.guards input:checked + label { background: var(--ink); color: var(--signal); }
.guards input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.guards label[for="g-skin"] { --h: 44px; }
.guards label[for="g-0"] { --h: 50px; }
.guards label[for="g-05"] { --h: 52px; }
.guards label[for="g-1"] { --h: 58px; }
.guards label[for="g-15"] { --h: 64px; }
.guards label[for="g-2"] { --h: 70px; }
.guards label[for="g-3"] { --h: 86px; }
.guards label[for="g-4"] { --h: 98px; }
.guards label[for="g-6"] { --h: 122px; }
.guards label[for="g-8"] { --h: 146px; }

.readouts { grid-area: read; min-height: 7.5em; }
.readout { font-size: 1.0625rem; }
.readout b { display: block; margin-bottom: 4px; font: 700 1.25rem/1.35 var(--read); }
@supports selector(:has(*)) {
  .readout { display: none; }
  .scale:has(#g-skin:checked) [data-guard="g-skin"],
  .scale:has(#g-0:checked) [data-guard="g-0"],
  .scale:has(#g-05:checked) [data-guard="g-05"],
  .scale:has(#g-1:checked) [data-guard="g-1"],
  .scale:has(#g-15:checked) [data-guard="g-15"],
  .scale:has(#g-2:checked) [data-guard="g-2"],
  .scale:has(#g-3:checked) [data-guard="g-3"],
  .scale:has(#g-4:checked) [data-guard="g-4"],
  .scale:has(#g-6:checked) [data-guard="g-6"],
  .scale:has(#g-8:checked) [data-guard="g-8"] { display: block; }
}

.scale-foot {
  grid-area: foot;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.scale-note { font: 400 0.8125rem/1.4 var(--mono); }

.upclose { max-width: 60ch; }
.upclose p + p { margin-top: 12px; }
.behind { max-width: 64rem; margin-top: clamp(48px, 7cqi, 88px); }

/* ---------- 03 · lingo ---------- */
.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin: 0 0 clamp(32px, 5cqi, 52px);
  padding: 0;
  border: 0;
}
.filter legend {
  margin-bottom: 10px;
  padding: 0;
  font: 500 0.875rem/1.35 var(--mono);
}
.filter input,
.ask-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.filter label,
.ask-options label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  font: 500 0.9375rem/1.35 var(--mono);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.filter label:hover,
.ask-options label:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.filter input:checked + label,
.ask-options input:checked + label { background: var(--ink); color: var(--bg); }
.ask-options input:checked + label { color: var(--signal); }
.filter input:focus-visible + label,
.ask-options input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 3px; }

.terms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: clamp(32px, 4cqi, 48px) clamp(20px, 3cqi, 36px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.term h3 {
  margin-bottom: 6px;
  font: 700 1.375rem/1.35 var(--read);
  letter-spacing: -0.01em;
}
.term p { max-width: 36ch; margin-bottom: 14px; }

.lingo:has(#lf-fades:checked) .term:not([data-cat="fades"]),
.lingo:has(#lf-lines:checked) .term:not([data-cat="lines"]),
.lingo:has(#lf-top:checked) .term:not([data-cat="top"]),
.lingo:has(#lf-beard:checked) .term:not([data-cat="beard"]) { display: none; }

/* ---------- 04 · process ---------- */
.steps {
  display: grid;
  gap: clamp(28px, 4cqi, 44px);
  margin-bottom: clamp(32px, 5cqi, 56px);
}
.track {
  --step: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.track::before,
.track::after {
  content: "";
  position: absolute;
  top: 21px;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--fg);
  opacity: 0.45;
}
.track::after {
  top: 20px;
  height: 4px;
  background: var(--signal);
  opacity: 1;
  transform: scaleX(calc(var(--step) * 0.2 + 0.02));
  transform-origin: left center;
  transition: transform 0.6s var(--ease-out);
}
.no-js .track::after { display: none; }
.stop {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 44px;
  padding: 12px 8px 4px 0;
  color: inherit;
  font: 500 0.9375rem/1.35 var(--mono);
  text-decoration: none;
}
.stop::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 2px solid var(--fg);
  border-radius: 50%;
  background: var(--bg);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.stop[aria-selected="true"]::before { background: var(--signal); border-color: var(--signal); }
.stop[aria-selected="true"] { font-weight: 700; }
.stop-n { font-variant-numeric: tabular-nums; }
.stop:hover { text-decoration: underline; }

.panels { display: grid; gap: 40px; }
.panel {
  display: grid;
  gap: 14px;
  max-width: 48rem;
}
.panel[hidden] { display: none; }
.panel-h { font: 700 clamp(1.5rem, 2.6cqi, 2rem)/1.35 var(--read); }
.panel-what {
  max-width: 30ch;
  font: 500 clamp(1.375rem, 3cqi, 2.125rem)/1.35 var(--read);
  letter-spacing: -0.015em;
}
.panel-you { max-width: 52ch; }
.panel-you b { margin-right: 0.4em; }

.step-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.process-time { max-width: 60ch; }

/* ---------- 05 · visit ---------- */
.visit {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(40px, 6cqi, 72px) clamp(24px, 4cqi, 56px);
}
.prep { grid-column: 1 / span 5; }
.rules { grid-column: 6 / span 7; }
.where { grid-column: 1 / -1; }

.prep-list {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: prep;
}
.prep-list li {
  max-width: 44ch;
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  font: 500 clamp(1.125rem, 2cqi, 1.375rem)/1.35 var(--read);
  counter-increment: prep;
}
.prep-list li::before {
  content: counter(prep, decimal-leading-zero);
  font: 500 0.875rem/2 var(--mono);
  font-variant-numeric: tabular-nums;
}

.facts--rules { grid-template-columns: 1fr; gap: 14px; }
.facts--rules > div {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 4px 20px;
}
.facts--where { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.facts .i { width: 1em; height: 1em; margin-left: 4px; vertical-align: -0.12em; }

/* ---------- 06 · showtime ---------- */
.booth {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(32px, 5cqi, 64px);
}
.booth-form { display: grid; gap: 36px; }
.ask { min-width: 0; margin: 0; padding: 0; border: 0; }
.ask legend { padding: 0; }
.ask-options { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-note { max-width: 60ch; margin-top: 14px; }

.collected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.collected-list:empty { display: none; }
.collected-list li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  padding: 4px 0 4px 12px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--white);
  font: 500 0.875rem/1.35 var(--mono);
}
.collected-list button {
  --focus: var(--signal);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: transparent;
}
.collected-list button:hover { color: var(--signal); }
.collected-empty { max-width: 56ch; }
.collected-empty[hidden] { display: none; }

.when textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--white);
  color: var(--ink);
  font: 400 1.0625rem/1.45 var(--read);
  resize: vertical;
}
.when textarea::placeholder { color: #505a5e; opacity: 1; }
.when label { display: block; }

.ticket {
  --fg: var(--white);
  --bg: var(--ink);
  --focus: var(--signal);
  --cms-bg: color-mix(in srgb, var(--white) 11%, var(--ink));
  padding: 32px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--white);
}
.preview {
  display: block;
  min-height: 10em;
  margin-bottom: 24px;
  color: var(--signal);
  font: 400 1rem/1.65 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview .is-new { background: color-mix(in srgb, var(--signal) 22%, transparent); transition: background-color 1.2s ease; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.status { min-height: 1.6em; margin-top: 14px; color: var(--signal); font: 500 0.9375rem/1.6 var(--mono); }
.booth-note { max-width: 62ch; margin-top: 32px; }
.nojs-book { display: none; max-width: 52ch; font-size: 1.25rem; }
.no-js .nojs-book { display: block; }
.no-js [data-js] { display: none !important; }

/* ---------- 07 · questions ---------- */
.faq {
  display: grid;
  gap: 6px;
  max-width: 62rem;
  margin-bottom: clamp(48px, 7cqi, 88px);
}
.faq details {
  border-radius: var(--r);
  background: color-mix(in srgb, var(--white) 7%, var(--c7));
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 14px 20px;
  font: 600 clamp(1.125rem, 2cqi, 1.375rem)/1.35 var(--read);
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .i { transition: transform 0.35s var(--ease-out); }
.faq details[open] summary .i { transform: rotate(45deg); }
.faq summary:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.faq-a { max-width: 65ch; padding: 0 20px 22px; }
.faq-a p + p { margin-top: 10px; }

.words { max-width: 62ch; }

.colophon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 14px clamp(24px, 4vw, 48px);
  padding: clamp(40px, 5vw, 64px) var(--pad-x) clamp(48px, 6vw, 80px);
  border-top: 1px solid var(--row-edge);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.9375rem;
}
.colophon p { max-width: 62ch; }
.colophon-id { font: 700 1.125rem/1.35 var(--read); }
.colophon .i { width: 1em; height: 1em; margin-left: 4px; vertical-align: -0.12em; }

/* ---------- container adjustments ---------- */
@container (max-width: 900px) {
  .scale { grid-template-columns: 1fr; grid-template-areas: "head" "spec" "read" "guards" "foot"; }
  .readouts { min-height: 5.5em; }
  .stage-foot { grid-template-columns: 1fr; }
  .read-list { grid-template-columns: 1fr; }
  .visit > * { grid-column: 1 / -1; }
  .booth { grid-template-columns: 1fr; }
}

@container (max-width: 720px) {
  .fade { --fs: clamp(1.9rem, calc(100cqi / 8.7), 6rem); grid-template-columns: 1fr; }
  .fade-key { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; }
  .fade-key li { height: auto; }

  .cut-row { grid-template-columns: 2rem minmax(0, 1fr) 1.5rem; }
  .cut-tags { grid-column: 2; grid-row: 2; justify-self: start; text-align: left; font-size: 0.8125rem; }
  .cut-toggle { grid-column: 3; grid-row: 1 / span 2; }
  .cut-row--pending { grid-template-columns: 2rem minmax(0, 1fr); }
  .cut-row--pending .cms { grid-column: 1 / -1; justify-self: start; }
  .cut-peek { display: none; }
  .study { grid-template-columns: 1fr; padding: 20px 16px 24px; }
  .study .toggle { grid-column: 1; }
  .facts { grid-template-columns: 1fr; }

  .scale { grid-template-columns: 1fr; grid-template-areas: "head" "spec" "read" "guards" "foot"; }
  .guards { grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 8px; }
  .guards label { height: calc(var(--h) * 0.62 + 18px); }

  .stop { font-size: 0.8125rem; }
  .facts--rules > div { grid-template-columns: 1fr; }
}

/* ---------- dock: the rail becomes a proportional chapter map under the thumb ---------- */
@media (max-width: 1023px) {
  :root { --dock: calc(64px + env(safe-area-inset-bottom)); }
  html { scroll-padding-bottom: calc(var(--dock) + 16px); }
  body { padding-bottom: var(--dock); }
  .frame { display: block; }

  .rail {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
    height: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgb(16 19 20 / 0.18);
  }
  .rail-list {
    flex-direction: row;
    gap: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .rail-list::-webkit-scrollbar { display: none; }
  .rail-list > li { flex: 0 0 var(--w, 7rem); min-height: 48px; }
  .rail-list > li:has(> .tab[aria-current]) { flex-grow: 0; }
  .tab {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 12px;
  }
  .tab-dot {
    top: auto;
    right: auto;
    bottom: 5px;
    left: calc(10px + (100% - 28px) * var(--p, 0));
    width: 6px;
    height: 6px;
  }
  .rail-book {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 48px;
    padding: 12px 14px 12px 16px;
    border-radius: var(--r);
    background: var(--signal);
    color: var(--ink);
    font: 700 1rem/1.35 var(--read);
    text-decoration: none;
  }
  body[data-chapter="showtime"] .rail-book { background: var(--white); }

  .stage { min-height: calc(100svh - var(--dock)); }
}

@media (max-width: 600px) {
  .ch { padding-top: 28px; padding-bottom: 28px; }
  .ticket { padding: 22px 20px; }
}

@media (max-width: 480px) {
  .stage-actions .btn { width: 100%; justify-content: space-between; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .cut-row:hover { transform: none; }
  .index-item:has(.cut-row:hover) .cut-peek,
  .index-item:has(.cut-row:focus-visible) .cut-peek { transform: translateY(-74%) rotate(-6deg); }
}
