/* The story page. Dark only: the design is built around amber light on a dark ground. */

:root {
  color-scheme: dark;
  --ground: #08090a;
  --surface: #101113;
  --raised: #16181b;
  --ink: #f4f5f6;
  --ink-2: #a1a7b0;
  --ink-3: #7c828c;
  --ignored: #62676f;
  --idbd: #ffb547;
  --lms: #5b8def;
  --you: #c792ea;
  --hairline: rgb(255 255 255 / 0.08);
  --hairline-2: rgb(255 255 255 / 0.12);
  --hairline-3: rgb(255 255 255 / 0.14);
  --sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --radius-card: 16px;
  --radius-tile: 12px;
  --radius-control: 10px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 150ms var(--ease);
}

a:hover {
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--ground);
  border-radius: 8px;
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 24px;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.muted {
  color: var(--ink-2);
}

.faint {
  color: var(--ink-3);
}

.small {
  font-size: 13px;
}

.strong {
  font-weight: 500;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgb(8 9 10 / 0.8);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--hairline);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding-block: 4px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  font-size: 14px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (max-width: 640px) {
  .header-row {
    flex-wrap: nowrap;
  }

  .nav {
    gap: 0 16px;
  }

  .nav .wide-only {
    display: none;
  }

  .hero {
    min-height: 0;
    gap: 32px;
  }
}

/* ---------- type ---------- */

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  max-width: 16ch;
}

h2 {
  font-size: clamp(32px, 4.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 20ch;
}

h2.display {
  font-size: clamp(34px, 5.6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 18ch;
}

p {
  margin: 0;
}

.lede {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--ink-2);
  max-width: 34em;
}

.chapter-copy p:not(.eyebrow) {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
}

.chapter-copy p.small {
  font-size: 14px;
}

/* ---------- buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-control);
  border: 1px solid var(--hairline-3);
  background: rgb(255 255 255 / 0.03);
  color: var(--ink);
  font: 500 15px var(--sans);
  cursor: pointer;
  transition:
    background 150ms var(--ease),
    border-color 150ms var(--ease);
}

.button:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 0.07);
}

.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ground);
  font-weight: 600;
}

.button.primary:hover {
  background: #ffffff;
}

.button.small {
  font-size: 14px;
  padding: 0 16px;
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
}

/* ---------- cards ---------- */

.card {
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card .card {
  background: var(--raised);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--ink-2);
}

.key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12px;
  color: var(--ink-2);
}

.key > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 12px;
  height: 2px;
  display: inline-block;
}

.swatch-actual {
  background: var(--ink);
  opacity: 0.55;
}

.swatch-idbd {
  background: var(--idbd);
}

.swatch-lms {
  background: var(--lms);
}

.swatch-you {
  background: var(--you);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.dot-idbd {
  background: var(--idbd);
  box-shadow: 0 0 8px var(--idbd);
}

/* ---------- lines ---------- */

svg polyline,
svg path {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-actual {
  stroke: var(--ink);
  stroke-opacity: 0.55;
  stroke-width: 1.5;
}

.line-idbd {
  stroke: var(--idbd);
  stroke-width: 2;
}

.line-lms {
  stroke: var(--lms);
  stroke-width: 2.2;
}

.line-lms.thin {
  stroke-width: 1.8;
}

.line-you {
  stroke: var(--you);
  stroke-width: 1.8;
  stroke-dasharray: 5 3;
}

.marker {
  stroke: rgb(255 255 255 / 0.4);
  stroke-dasharray: 3 4;
}

.zero {
  stroke: var(--hairline);
}

.changes {
  stroke: rgb(255 255 255 / 0.22);
  stroke-dasharray: 2 4;
}

/* ---------- hero ---------- */

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 48px;
  padding-block: clamp(24px, 5vw, 56px) 24px;
}

.hero-copy {
  flex: 1 1 400px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-visual {
  flex: 1 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.house {
  position: relative;
  aspect-ratio: 660 / 440;
  width: 100%;
}

.house-3d,
.house-2d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.house-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.house-2d .floor {
  fill: var(--surface);
  stroke: var(--hairline);
}

.house-2d .wall-r {
  fill: var(--raised);
  stroke: var(--hairline);
}

.house-2d .wall-l {
  fill: #131417;
  stroke: var(--hairline);
}

.house-2d .window {
  fill: rgb(255 181 71 / 0.1);
  stroke: rgb(255 181 71 / 0.45);
}

.house-2d .door {
  fill: #1a1c20;
  stroke: rgb(255 255 255 / 0.16);
}

.house-2d .block-top {
  fill: #26292e;
}

.house-2d .block-left {
  fill: #1d2024;
}

.house-2d .block-right {
  fill: #17191c;
}

.house-2d .label {
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 640px) {
  .house-2d .label,
  .house-2d .leader {
    display: none;
  }
}

.hero-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-cards .card {
  flex: 1 1 240px;
  min-width: 0;
  padding: 12px 16px;
  gap: 8px;
  font-size: 13px;
}

.legend {
  justify-content: center;
}

.legend strong {
  font-weight: 500;
}

.spark {
  width: 100%;
  height: 44px;
}

/* ---------- chapters ---------- */

.chapter {
  padding-block: clamp(32px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 64px;
  align-items: center;
}

.split.end {
  align-items: end;
  justify-content: space-between;
}

.chapter > .split,
.split > * {
  min-width: 0;
}

.chapter.split {
  flex-direction: row;
}

.chapter-copy {
  flex: 1 1 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chapter-copy.wide {
  flex-basis: 520px;
  max-width: 760px;
}

.chapter-figure {
  flex: 1 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-2);
  font-family: var(--mono);
  font-size: 12px;
}

.chip.muted {
  color: var(--ink-2);
}

.sensor-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.sensor-grid li {
  padding: 12px 12px 8px;
  border-radius: var(--radius-tile);
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sensor-grid .name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.sensor-grid .unknown {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--hairline-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

.sensor-grid svg {
  width: 100%;
  height: 36px;
}

.sensor-grid polyline {
  stroke: var(--ink-3);
  stroke-width: 1.5;
}

.figure-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.statement {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.statement p:not(.eyebrow) {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 36em;
}

.two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}

.figure {
  margin: 0;
}

.figure svg {
  width: 100%;
  height: auto;
}

.figure figcaption {
  font-size: 14px;
  color: var(--ink-2);
}

.axis-note {
  display: flex;
  justify-content: space-between;
  color: var(--ink-2);
}

.lms {
  color: var(--lms);
}

.idbd {
  color: var(--idbd);
}

.rule-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

.big {
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.35;
  letter-spacing: -0.015em;
  max-width: 30em;
}

.instrument {
  margin: 0;
  padding: 32px 24px 24px;
  gap: 24px;
}

.desk {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 24px 8px;
  align-items: end;
}

@media (max-width: 640px) {
  .desk {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fader {
    height: 140px !important;
  }
}

.desk li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fader {
  position: relative;
  width: 100%;
  height: 240px;
  display: flex;
  justify-content: center;
}

.fader .track {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--hairline);
}

.fader .fill {
  position: absolute;
  bottom: 0;
  width: 6px;
  border-radius: 3px;
  background: var(--ignored);
  transition: height 600ms var(--ease);
}

.fader .knob {
  position: absolute;
  width: 28px;
  height: 12px;
  margin-bottom: -6px;
  border-radius: 4px;
  background: #1d2024;
  border: 1px solid rgb(255 255 255 / 0.16);
  transition: bottom 600ms var(--ease);
}

.desk li.relevant .fill {
  background: var(--idbd);
  box-shadow: 0 0 18px rgb(255 181 71 / 0.55);
}

.desk li.relevant .knob {
  border-color: rgb(255 181 71 / 0.7);
}

.desk .fader-label {
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-2);
  min-height: 32px;
}

.desk li.relevant .fader-label {
  color: var(--ink);
}

.desk .fader-label .mono {
  font-size: 11px;
  color: var(--ink-3);
}

.band {
  background: var(--surface);
  border-block: 1px solid var(--hairline);
}

.band-figure {
  margin: 0 auto;
  padding-block: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lanes {
  display: grid;
  grid-template-columns: minmax(96px, 140px) minmax(0, 1fr) 64px;
  gap: 12px 16px;
  align-items: center;
  font-size: 13px;
}

.lanes svg {
  width: 100%;
  height: 20px;
  display: block;
}

.lanes .lane-ground {
  fill: var(--raised);
}

.lanes .lane-on {
  fill: var(--idbd);
}

.lanes .speed {
  font-family: var(--mono);
  color: var(--ink-2);
  text-align: right;
}

.lanes .inert {
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .lanes {
    grid-template-columns: minmax(0, 1fr) 56px;
    row-gap: 4px;
  }

  .lanes > .lane-name {
    grid-column: 1 / -1;
    margin-top: 8px;
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
}

.stat {
  padding: 16px;
  border-radius: var(--radius-tile);
  background: var(--raised);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.stat .value {
  font-size: 28px;
}

.stats p {
  grid-column: 1 / -1;
  line-height: 1.6;
  max-width: 75ch;
}

.stats a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2.5px;
  text-decoration-thickness: 1px;
}

/* ---------- game ---------- */

.scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 520px) {
  .scores {
    grid-template-columns: minmax(0, 1fr);
  }
}

.score {
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 150ms var(--ease);
}

.score .who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.score .who i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.score .value {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: -0.02em;
}

.score .note {
  font-size: 12px;
  color: var(--ink-3);
}

/* Two lines for the name and description, so every bar sits on one baseline. */

.failure {
  padding: 12px 16px;
  border-radius: var(--radius-tile);
  border: 1px solid rgb(255 120 120 / 0.5);
  color: #ffb4b4;
}

/* ---------- advanced and footer ---------- */

.advanced-card {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
}

.advanced-card > div {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 620px;
}

.advanced-card p:not(.eyebrow) {
  color: var(--ink-2);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  padding-block: 20px 32px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-3);
}

/* ---------- what it does ---------- */

h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.loop {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
}

.loop li p {
  color: var(--ink-2);
  font-size: 15px;
}

.loop .step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--hairline-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}

.loop .highlight {
  border-color: rgb(255 181 71 / 0.45);
  background: rgb(255 181 71 / 0.05);
}

.loop .highlight .step {
  border-color: rgb(255 181 71 / 0.6);
  color: var(--idbd);
}

.loop .card,
.loop .step {
  transition:
    border-color 300ms ease,
    background-color 300ms ease,
    color 300ms ease;
}

.loop .loop-live {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 13px;
  min-height: 3.2em;
}

.loop-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.loop-bar p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .loop .card,
  .loop .step {
    transition: none;
  }
}

/* ---------- slow motion ---------- */

.slow {
  gap: 20px;
}

.slow-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat-block {
  padding: 16px;
  border-radius: var(--radius-tile);
  background: var(--raised);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.stat-block .value {
  font-size: 28px;
}

.slow-summary {
  font-size: 16px;
  line-height: 1.6;
  max-width: 60em;
}

.table-scroll {
  overflow-x: auto;
}

.slow-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}

.slow-table th,
.slow-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.slow-table thead th {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.slow-table tbody th {
  font-weight: 500;
}

.slow-table tr.relevant th::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--idbd);
}

.slow-table td {
  font-family: var(--mono);
  font-size: 13px;
}

.slow-table td.up {
  color: var(--idbd);
}

.slow-table td.down {
  color: var(--ink-2);
}

.slow-table svg {
  width: 120px;
  height: 24px;
  display: block;
}

.slow-table polyline {
  stroke: var(--ink-3);
  stroke-width: 1.5;
}

.slow-table tr.relevant polyline {
  stroke: var(--idbd);
}

/* ---------- play ---------- */

/* In a vertical chapter the copy's flex-basis would set its height, not its width. */
.chapter:not(.split) > .chapter-copy {
  flex: none;
}

.chart-label {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--ink-3);
}

.score .prefix {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ---------- sensors in the house ---------- */

.sensor-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
}

.house-labels {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.house-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgb(8 9 10 / 0.72);
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.house-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}

@media (max-width: 640px) {
  .house-label {
    font-size: 10px;
    padding: 1px 6px;
  }
}

.house-2d .attention {
  fill: none;
  stroke: var(--idbd);
  stroke-width: 2;
  transition: r 600ms var(--ease);
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.9;
  }
}

.house-2d .led-glow {
  animation: blink 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .house-2d .led-glow {
    animation: none;
    opacity: 0.6;
  }
}

/* ---------- review fixes ---------- */

.mono.small {
  font-size: 12px;
}

.scroll-hint {
  display: none;
  font-size: 12px;
}

@media (max-width: 700px) {
  .scroll-hint {
    display: block;
  }

}

.slow-table td.flat {
  color: var(--ink-3);
}

.sensor-grid .unknown {
  border: none;
  width: auto;
}

.figure .key {
  margin-top: -4px;
}

/* ---------- second review ---------- */

.axis-note {
  display: grid;
  grid-template-columns: 1fr 4fr;
}

.axis-after {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.hero-cards > .card {
  justify-content: flex-start;
}

.legend > span {
  display: grid;
  grid-template-columns: 8px 1fr;
  column-gap: 8px;
  align-items: baseline;
}

.legend .dot {
  margin-right: 0;
}

.site-footer {
  position: relative;
  border-top: 0;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 24px auto;
  border-top: 1px solid var(--hairline);
}

.slow-table tbody tr:last-child td,
.slow-table tbody tr:last-child th {
  border-bottom: 0;
}

.slow-table th:first-child,
.slow-table td:first-child {
  padding-left: 0;
}

.stat,
.stat-block {
  border: 1px solid rgb(255 255 255 / 0.06);
}

.split {
  align-items: start;
}

@media (min-width: 900px) {
  .split:has(+ .instrument) > .chapter-copy:last-child {
    padding-top: 36px;
  }
}

@media (max-width: 640px) {
  .slow-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {

  .reveal .card-head {
    flex-direction: column;
    align-items: stretch;
  }
}

.house-2d .label-chip {
  fill: rgb(8 9 10 / 0.72);
  stroke: var(--hairline);
}

/* ---------- background ---------- */

/* Soft light behind the hero: warm where the house sits, cool to its left. It scrolls
   away with the hero, so the chapters below stay on the plain ground. */
main {
  position: relative;
  isolation: isolate;
}

main::before {
  content: "";
  position: absolute;
  inset: -120px 0 auto;
  height: 1100px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42rem 30rem at 72% 28%, rgb(255 181 71 / 0.11), transparent 70%),
    radial-gradient(36rem 26rem at 12% 8%, rgb(91 141 239 / 0.08), transparent 70%),
    radial-gradient(30rem 22rem at 90% 70%, rgb(199 146 234 / 0.05), transparent 70%);
}

/* A faint cool glow behind the game, where the three players meet. */
#play {
  position: relative;
}

#play::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(50rem 30rem at 50% 30%, rgb(91 141 239 / 0.06), transparent 70%);
}

/* Fine grain over the whole page, so the dark ground does not look flat. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-transparency: reduce) {
  body::after {
    display: none;
  }
}

/* ---------- three-way switches ---------- */

.site-header {
  scroll-margin-top: 0;
}

main section {
  scroll-margin-top: 64px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- five-stop sliders ---------- */

.stop-row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(0, 1fr) 104px;
  column-gap: 16px;
  align-items: center;
}

/* The stop names, once, above the rails, each over its stop. The thumb's centre runs from
   9 px to 9 px short of each end, so the ticks are inset by half the thumb. */
.stop-scale {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(0, 1fr) 104px;
  column-gap: 16px;
  font-size: 12px;
  color: var(--ink-3);
}

.stop-ticks {
  position: relative;
  height: 18px;
  margin: 0 9px;
}

.stop-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.stop-row label {
  font-size: 14px;
}

.stop-row output {
  font-size: 13px;
  text-align: right;
  color: var(--ink-2);
}

.stop-row output[data-mark="warms"] {
  color: #fdba74;
}

.stop-row output[data-mark="cools"] {
  color: #7dd3fc;
}

.stop-input {
  --lo: 50%;
  --hi: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.stop-input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--hairline-2) var(--lo), var(--you) var(--lo), var(--you) var(--hi), var(--hairline-2) var(--hi));
}

.stop-input::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--hairline-2) var(--lo), var(--you) var(--lo), var(--you) var(--hi), var(--hairline-2) var(--hi));
}

.stop-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--you);
}

.stop-input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--you);
}

@media (max-width: 600px) {
  .stop-scale {
    display: none;
  }

  .stop-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0;
  }

  .stop-row label {
    grid-row: 1;
    grid-column: 1;
  }

  .stop-row output {
    grid-row: 1;
    grid-column: 2;
  }

  .stop-row .stop-input {
    grid-row: 2;
    grid-column: 1 / -1;
  }
}

/* The sliders take the full width so the rails are long; scores sit beside the chart. */

/* ---------- third review ---------- */

.live-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.house-key {
  display: none;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.house-key li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 640px) {
  .house + .house-key {
    display: flex;
  }

  /* Twelve labels would cover the 3D house on a phone, so the key below names the colors. */
  .house-labels {
    display: none;
  }

  .lanes .lane-spacer {
    display: none;
  }

  .stat-block .value {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .house-2d .attention {
    transition: none;
  }
}

.legend > .legend-note {
  display: block;
  padding-left: 16px;
}

.eyebrow-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-links {
  display: flex;
  flex-direction: column;
}

/* GitHub and crates.io links as two-part pills, like the README's badges. */
.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-badge {
  display: inline-flex;
  align-items: stretch;
  min-height: 32px;
  border: 1px solid var(--hairline-3, rgb(255 255 255 / 0.14));
  border-radius: 999px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  transition: border-color 150ms ease;
}

.project-badge:hover {
  border-color: rgb(255 255 255 / 0.32);
}

.project-badge-label,
.project-badge-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
}

.project-badge-label {
  background: var(--raised, #16181b);
  color: var(--ink-2, #a1a7b0);
}

.project-badge-value {
  background: var(--surface, #101113);
  color: var(--ink, #f4f5f6);
  font-family: var(--mono, ui-monospace, monospace);
  border-left: 1px solid var(--hairline-3, rgb(255 255 255 / 0.14));
}

.project-badge:hover .project-badge-label {
  color: var(--ink, #f4f5f6);
}

.project-badge svg .badge-solid {
  fill: currentColor;
}

/* ---------- family assistant ---------- */

.family {
  padding: 20px;
  gap: 12px;
  --name: 200px;
  --track-h: 34px;
}

.family-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.family-head p {
  margin: 0;
  max-width: 60ch;
}

.family-view {
  display: flex;
  gap: 8px;
}

.family-view .button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--raised);
}

.family-scale,
.lane {
  display: grid;
  grid-template-columns: var(--name) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.family-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

.family-lanes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lane-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 14px;
  line-height: 1.3;
}

.lane-note {
  font-size: 12px;
  color: var(--ink-3);
}

.lane-note:empty {
  display: none;
}

/* The day: darker before 06:00 and after 21:00, a faint warmth around noon. */
.lane-track {
  position: relative;
  height: var(--track-h);
  border-radius: 8px;
  background:
    repeating-linear-gradient(to right, transparent 0 calc(100% / 24 - 1px), rgb(255 255 255 / 0.04) calc(100% / 24 - 1px) calc(100% / 24)),
    linear-gradient(to right, #0b0c10 0 25%, #14161a 37.5%, #1a1b1d 50%, #14161a 62.5%, #0b0c10 87.5% 100%);
  border: 1px solid var(--hairline);
}

/* The sweeping "now" line while the days run. */
.family.running .lane-track::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: calc(var(--now, 0) * 100%);
  width: 2px;
  background: var(--ink);
  opacity: 0.7;
  pointer-events: none;
}

.family.revealed .lane-track::after {
  display: none;
}

.lane-you {
  position: absolute;
  bottom: 3px;
  height: 6px;
  border-radius: 3px;
  background: var(--you);
  pointer-events: none;
}

.family.revealed .lane-you {
  bottom: 0;
  height: 4px;
  border-radius: 0 0 6px 6px;
}

.lane-truth {
  position: absolute;
  inset-block: 0;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  pointer-events: none;
}

.lane-bars {
  position: absolute;
  inset: 4px 0 6px;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  align-items: end;
  gap: 1px;
  visibility: hidden;
  pointer-events: none;
}

.family.revealed .lane-bars {
  visibility: visible;
}

.lane-bars i {
  height: calc(var(--h, 0) * 100%);
  background: var(--idbd);
  opacity: 0.35;
  border-radius: 2px 2px 0 0;
  transition: height 500ms var(--ease);
}

.family[data-view="lms"] .lane-bars i {
  background: var(--lms);
}

.lane-bars i.on {
  opacity: 1;
}

/* Two range inputs share one track; only their thumbs take the pointer. */
.lane-track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}

.lane-track input[type="range"]::-webkit-slider-runnable-track {
  height: 100%;
  background: none;
}

.lane-track input[type="range"]::-moz-range-track {
  height: 100%;
  background: none;
}

.lane-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 14px;
  height: var(--track-h);
  margin-top: 0;
  border-radius: 4px;
  background: rgb(199 146 234 / 0.25);
  border: 2px solid var(--you);
  cursor: ew-resize;
}

.lane-track input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 10px;
  height: calc(var(--track-h) - 4px);
  border-radius: 4px;
  background: rgb(199 146 234 / 0.25);
  border: 2px solid var(--you);
  cursor: ew-resize;
}

.lane-track input[type="range"]:focus-visible {
  outline: none;
}

.lane-track input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.lane-track input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.family.revealed .lane-track input[type="range"],
.lane-track input[type="range"]:disabled {
  visibility: hidden;
}

.family-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.family-bar p {
  margin: 0;
}

.family-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.family-explain {
  padding: 20px;
  gap: 10px;
}

.family-explain h3 {
  margin: 0;
  font-size: 16px;
}

.family-explain p {
  margin: 0;
  max-width: 75ch;
  color: var(--ink-2);
}

.family-explain a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2.5px;
  text-decoration-thickness: 1px;
}

@media (max-width: 640px) {
  .family {
    padding: 16px;
    --track-h: 40px;
  }

  .family-scale,
  .lane {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .family-scale > span:first-child {
    display: none;
  }

  .lanes,
  .family-lanes {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lane-bars i {
    transition: none;
  }
}

.lane.empty .lane-track input[type="range"]::-webkit-slider-thumb {
  opacity: 0.45;
}

.lane.empty .lane-track input[type="range"]::-moz-range-thumb {
  opacity: 0.45;
}

.family-key {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.key-truth,
.key-bars {
  display: inline-block;
  width: 14px;
  height: 10px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
}

.key-truth {
  border: 1.5px solid var(--ink);
}

.key-bars {
  background: var(--idbd);
}

.family[data-view="lms"] .key-bars {
  background: var(--lms);
}

.family-stage {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.family-stage.running {
  grid-template-columns: minmax(0, 440px);
  justify-content: center;
}

.family-stage .family-result .scores {
  grid-template-columns: minmax(0, 1fr);
}

.family-dial {
  margin: 0;
  padding: 16px;
  gap: 8px;
}

.family-dial svg {
  width: 100%;
  height: auto;
  display: block;
}

.dial-cell {
  fill: #121316;
}

.dial-cell.night {
  fill: #0c0d10;
}

.dial-cell.shown {
  fill: var(--idbd);
  fill-opacity: calc(0.04 + var(--h, 0) * 0.35);
  transition: fill-opacity 500ms var(--ease);
}

.dial-cell.shown.on {
  fill-opacity: 1;
}

.family[data-view="lms"] ~ .family-stage .dial-cell.shown {
  fill: var(--lms);
}

.dial-truth path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.dial-you path {
  fill: none;
  stroke: var(--you);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.dial-label {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--ink-3);
}

.dial-cell.live {
  fill: var(--idbd);
  fill-opacity: calc(0.03 + var(--h, 0) * 0.8);
  transition: fill-opacity 250ms linear;
}

.dial-rim {
  fill: none;
  stroke: var(--hairline);
  stroke-width: 1;
}

.turn .dial-rim {
  animation: dial-turn 900ms var(--ease);
}

@keyframes dial-turn {
  from {
    stroke: var(--idbd);
    stroke-width: 4;
  }
}

.dial-tick {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.dial-trail path {
  fill: var(--idbd);
  fill-opacity: 0.16;
}

.dial-hand {
  stroke: var(--idbd);
  stroke-width: 2;
  stroke-linecap: round;
}

.dial-tip {
  fill: var(--idbd);
}

.dial-pip {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.2;
}

.dial-pip.done {
  fill: var(--ink-2);
  stroke: var(--ink-2);
}

.dial-pip.now {
  fill: var(--idbd);
  stroke: var(--idbd);
}

.dial-day {
  font-size: 16px;
  font-weight: 500;
  fill: var(--ink);
}

.dial-time {
  font-family: var(--mono);
  font-size: 12px;
  fill: var(--ink-2);
}

@media (max-width: 900px) {
  .family-stage,
  .family-stage.running {
    grid-template-columns: minmax(0, 1fr);
  }

  .family-dial {
    max-width: 440px;
    width: 100%;
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dial-cell.shown,
  .dial-cell.live {
    transition: none;
  }

  .turn .dial-rim {
    animation: none;
  }
}
