/* Necessity Robotics: design system (see ../../DESIGN.md). One file, no build step, no web fonts (system stack). */

:root {
  color-scheme: dark;
  /* surfaces: black; panels sit a hair above */
  --bg: #000000;
  --bg-1: #0a0a0a;        /* band */
  --bg-2: #111111;        /* panel */
  --bg-3: #1a1a1a;        /* hover */
  --line: rgba(255, 255, 255, .13);
  --line-2: rgba(255, 255, 255, .22);
  --line-3: rgba(255, 255, 255, .40);
  /* text: every pair below is >= 7:1 on --bg and --bg-2 (DESIGN.md section 3) */
  --fg: #f4f4f4;          /* 19.1:1 on #000 */
  --fg-2: #cdcdcd;        /* 13.2:1 */
  --fg-3: #a6a6a6;        /* 8.6:1, labels only */
  /* one accent: "ion" signal blue, for xclean, links and live states */
  --ion: #6cc9ff;         /* 11.4:1 */
  --ion-dim: rgba(108, 201, 255, .16);
  /* data colours (results only, always with a text label) */
  --loss: #ffad7a;        /* the other system better: warm, hatched marks */
  --tie: #b0b0b0;
  --warn: #ffd27a;        /* disclosures, caveats */
  --ink: #000000;

  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --wrap: 1240px;
  --measure: 68ch;
  --r: 10px;
  --ease: cubic-bezier(.2, .7, 0, 1);
  --head-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 18px/1.65 var(--sans);
  font-kerning: normal; font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: auto;   /* never thin the strokes on dark (DESIGN.md 3.2) */
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: var(--ion); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--fg); }
:focus-visible { outline: 2px solid var(--ion); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--ion); color: var(--ink); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--fg); color: var(--ink); padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- type */
h1, h2, h3, h4, p, li, dd, figcaption { overflow-wrap: break-word; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--fg); margin: 0 0 .5em; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(36px, 5.2vw, 64px); line-height: 1.06; font-weight: 650; }
h2 { font-size: clamp(28px, 3.6vw, 44px); line-height: 1.12; font-weight: 650; }
h3 { font-size: clamp(20px, 2vw, 24px); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 18px; line-height: 1.35; font-weight: 600; letter-spacing: 0; }
p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
.lead { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.55; color: var(--fg); max-width: 60ch; }
.muted { color: var(--fg-2); }
strong, b { font-weight: 650; color: var(--fg); }
small, .small { font-size: 16px; line-height: 1.55; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
:not(pre) > code { background: var(--bg-2); border: 1px solid var(--line); padding: .08em .38em; border-radius: 5px; color: var(--fg); }
pre { margin: 0 0 1.2em; padding: 18px 20px; background: #0a0a0a; border: 1px solid var(--line-2); border-radius: var(--r); overflow-x: auto; font: 400 15.5px/1.6 var(--mono); color: var(--fg); }
pre .c { color: var(--fg-3); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* label: mono, small caps-style, still readable (13px, 8.3:1); never body text */
.label { font: 500 13px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.eyebrow { display: inline-flex; align-items: center; gap: 12px; font: 500 13.5px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ion); margin: 0 0 18px; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }

/* ---------------------------------------------------------------- layout */
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(72px, 10vw, 140px) 0; position: relative; }
.section--tight { padding: clamp(48px, 6vw, 84px) 0; }
.band { background: var(--bg-1); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }
.grid { display: grid; gap: clamp(20px, 3vw, 40px); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
@media (max-width: 960px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- header */
.head { position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--head-h); display: flex; align-items: center;
  background: rgba(0, 0, 0, .78); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line); transition: background .3s; }
.head.is-top { background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,0)); border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wordmark { display: inline-flex; align-items: baseline; gap: .32em; color: var(--fg); text-decoration: none; font: 650 19px/1 var(--display); letter-spacing: -0.01em; white-space: nowrap; }
.wordmark i { font-style: normal; color: var(--fg-2); font-weight: 500; }
.wordmark::before { content: ""; width: 9px; height: 9px; border: 1.5px solid var(--ion); border-radius: 50%; transform: translateY(-1px); align-self: center; box-shadow: 0 0 0 3px var(--ion-dim); }
.nav { display: flex; align-items: center; gap: clamp(4px, 1.4vw, 14px); }
.nav a { color: var(--fg-2); text-decoration: none; font: 500 16px/1 var(--sans); padding: 10px 8px; border-radius: 6px; }
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--ion); border-radius: 0; }
.nav .nav-gh { border: 1px solid var(--line-2); padding: 9px 13px; border-radius: 999px; color: var(--fg); }
.nav-btn { display: none; background: none; border: 1px solid var(--line-2); color: var(--fg); border-radius: 8px; height: 40px; padding: 0 14px; font: 500 15px var(--sans); }
@media (max-width: 900px) {
  .nav-btn { display: inline-flex; align-items: center; gap: 8px; }
  .nav { position: fixed; top: var(--head-h); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 20px;
    background: rgba(0,0,0,.97); border-bottom: 1px solid var(--line-2); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 15px 4px; font-size: 18px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--ion); padding-left: 14px; }
  .nav .nav-gh { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 15px 4px; }
}

/* ---------------------------------------------------------------- footer (one thin line) */
.foot { border-top: 1px solid var(--line); padding: 22px 0 26px; }
.foot p { margin: 0; max-width: none; font-size: 16px; color: var(--fg-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.foot a { color: var(--fg-2); }
.foot a:hover { color: var(--fg); }
.foot .dot { color: var(--fg-3); }

/* ---------------------------------------------------------------- page header (content pages) */
.phead { padding: calc(var(--head-h) + clamp(56px, 8vw, 110px)) 0 clamp(40px, 5vw, 64px); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.phead h1 { max-width: 20ch; }
.phead .lead { margin-top: 18px; }
.phead canvas.field { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; pointer-events: none; }
.phead .wrap { position: relative; }

/* ---------------------------------------------------------------- components */
.btn { max-width: 100%; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--line-3);
  color: var(--fg); background: rgba(0,0,0,.4); text-decoration: none; font: 600 16.5px/1 var(--sans); letter-spacing: 0; transition: border-color .2s, background .2s, color .2s; cursor: pointer; }
.btn:hover { border-color: var(--fg); color: var(--fg); background: rgba(255,255,255,.06); }
.btn--ion { background: var(--ion); border-color: var(--ion); color: var(--ink); }
.btn--static { cursor: default; }
.btn--static:hover { background: var(--ion); border-color: var(--ion); }
.btn--ion:hover { background: #a6deff; border-color: #a6deff; color: var(--ink); }
.btn .arr { transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.more { display: inline-flex; align-items: center; gap: 8px; font: 600 17px/1.3 var(--sans); color: var(--ion); text-decoration: none; margin-top: 8px; }
.more:hover { color: var(--fg); }
.more::after { content: "→"; transition: transform .25s var(--ease); }
.more:hover::after { transform: translateX(4px); }

.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(20px, 2.4vw, 30px); }
.card { position: relative; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); padding: 26px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg); transition: border-color .25s, background .25s; }
a.card:hover { border-color: var(--line-3); background: var(--bg-2); color: var(--fg); }
.card p { color: var(--fg-2); margin: 0; }
.card .label { margin-bottom: 4px; }

/* corner-tick frame (instrument look): four 12px ticks, no glow */
.frame { position: relative; }
.frame::before, .frame::after { content: ""; position: absolute; width: 12px; height: 12px; border-color: var(--line-3); border-style: solid; pointer-events: none; }
.frame::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.frame::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* spec block: big numeral + unit + label + source */
.specs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.spec { padding: 26px 22px 24px 0; border-bottom: 1px solid var(--line); position: relative; }
.spec + .spec { padding-left: 22px; border-left: 1px solid var(--line); }
.spec .v { display: flex; align-items: baseline; gap: 8px; font: 600 clamp(44px, 5.4vw, 72px)/1 var(--display); letter-spacing: -0.03em; color: var(--fg); font-variant-numeric: tabular-nums; }
.spec .v small { font: 500 clamp(17px, 1.6vw, 22px)/1 var(--mono); letter-spacing: 0; color: var(--fg-2); }
.spec .k { margin-top: 14px; font-size: 17px; line-height: 1.45; color: var(--fg); max-width: 26ch; }
.spec .s { margin-top: 8px; }
@media (max-width: 960px) { .specs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .spec:nth-child(3) { padding-left: 0; border-left: 0; } }
@media (max-width: 480px) { .specs { grid-template-columns: minmax(0, 1fr); } .spec + .spec { padding-left: 0; border-left: 0; } }

/* figure with "Fig. N" caption */
figure { margin: 0; }
figcaption { margin-top: 14px; font-size: 17px; line-height: 1.55; color: var(--fg-2); max-width: var(--measure); }
figcaption b { font: 600 13.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg); margin-right: 8px; }
.plate { display: block; position: relative; border-radius: var(--r); overflow: hidden; background: #050505; border: 1px solid var(--line); }
.plate img, .plate video { width: 100%; height: 100%; object-fit: cover; }

/* data note: names the source of every number in its section */
.note { border-left: 2px solid var(--line-3); padding: 4px 0 4px 16px; font-size: 17px; line-height: 1.6; color: var(--fg-2); max-width: var(--measure); margin: 24px 0 0; }
.note b { color: var(--fg); }
.disclose { border: 1px solid rgba(255, 210, 122, .45); background: rgba(255, 210, 122, .06); border-radius: var(--r); padding: 22px 24px; }
.disclose h3, .disclose h4 { color: var(--warn); }
.disclose p, .disclose li { color: var(--fg); }
.disclose ul { margin: 0; padding-left: 1.2em; }
.disclose li { margin: 0 0 .5em; max-width: var(--measure); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); font: 500 13px/1 var(--mono); letter-spacing: .04em; color: var(--fg); white-space: nowrap; }
.chip--ion { border-color: rgba(108,201,255,.6); color: var(--ion); }
.chip--warn { border-color: rgba(255,210,122,.6); color: var(--warn); }
.chip--loss { border-color: rgba(255,173,122,.6); color: var(--loss); }

/* tally bar: wins | ties | losses, with text labels */
.tally { margin: 18px 0 8px; }
.tally-bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; gap: 2px; }
.tally-bar i { display: block; height: 100%; }
.tally-bar .w { background: var(--ion); }
.tally-bar .t { background: var(--tie); }
.tally-bar .l { background: repeating-linear-gradient(-45deg, var(--loss) 0 3px, rgba(255,173,122,.35) 3px 6px); }
.tally-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font: 500 15px/1.4 var(--mono); color: var(--fg); }
.tally-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 2px; vertical-align: -1px; }
.tally-legend .w::before { background: var(--ion); }
.tally-legend .t::before { background: var(--tie); }
.tally-legend .l::before { background: var(--loss); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-1); -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.4; }
table.t th, table.t td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
table.t th { font: 600 13px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2); background: var(--bg-2); position: sticky; top: 0; z-index: 1; }
table.t td.num, table.t th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.t tbody tr:hover { background: var(--bg-2); }
table.t td.wrapcell { white-space: normal; min-width: 18ch; }
.v-win { color: var(--ion); font-weight: 600; }
.v-tie { color: var(--tie); font-weight: 600; }
.v-loss { color: var(--loss); font-weight: 600; }
.pass { color: var(--ion); font-weight: 650; }
.fail { color: var(--loss); font-weight: 650; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: none; border: 0; color: var(--fg-2); font: 500 15px/1 var(--sans); padding: 9px 14px; border-radius: 999px; cursor: pointer; min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--ink); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--fg); }
select.sel, input.search { height: 44px; background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 16px; font: 400 16px var(--sans); }
input.search::placeholder { color: var(--fg-3); }

/* reveal on scroll (content always visible without JS and with reduced motion) */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* lists */
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { position: relative; padding: 14px 0 14px 30px; border-bottom: 1px solid var(--line); max-width: var(--measure); }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 25px; width: 12px; height: 1px; background: var(--ion); }
.ticks li:first-child { border-top: 1px solid var(--line); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 22px; margin: 0; }
dl.kv dt { font: 500 13px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); padding-top: 2px; }
dl.kv dd { margin: 0; color: var(--fg); }

/* licence badge */
.lic { display: inline-flex; white-space: nowrap; align-items: center; gap: 8px; font: 500 13px/1 var(--mono); letter-spacing: .04em; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--fg); background: rgba(0,0,0,.75); }
.lic::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ion); }
.specs.specs--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .specs.specs--3 { grid-template-columns: minmax(0, 1fr); } .specs.specs--3 .spec + .spec { padding-left: 0; border-left: 0; } }
.note.robust { margin-top: 28px; }
