/* Same design language as martinferret.dev: tokens, blue hero panel, cards, badges, instrument readings, charts. Light only. */
:root {
  --paper: #f7f9fb; --sheet: #ffffff; --fill: #edf1f5; --rule: #d5dde7; --rule-strong: #aab6c5;
  --ink: #0e1726; --ink-2: #2b3546; --muted: #4a576b;
  --accent: #1d5fb8; --accent-strong: #174d96; --accent-tint: #e6eefa;
  --st-merged: #13703a; --st-merged-bg: #e3f4e8;
  --st-discussion: #2b3546; --st-discussion-bg: #edf1f5;
  --st-closed: #4a576b;
  --c-blue: #1d5fb8; --c-blue-mid: #5b8fd9; --c-sky: #e6eefa; --c-sky-strong: #c4d8f5;
  --c-mint: #24875a; --c-coral: #d9482c; --c-coral-ink: #a3321b; --c-coral-soft: #ffe6df;
  --grid-line: rgba(29, 95, 184, 0.07); --c-violet: #7b5cd6; --c-amber-ink: #7a4a00; --c-sun: #ffd166; --c-sun-soft: #fff4d6; --c-ink: #0e1726;

  --font-display: "Funnel Display", "Geist", system-ui, sans-serif;
  --font-ui: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --step--2: 0.875rem; --step--1: 0.9375rem; --step-0: 1.0625rem; --step-1: 1.25rem; --step-2: 1.5rem;
  --step-5: 3.25rem; --step-6: 4.25rem;
  --fs-h1: clamp(2.25rem, 1.5rem + 2.6vw, 3.75rem);
  --fs-h2: clamp(1.625rem, 1.3rem + 1.1vw, 2.25rem);
  --measure: 68ch;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px; --s8: 64px;
  --content: 1120px; --gutter: clamp(16px, 4vw, 40px); --header-h: 64px;
  --r-ctl: 8px;
  --sec-y: clamp(64px, 8vw, 112px); --frame: clamp(8px, 1.5vw, 20px); --r-frame: clamp(24px, 3vw, 40px);
  --card-pad: clamp(20px, 2.2vw, 32px); --grid-gap: clamp(16px, 2vw, 24px); --head-gap: clamp(32px, 4vw, 48px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1); --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms; --t-med: 240ms;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: var(--step-0); line-height: 1.6; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 500; color: var(--ink); text-wrap: balance; overflow-wrap: break-word; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.02em; line-height: 1.12; }
h3 { font-size: var(--step-1); letter-spacing: -0.01em; line-height: 1.3; }
code, .ver { font-family: var(--font-mono); font-size: 0.86em; }
a { color: inherit; text-decoration: none; }
.link { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: color var(--t-fast), text-decoration-color var(--t-fast); }
.link:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }
::selection { background: var(--accent-tint); color: var(--ink); }
.wrap { max-width: var(--content); margin: 0 auto; padding-inline: var(--gutter); }
.block { padding-block: calc(var(--sec-y) / 2); }
.frame { position: relative; margin: calc(var(--sec-y) / 2) var(--frame); border-radius: var(--r-frame); padding-block: var(--sec-y); overflow: hidden; }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.meta { font-size: var(--step--1); color: var(--muted); }
.read { line-height: 1.65; max-width: var(--measure); color: var(--ink-2); }
.read code, .kcard-text code, .facts code, .plain code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.hero-sub code { background: rgba(255, 255, 255, 0.16); color: #fff; border-radius: 5px; padding: 1px 5px; }
.skip { position: absolute; left: var(--s2); top: -100px; z-index: 100; background: var(--ink); color: var(--paper); padding: var(--s1) var(--s2); border-radius: var(--r-ctl); }
.skip:focus { top: var(--s2); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--rule); }
.header-inner { max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter); min-height: var(--header-h); display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s2); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-height: var(--header-h); font-family: var(--font-display); font-weight: 500; font-size: var(--step-1); letter-spacing: -0.01em; line-height: 1; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--c-blue); color: #fff; font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: -0.02em; }
.nav { list-style: none; display: flex; gap: 4px; }
.nav a { position: relative; display: flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: var(--step--1); font-weight: 500; color: var(--ink-2); border-radius: var(--r-ctl); white-space: nowrap; transition: color var(--t-fast), background-color var(--t-fast); }
.nav a:hover { color: var(--ink); background: var(--fill); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -10px; height: 2px; border-radius: 2px; background: var(--accent); }
.gh { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: var(--r-ctl); background: var(--sheet); font-size: var(--step--1); font-weight: 500; color: var(--ink-2); transition: border-color var(--t-fast), color var(--t-fast); }
.gh:hover { border-color: var(--rule-strong); color: var(--ink); }
.gh svg { width: 18px; height: 18px; }
@media (max-width: 860px) {
  .nav { order: 3; width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)); padding: 0 calc(var(--gutter) - 12px) 6px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--rule); }
  .nav a[aria-current="page"]::after { bottom: 4px; }
}

/* ---------- CTAs ---------- */
.cta { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 14px; font-family: var(--font-ui); font-weight: 600; font-size: var(--step-0); line-height: 1; border: 2px solid transparent; white-space: nowrap; cursor: pointer; transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.cta svg { width: 20px; height: 20px; transition: transform var(--t-med) var(--ease); }
.cta:hover { transform: translateY(-2px); }
.cta:hover svg { transform: translateX(4px); }
.cta:active { transform: translateY(0); }
.cta--primary { background: var(--c-blue); color: #fff; box-shadow: 0 10px 24px -10px rgba(29, 95, 184, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.cta--primary:hover { background: var(--accent-strong); }
.cta--soft { background: var(--c-sun); color: var(--c-ink); box-shadow: 0 10px 24px -14px rgba(180, 120, 0, 0.8); }
.cta--soft:hover { background: #ffc53d; }
.cta--outline { background: var(--sheet); color: var(--c-ink); border-color: var(--c-ink); }
.cta--outline:hover { background: var(--c-ink); color: #fff; }
.cta--onblue { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.7); }
.cta--onblue:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }

/* ---------- Hero ---------- */
.hero-panel { margin-top: var(--frame); padding-block: 0; color: #fff; background: radial-gradient(circle at 78% 45%, #3a80d8 0%, transparent 42%), linear-gradient(135deg, #2366c2, #1d5fb8 45%, #174d96); }
.hero-panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.18; background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(ellipse at 20% 30%, #000, transparent 60%); -webkit-mask-image: radial-gradient(ellipse at 20% 30%, #000, transparent 60%); }
.hero-panel :focus-visible { outline-color: var(--c-sun); }
.hero { position: relative; display: grid; gap: var(--head-gap); align-items: center; padding-block: calc(var(--sec-y) * 0.8); }
.hero-text { display: grid; gap: var(--s3); min-width: 0; }
.hero-crumb { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: var(--step--1); font-weight: 600; color: #e3ecf9; }
.hero-crumb a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.5); text-underline-offset: 0.2em; }
.hero-title { color: #fff; font-size: clamp(2.5rem, 1.6rem + 2.6vw, 3.75rem); line-height: 1.02; letter-spacing: -0.045em; max-width: 18ch; }
.hero-sub { font-size: var(--step-1); line-height: 1.55; color: #e3ecf9; max-width: 46ch; }
.hero-actions { gap: 14px; }
.hero-fig { min-width: 0; padding: var(--card-pad); border-radius: 24px; background: var(--sheet); color: var(--ink); box-shadow: 0 40px 80px -36px rgba(8, 30, 70, 0.75); }
@media (min-width: 960px) { .hero:not(.hero--solo) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s8); } }
.lab-fig { display: grid; gap: var(--s2); }
.lab-fig-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.lab-fig-cap b { font-family: var(--font-display); font-weight: 500; font-size: var(--step-2); }
.lab-fig-cap span { font-size: var(--step--1); color: var(--muted); }
.lab-fig ul { list-style: none; display: grid; gap: 12px; }
.lab-fig a { display: grid; gap: 6px; padding: 16px 18px; border-radius: 16px; background: var(--c-sky); transition: transform var(--t-med) var(--ease), background-color var(--t-fast); }
.lab-fig a:hover { transform: translateX(4px); background: var(--c-sky-strong); }
.lf-top, .res-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lf-num { font-family: var(--font-display); font-size: var(--step-5); line-height: 1; letter-spacing: -0.045em; color: var(--c-blue); }
.lf-label { font-size: var(--step--1); color: var(--ink-2); }
.res { display: grid; gap: 10px; }
.res-num { font-family: var(--font-display); font-size: clamp(3.5rem, 2rem + 4vw, 5.5rem); line-height: 1; letter-spacing: -0.05em; color: var(--c-blue); }
.res-label { font-size: var(--step-1); color: var(--ink); }
.res-meta { font-size: var(--step--1); color: var(--muted); padding-top: 10px; border-top: 1px solid var(--rule); }

/* ---------- Overview hero: a replay of the measured check, file by file ---------- */
.hx { align-items: center; padding-block: calc(var(--sec-y) * 0.85); }
.hx .hero-text { gap: var(--s3); }
.hx .hero-title { position: relative; z-index: 0; font-size: clamp(2.5rem, 1.6rem + 2.8vw, 4rem); line-height: 1.02; letter-spacing: -0.045em; max-width: 12ch; }
.hx .hero-sub { max-width: 36ch; }
.hx-word { display: inline-block; }
.js .hx-word { opacity: 0; transform: translateY(0.4em); filter: blur(4px); animation: word 0.8s var(--ease-out) forwards; animation-delay: calc(100ms + var(--w) * 80ms); }
@keyframes word { to { opacity: 1; transform: none; filter: none; } }
.hx-mark { position: relative; white-space: nowrap; }
.hx-mark::after { content: ""; position: absolute; left: 0; right: 0.12em; bottom: 0.02em; height: 0.09em; border-radius: 0.1em; background: var(--c-sun); z-index: -1; transform-origin: left; }
.js .hx-mark::after { transform: scaleX(0); animation: sweep 0.7s var(--ease-out) 0.8s forwards; }
@keyframes sweep { to { transform: scaleX(1); } }
@media (min-width: 960px) { .hx { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s8); } }

.tw { position: relative; justify-self: stretch; width: 100%; max-width: 500px; margin: 0; display: grid; gap: 18px; padding: 22px 24px 20px; border-radius: 24px; background: var(--sheet); color: var(--ink); box-shadow: 0 40px 80px -36px rgba(8, 30, 70, 0.75); }
@media (min-width: 960px) { .tw { justify-self: end; } }
.js .tw { animation: rise 0.9s var(--ease-out) 0.2s both; }
.tw-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tw-top p { font-size: var(--step--2); color: var(--muted); }
.tw-top p b { display: block; font-family: var(--font-display); font-weight: 500; font-size: var(--step-1); line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 2px; }
.tw-replay { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--rule); background: var(--sheet); color: var(--muted); cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-med) var(--ease); }
.tw-replay:hover { color: var(--accent); border-color: var(--rule-strong); transform: rotate(-40deg); }
.tw-replay svg { width: 16px; height: 16px; }
.run { display: grid; gap: 8px; }
.run-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: var(--step--1); }
.run-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.run-name .ver { font-weight: 500; color: var(--muted); }
.run-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cell); }
.run[data-state="running"] .run-dot { animation: blink 0.9s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.run-time { font-family: var(--font-mono); font-size: var(--step--1); font-weight: 600; color: var(--ink); }
.run[data-state="done"] .run-time { color: var(--done-ink); }
.files { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; }
.files i { aspect-ratio: 1; border-radius: 1.5px; background: var(--fill); transition: background-color 0.45s ease; }
.files i.on { background: var(--cell); }
.files i.hot { background: var(--c-sun); box-shadow: 0 0 6px 1px rgba(255, 196, 61, 0.8); transition: none; }
.run--slow { --cell: #8db3ea; --done-ink: var(--ink-2); }
.run--fast { --cell: var(--c-blue); --done-ink: var(--st-merged); }
.run-meta { font-size: 0.8125rem; color: var(--muted); }
.tw-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.tw-foot p { font-size: 0.8125rem; line-height: 1.45; color: var(--muted); max-width: 32ch; }
.tw-foot a { color: var(--ink-2); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; }
.tw-foot a:hover { color: var(--accent); }
.tw-x { flex: none; display: inline-flex; align-items: baseline; gap: 6px; color: var(--c-blue); opacity: 0; transform: translateY(6px); transition: opacity 0.4s, transform 0.6s var(--ease-out); }
.tw-x b { font-family: var(--font-display); font-weight: 500; font-size: 2.5rem; line-height: 0.9; letter-spacing: -0.05em; }
.tw-x span { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.tw[data-finished] .tw-x { opacity: 1; transform: none; }
@media (max-width: 560px) { .tw { padding: 18px 16px; } .tw-foot { flex-direction: column-reverse; align-items: flex-start; } }
@media (prefers-reduced-motion: reduce) {
  .js .hx-word { opacity: 1 !important; transform: none !important; filter: none !important; }
  .js .hx-mark::after { transform: none !important; }
}

/* ---------- Tags and badges ---------- */
.tag { display: inline-flex; align-items: center; gap: 8px; font-size: var(--step--1); font-weight: 600; line-height: 1; color: var(--ink-2); }
.tag-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; background: var(--t); box-shadow: 0 4px 10px -4px var(--t); }
.tag-ic svg { width: 16px; height: 16px; }
.tag--violet { --t: var(--c-violet); } .tag--coral { --t: var(--c-coral); } .tag--blue { --t: var(--c-blue); } .tag--mint { --t: var(--c-mint); } .tag--amber { --t: #a86400; } .tag--neutral { --t: var(--ink-2); }
.badge { --b: var(--st-discussion); --bg: var(--st-discussion-bg); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; font-size: var(--step--2); font-weight: 600; line-height: 1; padding: 5px 11px 5px 8px; border-radius: 999px; color: var(--b); background: var(--bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--b) 22%, transparent); }
.badge svg { width: 15px; height: 15px; flex: none; }
.badge--merged { --b: var(--st-merged); --bg: var(--st-merged-bg); }
.badge--closed { --b: var(--st-closed); --bg: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule-strong); }

/* ---------- Section heads, cards, grids ---------- */
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s2) var(--s4); margin-bottom: var(--head-gap); }
.head-row p { color: var(--ink-2); margin-top: 8px; max-width: 60ch; }
.head-center { display: grid; justify-items: center; gap: 16px; text-align: center; margin-bottom: var(--head-gap); }
.head-center h2 { font-size: var(--fs-h1); }
.head-center p { color: var(--ink-2); max-width: 54ch; }
.kcard { display: grid; gap: 12px; align-content: start; padding: var(--card-pad); border-radius: 24px; background: var(--sheet); border: 1px solid var(--rule); min-width: 0; }
.kcard-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 500; line-height: 1.2; }
.kcard-text { color: var(--ink-2); }
.g2, .g3 { list-style: none; display: grid; gap: var(--grid-gap); }
.g2 > li, .g3 > li { display: flex; min-width: 0; } .g2 > li > *, .g3 > li > * { width: 100%; }
@media (min-width: 760px) { .g2, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sky-frame { background: var(--c-sky); background-image: radial-gradient(#c4d8f5 1.4px, transparent 1.4px); background-size: 26px 26px; }
.stack { display: grid; gap: var(--grid-gap); }
.stack > * { min-width: 0; }
.stack + .stack { margin-top: var(--sec-y); }

/* ---------- Experiment page ---------- */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px var(--s3); margin: 0; }
.facts dt { font-size: var(--step--1); font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
@media (max-width: 560px) { .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; } .facts dd { margin-bottom: 10px; } }
.plain { padding-left: 20px; color: var(--ink-2); display: grid; gap: 6px; }
.plain li::marker { color: var(--c-blue); }
.ok-line { display: inline-flex; align-items: center; gap: 8px; color: var(--st-merged); font-weight: 500; }
.ok-line svg { width: 18px; height: 18px; flex: none; }

.stamp { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px; border-radius: 999px; background: var(--c-coral-soft); color: var(--c-coral-ink); font-size: var(--step--2); font-weight: 600; white-space: nowrap; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-coral-ink) 22%, transparent); }
.stamp svg { width: 15px; height: 15px; }

.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: 24px; padding: 4px var(--card-pad); }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); line-height: 1.5; }
th, td { text-align: left; padding: 14px 18px 14px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th:last-child, td:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
td { color: var(--ink-2); }
th.n, td.n { text-align: right; white-space: nowrap; }
td.n { font-family: var(--font-mono); font-size: 0.875rem; color: var(--ink); }
td .range, th .range { display: block; font-family: var(--font-ui); font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
td:first-child { min-width: 18ch; }
td.fail { color: var(--c-coral-ink); font-weight: 600; }

.code { display: flex; align-items: stretch; border-radius: 24px; background: #0f1b2e; box-shadow: 0 30px 60px -40px rgba(14, 23, 38, 0.6); overflow: hidden; }
.code code { flex: 1; min-width: 0; padding: var(--card-pad); color: #dbe6f6; font-size: var(--step--1); line-height: 1.6; overflow-x: auto; white-space: pre; }
.code code::before { content: "$ "; color: #5d7396; }
.copy { flex: none; align-self: center; margin-right: 14px; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid #2b3f5e; border-radius: var(--r-ctl); background: #16253d; color: #dbe6f6; font: inherit; font-size: var(--step--1); font-weight: 500; cursor: pointer; transition: background-color var(--t-fast), border-color var(--t-fast); }
.copy:hover { background: #1f3352; border-color: #3d5a85; }
.copy svg { width: 16px; height: 16px; }

/* ---------- Grid paper: the texture of measured surfaces ---------- */
.grid-paper { background-color: var(--sheet); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 16px 16px; background-position: -1px -1px; }

/* ---------- Instrument reading: numeral, rule, label, monospace caption ---------- */
.readings { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4) var(--s3); padding: var(--card-pad); border: 1px solid var(--rule); border-radius: 24px; }
@media (min-width: 560px) { .readings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .readings[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.reading { display: grid; align-content: start; gap: 10px; min-width: 0; }
.reading-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.reading-num { font-family: var(--font-display); font-weight: 500; font-size: clamp(2.5rem, 2rem + 1.6vw, 3.25rem); line-height: 1; letter-spacing: -0.04em; color: var(--c-blue); white-space: nowrap; }
.reading-vs { font-family: var(--font-display); font-size: var(--step-1); color: var(--muted); white-space: nowrap; }
.reading-label { font-size: var(--step--1); line-height: 1.45; color: var(--ink); }
.reading-cap { font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.55; color: var(--muted); }

/* ---------- Overview cards ---------- */
.xcards { list-style: none; display: grid; gap: var(--grid-gap); }
@media (min-width: 900px) { .xcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.xcards > li { display: flex; min-width: 0; }
.xcard { position: relative; width: 100%; gap: var(--s2); transition: border-color var(--t-fast), box-shadow var(--t-med) var(--ease); }
.xcard:hover { border-color: var(--rule-strong); box-shadow: 0 24px 48px -36px rgba(14, 23, 38, 0.5); }
.xcard:has(.xcard-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.xcard-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.xcard h3 { font-size: var(--step-2); line-height: 1.2; letter-spacing: -0.015em; }
.xcard-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.xcard-link:focus-visible { outline: none; }
.xcard-reading { padding: var(--s2) 20px 18px; border: 1px solid var(--rule); border-radius: 16px; }
.xcard-q { color: var(--ink-2); }
.xcard-q code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.xcard-more { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; font-weight: 600; color: var(--accent); }
.xcard-more svg { width: 18px; height: 18px; transition: transform var(--t-med) var(--ease); }
.xcard:hover .xcard-more svg { transform: translateX(4px); }

/* ---------- Experiment header ---------- */
.xh { border-bottom: 1px solid var(--rule); background: linear-gradient(var(--paper), var(--paper)) padding-box; }
.xh-inner { display: grid; gap: var(--s2); padding-block: var(--s6) var(--s5); }
.xh-crumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--step--1); color: var(--muted); }
.xh-crumb a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em; }
.xh-crumb a:hover { color: var(--accent); }
.xh-title { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -0.035em; max-width: 30ch; }
.xh-q { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.xh-q code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.xh-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: var(--s1) 0 0; padding-top: var(--s2); border-top: 1px solid var(--rule); }
.xh-meta div { display: grid; gap: 4px; min-width: 0; }
.xh-meta dt { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.xh-meta dd { margin: 0; font-weight: 500; color: var(--ink); }
.xh-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.xh-reason { font-weight: 400; font-size: var(--step--1); color: var(--ink-2); }

/* ---------- Paper layout with a table of contents in the margin ---------- */
.paper { display: grid; gap: var(--s4); padding-block: var(--s5) var(--sec-y); }
.paper-body { display: grid; gap: var(--s8); min-width: 0; }
.toc-side { display: none; }
.toc-list { list-style: none; display: grid; gap: 2px; }
.toc-list a { display: flex; align-items: baseline; gap: 10px; min-height: 36px; align-items: center; padding: 4px 10px; border-radius: var(--r-ctl); font-size: var(--step--1); color: var(--ink-2); border-left: 2px solid transparent; }
.toc-list a:hover { color: var(--ink); background: var(--fill); }
.toc-list a[aria-current] { color: var(--ink); font-weight: 600; border-left-color: var(--accent); border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.toc-n { flex: none; width: 1.2em; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.toc-title { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); padding: 0 12px 8px; }
.toc-inline { border: 1px solid var(--rule); border-radius: 16px; background: var(--sheet); }
.toc-inline summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; padding: 0 var(--s2); font-weight: 600; }
.toc-inline .toc-list { padding: 0 8px 12px; }
@media (min-width: 1100px) {
  .paper { grid-template-columns: 200px minmax(0, 1fr); gap: var(--s6); }
  .toc-side { display: block; position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
  .toc-inline { display: none; }
}

/* ---------- Paper sections ---------- */
.psec { display: grid; gap: var(--s3); min-width: 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.psec > * { min-width: 0; }
.psec h2 { display: flex; align-items: baseline; gap: 14px; font-size: var(--fs-h2); }
.psec-n { font-family: var(--font-mono); font-size: 0.5em; font-weight: 500; color: var(--accent); letter-spacing: 0; }
.psec h3 { font-size: var(--step-1); margin-top: var(--s2); }
.psec h4 { display: grid; gap: 2px; font-family: var(--font-display); font-weight: 500; font-size: var(--step-1); line-height: 1.25; }
.psec h4 .meta, .machine > h3 .meta { font-family: var(--font-ui); font-size: var(--step--1); font-weight: 400; letter-spacing: 0; }
.psec h5 { margin: var(--s1) 0 0; font-size: var(--step--1); font-weight: 600; color: var(--ink); }
.abstract { font-size: var(--step-1); line-height: 1.6; color: var(--ink); max-width: var(--measure); }
.abstract code { background: var(--fill); border-radius: 5px; padding: 1px 5px; font-size: 0.8em; }
.prose { display: grid; gap: var(--s2); max-width: var(--measure); color: var(--ink-2); line-height: 1.7; }
.prose code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.v-lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink); max-width: var(--measure); padding-left: 16px; border-left: 3px solid var(--c-blue); }
.v-lead code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.recs { padding-left: 24px; display: grid; gap: 10px; max-width: var(--measure); color: var(--ink-2); }
.recs li::marker { font-family: var(--font-mono); color: var(--accent); }
.recs code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.machines { display: grid; gap: var(--grid-gap); }
.machine-card { gap: 14px; }
.machine-card h4, .machine-card h5 { margin: 0; }
.machine-card .facts { grid-template-columns: 10rem minmax(0, 1fr); }
.kcard .table-wrap { border: 0; border-radius: 0; padding: 0; }
.metrics { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--rule); max-width: var(--measure); }
.metrics div { display: grid; gap: 2px 24px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
@media (min-width: 640px) { .metrics div { grid-template-columns: 9rem minmax(0, 1fr); } }
.metrics dt { font-weight: 600; color: var(--ink); }
.metrics dd { margin: 0; color: var(--ink-2); }
.metrics code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
.files { list-style: none; display: grid; gap: 4px; }
.files li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.files code { overflow-wrap: anywhere; }
.changelog { list-style: none; display: grid; gap: var(--s2); border-left: 2px solid var(--rule); padding-left: var(--s3); }
.changelog time { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.changelog p { color: var(--ink-2); }
.more { display: grid; gap: 12px; }
.more summary, .chart-data summary { cursor: pointer; width: fit-content; min-height: 32px; display: inline-flex; align-items: center; font-size: var(--step--1); font-weight: 600; color: var(--accent); }
.more[open] summary { margin-bottom: 12px; }
table caption { caption-side: top; text-align: left; padding: 14px 0 4px; font-weight: 600; color: var(--ink); font-size: var(--step--1); }

/* ---------- Results: one block per machine, one chart per workload ---------- */
.machine { display: grid; gap: var(--s3); min-width: 0; }
.machine + .machine { margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--rule); }
.machine > h3 { display: grid; gap: 2px; margin: 0; font-size: var(--step-2); }
.machine--minor > h3 { font-size: var(--step-1); }
.charts { display: grid; gap: var(--grid-gap); }
.chart { --label-w: 15rem; --row-h: 30px; margin: 0; display: grid; gap: 12px; padding: var(--card-pad); border: 1px solid var(--rule); border-radius: 24px; background: var(--sheet); min-width: 0; }
.chart--minor { --row-h: 22px; max-width: 760px; padding: 20px; }
.chart-cap { font-weight: 600; color: var(--ink); font-size: var(--step--1); }
.chart-plot { display: grid; gap: 10px; padding-top: 4px; }
.chart-row, .chart-axis, .chart-axis-title { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); gap: 4px var(--s2); align-items: center; }
.chart-label { font-size: var(--step--1); line-height: 1.3; color: var(--ink-2); }
.chart-track { position: relative; height: var(--row-h); border-right: 1px solid var(--rule); background-image: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px calc(100% / var(--ticks))); }
.chart-bar { position: absolute; left: 0; top: 20%; bottom: 20%; border-radius: 0 4px 4px 0; transform-origin: left; }
.chart-bar--a { background: var(--c-blue-mid); }
.chart-bar--b { background: var(--c-blue); }
.chart-wh { position: absolute; top: 50%; height: 0; border-top: 1.5px solid var(--ink); }
.chart-wh::before, .chart-wh::after { content: ""; position: absolute; top: -6px; height: 11px; border-left: 1.5px solid var(--ink); }
.chart-wh::before { left: -1px; } .chart-wh::after { right: -1px; }
.chart-val { position: absolute; top: 50%; translate: 8px -50%; white-space: nowrap; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--ink); background: color-mix(in srgb, var(--sheet) 85%, transparent); padding: 0 3px; border-radius: 3px; }
.chart-row--fail .chart-track { display: flex; align-items: center; background-image: none; border-right: 0; height: auto; min-height: var(--row-h); }
.chart-row--fail .stamp { white-space: normal; }
.chart-axis { margin-top: -6px; }
.chart-scale { position: relative; height: 18px; border-top: 1.5px solid var(--ink); }
.chart-scale span { position: absolute; top: 4px; translate: -50% 0; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--muted); }
.chart-scale span:first-child { translate: 0 0; } .chart-scale span:last-child { translate: -100% 0; }
.chart-axis-title > span:last-child { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); text-align: center; }
.chart-key { font-size: 0.8125rem; color: var(--muted); }
.chart-data .table-wrap { margin-top: 10px; padding: 0 var(--s2); border-radius: 16px; }
.chart-none { display: grid; gap: 8px; padding: var(--card-pad); border: 1px dashed var(--rule-strong); border-radius: 24px; background: var(--sheet); }
@media (max-width: 700px) {
  .chart { --label-w: 0; padding: 16px; }
  .chart-row, .chart-axis, .chart-axis-title { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .chart-axis > .chart-label, .chart-axis-title > .chart-label { display: none; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--rule); margin-top: var(--s5); }
.footer .wrap { padding-top: var(--s5); padding-bottom: var(--s6); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3); }
.footer p { max-width: 60ch; color: var(--ink-2); font-size: var(--step--1); }
.footer-nav { list-style: none; display: flex; flex-wrap: wrap; gap: 4px var(--s3); }
.footer-nav a { display: inline-flex; min-height: 44px; align-items: center; font-size: var(--step--1); color: var(--ink-2); }
.footer-nav a:hover { color: var(--accent); }
.empty { padding: var(--card-pad); border: 1px dashed var(--rule-strong); border-radius: 24px; color: var(--ink-2); background: var(--sheet); }

/* ---------- Motion ---------- */
.js .hero-text > *, .js .hero-fig { animation: rise 0.7s var(--ease-out) both; }
.js .hero-text > :nth-child(2) { animation-delay: 100ms; } .js .hero-text > :nth-child(3) { animation-delay: 200ms; } .js .hero-fig { animation-delay: 150ms; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.js [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 520ms var(--ease-out), transform 520ms var(--ease-out); }
.js [data-reveal][data-shown] { opacity: 1; transform: none; }
.js .chart .chart-bar { transform: scaleX(0); transition: transform 0.8s var(--ease) calc(var(--i, 0) * 80ms); }
.js .chart[data-drawn] .chart-bar { transform: none; }
.js [data-reveal] .g2 > li, .js [data-reveal] .g3 > li { opacity: 0; translate: 0 24px; transition: opacity 0.6s var(--ease-out), translate 0.6s var(--ease-out); transition-delay: calc(var(--i, 0) * 110ms); }
.js [data-reveal][data-shown] .g2 > li, .js [data-reveal][data-shown] .g3 > li { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal], .js [data-reveal] li { opacity: 1 !important; transform: none !important; translate: none !important; }
  .js .chart-bar { transform: none !important; }
}
@media (max-width: 560px) {
  .code { flex-direction: column; }
  .copy { align-self: flex-start; margin: 0 0 14px var(--card-pad); }
}
