:root {
  color-scheme: light;
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #eceae5;
  --border: #d9d6cf;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77756e;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --good: #1e7a4d;
  --good-bg: #dff0e5;
  --serious: #a35b00;
  --serious-bg: #fbeacf;
  --critical: #b4302f;
  --critical-bg: #fadedd;
  --info: #1c5cab;
  --info-bg: #dbe8fa;
  --neutral-bg: #e6e4de;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --surface-2: #242423;
    --border: #3a3a37;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #96958c;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --good: #6fd39c;
    --good-bg: #17331f;
    --serious: #e0a24a;
    --serious-bg: #3a2a10;
    --critical: #f08b89;
    --critical-bg: #3a1b1b;
    --info: #7fb3f2;
    --info-bg: #14263f;
    --neutral-bg: #2d2d2b;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--info); }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
code { font-size: 0.88em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
pre { overflow-x: auto; background: var(--surface-2); padding: 14px 16px; border-radius: 10px; }
pre code { background: none; padding: 0; }

.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
  padding: 12px 20px; background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; color: var(--text-primary); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; }
.topbar nav a { color: var(--text-secondary); text-decoration: none; font-size: 0.93rem; }
.topbar nav a.on, .topbar nav a:hover { color: var(--text-primary); }

main { max-width: 900px; margin: 0 auto; padding: 28px 20px 64px; }
section { margin: 0 0 40px; }
h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 1.22rem; letter-spacing: -0.01em; margin: 32px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }
.lede { font-size: 1.02rem; color: var(--text-secondary); }
.note { font-size: 0.9rem; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.more { font-size: 0.92rem; }
blockquote { margin: 0; padding: 12px 18px; border-left: 3px solid var(--series-1);
  background: var(--surface-1); border-radius: 0 8px 8px 0; color: var(--text-secondary); }

.tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.tile { flex: 1 1 110px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; }
.tile-value { display: block; font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; }
.tile-label { display: block; font-size: 0.78rem; color: var(--text-muted); text-transform: lowercase; }

.gate-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gate { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.gate header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gate-id { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.gate h3 { margin: 8px 0 6px; font-size: 0.98rem; }
.gate p { margin: 0 0 6px; font-size: 0.88rem; color: var(--text-secondary); }
.gate .evidence { color: var(--text-muted); font-size: 0.83rem; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem;
  font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--neutral-bg);
  color: var(--text-secondary); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-completed, .badge-passed, .badge-pass { background: var(--good-bg); color: var(--good); }
.badge-failed, .badge-cancelled { background: var(--critical-bg); color: var(--critical); }
.badge-falsified, .badge-partially-falsified { background: var(--serious-bg); color: var(--serious); }
.badge-running, .badge-staged { background: var(--info-bg); color: var(--info); }

.table-scroll { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
tbody tr:hover { background: var(--surface-1); }
.nowrap { white-space: nowrap; }
.runs td:first-child { max-width: 420px; word-break: break-all; }

.transitions { list-style: none; margin: 0; padding: 0; }
.transitions li { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.transitions .detail { color: var(--text-muted); }

.tree { display: grid; gap: 2px; }
.tree .tree { margin-left: 0; padding-left: 12px; border-left: 2px solid var(--border); }
.kv { display: grid; grid-template-columns: minmax(120px, 210px) 1fr; gap: 12px;
  padding: 4px 0; font-size: 0.88rem; align-items: baseline; }
.kv > .k { color: var(--text-muted); font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.82rem; word-break: break-word; }
.kv > .v { color: var(--text-secondary); overflow-wrap: anywhere; }
.li { padding: 4px 0; }
.bool-true { color: var(--good); font-weight: 600; }
.bool-false { color: var(--critical); font-weight: 600; }
.hash { cursor: help; }

.shots { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.shot { margin: 0; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; }
.shot img { display: block; width: 100%; height: auto; border-radius: 6px; background: #fff; }
.shot figcaption { margin-top: 8px; font-size: 0.74rem; color: var(--text-muted); word-break: break-all; }

.chart { margin: 0 0 26px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px 10px; }
.chart figcaption { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 4px; font-size: 0.82rem;
  color: var(--text-secondary); }
.legend .chip { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; }
.legend i.series-1 { background: var(--series-1); }
.legend i.series-2 { background: var(--series-2); }
.legend i.series-3 { background: var(--series-3); }
.plot { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .tick { fill: var(--text-muted); font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace; }
.chart .tick-y { text-anchor: end; }
.chart .tick-x { text-anchor: middle; }
.chart .axis-label { fill: var(--text-muted); font-size: 11px; text-anchor: middle;
  letter-spacing: 0.04em; }
.chart .line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; stroke-linecap: round; }
.chart .line.series-1, .chart .end.series-1 { stroke: var(--series-1); }
.chart .line.series-2, .chart .end.series-2 { stroke: var(--series-2); }
.chart .line.series-3, .chart .end.series-3 { stroke: var(--series-3); }
.chart .end { stroke-width: 2; vector-effect: non-scaling-stroke; fill: var(--surface-1); }
.chart .end.series-1 { fill: var(--series-1); }
.chart .end.series-2 { fill: var(--series-2); }
.chart .end.series-3 { fill: var(--series-3); }
.chart .marker { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke; }
.chart .marker-label { fill: var(--text-muted); font-size: 10px; letter-spacing: 0.05em;
  text-transform: uppercase; }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .hit { fill: transparent; }
.tooltip { position: absolute; pointer-events: none; z-index: 5; min-width: 130px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 0.8rem; box-shadow: 0 6px 18px rgba(0,0,0,0.16); }
.tooltip .tt-x { color: var(--text-muted); font-size: 0.74rem; display: block; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .tt-row i { width: 9px; height: 3px; border-radius: 2px; display: inline-block;
  margin-right: 6px; vertical-align: middle; }
.tooltip .tt-row i.series-1 { background: var(--series-1); }
.tooltip .tt-row i.series-2 { background: var(--series-2); }
.tooltip .tt-row i.series-3 { background: var(--series-3); }
.tooltip .tt-value { font-family: ui-monospace, Menlo, Consolas, monospace; }
.chart-table { margin-top: 8px; }
.chart-table summary { cursor: pointer; font-size: 0.82rem; color: var(--text-muted); }

.prose h2 { margin-top: 34px; }
.prose p, .prose li { color: var(--text-secondary); }
.prose h2, .prose h3 { color: var(--text-primary); }

footer { border-top: 1px solid var(--border); background: var(--surface-1);
  padding: 20px; text-align: center; }
footer p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
footer p + p { margin-top: 6px; }

@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  h1 { font-size: 1.55rem; }
}

/* Latest decisions: the newest entries of the trail, on the page people open first. */
.decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}
.decision {
  border: 1px solid var(--border);
  border-left: 3px solid var(--series-1);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  background: var(--surface-1);
}
.decision h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  line-height: 1.35;
}
.decision p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
}
