:root {
  --bg: #f4efe6;
  --ink: #241c16;
  --muted: #6e6258;
  --faint: #9a8c7e;
  --line: rgba(36, 28, 22, 0.12);
  --card: #fffaf3;
  --well: #efe6da;
  --oxide: #c6532a;
  --glow-warm: #f6d9c8;
  --glow-cool: #e7efe4;
  --hair: rgba(36, 28, 22, 0.16);
  --hover: rgba(36, 28, 22, 0.05);
  --graph-line: rgba(36, 28, 22, 0.22);
  --sans: "Outfit", "Segoe UI", "Helvetica Neue", sans-serif;
  --display: "Fraunces", "Times New Roman", serif;
  --mono: "Segoe UI Mono", "Cascadia Mono", ui-monospace, monospace;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #14110e;
  --ink: #f3eadf;
  --muted: #cbbbaa;
  --faint: #8d7f72;
  --line: rgba(243, 234, 223, 0.12);
  --card: #211c17;
  --well: #2c261f;
  --oxide: #d25a34;
  --glow-warm: #4a2618;
  --glow-cool: #1a2620;
  --hair: rgba(243, 234, 223, 0.18);
  --hover: rgba(243, 234, 223, 0.06);
  --graph-line: rgba(243, 234, 223, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  background-image:
    radial-gradient(900px 420px at 0% 0%, var(--glow-warm) 0%, transparent 60%),
    radial-gradient(700px 380px at 100% 8%, var(--glow-cool) 0%, transparent 55%);
}
body.reduce *, body.reduce *::before, body.reduce *::after {
  scroll-behavior: auto !important;
}
::selection { background: rgba(198, 83, 42, 0.22); }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 8px;
}
.mark {
  text-decoration: none;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-size: 15px;
}
.top-side { display: flex; align-items: center; gap: 18px; }
.theme { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.hero { padding: 42px 0 18px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1, h2, .temper h3 {
  font-family: var(--display);
  font-weight: 500;
  font-optical-sizing: auto;
}
h1 {
  margin: 0;
  max-width: 11em;
  font-size: clamp(44px, 6.2vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.lede {
  max-width: 38rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.stage-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 36px 0 10px;
  align-items: start;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.stage { padding: 22px 22px 28px; display: flex; flex-direction: column; }
.stage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.ghost:hover { background: var(--hover); }
.ghost.hot { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 4px 4px;
}
.temper {
  background: var(--well);
  border-radius: 20px;
  padding: 18px 16px 20px;
}
.temper h3 { margin: 0; font-size: 28px; letter-spacing: -0.03em; line-height: 1; }
.temper p { margin: 8px 0 0; color: var(--muted); font-size: 14px; min-height: 2.6em; }
.temper-pair {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}
.temper-pair .stack { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.temper-pair .cap { color: var(--faint); font-size: 12px; min-height: 1em; }
.temper-acc { margin-top: 16px; }
.lean {
  margin-top: 16px;
  padding: 2px 8px 0;
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(180px, 1fr);
  gap: 4px 28px;
  align-items: end;
}
.lean h2, .look h2 { grid-column: 1 / -1; }
.lean h2, .look h2 {
  margin: 8px 8px 4px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.look {
  margin-top: 22px;
  padding: 0 8px 4px;
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(180px, 1fr);
  column-gap: 28px;
  align-items: start;
}
.look h2 { margin: 0 8px 14px; }
.look .switch-line { padding: 0 8px; align-self: start; }
.look .look-size { display: grid; gap: 8px; }
.look .look-note { margin: 0; line-height: 1.45; }
.look .actions { grid-column: 1 / -1; margin-top: 16px; padding: 14px 8px 4px; }
.stage-note {
  margin: 10px 4px 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.row {
  display: grid;
  grid-template-columns: 92px 1fr 1px 1fr;
  align-items: center;
  gap: 18px;
}
.row-name { color: var(--muted); font-size: 15px; text-align: right; letter-spacing: -0.02em; }
.row-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.row-cell .cap { color: var(--faint); font-size: 12px; min-height: 1em; }
.rule { width: 1px; height: 46px; background: var(--line); justify-self: center; }

details.group { border-top: 1px solid var(--line); }
details.group summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 8px;
  font-size: 14px;
}
details.group summary::-webkit-details-marker { display: none; }
details.group summary::after { content: "+"; color: var(--faint); }
details.group[open] summary::after { content: "–"; }
.group .inner { padding: 0 8px 12px; display: grid; gap: 10px; }
.switch-line, .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 8px 10px;
}
.actions { border-top: 1px solid var(--line); padding-top: 12px; }
.actions button, .textish {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
.actions button:hover, .textish:hover { color: var(--ink); }

.slider { display: grid; gap: 6px; }
.slider span, .switch-line span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.slider output, .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]:focus-visible { outline: 2px solid var(--oxide); outline-offset: 2px; border-radius: 6px; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--oxide) var(--p, 30%), var(--hair) var(--p, 30%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--hair); border: 0; }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--oxide); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(168px, 1fr);
  column-gap: 42px;
  align-items: start;
}
.foot {
  grid-column: 1 / -1;
  margin-top: max(12rem, calc(100vh - 34rem));
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 16px 0 28px;
}
.foot p {
  margin: 0;
  color: var(--faint);
  font-size: 13px;
}
.foot a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.foot a:hover { color: var(--ink); }
article section { padding: 64px 0 10px; scroll-margin-top: 18px; }
.kicker {
  margin: 0 0 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
}
h2 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -0.03em;
  font-weight: 500;
  line-height: 1;
}
.prose { color: var(--muted); max-width: 40rem; }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--ink); font-weight: 500; }
.note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 15px;
}
.note b { color: var(--muted); font-weight: 500; }

.well {
  margin-top: 22px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 22px 22px;
}
.well h3 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.demo-row {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: auto auto;
  justify-content: center;
  align-items: center;
  column-gap: 42px;
  row-gap: 10px;
}
.cell {
  margin: 0;
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  justify-items: center;
  align-items: center;
}
.cell figcaption {
  align-self: start;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  max-width: 9rem;
}

.well-controls { margin-top: 22px; display: grid; gap: 12px; }
.inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cell .check { width: 28px; height: 28px; }
.check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 0;
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--hair);
}
.check svg { width: 13px; height: 13px; opacity: 0; }
.check[aria-checked="true"] svg { opacity: 1; }
.check:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: var(--faint);
  font-size: 14px;
}
.legend b { color: var(--muted); font-weight: 500; }

.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 36px;
}
svg.graph { width: 100%; height: auto; display: block; }
.look-note { margin: 2px 8px 8px; color: var(--muted); font-size: 13px; }
.hint {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  min-height: 1.4em;
}
.clock-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 auto 36px;
  max-width: 520px;
}
.clock {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px 14px;
}
.clock span {
  display: block;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.clock b {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.graph-copy p { margin: 0 0 8px; }
.curve-key { display: grid; gap: 6px; margin-top: 12px; }
.curve-key span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.curve-key i { width: 16px; height: 2px; border-radius: 2px; display: block; flex: none; }
#mount-curves .demo-row { gap: 22px; }
#mount-curves .cell figcaption { max-width: 7.4rem; }
.readout b { color: var(--ink); font-weight: 500; }

.pair {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.pair .tag {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}
.jam {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}
.jam .ghost.hot { background: var(--oxide); color: #fffaf3; border-color: var(--oxide); }

.toc {
  position: sticky;
  top: 24px;
  justify-self: end;
  width: 168px;
  display: grid;
  gap: 8px;
  padding-top: 68px;
}
.toc a {
  text-decoration: none;
  color: var(--faint);
  font-size: 13px;
}
.toc a:hover, .toc a.active { color: var(--ink); }

.numbers { display: grid; gap: 10px; margin-top: 8px; }
.numbers div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}
.numbers b { color: var(--ink); font-weight: 500; }
.numbers span { font-family: var(--mono); font-size: 13px; color: var(--ink); }

.toggle {
  --track: #e6ddd0;
  --fill: var(--oxide);
  --knob: #2a221c;
  --ink: #fffaf3;
  --piece: var(--knob);
  position: relative;
  width: var(--track-w);
  height: var(--track-h);
  padding: 0;
  border: 0;
  background: var(--track);
  border-radius: var(--radius);
  color: var(--knob);
  cursor: pointer;
  touch-action: none;
  display: block;
  flex: none;
}
.toggle:focus { outline: none; }
.toggle:focus-visible, .toggle .side:focus-visible {
  outline: 2px solid var(--oxide);
  outline-offset: 3px;
}
.toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--hair);
  pointer-events: none;
  z-index: 4;
}
.clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.fill {
  position: absolute;
  inset: 0;
  background: var(--fill);
  opacity: 0;
}
.mover {
  position: absolute;
  left: var(--inset-x);
  top: var(--inset-y);
  width: var(--shape-w);
  height: var(--shape-h);
  transform-origin: left center;
  filter: drop-shadow(0 1px 1px rgba(36, 28, 22, 0.22));
}
html[data-theme="dark"] .toggle {
  --track: #8a7b6e;
  --knob: #100e0c;
  --ink: #fffaf3;
}
.toggle, .toggle * { user-select: none; }
.body {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  will-change: transform;
}
.bar, .end {
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
  background: var(--piece);
  transition: background-color 180ms cubic-bezier(0.22, 0.8, 0.28, 1);
}
.toggle[aria-checked="true"] .bar,
.toggle[aria-checked="true"] .end {
  background: var(--ink);
}
.body.plate .bar, .body.plate .end, .blob.plate { background: var(--fill); }
.end { border-radius: var(--shape-r); left: 0; }
.end.rest { z-index: 2; }
.end.left { clip-path: inset(-2px calc(50% - 2px) -2px -2px); }
.end.right { clip-path: inset(-2px -2px -2px calc(50% - 2px)); }
.bar {
  left: calc(50% - 2px);
  width: calc(100% + 4px);
  border-radius: 0;
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}
.end.right { will-change: transform; }
.ink {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
}
.blob {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--knob);
  border-radius: var(--shape-r);
  transform-origin: center center;
  will-change: transform;
}
.side {
  position: absolute;
  top: var(--inset-y);
  width: var(--shape-w);
  height: var(--shape-h);
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 3;
}
.side[data-side="grid"] { left: var(--inset-x); }
.side[data-side="list"] { right: var(--inset-x); }
.ico { grid-area: 1 / 1; width: calc(var(--shape-h) * 0.5); height: calc(var(--shape-h) * 0.5); display: block; }
.ico svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.ico.lit { color: var(--ink); opacity: 0; }
.ico.dim { color: var(--knob); }

@media (max-width: 980px) {
  .layout, .graph-layout, .rows, .clock-board, .lean, .look { grid-template-columns: 1fr; }
  .toc { position: static; justify-self: stretch; width: auto; padding-top: 0; grid-auto-flow: column; overflow: auto; gap: 14px; }
  .temper p { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar, .end { transition: none; }
}
