@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: #fcfaf5;
  --ink: #1d1a16;
  --muted: #5d564b;
  --line: #d9d0be;
  --control: #857d6c;
  --accent: #2b3bc4;
  --on-accent: #ffffff;
  --code: #ece5d6;
  --halo: rgba(43, 59, 196, 0.16);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151310;
  --surface: #1c1a16;
  --ink: #f0ebe0;
  --muted: #b0a794;
  --line: #3a352c;
  --control: #7d7667;
  --accent: #9aa6ff;
  --on-accent: #10121f;
  --code: #0f0e0c;
  --halo: rgba(154, 166, 255, 0.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #151310;
    --surface: #1c1a16;
    --ink: #f0ebe0;
    --muted: #b0a794;
    --line: #3a352c;
    --control: #7d7667;
    --accent: #9aa6ff;
    --on-accent: #10121f;
    --code: #0f0e0c;
    --halo: rgba(154, 166, 255, 0.2);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-wrap: break-word;
}
.wrap { width: 100%; max-width: 74rem; margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 10; background: var(--ink); color: var(--bg); padding: 0.6rem 1rem; }
code { font-family: var(--mono); font-size: 0.875em; }

.stale { background: var(--ink); color: var(--bg); padding: 0.7rem clamp(1.25rem, 4vw, 3rem); font-size: 0.95rem; }
.stale p { margin: 0 auto; max-width: 74rem; }

.masthead { display: flex; justify-content: space-between; align-items: center; padding-block: 1.5rem; }
.wordmark { font: 600 1.35rem/1 var(--serif); letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.theme {
  min-height: 44px; min-width: 5rem; padding: 0 1.1rem;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  font: 500 0.95rem var(--sans); cursor: pointer;
}
.theme:hover { border-color: var(--ink); }

.hero { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(1.75rem, 4vw, 3rem); }
h1 {
  margin: 0; max-width: 17ch;
  font: 400 clamp(2.5rem, 7.2vw, 5.4rem)/1.02 var(--serif);
  letter-spacing: -0.03em; text-wrap: balance;
}
.lede { margin: 1.75rem 0 0; max-width: 38rem; font-size: 1.2rem; color: var(--muted); text-wrap: pretty; }

.inputs {
  display: grid; gap: 1.1rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  padding-block: 1.75rem; margin-bottom: clamp(2rem, 5vw, 3.5rem);
  border-block: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.field label, .field .label { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.sel { position: relative; }
.sel::after {
  content: ""; position: absolute; right: 1rem; top: 50%; width: 0.5rem; height: 0.5rem;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
select {
  width: 100%; min-height: 46px; padding: 0.6rem 2.4rem 0.6rem 0.9rem;
  appearance: none; -webkit-appearance: none;
  background-color: var(--surface); color: var(--ink);
  border: 1px solid var(--control); border-radius: 4px;
  font: 500 1rem var(--sans); cursor: pointer; text-overflow: ellipsis;
}
select:hover { border-color: var(--ink); }
.toggle { display: flex; min-height: 46px; border: 1px solid var(--control); border-radius: 4px; overflow: hidden; background: var(--surface); }
.toggle button {
  flex: 1; min-height: 44px; padding: 0 0.9rem; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); font: 500 1rem var(--sans); cursor: pointer;
}
.toggle button + button { border-left: 1px solid var(--control); }
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.toggle button:focus-visible { outline-offset: -3px; }

.answer { scroll-margin-top: 1rem; }
.answer:focus { outline: none; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: clamp(1.5rem, 4vw, 3.25rem);
}
.card-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.verdict {
  display: inline-block; margin: 0 0 1.25rem; padding: 0.3rem 0.95rem;
  border-radius: 999px; font: 600 0.95rem/1.4 var(--sans);
  border: 1.5px solid var(--ink); color: var(--ink);
}
.card[data-verdict="local"] .verdict { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.model-name {
  margin: 0; font: 400 clamp(2.1rem, 5.2vw, 3.9rem)/1.04 var(--serif);
  letter-spacing: -0.025em; text-wrap: balance;
}
.card[data-verdict="api"] .model-name { font-size: clamp(1.7rem, 4vw, 2.7rem); }
.behind { margin-top: 1.5rem; max-width: 34rem; }
.behind p { margin: 0; }
.behind-main { font: 400 clamp(1.25rem, 2.4vw, 1.6rem)/1.3 var(--serif); letter-spacing: -0.01em; }
.behind-sub { margin-top: 0.4rem !important; color: var(--muted); font-variant-numeric: tabular-nums; }
.speed { margin: 1.25rem 0 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.speed:empty { display: none; }

.facts { margin: 0; display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); border-top: 1px solid var(--ink); }
.facts dt, .facts dd { margin: 0; padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.facts dt { color: var(--muted); padding-right: 1rem; font-size: 0.95rem; padding-top: 0.75rem; }
.facts dd { font-weight: 500; }

.run { margin-top: clamp(2.25rem, 5vw, 3.5rem); padding-top: 1.75rem; border-top: 1px solid var(--line); }
h3 { margin: 0 0 1.1rem; font: 500 1.5rem/1.2 var(--serif); letter-spacing: -0.015em; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1.25rem; max-width: 52rem; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6rem; min-width: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -0.1rem;
  font: 400 1.6rem/1.2 var(--serif); color: var(--accent); font-variant-numeric: lining-nums;
}
.step-label { display: block; font-weight: 500; margin-bottom: 0.4rem; }
.step-text { margin: 0; color: var(--muted); }
.cmd { display: flex; align-items: stretch; background: var(--code); border-radius: 4px; border: 1px solid var(--line); }
.cmd code { flex: 1; min-width: 0; padding: 0.75rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; line-height: 1.5; }
.copy {
  flex: none; min-width: 5.5rem; min-height: 44px; padding: 0 0.9rem;
  background: transparent; color: var(--accent); border: 0; border-left: 1px solid var(--line);
  border-radius: 0 3px 3px 0; font: 600 0.9rem var(--sans); cursor: pointer;
}
.copy:hover { background: var(--accent); color: var(--on-accent); }
.copy:focus-visible { outline-offset: -3px; }
.note { margin: 1.5rem 0 0; color: var(--muted); font-size: 0.92rem; max-width: 46rem; }

.alts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem clamp(2rem, 5vw, 4.5rem); margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.alt { margin: 0; font-size: 0.97rem; }
.alt:empty { display: none; }
.alt strong { font-weight: 600; }
.api { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.api p { max-width: 46rem; }
.api h3 { font-size: 1.25rem; margin-bottom: 0.7rem; }
.api p { margin: 0.35rem 0; }
.api .note { margin-top: 0.8rem; }
.card[data-verdict="api"] .api { border-top-color: var(--ink); }

.chart { margin: clamp(2.5rem, 6vw, 4.5rem) 0 0; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart figcaption { margin-top: 0.9rem; max-width: 46rem; color: var(--muted); font-size: 0.92rem; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .grid .vgrid { stroke-dasharray: 2 4; }
.chart text { font-family: var(--sans); fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .axis-title { font-weight: 500; }
.chart .frontier { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.chart .dot { fill: var(--muted); stroke: var(--bg); stroke-width: 1.5; }
.chart .dot.pick { fill: var(--accent); stroke: var(--accent); stroke-width: 2; }
.chart .dot.pick.hollow { fill: var(--bg); }
.chart .halo { fill: var(--halo); }
.chart .label { fill: var(--ink); font-size: 13px; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.chart .label.strong, .chart .pick-label { font-weight: 600; }
.chart .pick-label { fill: var(--accent); font-size: 14px; }

.pitch { margin-top: clamp(3rem, 8vw, 6rem); padding-block: clamp(2rem, 5vw, 3.5rem); border-top: 1px solid var(--ink); display: grid; gap: 1rem; max-width: 46rem; }
.pitch h2 { margin: 0; font: 400 clamp(1.7rem, 3.6vw, 2.5rem)/1.12 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.pitch p { margin: 0; color: var(--muted); }
.pitch-link {
  justify-self: start; display: inline-flex; align-items: center; min-height: 48px; padding: 0 1.5rem;
  background: var(--ink); color: var(--bg); border-radius: 999px; font-weight: 600; text-decoration: none;
}
.pitch-link:hover { background: var(--accent); color: var(--on-accent); }

.foot { padding-block: 0 3rem; color: var(--muted); font-size: 0.92rem; }
.foot p { margin: 0 0 0.6rem; max-width: 52rem; }

@media (prefers-reduced-motion: no-preference) {
  .theme, .copy, .toggle button, select, .pitch-link { transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
}

@media (max-width: 860px) {
  .card-top { grid-template-columns: minmax(0, 1fr); }
  .alts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  body { font-size: 1rem; }
  .card { padding: 1.25rem; }
  .facts { grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); }
  .steps li { padding-left: 2rem; }
  .cmd { flex-direction: column; }
  .copy { border-left: 0; border-top: 1px solid var(--line); border-radius: 0 0 3px 3px; }
  .inputs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .field-goal, .field:has(.toggle) { grid-column: 1 / -1; }
}
