/* Field Test site. Ink lane: near-black ground, one luminous accent, tone steps instead of lines.
   Layer 1 foundations, layer 2 purpose tokens, components below use purpose tokens only. */
@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  /* Foundations */
  --neutral-030: #0A0A0B; --neutral-070: #121214; --neutral-110: #19191C; --neutral-160: #222226;
  --neutral-450: #6E6E75; --neutral-660: #A1A1A8; --neutral-940: #EDEDEF;
  --blue-680: #8FA3FF; --blue-560: #6F86F0; --red-640: #F2838A;

  /* Purpose tokens */
  --bg: var(--neutral-030); --bg-raised: var(--neutral-070); --bg-raised-2: var(--neutral-110); --bg-raised-3: var(--neutral-160);
  --ink: var(--neutral-940); --ink-2: var(--neutral-660); --ink-3: var(--neutral-450);
  --accent: var(--blue-680); --accent-strong: var(--blue-560); --danger: var(--red-640);
  --baseline: var(--neutral-660);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --text-display: clamp(2.5rem, 1.2rem + 4.4vw, 4.75rem);
  --text-h2: clamp(1.75rem, 1.2rem + 1.7vw, 2.5rem);
  --text-h3: 1.25rem; --text-body: 1rem; --text-lede: 1.1875rem; --text-small: 0.875rem; --text-xs: 0.8125rem;
  --radius-frame: 20px; --radius-card: 14px; --radius-inner: 8px; --radius-cell: 4px; --radius-pill: 999px;
  --wrap: 1200px; --gutter: clamp(20px, 4vw, 40px); --section-y: clamp(72px, 9vw, 112px); --rhythm: 24px;
  --dur-hover: 150ms; --dur-reveal: 700ms; --dur-scene: 1000ms;
  --ease-standard: cubic-bezier(.4, 0, .2, 1); --ease-out: cubic-bezier(.25, 1, .5, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--text-body)/1.6 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "tnum"; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 540; text-wrap: balance; }
h2 { font-size: var(--text-h2); line-height: 1.1; letter-spacing: -0.03em; }
h3 { font-size: var(--text-h3); line-height: 1.3; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.acc { color: var(--accent); }
.skip { position: absolute; left: 12px; top: -48px; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: var(--radius-inner); z-index: 20; }
.skip:focus { top: 12px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* Buttons */
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: var(--radius-pill); font-weight: 500; font-size: 0.9375rem; text-decoration: none;
  transition: background-color var(--dur-hover) var(--ease-standard), color var(--dur-hover) var(--ease-standard), transform 120ms var(--ease-standard); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #FFFFFF; }
.btn-quiet { background: var(--bg-raised-2); color: var(--ink); }
.btn-quiet:hover { background: var(--bg-raised-3); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px); }
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; letter-spacing: -0.01em; }
.mark b { font-weight: 500; color: var(--ink-2); }
.nav nav { display: flex; align-items: center; gap: 4px; }
.nav nav a:not(.btn) { padding: 10px 12px; color: var(--ink-2); text-decoration: none; font-size: var(--text-small); border-radius: var(--radius-pill); transition: color var(--dur-hover) var(--ease-standard); }
.nav nav a:not(.btn):hover { color: var(--ink); }
.nav .btn { min-height: 36px; padding: 0 14px; font-size: var(--text-small); margin-left: 8px; }

/* Hero */
.hero { padding: clamp(56px, 8vw, 104px) 0 var(--section-y); }
.hero-in { display: grid; grid-template-columns: 1fr 1.25fr; column-gap: clamp(32px, 6vw, 96px); row-gap: 40px; align-items: start; }
.hero-in h1 { grid-column: 1 / -1; }
.hero-copy { padding-top: 8px; }
h1 { font-size: var(--text-display); line-height: 1.02; letter-spacing: -0.045em; font-weight: 560; }
.lede { margin: 0 0 32px; font-size: var(--text-lede); line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.score { margin: 0; padding: 28px; background: var(--bg-raised); border-radius: var(--radius-frame); }
.score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.score-cell { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: var(--radius-card); background: var(--bg-raised-2); }
.score-cell.is-skills { background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised-2)); }
.score-label { font-size: var(--text-small); color: var(--ink-2); }
.score-num { font-size: clamp(2.75rem, 2rem + 2.6vw, 4.25rem); line-height: 1; font-weight: 520; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.is-skills .score-num { color: var(--accent); }
.score-label { display: inline-flex; align-items: center; gap: 8px; }
.score-label .key.s { margin-left: 0; }
.field-wrap { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; margin: 24px 0 16px; }
.field-axis { display: grid; grid-template-rows: 1fr 1fr; gap: 6px; font-size: var(--text-xs); color: var(--ink-3); align-items: center; }
.field { width: 100%; height: auto; display: block; }
.field rect.f { fill: none; stroke: var(--bg-raised-3); stroke-width: 1.2; }
.field rect.p.b { fill: var(--baseline); }
.field rect.p.s { fill: var(--accent); }
.field-tasks { grid-column: 2; display: grid; grid-template-columns: 19fr 18fr 20fr; margin-top: 8px; font-size: var(--text-xs); color: var(--ink-3); }
.score figcaption { font-size: var(--text-xs); color: var(--ink-3); line-height: 1.5; }

/* Library */
.lib { display: grid; grid-template-columns: 1fr 1.35fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.lib-head p { color: var(--ink-2); margin-top: 16px; max-width: 52ch; }
.lib-head code { font-size: 0.875em; color: var(--ink); }
.agents { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.agents li { font-size: var(--text-small); padding: 7px 14px; border-radius: var(--radius-pill); background: var(--bg-raised-2); color: var(--ink); }
.collections { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.collections li { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; column-gap: 16px; row-gap: 6px; padding: 20px; border-radius: var(--radius-card); background: var(--bg-raised); }
.collections strong { grid-row: 1; grid-column: 1; font-weight: 540; }
.c-count { grid-row: 1; grid-column: 2; font: 500 var(--text-small)/1.5 var(--mono); color: var(--ink-3); }
.c-desc { grid-column: 1 / -1; font-size: var(--text-small); color: var(--ink-2); line-height: 1.5; }

/* A real skill file */
.skillfile { margin: 32px 0 0; background: var(--bg-raised); border-radius: var(--radius-card); overflow: hidden; }
.skillfile figcaption code { overflow-wrap: anywhere; }
.skillfile figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 16px; background: var(--bg-raised-2); font-size: var(--text-xs); color: var(--ink-2); }
.skillfile figcaption a { color: var(--ink-2); }
.skillfile figcaption a:hover { color: var(--ink); }
.skillfile pre { margin: 0; padding: 16px; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; max-height: 360px; overflow: auto; }

/* Sections */
.section { padding: var(--section-y) 0; }
.band { padding: var(--section-y) 0; background: var(--bg-raised); }
.split { display: grid; grid-template-columns: 1fr 1.35fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.split-head p, .head-row p, .task-head p { color: var(--ink-2); margin-top: 16px; max-width: 58ch; }
.legend { display: flex; align-items: center; gap: 8px; font-size: var(--text-small); }
.key { width: 10px; height: 10px; border-radius: 3px; background: var(--baseline); display: inline-block; }
.key.s { background: var(--accent); margin-left: 12px; }
.head-row { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: end; margin-bottom: 40px; }

/* Task rows */
.tasklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.trow { display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 24px; align-items: center; padding: 22px 24px; background: var(--bg-raised-2); border-radius: var(--radius-card); }
.tname { display: flex; flex-direction: column; gap: 2px; }
.tname strong { font-weight: 540; }
.tname span { font-size: var(--text-small); color: var(--ink-2); }
.tbars { display: grid; gap: 6px; }
.bar { display: block; height: 8px; border-radius: var(--radius-pill); background: var(--bg-raised-3); position: relative; overflow: hidden; }
.bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--baseline); border-radius: inherit; transform-origin: left; }
.bar.s::after { background: var(--accent); }
.tnums { display: grid; grid-template-columns: repeat(3, auto); gap: 14px; font-variant-numeric: tabular-nums; font-size: 0.9375rem; align-items: baseline; }
.tnums span:first-child { color: var(--ink-2); }
.delta { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-2); padding: 3px 8px; border-radius: var(--radius-pill); background: var(--bg-raised-3); }

/* Matrix */
.matrix-wrap { background: var(--bg-raised); border-radius: var(--radius-frame); padding: 8px; }
.tabs { display: flex; gap: 4px; padding: 4px; }
.tabs button { font: inherit; font-size: var(--text-small); font-weight: 500; color: var(--ink-2); background: none; border: 0; min-height: 40px; padding: 0 16px; border-radius: var(--radius-pill); cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease-standard), color var(--dur-hover) var(--ease-standard); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--bg-raised-3); color: var(--ink); }
.matrix-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 8px; margin-top: 4px; }
.panels { background: var(--bg-raised-2); border-radius: var(--radius-card); padding: 12px 8px 8px; min-width: 0; }
.panels [role=tabpanel]:focus-visible { outline-offset: -2px; }
.m-scroll { overflow-x: auto; position: relative; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--text-small); }
.matrix th, .matrix td { padding: 0; text-align: center; }
.matrix thead th { font: 500 var(--text-xs)/1 var(--mono); color: var(--ink-3); padding: 6px 0 10px; }
.matrix thead th.m-skills { color: var(--accent); }
.matrix .m-name { text-align: left; font-weight: 400; color: var(--ink-2); padding: 0 16px 0 10px; line-height: 1.35; min-width: 220px; }
.matrix tbody tr:hover .m-name { color: var(--ink); }
.matrix td { width: 44px; height: 38px; }
.matrix thead th.m-skills:nth-child(5), .matrix tbody td:nth-child(5), .matrix tfoot td:nth-child(5) { padding-left: 12px; }
.cell { width: 28px; height: 28px; border: 0; padding: 0; border-radius: var(--radius-cell); cursor: pointer; background: transparent; box-shadow: inset 0 0 0 1.5px var(--bg-raised-3);
  transition: transform var(--dur-hover) var(--ease-standard), box-shadow var(--dur-hover) var(--ease-standard); }
.cell.pass.m-baseline { background: var(--baseline); box-shadow: none; }
.cell.pass.m-skills { background: var(--accent); box-shadow: none; }
.cell:hover { transform: scale(1.12); }
.cell.fail:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.cell[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg-raised-2), 0 0 0 4px var(--ink); }
.m-tally { font: 500 var(--text-xs)/1.3 var(--mono); color: var(--ink-3); white-space: nowrap; padding-left: 12px !important; }
.m-tally span + span { margin-left: 10px; }
.matrix tfoot td, .matrix tfoot th { padding-top: 12px; font: 500 var(--text-xs)/1 var(--mono); color: var(--ink-2); }
.matrix tfoot th { font-family: var(--font); }
.matrix tfoot .m-skills { color: var(--accent); }
.inspector { background: var(--bg-raised-2); border-radius: var(--radius-card); padding: 20px; align-self: stretch; }
.ins-empty { color: var(--ink-3); font-size: var(--text-small); }
.ins-run { font: 500 var(--text-xs)/1.4 var(--mono); color: var(--ink-3); }
.ins-name { margin: 8px 0 12px; font-size: 1.0625rem; }
.ins-result { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-small); font-weight: 500; }
.ins-result::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.ins-result.is-fail { color: var(--danger); }
.ins-result.is-fail::before { background: none; box-shadow: inset 0 0 0 1.5px var(--danger); }
.ins-detail { margin: 16px 0 0; padding: 12px; background: var(--bg); border-radius: var(--radius-inner); font-size: var(--text-xs); line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.ins-detail:empty { display: none; }

/* Tasks */
.task + .task { padding-top: 0; }
.task-head { max-width: 760px; margin-bottom: 40px; }
.task-head h2 { margin-top: 10px; }
.task-kicker { font-size: var(--text-small); color: var(--ink-3); font-weight: 500; }
.task-head q { color: var(--ink); quotes: "“" "”"; }
.task-score { display: flex; gap: 24px; margin-top: 28px; font-size: var(--text-small); color: var(--ink-2); }
.task-score b { color: var(--ink); font-weight: 540; font-size: 1.0625rem; margin-left: 6px; font-variant-numeric: tabular-nums; }
.task-score b.acc { color: var(--accent); }
.shot { margin: 0; }
.mat { padding: 6px; background: var(--bg-raised-2); border-radius: var(--radius-frame); }
.mat img { border-radius: calc(var(--radius-frame) - 6px); width: 100%; height: auto; background: var(--bg-raised-3); }
.shot figcaption { margin-top: 10px; font-size: var(--text-xs); color: var(--ink-2); }
.shot figcaption a { color: var(--ink-2); margin-left: 6px; }
.t1-grid { display: grid; grid-template-columns: 300px 1fr; gap: clamp(24px, 4vw, 56px); align-items: start; }
.defects { list-style: none; margin: 0; padding: 0; counter-reset: d; display: grid; gap: 2px; }
.defects li { counter-increment: d; display: grid; grid-template-columns: 28px 1fr; padding: 9px 12px; border-radius: var(--radius-inner); font-size: var(--text-small); color: var(--ink-2); background: var(--bg-raised); }
.defects li::before { content: counter(d, decimal-leading-zero); font: 500 var(--text-xs)/1.7 var(--mono); color: var(--ink-3); }
.t1-shots { display: grid; gap: 20px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.gallery .mat img { aspect-ratio: 1280 / 900; object-fit: cover; object-position: top; }
.g-skills figcaption { color: var(--accent); }
.ledger { display: grid; gap: 8px; }
.ledger-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 24px; align-items: center; padding: 22px 24px; border-radius: var(--radius-card); background: var(--bg-raised); }
.ledger-k { font-family: var(--mono); font-size: var(--text-small); color: var(--ink-2); }
.ledger-v { font: 500 1.375rem/1.2 var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ledger-v s { color: var(--danger); text-decoration-thickness: 1.5px; margin-right: 10px; font-size: 0.8em; }
.ledger-v small { font-size: var(--text-xs); color: var(--ink-3); }
.ledger-n { font-size: var(--text-small); color: var(--ink-2); }

/* Skills */
.skills { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skills li { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius-inner); background: var(--bg-raised-2); }
.skills a { text-decoration: none; }
.skills a:hover code { color: var(--accent); }
.skills code { font-size: var(--text-small); transition: color var(--dur-hover) var(--ease-standard); }
.skills span { font-size: var(--text-xs); color: var(--ink-3); }

/* Method */
.method { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 6vw, 96px); }
.facts, .limits { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 16px; }
.facts li { color: var(--ink-2); max-width: 60ch; }
.facts b { color: var(--ink); font-weight: 540; }
.facts code { font-size: 0.875em; color: var(--ink); }
.val { width: 100%; border-collapse: collapse; font-size: var(--text-small); background: var(--bg-raised); border-radius: var(--radius-card); overflow: hidden; }
.val caption { text-align: left; font-weight: 540; font-size: 1.0625rem; margin-bottom: 14px; }
.val th, .val td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--bg-raised-3); }
.val tbody tr:last-child > * { border-bottom: 0; }
.val thead th { color: var(--ink-3); font-weight: 500; font-size: var(--text-xs); }
.val td { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.val td:last-child { color: var(--ink); }
.limits-h { margin-top: 40px; font-size: 1.0625rem; }
.limits { margin-top: 14px; gap: 10px; }
.limits li { font-size: var(--text-small); color: var(--ink-2); padding-left: 18px; position: relative; }
.limits li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border-radius: 2px; background: var(--ink-3); }

/* CTA + footer */
.cta-in > *, .cmds > * { min-width: 0; }
.cta-in { display: grid; gap: 32px; padding: clamp(32px, 5vw, 56px); background: var(--bg-raised); border-radius: var(--radius-frame); }
.cta-copy p { color: var(--ink-2); margin-top: 14px; max-width: 64ch; }
.cta-copy code { font-size: 0.875em; color: var(--ink); }
.cmds { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmds h3 { font-size: var(--text-small); font-weight: 500; color: var(--ink-2); margin-bottom: 10px; }
.cmd { position: relative; margin: 0; width: 100%; padding: 20px 22px; background: var(--bg); border-radius: var(--radius-card); font-size: var(--text-small); line-height: 1.8; color: var(--ink-2); overflow-x: auto; }
.foot { padding: 40px 0 56px; color: var(--ink-3); font-size: var(--text-xs); }
.foot-in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot a { color: var(--ink-2); margin-left: 16px; }

/* Motion: entrances only when script runs and motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out); transition-delay: var(--d, 0ms); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .bar::after { transform: scaleX(0); transition: transform var(--dur-scene) var(--ease-out); transition-delay: var(--d, 120ms); }
  .js .in .bar::after { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition-duration: 0ms !important; animation: none !important; } }

/* Responsive */
@media (max-width: 1080px) {
  .matrix-grid { grid-template-columns: 1fr; }
  .inspector { min-height: 0; }
}
@media (max-width: 900px) {
  .hero-in, .split, .method, .head-row, .t1-grid, .lib, .cmds { grid-template-columns: 1fr; }
  .head-row { gap: 0; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .ledger-row { grid-template-columns: 1fr; gap: 6px; }
  .nav nav a:not(.btn) { display: none; }
}
@media (max-width: 600px) {
  .trow { grid-template-columns: 1fr; gap: 14px; }
  .pair, .gallery, .skills, .collections { grid-template-columns: 1fr; }
  .score { padding: 16px; } .score-cell { padding: 16px; }
  .task-score { flex-direction: column; gap: 6px; }
  .matrix .m-name { min-width: 170px; }
}

/* Interim state while the first results are graded */
.score.pending { display: grid; gap: 16px; justify-items: start; }
.pending-label { display: inline-flex; align-items: center; gap: 10px; font-weight: 540; }
.pending-text { color: var(--ink-2); font-size: var(--text-small); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .pulse { animation: pulse 2.4s var(--ease-standard) infinite; } }
@keyframes pulse { 50% { opacity: .35; } }
