/* ==========================================================================
   Toki Recur — design system

   One dark surface, one accent, one type scale, one spacing scale. Every
   section below is built from those tokens, so the page reads as a single
   piece of software rather than a stack of landing-page blocks.
   ========================================================================== */

/* --- tokens --------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Surfaces. Five real steps, each cooler in the shadows, and each with
     enough chroma to catch a light source. Flat greys are what make a dark
     interface read as a sketch: without chroma the eye has nothing to
     model, and the page looks like pencil on paper rather than like a lit
     room. The hex values are the fallbacks; the oklch values are the truth,
     because oklch steps by lightness instead of by whatever the RGB maths
     happened to do. */
  --bg: #070a11;
  --bg: oklch(0.142 0.016 268);
  --bg-2: #0e131c;
  --bg-2: oklch(0.185 0.02 264);
  --panel: #131a24;
  --panel: oklch(0.215 0.022 258);
  --panel-2: #1a242e;
  --panel-2: oklch(0.255 0.024 252);
  --panel-3: #242f3a;
  --panel-3: oklch(0.3 0.026 248);

  /* Ink. The headline is warm and the body is cool, so the page has a
     temperature of its own instead of one flat white. */
  --fg: #f9f7ef;
  --fg: oklch(0.975 0.01 96);
  --fg-dim: #ccd3dc;
  --fg-dim: oklch(0.865 0.014 252);
  --muted: #9199a3;
  --muted: oklch(0.68 0.018 254);

  /* A hairline carries the hue of the surface it sits on. Pure white at 9%
     is a pencil line; a cool line at 36% is light falling on an edge. */
  --line: oklch(0.38 0.022 262 / 0.36);
  --line-strong: oklch(0.5 0.026 258 / 0.58);

  /* The brand is a family, not one colour: a deep gold for fills, the pure
     yellow for marks, a lift for the top edge of a lit button. */
  --brand: #ffd60f;
  --brand: oklch(0.885 0.18 95);
  --brand-deep: #e2b42c;
  --brand-deep: oklch(0.79 0.15 88);
  --brand-lift: #ffef6e;
  --brand-lift: oklch(0.945 0.15 100);
  --brand-ink: #211d0c;
  --brand-ink: oklch(0.16 0.03 95);
  --brand-soft: oklch(0.885 0.18 95 / 0.13);
  --brand-line: oklch(0.885 0.18 95 / 0.34);
  --cream: #f4ecdc;

  /* The two things the product actually distinguishes. */
  --hit: #47e0e2;
  --hit: oklch(0.83 0.125 196);
  --compute: #fe9d4a;
  --compute: oklch(0.78 0.15 58);

  /* type */
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--1: clamp(0.8rem, 0.78rem + 0.1vw, 0.88rem);
  --step-0: clamp(1rem, 0.97rem + 0.16vw, 1.08rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.34vw, 1.38rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.7vw, 1.9rem);
  --step-3: clamp(2rem, 1.7rem + 1.4vw, 2.9rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.1vw, 4.6rem);

  /* space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 28px;
  --s6: 40px;
  --s7: 56px;
  --s8: 80px;
  --s9: 112px;
  --s10: 160px;

  --radius: 14px;
  --radius-lg: 22px;
  --container: 1180px;
  --gutter: clamp(20px, 4vw, 48px);

  --shadow-lift: 0 18px 50px -24px rgba(0, 0, 0, 0.9);
  --ease: cubic-bezier(0.22, 0.68, 0.24, 1);
}

/* --- reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.7;
  letter-spacing: -0.006em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 650;
  transform: translateY(-160%);
  transition: transform 0.16s var(--ease);
}

.skip-link:focus {
  transform: none;
}

.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;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

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

.accent {
  color: var(--brand);
}

.overline {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 var(--s3);
}

.kicker {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0 0 var(--s5);
}

.section-sub {
  color: var(--fg-dim);
  max-width: 62ch;
  margin: var(--s5) 0 var(--s9);
  font-size: var(--step-1);
  line-height: 1.62;
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
  max-width: 72ch;
}

/* --- topbar --------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* Content fades under the bar instead of butting against a rule. */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 28px;
  background: linear-gradient(180deg, rgba(8, 9, 11, 0.92), transparent);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}

.topbar.scrolled::after { opacity: 1; }

.topbar nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s4) var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s6);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
  flex: none;
}

.brand .logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.wordmark-accent { color: var(--brand); }

.links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 24px);
  font-size: 0.92rem;
  color: var(--fg-dim);
}

.links a {
  position: relative;
  padding: 6px 2px;
  transition: color 0.18s var(--ease);
  white-space: nowrap;
}

.links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.24s var(--ease);
}

.links a:hover { color: var(--fg); }
.links a:hover::after { transform: scaleX(1); }
.links a.active { color: var(--brand); }

.btn-nav {
  font-family: var(--mono);
  font-size: 0.82rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 16px;
  color: var(--fg) !important;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.btn-nav::after { display: none; }
.btn-nav:hover { border-color: var(--brand); background: var(--brand-soft); }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  place-items: center;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--fg);
  transition: transform 0.24s var(--ease), opacity 0.2s var(--ease);
}

body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* --- layout --------------------------------------------------------------- */

main:focus { outline: none; }

main > section {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s10) var(--gutter);
}

/* Sections are separated by rhythm. A hairline that stops in the middle of
   the viewport reads as a stray mark, not as structure. */

section > h2 {
  font-size: var(--step-3);
  max-width: 22ch;
}

section > h2 + .section-sub { margin-top: var(--s4); }

/* --- the reuse diagram ---------------------------------------------------- */

.loop-block {
  fill: var(--panel-2);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.loop-block.hit {
  fill: var(--brand);
  stroke: var(--brand);
}

.loop-arc {
  fill: none;
  stroke: var(--brand-line);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  animation: dash-run 1.6s linear infinite;
}

@keyframes dash-run {
  to { stroke-dashoffset: -20; }
}

.loop-runner {
  fill: var(--brand);
  filter: drop-shadow(0 0 8px rgba(255, 214, 10, 0.8));
}

.loop-arc-back {
  stroke: rgba(255, 255, 255, 0.22);
  animation-direction: reverse;
}

.loop-runner-back {
  fill: var(--fg-dim);
  filter: none;
}

.loop-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.loop-label.hit { fill: var(--brand); }

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

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  margin-bottom: var(--s9);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.96rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.22s var(--ease);
}

/* The arrow is its own little island inside the button, so the label and the
   direction read as two things instead of one crowded word. */
.btn-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: -6px;
  border-radius: 50%;
  background: rgba(20, 20, 12, 0.14);
  transition: transform 0.22s var(--ease), background 0.22s var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:hover svg { transform: translateX(3px); }
.btn.primary:hover .btn-icon { transform: translateX(2px) translateY(-1px); background: rgba(20, 20, 12, 0.2); }

/* The press answers the finger: 100ms, and it is already there. */
.btn:active,
.bench-tab:active,
.code .copy:active {
  transform: scale(0.97);
  transition-duration: 100ms;
}

.btn.primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 10px 26px -18px rgba(255, 214, 10, 0.6);
}

.btn.primary:hover {
  box-shadow: 0 14px 30px -18px rgba(255, 214, 10, 0.7);
}

.btn.ghost {
  border-color: var(--line-strong);
  color: var(--fg);
  background: rgba(255, 255, 255, 0.02);
}

.btn.ghost:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

/* --- cards (pricing) ----------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--s6) var(--s6) var(--s7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(17, 20, 24, 0.35) 100%);
}

.card:hover {
  border-color: var(--brand-line);
}

/* --- benchmarks ----------------------------------------------------------- */

.bench-picker { margin-top: var(--s7); }

.bench-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}

.bench-tab {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--fg-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.bench-tab:hover { color: var(--fg); border-color: var(--line-strong); }

.bench-tab.active {
  color: var(--brand-ink);
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
}

.bench-panel { display: none; }

.bench-panel.active {
  display: block;
  animation: panel-in 0.4s var(--ease);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.table-wrap:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 4px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: var(--s6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  min-width: 640px;
}

thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: var(--s5);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}

tbody td {
  padding: var(--s5);
  border-bottom: 1px solid var(--line);
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
tbody td:first-child { color: var(--fg); font-family: var(--mono); font-size: 0.86rem; }

.grade {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 24px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(255, 214, 10, 0.16);
  color: var(--brand);
}

.grade.mid { background: rgba(255, 190, 90, 0.14); color: #ffc25a; }
.grade.bad { background: rgba(255, 255, 255, 0.06); color: var(--muted); }

/* --- code ----------------------------------------------------------------- */

.code {
  position: relative;
  margin: var(--s5) 0 0;
  /* the gutter on the right belongs to the copy button, so nothing ever
     runs underneath it */
  padding: var(--s5) 96px var(--s5) var(--s6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 2;
  color: var(--fg-dim);
}

/* One row per command, the comment in its own column: aligned by the
   layout, not by a run of spaces that breaks the moment the width moves. */
.code .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0 28px;
  align-items: baseline;
}

.code .c {
  color: var(--muted);
  white-space: nowrap;
}

/* A command longer than the box wraps instead of running under its own
   comment. Two lines of shell beats a line that lies about what it says. */
.code .cmd {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code .copy {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.code .copy:hover { color: var(--brand); border-color: var(--brand-line); }
.code .copy.done { color: var(--brand); border-color: var(--brand); }

.code .copy-status {
  position: absolute;
  top: 15px;
  right: 78px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.code .copy-status:empty { display: none; }

.code-label {
  margin: var(--s5) 0 calc(var(--s2) * -1);
  color: var(--brand);
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.code .prompt { color: var(--brand); }
.code .comment { color: var(--muted); }

/* --- footer --------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--line);
  padding: var(--s9) var(--gutter) var(--s6);
  background: var(--bg-2);
}

.footer-grid {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: var(--s7);
}

/* The mark and the wordmark are one lockup: the footer used to carry a
   second, smaller logo inside the link, which read as two competing marks. */
.footer-brand-link {
  display: flex;
  align-items: center;
  gap: var(--s4);
  font-size: 1.28rem;
  letter-spacing: -0.03em;
}

.footer-mark {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.6));
}

.footer-wordmark {
  font-size: 1.34rem;
  font-weight: 650;
  letter-spacing: -0.035em;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 34ch;
  margin-top: var(--s5);
}

.footer-col h3 {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s4);
  font-weight: 500;
}

.footer-col a {
  display: block;
  color: var(--fg-dim);
  font-size: 0.92rem;
  padding: 5px 0;
  transition: color 0.18s var(--ease);
}

.footer-col a:hover { color: var(--brand); }

.footer-bottom {
  max-width: var(--container);
  margin: var(--s8) auto 0;
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.84rem;
  font-family: var(--mono);
}

/* --- pricing page --------------------------------------------------------- */

.pricing-page { padding-top: var(--s9) !important; }

.pricing-h1 {
  font-size: var(--step-3);
  margin-bottom: var(--s5);
}

.pricing-blurb {
  color: var(--fg-dim);
  max-width: 58ch;
  margin-bottom: var(--s7);
}

.pricing-card {
  max-width: 620px;
  padding: var(--s7);
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  margin-bottom: var(--s5);
}

.price {
  font-family: var(--mono);
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.price-suffix { color: var(--muted); }

.pricing-tagline {
  color: var(--fg-dim);
  margin-bottom: var(--s5);
}

.pricing-includes {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--s6);
  display: grid;
  gap: var(--s3);
  color: var(--fg-dim);
  font-size: 0.94rem;
}

.pricing-includes li {
  padding-left: 26px;
  position: relative;
}

.pricing-includes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg);
}

.pricing-fine {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.pricing-fine-joke {
  color: var(--brand);
  font-family: var(--mono);
  font-size: 0.84rem;
}

/* --- legal pages ---------------------------------------------------------- */

/* Privacy and terms are read, not skimmed: one measure, generous leading,
   and no furniture. */
.legal-page {
  max-width: none;
  margin: 0;
  padding: clamp(44px, 5.5vw, 84px) max(var(--gutter), calc((100% - 1080px) / 2))
    clamp(64px, 8vw, 120px);
}

.legal-page h1 {
  font-size: clamp(2.1rem, 1.4rem + 2.1vw, 3.1rem);
  font-weight: 550;
  line-height: 1.06;
  letter-spacing: -0.04em;
  margin: 0 0 var(--s5);
  max-width: 20ch;
}

.legal-page .lede {
  color: var(--fg-dim);
  font-size: 1.04rem;
  line-height: 1.66;
  max-width: 62ch;
  margin: 0 0 var(--s7);
}

.legal-page h2 {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: var(--s7) 0 var(--s3);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  max-width: 40ch;
}

.legal-page h2:first-of-type { border-top: 0; padding-top: 0; }

.legal-page p,
.legal-page ul {
  color: var(--fg-dim);
  font-size: 0.97rem;
  line-height: 1.74;
  max-width: 68ch;
  margin: 0 0 var(--s4);
}

.legal-page ul { padding-left: 1.15em; }

.legal-page li { margin-bottom: var(--s2); }

.legal-page a {
  color: var(--fg-dim);
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.legal-page a:hover {
  color: var(--brand);
  border-color: var(--brand-line);
}

.legal-updated {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin-top: var(--s7) !important;
}

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

.js-ready .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--d, 0s);
}

.js-ready .reveal.in-view {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js-ready .reveal { opacity: 1; transform: none; }
  .loop-arc { animation: none; }
  .loop-runner { display: none; }
}

/* --- materials, restraint, and the user's settings ------------------------ */

@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(255, 255, 255, 0.34); --muted: #b3b0a6; }
  .card,
  .table-wrap { border-color: var(--line-strong); }
}

@media (max-width: 760px) {
  /* The comment moves under its command rather than squeezing it. */
  .code { padding-right: 78px; }
  .code .row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .code .c { white-space: normal; }
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  html { scroll-padding-top: 76px; }

  .nav-toggle { display: grid; }

  .links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s4) var(--gutter) var(--s6);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
  }

  body.nav-open .links {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .links a { padding: 11px 0; border-bottom: 1px solid var(--line); }
  .links .btn-nav { border-bottom: 1px solid var(--line); border-radius: 0; padding: 13px 0; }

  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .cta .btn { flex: 1 1 100%; justify-content: center; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .footer-bottom { flex-direction: column; gap: var(--s2); }
  main > section { padding: var(--s9) var(--gutter); }
}

.tui {
  --tui-yellow: #ffd60a;
  --tui-amber: #b8860b;
  --tui-text: #f0ece0;
  --tui-muted: #9a967f;
  --tui-red: #ff6b8b;
  --tui-green: #4ade80;
  --tui-blue: #5a7adb;
  --tui-purple: #c084fc;
  --tui-cyan: #4dd0e1;

  position: relative;
  height: clamp(440px, 74vh, 700px);
  padding: 16px 18px;
  background: #08090b;
  color: var(--tui-text);
  font-family: var(--mono);
  font-size: 14px;
  font-size: clamp(11px, 1vw, 14px);
  display: flex;
  flex-direction: column;
  line-height: 1.38;
  overflow: hidden;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: #2a2c30 transparent;
  transition: box-shadow 0.22s var(--ease);
}

.tui::-webkit-scrollbar { width: 8px; }
.tui::-webkit-scrollbar-thumb { background: #2a2c30; border-radius: 4px; }
.tui::-webkit-scrollbar-track { background: transparent; }

.tui-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2c30 transparent;
}

.tui-body::-webkit-scrollbar { width: 8px; }
.tui-body::-webkit-scrollbar-thumb { background: #2a2c30; border-radius: 4px; }
.tui-body::-webkit-scrollbar-track { background: transparent; }

.tui-body:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -4px;
  border-radius: 4px;
}

.tui-foot { flex: none; }

.tui:focus-visible,
.tui.focused {
  box-shadow: inset 0 0 0 1px var(--brand-line);
}

.tui[data-screen="chat"] {
  display: block;
  overflow: hidden;
  padding-bottom: 10px;
}

.tui .tui-line { white-space: pre; }
.tui .gutter { color: var(--tui-muted); }
.tui .wordmark {
  color: var(--tui-yellow);
  font-family: "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 2em;
  font-weight: 700;
  line-height: 1.08;
}

.tui .wordmark + .tui-line { margin-top: 0.55em; }
.tui .wordmark-plain { display: none; }
.tui .sel { color: var(--tui-yellow); font-weight: 600; }
.tui .bar { color: var(--tui-yellow); font-weight: 600; }
.tui .name { color: var(--tui-muted); }
.tui .chip { color: var(--tui-amber); }
.tui .dim-chip { color: var(--tui-amber); }
.tui .ok { color: var(--tui-green); font-size: 0.74em; }
.tui .off { color: var(--tui-red); font-size: 0.74em; }
.tui .bad { color: var(--tui-red); }
.tui .dim { color: var(--tui-muted); }
.tui .value { color: var(--tui-text); }
.tui .group { color: var(--tui-yellow); font-weight: 600; margin-top: 6px; }
.tui .head { margin-bottom: 2px; }
.tui .status { margin-top: 10px; }
.tui .setting-row { display: flex; }
.tui .setting-row .key { flex: none; width: 13ch; }
.tui .setting-row .value { white-space: pre; }
.tui .hints { color: var(--tui-muted); }

/* --- the edit modal ------------------------------------------------------ */

.tui-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 4, 6, 0.62);
  z-index: 5;
}

.tui-modal {
  width: min(460px, 88%);
  padding: 14px 16px;
  border: 1px solid var(--brand-line);
  background: #0c0e11;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.modal-title {
  color: var(--tui-yellow);
  font-weight: 600;
  margin-bottom: 10px;
}

.modal-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  background: #08090b;
  color: var(--tui-text);
  font: inherit;
  outline: none;
}

.modal-input:focus { border-color: var(--brand-line); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.modal-btn {
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  background: none;
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 0.72em;
  cursor: pointer;
}

.modal-btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

@media (max-width: 860px) {
  .tui { font-size: clamp(11px, 1.9vw, 12px); height: clamp(400px, 70vh, 540px); }
  .tui .wordmark { display: none; }
  .tui .wordmark-plain {
    display: block;
    color: var(--tui-yellow);
    font-weight: 700;
    letter-spacing: 0.34em;
    margin: 0 0 0.6em;
  }
}

/* ==========================================================================
   ink-quiet — the finished direction
   --------------------------------------------------------------------------
   Black, Geist, one yellow. The craft is in the spacing, the rhythm and
   the two elements that carry the idea: the backend strip and the prefix
   matcher. Nothing here is decoration for its own sake; every band on the
   page says something the page needs to say.
   ========================================================================== */

:root {
  /* Two semantic inks the rest of the page can borrow: what was replayed
     and what had to be computed. They appear in the matcher and nowhere
     else, so they mean one thing. */
  --hit: #4fd6e0;
  --compute: #ff9b5e;

  --hairline: rgba(255, 255, 255, 0.11);
  --hairline-strong: rgba(255, 255, 255, 0.2);
}

/* ── the mechanism: the prefix matcher ────────────────────────────────── */

.mechanism {
  position: relative;
  padding-top: clamp(72px, 9vw, 132px);
  padding-bottom: clamp(72px, 9vw, 132px);
}

/* A drawn band: the same grid paper an engineer would sketch on. */
.mech-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  max-width: var(--container);
  margin: 0 auto;
}

.mech-copy h2 {
  font-size: clamp(1.7rem, 1.1rem + 2vw, 2.8rem);
  font-weight: 560;
  letter-spacing: -0.032em;
  line-height: 1.12;
  max-width: 22ch;
}

.mech-copy .section-sub {
  max-width: 52ch;
}

/* Three facts under the drawing: the labels are the terms, the values are
   the sentence. */
.mech-facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s6);
  margin: var(--s7) 0 0;
  padding-top: var(--s5);
  border-top: 1px solid var(--hairline);
}

.mech-facts > div {
  display: grid;
  gap: var(--s2);
  align-content: start;
}

.mech-facts dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}

.mech-facts dd {
  margin: 0;
  color: var(--fg-dim);
  font-size: 0.98rem;
}

/* the stage */
/* Without JavaScript there is no matcher to show, so the stage steps aside
   instead of leaving an empty box where the drawing should be. */
html:not(.js-ready) .mech-stage {
  display: none;
}

.mech-stage {
  margin: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(8px);
  padding: var(--s6);
  box-shadow: 0 50px 100px -70px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.mech-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--hairline);
}

.mech-title {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.mech-readout {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mech-readout b {
  color: var(--fg);
  font-weight: 500;
}

.mech-dot {
  margin: 0 0.55em;
  color: var(--muted);
  opacity: 0.7;
}

.mech-cells {
  position: relative;
  display: flex;
  gap: 3px;
  margin: var(--s6) 0 var(--s5);
  padding: 0 2px;
}

.mech-cell {
  flex: 1 1 0;
  height: 52px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.mech-cell.is-replay {
  background: color-mix(in srgb, var(--hit) 26%, transparent);
  border-color: color-mix(in srgb, var(--hit) 55%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.mech-cell.is-compute {
  background: color-mix(in srgb, var(--compute) 26%, transparent);
  border-color: color-mix(in srgb, var(--compute) 55%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.mech-cell.is-current {
  border-color: var(--brand);
  transform: translateY(-3px);
}

/* the matcher itself: a line that walks the prompt */
.mech-scan {
  position: absolute;
  top: -7px;
  bottom: -7px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--brand) 14%, var(--brand) 86%, transparent);
  box-shadow: 0 0 14px rgba(255, 214, 10, 0.55);
  transform: translateX(0);
  transition: transform 0.09s linear;
  will-change: transform;
  pointer-events: none;
}

.mech-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.mech-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: -1px;
}

.dot-replay { background: var(--hit); }
.dot-compute { background: var(--compute); }
.dot-new { background: rgba(255, 255, 255, 0.16); }

/* ── benchmarks read as a printed ledger ───────────────────────────────── */

#benchmarks .table-wrap {
  border: none;
  border-top: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline-strong);
  border-radius: 0;
  background: transparent;
}

#benchmarks thead th {
  background: transparent;
  border-bottom: 1px solid var(--hairline-strong);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

#benchmarks tbody td {
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--hairline);
}

#benchmarks tbody tr:hover td {
  background: rgba(255, 214, 10, 0.035);
}

#benchmarks .grade {
  border-radius: 4px;
}

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

@media (max-width: 900px) {
  .hero .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s5) var(--s6);
  }
  .hero-visual {
    max-width: 100%;
    justify-self: stretch;
  }
  .mech-cell {
    height: 34px;
  }
  .mech-cells {
    gap: 2px;
  }
}

@media (max-width: 760px) {
  .mech-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s5);
  }
}

/* ── the small motions ──────────────────────────────────────────────── */

/* The reuse diagram carries something along the path: the arc is drawn in
   a moving dash and the runner carries a light with it. */
.loop-arc {
  stroke-dasharray: 5 7;
  animation: loop-dash 1.4s linear infinite;
}

.loop-arc-back {
  animation-direction: reverse;
}

@keyframes loop-dash {
  to { stroke-dashoffset: -24; }
}

.loop-runner {
  fill: var(--brand);
  filter: drop-shadow(0 0 6px rgba(255, 214, 10, 0.75));
}

.loop-block.hit {
  fill: rgba(255, 214, 10, 0.16);
  stroke: var(--brand-line);
}

.loop-block {
  transition: fill 0.4s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .loop-arc,
  .loop-arc-back {
    animation: none;
  }
}

/* ==========================================================================
   the light
   --------------------------------------------------------------------------
   A dark page is not a dark rectangle. What makes Stripe and Linear look
   expensive is not their greys — it is that the page is *lit*: several
   coloured sources, each with its own hue, falling on a surface that has
   chroma of its own. One blob of colour is a gradient; several sources with
   different hues, moving at different speeds, is a room.

   The grain on top is not decoration. Eight-bit panels band badly on wide,
   slow gradients; a 3% noise layer is what makes them look continuous.
   ========================================================================== */

body::before {
  content: "";
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 38% at 82% 0%, oklch(0.52 0.185 290 / 0.3), transparent 64%),
    radial-gradient(36% 34% at 2% 4%, oklch(0.6 0.135 240 / 0.18), transparent 60%),
    radial-gradient(34% 32% at 102% 54%, oklch(0.48 0.17 350 / 0.15), transparent 62%),
    radial-gradient(38% 34% at 34% 106%, oklch(0.75 0.14 75 / 0.09), transparent 64%);
  filter: blur(30px);
  animation: light-drift 74s ease-in-out infinite alternate;
}

@keyframes light-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-1.6%, 1.4%, 0) scale(1.06); }
  100% { transform: translate3d(1.4%, -1.2%, 0) scale(1.02); }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.038;
  mix-blend-mode: overlay;
  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.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Everything the visitor reads sits above the light. */
main,
.topbar nav,
footer > * {
  position: relative;
  z-index: 1;
}

/* The topbar is glass over the light, not a slab on top of it. */
.topbar {
  background: oklch(0.155 0.018 268 / 0.72);
  border-bottom: 1px solid oklch(0.42 0.024 262 / 0.28);
  backdrop-filter: blur(20px) saturate(150%);
}

/* ==========================================================================
   material
   --------------------------------------------------------------------------
   A surface in a room has an edge. Two declarations draw it: a border
   gradient that is bright where the light lands and fades where the
   surface turns away, and a single hairline of light along the top inside
   the panel. Shadow alone never reads as depth; the edge does.
   ========================================================================== */

.mech-stage,
.code,
.table-wrap {
  border: 1px solid transparent;
  background-image:
    linear-gradient(var(--panel), var(--panel)),
    linear-gradient(
      168deg,
      oklch(0.6 0.028 258 / 0.5),
      oklch(0.32 0.022 260 / 0.14) 44%,
      oklch(0.24 0.02 262 / 0.05)
    );
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.mech-stage,
.code,
.table-wrap {
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.055),
    0 26px 60px -38px oklch(0.08 0.05 280 / 0.95);
}

/* A lit button: a highlight along the top edge, the pure yellow in the
   middle, the deep gold where it turns away. */
.btn.primary {
  background-image: linear-gradient(
    180deg,
    var(--brand-lift) 0%,
    var(--brand) 46%,
    var(--brand-deep) 100%
  );
  color: var(--brand-ink);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.5),
    0 14px 30px -14px oklch(0.885 0.18 95 / 0.55);
}

.btn.primary:hover {
  background-image: linear-gradient(
    180deg,
    oklch(0.97 0.16 103) 0%,
    var(--brand-lift) 40%,
    var(--brand) 100%
  );
}

.btn.ghost {
  border-color: transparent;
  background-image:
    linear-gradient(oklch(0.215 0.022 258 / 0.55), oklch(0.215 0.022 258 / 0.55)),
    linear-gradient(170deg, oklch(0.56 0.026 258 / 0.55), oklch(0.28 0.02 260 / 0.12));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.05);
}

.btn.ghost:hover {
  background-image:
    linear-gradient(oklch(0.24 0.024 256 / 0.7), oklch(0.24 0.024 256 / 0.7)),
    linear-gradient(170deg, oklch(0.7 0.03 258 / 0.7), oklch(0.3 0.02 260 / 0.16));
}

/* The active tab is a small lit surface, not a yellow rectangle. */
.bench-tab.active {
  color: var(--brand);
  border-color: oklch(0.885 0.18 95 / 0.34);
  background: linear-gradient(
    180deg,
    oklch(0.885 0.18 95 / 0.16),
    oklch(0.885 0.18 95 / 0.06)
  );
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.12),
    0 0 24px -10px oklch(0.885 0.18 95 / 0.5);
}

/* The matcher cells are real colour: a solid body with a lit top edge,
   not a wash of the accent at 26%. */
.mech-cell {
  background: oklch(0.28 0.03 262 / 0.55);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.05);
}

.mech-cell.is-replay {
  background: linear-gradient(
    180deg,
    oklch(0.62 0.13 196),
    oklch(0.42 0.1 200) 60%,
    oklch(0.33 0.075 204)
  );
  border-color: oklch(0.83 0.125 196 / 0.65);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.3),
    0 0 18px -6px oklch(0.83 0.125 196 / 0.6);
}

.mech-cell.is-compute {
  background: linear-gradient(
    180deg,
    oklch(0.68 0.15 58),
    oklch(0.47 0.12 55) 60%,
    oklch(0.36 0.09 52)
  );
  border-color: oklch(0.78 0.15 58 / 0.65);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.28),
    0 0 18px -6px oklch(0.78 0.15 58 / 0.5);
}

/* The legend swatches follow the cells. */
.dot-replay { background: linear-gradient(180deg, oklch(0.62 0.13 196), oklch(0.42 0.1 200)); }
.dot-compute { background: linear-gradient(180deg, oklch(0.68 0.15 58), oklch(0.47 0.12 55)); }
.dot-new { background: oklch(0.28 0.03 262 / 0.8); }

/* Grade pills carry their own colour. */
.grade {
  background: oklch(0.885 0.18 95 / 0.14);
  color: var(--brand);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.1);
}

.grade.mid {
  background: oklch(0.78 0.15 58 / 0.16);
  color: var(--compute);
}

.grade.bad {
  background: oklch(0.62 0.16 25 / 0.16);
  color: oklch(0.75 0.14 30);
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}
