:root {
  color-scheme: dark;
  /* Site palette (brian.biz home, blog, /h100, /optimum). Dark only, so the page
     no longer flips to a light theme the rest of the site does not have. */
  --surface-0: #0d1117;
  --surface-1: #161b22;
  --surface-2: #21262d;
  --border: #30363d;
  --text-primary: #f0f2f4;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --series-1: #79c0ff;
  --series-2: #d29922;
  --series-3: #3fb950;
  --series-4: #b87cff;
  --critical: #f85149;
  --serious: #db6d28;
  --warning: #d29922;
  --ok: #3fb950;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #0d1117;
    --surface-1: #161b22;
    --surface-2: #21262d;
    --border: #30363d;
    --text-primary: #f0f2f4;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    --series-1: #79c0ff;
    --series-2: #d29922;
    --series-3: #3fb950;
    --series-4: #b87cff;
    --critical: #f85149;
    --serious: #db6d28;
    --warning: #d29922;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
a { color: var(--series-1); }
code { font-family: var(--mono); font-size: 0.92em; }
header {
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  padding: 18px 28px;
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
}
header h1 { font-size: 17px; margin: 0; letter-spacing: -0.01em; }
header .sub { color: var(--text-muted); font-size: 13px; }
nav { margin-left: auto; display: flex; gap: 16px; font-size: 14px; }
nav a { text-decoration: none; color: var(--text-secondary); }
nav a.active { color: var(--text-primary); font-weight: 600; }
main { padding: 24px 28px 64px; max-width: 1500px; }
h2 { font-size: 15px; margin: 32px 0 12px; letter-spacing: -0.01em; }
h2:first-child { margin-top: 0; }
p.note { color: var(--text-secondary); font-size: 13.5px; max-width: 78ch; margin: 0 0 14px; }

/* The masthead states how the artifact was built, above everything it produced. */
.masthead {
  border: 1px solid var(--border); border-top: 3px solid var(--text-primary);
  background: var(--surface-1); border-radius: 10px;
  padding: 18px 20px 16px; margin: 0 0 26px; max-width: 100ch;
}
.masthead .flags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
/* The thesis leads the page, so it outweighs the live figures beneath it. */
.masthead p.thesis {
  font-size: 18px; line-height: 1.45; color: var(--text-primary);
  letter-spacing: -0.01em; max-width: 62ch; margin-bottom: 14px;
}
.masthead p { margin: 0 0 10px; font-size: 14px; color: var(--text-secondary); max-width: 88ch; }
.masthead p:last-of-type { margin-bottom: 14px; }

.chain { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
.chain .link {
  border: 1px solid var(--border); border-left: 3px solid var(--series-1);
  border-radius: 7px; padding: 7px 9px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.chain .link.reviewer { border-left-color: var(--warning); }
.chain .link.absent { opacity: 0.45; }
.chain .who {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted);
}
.chain .what { font-size: 12px; font-weight: 600; line-height: 1.3; }
.chain .lines { font-size: 10.5px; color: var(--text-muted); }
.chain .gate { display: block; margin-top: 3px; font-size: 10px; font-weight: 600; }
.chain .gate.ok { color: var(--ok); }
.chain .gate.stale { color: var(--critical); }

.intro { max-width: 82ch; margin: 0 0 22px; }
.intro h2 { font-size: 22px; font-weight: 600; margin: 0 0 8px; }
.intro .lead { font-size: 15px; color: var(--text-secondary); margin: 0 0 16px; }
.intro p { font-size: 15px; margin: 0 0 14px; }
.intro .pull {
  border-left: 3px solid var(--text-primary);
  padding: 2px 0 2px 16px;
  margin: 18px 0;
}
.intro .pull .label {
  display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 5px;
}

/* Two notes sit at the top of the results page. Only the one that qualifies the
   data carries caution styling; the scope note is neutral, so the page does not
   open on a stack of warnings. */
.banner {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: 10px; padding: 13px 16px; margin: 0 0 14px;
  font-size: 13.5px; color: var(--text-secondary); max-width: 100ch;
}
.banner.caution { border-color: var(--warning); border-left-color: var(--warning); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.tile .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tile .k { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.tile .d { color: var(--text-secondary); font-size: 12.5px; margin-top: 4px; }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.scroll { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; }
.scroll.tall { max-height: 460px; overflow-y: auto; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary);
  white-space: nowrap;
}
.badge.critical { color: var(--critical); border-color: var(--critical); }
.badge.serious { color: var(--serious); border-color: var(--serious); }
.badge.warning { color: var(--warning); border-color: var(--warning); }
.badge.ok { color: var(--ok); border-color: var(--ok); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card h3 { margin: 0 0 2px; font-size: 13.5px; }
.card .cap { color: var(--text-muted); font-size: 12px; margin: 0 0 12px; }
.card img { width: 100%; height: auto; border-radius: 6px; background: #fff; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 62px; align-items: center; gap: 10px; margin: 7px 0; font-size: 12.5px; }
.bar-track { display: block; background: var(--surface-2); border-radius: 4px; height: 16px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.bar-val { font-family: var(--mono); text-align: right; color: var(--text-secondary); font-size: 12px; }

.md { font-size: 13.5px; color: var(--text-secondary); max-width: 88ch; }
.md li { margin: 4px 0; }

/* inspector */
.viewer { display: grid; grid-template-columns: 260px 300px 1fr 330px; gap: 14px; height: calc(100vh - 74px); }
.pane { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; overflow: auto; padding: 12px; }
.pane h3 { position: sticky; top: -12px; margin: -12px -12px 10px; padding: 10px 12px; background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); z-index: 1; }
.list button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text-secondary); padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; font-family: inherit;
}
.list button:hover { background: var(--surface-2); }
.list button.active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.list .grp { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 12px 0 4px; }
.list .mark { font-family: var(--mono); font-size: 11px; }
.list .mark.pass { color: var(--ok); }
.list .mark.fail { color: var(--critical); }
.list .mark.err { color: var(--warning); }

.step { border: 1px solid var(--border); border-left-width: 3px; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); }
.step.model { border-left-color: var(--series-1); }
.step.tool { border-left-color: var(--series-3); }
.step.tool.err { border-left-color: var(--critical); }
.step.problem { border-left-color: var(--warning); }
.step .t { font-weight: 600; font-size: 12.5px; margin: 6px 0 4px; }
.step .d { font-size: 12.5px; color: var(--text-secondary); }
pre.text { font-family: var(--mono); font-size: 11px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; color: var(--text-secondary); margin: 6px 0 0; }
/* An abbreviation has to be visible as one, so it is coloured as a warning
   rather than reading as part of the value. */
.trunc { display: block; margin-top: 4px; color: var(--warning); font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; margin-bottom: 14px; }
.kv .k { color: var(--text-muted); }
.kv .v { font-family: var(--mono); text-align: right; word-break: break-all; }
.empty { color: var(--text-muted); font-size: 12.5px; font-style: italic; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; }
.filters select {
  background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 6px; font-size: 12px; font-family: inherit;
}

@page { size: A4 landscape; margin: 10mm; }
@media print {
  body { background: #fff; color: #000; }
  header { padding: 8px 0 10px; border-color: #ccc; background: none; }
  nav { display: none; }
  main { max-width: none; padding: 0; }
  h2 { margin: 18px 0 8px; break-after: avoid; }
  .scroll { overflow: visible; border: 1px solid #ddd; }
  .scroll.tall { max-height: none; }
  table { font-size: 9px; table-layout: fixed; width: 100%; }
  th, td { padding: 4px 6px; overflow-wrap: anywhere; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile .v { font-size: 20px; }
  .charts { grid-template-columns: repeat(2, 1fr); }
  .bar-row { grid-template-columns: 130px 1fr 50px; font-size: 10px; }
  tr, .card, .tile, .step { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
