/*
  Stoop shared chassis — ported from peregrine's site/styles.css grammar
  (topbar, eyebrow/panel-label, truth-badge, hairline cards, fleet-table,
  buttons, focus states) with the accent swapped to Stoop's ice-cyan per
  docs/DESIGN.md. PASS/BLOCK semantics are untouched (still green/red);
  violet appears only in the footer lockup. No border-radius except the
  two deliberate exceptions noted inline — square hairline chrome is the
  house style, not an oversight.

  Loaded by site/index.html and site/lab/index.html as a <link>, same-origin,
  no external requests (system font stacks only — see docs/DESIGN.md and the
  Lab page's self-contained contract).
*/

:root {
  color-scheme: dark;

  /* ---------- palette (docs/DESIGN.md tokens, verbatim) ---------- */
  --ground: #08120f;
  --surface: #0e1b17;
  --raised: #132420;
  --ink: #e6f0ec;
  --ink-2: #c3d6cd;
  --ink-muted: #8fa8a0;
  --ink-dim: #5c7269;
  --line: #1b2b26;
  --line-strong: #2e463f;

  --accent: #5FD8FF;
  --accent-ink: #062125;
  --accent-soft: rgba(95, 216, 255, 0.14);
  --accent-wash: rgba(95, 216, 255, 0.08);

  --pass: #78f0ad;
  --pass-ink: #062116;
  --pass-soft: rgba(120, 240, 173, 0.14);

  --block: #ff7168;
  --block-ink: #200705;
  --block-soft: rgba(255, 113, 104, 0.14);

  --amber: #ffc85a;
  --amber-ink: #1d1400;
  --amber-soft: rgba(255, 200, 90, 0.12);

  --blue: #80b8ff;
  --blue-soft: rgba(128, 184, 255, 0.1);

  /* violet — footer lockup only, nowhere else on the page (docs/DESIGN.md) */
  --violet: #9333ea;

  /* ---------- type ---------- */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* ---------- rhythm: 4/8px grid ---------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 48px;
  --s-9: 64px;

  --max: 1180px;
  --pad: clamp(18px, 4.4vw, 56px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- reset ---------- */
* { box-sizing: border-box; min-width: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-dim); }
::-webkit-scrollbar-corner { background: var(--surface); }

html {
  max-width: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  max-width: 100%;
  overflow-x: clip;
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, video { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }

.skip-link {
  position: fixed; left: 16px; top: -96px; z-index: 99;
  background: var(--ink); color: var(--ground);
  padding: 12px 16px; font: 700 12px var(--mono);
}
.skip-link:focus { top: 16px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

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

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

.mono, .num, td.num, .tabular {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  border: 0; overflow: hidden; white-space: nowrap; clip-path: inset(50%);
}

/* ---------- typography ---------- */
.eyebrow, .panel-label {
  display: block;
  font: 700 11px/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s-3);
}

h1 {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.22;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 0 0 var(--s-3);
  max-width: 22ch;
}

h2 {
  font-size: clamp(19px, 2.6vw, 23px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 650;
  margin: 0;
}

h3 {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  margin: 0;
}

.lede {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.65;
  max-width: 74ch;
  margin: 0;
}
.lede code, p code { font-family: var(--mono); font-size: 0.92em; }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

.caption {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 78ch;
  margin: var(--s-2) 0 0;
}

.status-line { font: 11px/1.6 var(--mono); color: var(--ink-dim); margin: var(--s-2) 0 0; }

/* ---------- site header ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  min-height: 56px;
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-7);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font: 700 14px var(--mono);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.wordmark .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  flex: none;
}

.site-nav { display: flex; align-items: center; gap: var(--s-5); margin-right: auto; }
.site-nav a {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 13px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.header-badge {
  flex: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-muted);
  font: 11px var(--mono);
  letter-spacing: 0.03em;
  padding: 7px 12px;
  white-space: nowrap;
}
.header-badge .sep { color: var(--ink-dim); margin: 0 3px; }
.header-badge .hl { color: var(--accent); font-weight: 700; }

/* ---------- truth-badge family: LIVE / RECORDED / DEFINED / SIMULATED ---------- *
 * Same visual grammar on every Stoop surface (docs/DESIGN.md "family signature").
 * .truth-badge carries shape; the modifier carries color. An unbadged number does
 * not render as a number at all — see docs/DESIGN.md.
 */
.truth-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 3px 7px;
  border: 1px solid currentColor;
  font: 700 10.5px/1.2 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.truth-live { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.truth-recorded { color: var(--amber-ink); background: var(--amber); border-color: var(--amber); }
.truth-defined { color: var(--blue); background: transparent; border-style: dashed; }
.truth-simulated { color: var(--amber); background: transparent; }
/* extension beyond the four-family badge: a claim actively in dispute — same
   shape, block-red tone, so it reads as kin to the family, not a new system. */
.truth-dispute { color: var(--block); background: transparent; border-style: dashed; }

.truth-legend {
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
  margin: var(--s-3) 0 0; font: 11px var(--mono); color: var(--ink-muted);
}
.truth-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.truth-legend .dot { width: 8px; height: 8px; flex: none; }

/* ---------- status pill: claim lifecycle, deliberately round (vs. square
   truth-badges) — a second axis, not a clash: shape says which axis. ---------- */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px; /* exception 1 of 2 */
  font: 10px var(--mono);
  letter-spacing: 0.03em;
  border: 1px solid;
  white-space: nowrap;
}
.status-active { color: var(--pass); border-color: rgba(120, 240, 173, 0.4); background: var(--pass-soft); }
.status-withdrawn { color: var(--block); border-color: rgba(255, 113, 104, 0.4); background: var(--block-soft); }
.status-annotated { color: var(--accent); border-color: rgba(95, 216, 255, 0.4); background: var(--accent-soft); }

/* ---------- buttons ---------- */
.button {
  appearance: none;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 700 12.5px var(--sans);
  cursor: pointer;
  transition: background 160ms linear, color 160ms linear, border-color 160ms linear;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button-primary:hover { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }
.button-secondary { background: var(--surface); color: var(--ink-muted); }
.button:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--line); color: var(--ink-dim); background: transparent; }

/* ---------- sections ---------- */
.block { margin-bottom: var(--s-8); }
.block-head { margin-bottom: var(--s-4); display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.block-head h2 { flex: none; }
.block-title { font-size: 14px; font-weight: 650; color: var(--ink); }

/* ---------- cards / panels — square, hairline, no radius ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s-5);
}
.panel-2 { background: var(--surface); border: 1px solid var(--line); padding: var(--s-4); }

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s-3) var(--s-4);
  min-width: 128px;
  flex: 1 1 128px;
}
.stat-chip .v { font: 650 16px/1.25 var(--mono); color: var(--ink); }
.stat-chip .l { font-size: 10.5px; color: var(--ink-muted); line-height: 1.4; margin-top: 3px; max-width: 210px; }
.stat-row { display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* ---------- data tables ---------- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
}
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 12px; }
.data-table th, .data-table td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table thead th {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface);
  position: sticky;
  top: 0;
}
.data-table tbody tr:hover { background: var(--raised); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table td.empty-state { color: var(--ink-dim); font-family: var(--mono); text-align: left; }

/* ---------- footer ---------- */
.site-footer {
  margin-top: var(--s-9);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  font: 11px var(--mono);
  color: var(--ink-dim);
}
.site-footer a { color: var(--ink-dim); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.lockup { display: inline-flex; align-items: center; gap: 6px; }
.lockup .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); display: inline-block; } /* exception 2 of 2 */
.lockup .name { color: var(--ink-dim); }

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .site-header { gap: var(--s-3); }
  .header-badge { width: 100%; white-space: normal; line-height: 1.7; }
  .stat-chip { min-width: 100%; }
}

@media (min-width: 640px) {
  .stat-chip { flex: 1 1 auto; }
}

@media (min-width: 900px) {
  .site-header { padding: var(--s-4) 0; }
}

[hidden] { display: none !important; }
