/* Shared chrome for the three pages: Overview, Architecture, Results.
 *
 * The tokens are taken from the architecture diagram rather than invented, so
 * the three tabs read as one site instead of three documents that happen to be
 * linked. The diagram is generated by a tool whose look is fixed; matching it
 * is cheaper and more honest than restyling it to match a page.
 *
 * Dark first, because the diagram is. A light mode exists and is deliberate --
 * a screen share in a bright room, and printing -- but it is the second thing.
 *
 * No @font-face and no @import. The pages must render with the network off, so
 * the font stacks name JetBrains Mono first and fall back to whatever the
 * machine has. Nothing here depends on a download arriving.
 */

:root {
  color-scheme: dark;

  --bg:            #020617;
  --panel:         #0b1220;
  --panel-2:       #0f172a;
  --line:          #1e293b;
  --line-strong:   #334155;

  --ink:           #ffffff;
  --ink-2:         #94a3b8;
  --ink-3:         #64748b;

  /* The diagram colours a node by what it is. The same meanings carry here:
   * emerald is the thing that works, rose is the thing that is wrong, amber is
   * the thing to be careful about. Nothing is coloured decoratively. */
  --ok:            #34d399;
  --ok-dim:        rgba(52, 211, 153, 0.14);
  --warn:          #fbbf24;
  --warn-dim:      rgba(251, 191, 36, 0.14);
  --bad:           #fb7185;
  --bad-dim:       rgba(251, 113, 133, 0.14);
  --info:          #22d3ee;
  --accent:        #a78bfa;

  /* Two categorical series, checked for colourblind separation against each
   * other and for contrast on both surfaces. */
  --series-a:      #fb923c;
  --series-b:      #38bdf8;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas,
          'DejaVu Sans Mono', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
          Arial, sans-serif;

  --radius: 10px;
  --gap: 16px;
  --maxw: 1100px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:          #f6f7f9;
  --panel:       #ffffff;
  --panel-2:     #f1f5f9;
  --line:        #e2e8f0;
  --line-strong: #cbd5e1;
  --ink:         #0b1220;
  --ink-2:       #475569;
  --ink-3:       #64748b;
  --ok:          #047857;
  --ok-dim:      rgba(4, 120, 87, 0.10);
  --warn:        #b45309;
  --warn-dim:    rgba(180, 83, 9, 0.10);
  --bad:         #be123c;
  --bad-dim:     rgba(190, 18, 60, 0.10);
  --info:        #0e7490;
  --accent:      #6d28d9;
  --series-a:    #c2410c;
  --series-b:    #0369a1;
}

* { box-sizing: border-box; }

html, body { background: var(--bg); margin: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.55;
  font-size: 14px;
  /* The diagram sits on a dot grid. Repeating it here is what makes the tabs
   * feel like one surface rather than three. */
  background-image: radial-gradient(rgba(148, 163, 184, 0.14) 1px,
                                    transparent 1px);
  background-size: 28px 28px;
}

:root[data-theme="light"] body {
  background-image: radial-gradient(rgba(15, 23, 42, 0.07) 1px,
                                    transparent 1px);
}

a { color: var(--info); }

/* ---------------------------------------------------------------- site nav */

.sitenav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
}

.sitenav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 7px;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.sitenav a:hover { color: var(--ink); background: var(--panel-2); }

.sitenav a:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

/* The current tab is marked by a border and a brighter label, not by colour
 * alone -- colour is the first thing a projector and a colourblind reader
 * lose. */
.sitenav a[aria-current="page"] {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line-strong);
}

.sitenav .spacer { flex: 1; }

.sitenav .out::after { content: " \2197"; color: var(--ink-3); }

.themetoggle {
  font: inherit;
  font-family: var(--mono);
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
}

.themetoggle:hover { color: var(--ink); border-color: var(--line-strong); }

/* ------------------------------------------------------------------ layout */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 16px 72px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(21px, 2.4vw, 27px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.stamp {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  margin: 0 0 26px;
}

section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: var(--gap);
}

section > h2 {
  font-size: 13.5px;
  letter-spacing: 0.01em;
  margin: 0 0 4px;
}

.lede {
  color: var(--ink-2);
  font-size: 12.5px;
  margin: 0 0 16px;
  max-width: 74ch;
}

.caveat {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.65;
  border-left: 2px solid var(--line-strong);
  padding-left: 12px;
  margin: 14px 0 0;
  max-width: 78ch;
}

.caveat b { color: var(--ink-2); }

/* ------------------------------------------------------------------ metrics */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel-2);
}

.kpi .kv {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.kpi .kl { font-size: 11px; color: var(--ink-2); margin-top: 3px; }

.kpi.is-ok   .kv { color: var(--ok); }
.kpi.is-bad  .kv { color: var(--bad); }
.kpi.is-warn .kv { color: var(--warn); }

/* ------------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  font-weight: 500;
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

td:first-child { color: var(--ink); }

tr:last-child td { border-bottom: 0; }

td.n, th.n {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.mono { font-family: var(--mono); font-size: 11.5px; }

/* Sortable headers announce themselves. A table that silently responds to a
 * click teaches nobody it can be sorted. */
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[data-sort]::after { content: " \2195"; opacity: 0.35; }
th[data-sort][aria-sort="ascending"]::after  { content: " \2191"; opacity: 1; }
th[data-sort][aria-sort="descending"]::after { content: " \2193"; opacity: 1; }

/* -------------------------------------------------------------------- badge */

.badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid;
}

.badge.pass { color: var(--ok);  background: var(--ok-dim);  border-color: var(--ok); }
.badge.fail { color: var(--bad); background: var(--bad-dim); border-color: var(--bad); }
.badge.warn { color: var(--warn);background: var(--warn-dim);border-color: var(--warn); }

/* The generator emits an inline <svg viewBox="0 0 16 16"> with no width or
 * height. An SVG without intrinsic dimensions fills whatever box it is given,
 * so without these two lines each tick renders a thousand pixels tall and the
 * page looks like a bug report. Sizing lives here rather than in the markup
 * because the markup comes from Python. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge svg {
  width: 11px;
  height: 11px;
  flex: none;
}

/* Row classes the generator emits. */
td.stage, td.check { font-family: var(--mono); font-size: 11.5px; }
td.check { color: var(--ink); }
td.detail { color: var(--ink-3); font-size: 11.5px; }

td.store { display: flex; align-items: center; gap: 8px; }

.sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
  display: inline-block;
}

.sw.a { background: var(--series-a); }
.sw.b { background: var(--series-b); }

/* --------------------------------------------------------------------- bars */

.bars { margin-top: 4px; }

.bar-row { margin-bottom: 14px; }

.bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 5px;
}

.bar-name { font-size: 12.5px; font-weight: 600; }

.bar-val {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.track {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  height: 17px;
  overflow: hidden;
}

.fill { height: 100%; }

.bar-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------- misc */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 12px;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

@media (max-width: 620px) {
  .wrap { padding: 20px 14px 56px; }
  .sitenav { overflow-x: auto; }
  section { padding: 15px 14px; }
}

@media print {
  body { background: #fff; background-image: none; }
  .sitenav { display: none; }
  section { break-inside: avoid; }
}
