@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --ground: oklch(0.962 0.007 255);
  --surface: oklch(0.992 0.003 255);
  --ink: oklch(0.21 0.03 262);
  --ink-2: oklch(0.40 0.025 262);
  --rule: oklch(0.84 0.012 258);
  --rule-soft: oklch(0.905 0.009 258);
  --cobalt: oklch(0.47 0.19 263);
  --cobalt-ink: oklch(0.38 0.17 263);
  --cobalt-tint: oklch(0.915 0.045 263);
  --cobalt-face: oklch(0.62 0.15 263);
  --signal: oklch(0.80 0.15 75);
  --signal-tint: oklch(0.93 0.07 85);
  --night: oklch(0.22 0.045 265);
  --night-ink: oklch(0.93 0.015 260);

  --f-sans: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --gutter: clamp(1rem, 4vw, 3rem);
  --maxw: 78rem;
  --s1: 0.5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2.5rem; --s5: 4rem; --s6: clamp(4.5rem, 10vw, 8.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-sticky: 10;
  --z-skip: 50;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--cobalt); color: var(--surface); }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }
html { scrollbar-color: var(--rule) var(--ground); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

h1, h2 {
  font-stretch: 112%;
  font-weight: 640;
  letter-spacing: -0.022em;
  line-height: 1.04;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.3rem, 1.3rem + 2.6vw, 3.7rem); }
h2 { font-size: clamp(1.8rem, 1.2rem + 2.2vw, 3rem); max-width: 22ch; }
p { text-wrap: pretty; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: var(--gutter); top: -3rem; z-index: var(--z-skip);
  background: var(--ink); color: var(--surface); padding: 0.5rem 0.9rem; text-decoration: none;
}
.skip:focus { top: 0.75rem; }

/* ---------- bar ---------- */
.bar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: color-mix(in oklch, var(--ground) 92%, transparent);
  border-bottom: 1px solid var(--rule-soft);
  backdrop-filter: saturate(1.2) blur(8px);
}
.bar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0.7rem var(--gutter);
  display: flex; align-items: center; gap: var(--s3);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-stretch: 125%; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark__mark { width: 1.45rem; height: 1.45rem; color: var(--ink); }
.bar__links { display: flex; gap: var(--s3); list-style: none; margin: 0 0 0 auto; padding: 0; }
.bar__links a { text-decoration: none; color: var(--ink-2); font-size: 0.95rem; }
.bar__links a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- buttons: cells of the grid ---------- */
.cellbtn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  background: var(--cobalt); color: var(--surface);
  border: 1px solid var(--cobalt-ink);
  border-radius: 2px;
  font: 600 1rem/1.1 var(--f-sans);
  text-decoration: none; cursor: pointer;
  transition: background-color 180ms var(--ease), transform 180ms var(--ease);
}
.cellbtn svg { width: 1.05em; height: 1.05em; flex: none; }
.cellbtn:hover { background: var(--cobalt-ink); }
.cellbtn:active { transform: translateY(1px); }
.cellbtn--small { padding: 0.5rem 0.8rem; font-size: 0.92rem; }
.cellbtn--light { background: var(--surface); color: var(--night); border-color: var(--surface); }
.cellbtn--light:hover { background: var(--cobalt-tint); }
.cellbtn:disabled { opacity: 0.55; cursor: progress; }

.textlink { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.textlink:hover { border-bottom-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.5rem) var(--gutter) var(--s4);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: start;
}
.hero__copy { padding-top: clamp(0rem, 3vw, 2.5rem); }
.lede { font-size: clamp(1.08rem, 1rem + 0.35vw, 1.25rem); color: var(--ink-2); max-width: 40ch; margin: var(--s3) 0 var(--s4); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.hero__note { margin-top: var(--s4); font-size: 0.92rem; color: var(--ink-2); max-width: 34ch; }

/* ---------- cube figure ---------- */
.cube { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.85rem; min-width: 0; }
.cube__stage { display: flex; justify-content: center; min-width: 0; }
.cube__svg { width: 100%; max-width: 25rem; height: auto; overflow: hidden; }
.cube__svg .slab { transition: transform 560ms var(--ease); }
.cube__svg .slab.is-out .front { fill: var(--surface); }
.cube__svg .face { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill 420ms var(--ease); }
.cube__svg .top { fill: var(--surface); }
.cube__svg .front { fill: oklch(0.935 0.01 258); }
.cube__svg .side { fill: oklch(0.885 0.013 258); }
.cube__svg .top.on { fill: var(--cobalt-face); }
.cube__svg .side.on { fill: var(--cobalt); }
.cube__svg .front.lit { fill: var(--signal-tint); }
.cube__svg .edge { fill: none; stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.cube__svg .axis { font: 600 13px var(--f-sans); fill: var(--ink); letter-spacing: 0.01em; }
.cube__svg .axis-sub { font: 400 11px var(--f-sans); fill: var(--ink-2); }
.cube__svg .tick { stroke: var(--ink-2); stroke-width: 1; vector-effect: non-scaling-stroke; }

.slicer { display: flex; flex-wrap: wrap; align-items: center; gap: 0; justify-self: center; border: 1px solid var(--rule); background: var(--surface); }
.slicer__label { padding: 0.5rem 0.8rem; font-size: 0.85rem; color: var(--ink-2); border-right: 1px solid var(--rule); }
.slicer__opt {
  font: 500 0.92rem var(--f-sans); color: var(--ink);
  background: none; border: 0; border-right: 1px solid var(--rule-soft);
  padding: 0.5rem 0.9rem; cursor: pointer;
  transition: background-color 200ms var(--ease), color 200ms var(--ease);
}
.slicer__opt:last-child { border-right: 0; }
.slicer__opt:hover { background: var(--cobalt-tint); }
.slicer__opt[aria-checked="true"] { background: var(--cobalt); color: var(--surface); }

.sheet { background: var(--surface); border: 1px solid var(--rule); }
.sheet__pov {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem;
  padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--rule);
  font-size: 0.82rem; color: var(--ink-2);
}
.sheet__pov b { color: var(--ink); font-weight: 600; }
.sheet__scroll { overflow-x: auto; }
.grid { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.grid th, .grid td { padding: 0.42rem 0.75rem; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
.grid thead th { font-weight: 600; text-align: right; color: var(--ink-2); border-bottom: 1px solid var(--rule); font-size: 0.82rem; }
.grid thead th:first-child { text-align: left; }
.grid tbody th { text-align: left; font-weight: 500; }
.grid tbody th.l2 { padding-left: 1.6rem; font-weight: 400; color: var(--ink-2); }
.grid tbody tr.total th, .grid tbody tr.total td { font-weight: 650; border-top: 1px solid var(--rule); }
.grid td { text-align: right; font-family: var(--f-mono); font-size: 0.84rem; letter-spacing: -0.01em; transition: background-color 600ms var(--ease); }
.grid td.flip { background: var(--signal-tint); }
.grid td .d { display: inline-block; }
.grid td .d.turn { animation: flap 260ms var(--ease); }
@keyframes flap {
  0% { transform: rotateX(0deg); filter: blur(0); }
  45% { transform: rotateX(88deg); filter: blur(0.6px); }
  100% { transform: rotateX(0deg); filter: blur(0); }
}
.sheet__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--rule); background: color-mix(in oklch, var(--cobalt-tint) 45%, var(--surface));
}
.cellbtn--run { padding: 0.6rem 1rem; font-size: 0.95rem; }
.timer { margin: 0; display: grid; gap: 0.15rem; font-size: 0.85rem; min-width: 15rem; }
.timer__row { display: flex; justify-content: space-between; gap: var(--s2); }
.timer__k { color: var(--ink-2); }
.timer__v { font-family: var(--f-mono); font-weight: 600; }
#t-new.done { color: var(--cobalt-ink); }
.cube__caption { font-size: 0.82rem; color: var(--ink-2); max-width: 60ch; }

/* ---------- what ---------- */
.what, .evidence, .engine, .roadmap {
  max-width: var(--maxw); margin: 0 auto; padding: var(--s6) var(--gutter) 0;
}
.what__body { margin-top: var(--s5); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.outline { background: var(--surface); border: 1px solid var(--rule); font-size: 0.92rem; }
.outline__head { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--rule); font-weight: 600; font-stretch: 112%; }
.outline ul { list-style: none; margin: 0; padding: 0.6rem 0 0.9rem; }
.outline li { padding: 0.2rem 0.9rem; display: flex; justify-content: space-between; gap: 1rem; }
.outline li i { font-style: normal; font-size: 0.78rem; color: var(--ink-2); }
.outline .o-dim { margin-top: 0.55rem; font-weight: 650; color: var(--cobalt-ink); }
.outline .o-dim:first-child { margin-top: 0; }
.outline .o-1 { padding-left: 1.6rem; }
.outline .o-2 { padding-left: 2.6rem; color: var(--ink-2); }
.outline .o-3 { padding-left: 3.6rem; color: var(--ink-2); }
.defs { margin: 0; display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.defs dt { font-weight: 650; font-size: 1.15rem; font-stretch: 108%; margin-bottom: 0.4rem; }
.defs dd { margin: 0; color: var(--ink-2); max-width: 46ch; }

/* ---------- evidence ---------- */
.evidence__head { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: end; }
.evidence__head p { margin: 0; color: var(--ink-2); max-width: 52ch; }
.ledger { margin-top: var(--s4); border-top: 2px solid var(--ink); }
.ledger table { width: 100%; border-collapse: collapse; }
.ledger th, .ledger td { padding: 1.05rem 0.75rem 1.05rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.ledger thead th { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); padding-top: 0.75rem; padding-bottom: 0.75rem; }
.ledger tbody th { font-weight: 600; font-size: 1.05rem; }
.ledger tbody th small { display: block; font-weight: 400; font-size: 0.85rem; color: var(--ink-2); margin-top: 0.15rem; }
.ledger .num { text-align: right; font-family: var(--f-mono); font-size: 0.95rem; white-space: nowrap; }
.ledger .num.em { font-family: var(--f-sans); font-stretch: 112%; font-weight: 650; font-size: 1.15rem; color: var(--cobalt-ink); }
.ledger__foot { margin: var(--s3) 0 0; color: var(--ink-2); font-size: 0.95rem; }

/* ---------- engine ---------- */
.engine__body { margin-top: var(--s5); display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.stack { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.stack li { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--s2); padding: 0.95rem 0; border-bottom: 1px solid var(--rule); }
.stack__k { font-weight: 650; font-stretch: 108%; }
.stack__v { color: var(--ink-2); }
.stack li.is-next { background: linear-gradient(var(--cobalt-tint), var(--cobalt-tint)) no-repeat 0 0 / 100% 100%; padding-left: 0.75rem; margin-left: -0.75rem; padding-right: 0.75rem; }
.stack li.is-next .stack__v { color: var(--ink); }
.term { background: var(--night); color: var(--night-ink); border-radius: 4px; overflow: hidden; }
.term__bar { padding: 0.6rem 1rem; font-size: 0.8rem; color: oklch(0.78 0.02 260); border-bottom: 1px solid oklch(0.32 0.04 265); }
.term pre { margin: 0; padding: 1rem 1rem 1.2rem; overflow-x: auto; font: 400 0.85rem/1.7 var(--f-mono); }
.term .c { color: oklch(0.72 0.05 255); }

/* ---------- roadmap ---------- */
.versions { list-style: none; margin: var(--s4) 0 0; padding: 0; border-top: 1px solid var(--ink); }
.versions li { display: grid; grid-template-columns: 5rem 1fr auto; gap: var(--s2); align-items: baseline; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.ver { font-family: var(--f-mono); font-weight: 600; }
.ver__t { color: var(--ink-2); }
.ver__s { font-size: 0.85rem; color: var(--ink-2); }
.versions li.is-now .ver__t { color: var(--ink); font-weight: 600; }
.versions li.is-now .ver__s { color: var(--cobalt-ink); font-weight: 650; }

/* ---------- close ---------- */
.close { margin-top: var(--s6); background: var(--night); color: var(--night-ink); }
.close__inner { max-width: var(--maxw); margin: 0 auto; padding: var(--s6) var(--gutter); display: grid; gap: var(--s3); justify-items: start; }
.close h2 { color: var(--surface); }
.close__name { margin: var(--s2) 0 0; color: oklch(0.80 0.02 260); max-width: 52ch; font-size: 0.95rem; }
.foot {
  background: var(--night); color: oklch(0.80 0.02 260); border-top: 1px solid oklch(0.32 0.04 265);
  display: flex; justify-content: space-between; gap: var(--s2);
  padding: 1.1rem var(--gutter); font-size: 0.88rem;
}
.foot a { color: var(--night-ink); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero, .what__body, .engine__body, .evidence__head { grid-template-columns: minmax(0, 1fr); }
  .hero__copy { padding-top: 0; }
  .hero__note { display: none; }
}
@media (max-width: 720px) {
  .bar__links { display: none; }
  .wordmark { margin-right: auto; }
  .ledger thead { display: none; }
  .ledger tr { display: grid; grid-template-columns: 1fr 1fr; padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
  .ledger th, .ledger td { border: 0; padding: 0.15rem 0; }
  .ledger tbody th { grid-column: 1 / -1; margin-bottom: 0.35rem; }
  .ledger .num { text-align: left; }
  .ledger .num.em { grid-column: 1 / -1; }
  .ledger td:nth-of-type(1)::before { content: "Today "; color: var(--ink-2); font-family: var(--f-sans); font-size: 0.85rem; }
  .ledger td:nth-of-type(2)::before { content: "Columnar "; color: var(--ink-2); font-family: var(--f-sans); font-size: 0.85rem; }
  .stack li { grid-template-columns: 1fr; gap: 0.15rem; }
  .versions li { grid-template-columns: 3.5rem 1fr; }
  .ver__s { grid-column: 2; }
  .timer { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
