/* Shared project page styles. Layout: one reading column plus a margin column for
   provenance notes; the record block at the top identifies what was measured and when. */

:root {
  color-scheme: light;
  --page: #f3f5f6;
  --surface: #ffffff;
  --ink: #15202b;
  --ink-2: #4a5763;
  --muted: #6b7680;
  --rule: #d3d9de;
  --accent: #1f5fae;
  --accent-wash: #e6eef8;
  --grid: #e3e7ea;
  --axis: #c3cbd1;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --good: #0ca30c;
  --critical: #d03b3b;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f1418;
    --surface: #151b21;
    --ink: #e5e9ec;
    --ink-2: #a3aeb8;
    --muted: #87929c;
    --rule: #2a333b;
    --accent: #7fb0ee;
    --accent-wash: #1b2a3a;
    --grid: #232b32;
    --axis: #38424b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1418;
  --surface: #151b21;
  --ink: #e5e9ec;
  --ink-2: #a3aeb8;
  --muted: #87929c;
  --rule: #2a333b;
  --accent: #7fb0ee;
  --accent-wash: #1b2a3a;
  --grid: #232b32;
  --axis: #38424b;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

code, pre { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code { overflow-wrap: anywhere; }

.site-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px;
  font-size: 15px;
}
.site-bar a { color: var(--ink-2); text-decoration: none; }
.site-bar a:hover { color: var(--accent); text-decoration: underline; }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* Each section: heading and body in the reading column, notes in the margin column. */
section {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(0, 240px);
  column-gap: 56px;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
}
section > * { grid-column: 1; }
section > .note { grid-column: 2; grid-row: 1 / span 20; align-self: start; }

.intro { border-top: 0; padding-top: 32px; }

h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.015em;
}
h2 { margin: 0 0 12px; font-size: 24px; line-height: 1.25; font-weight: 600; }
h3 { margin: 24px 0 8px; font-size: 18px; font-weight: 600; }
p, ul, ol { margin: 0 0 14px; max-width: 68ch; }
li + li { margin-top: 4px; }

.lede { font-size: 20px; line-height: 1.5; color: var(--ink-2); max-width: 60ch; }

/* The record block: what was measured, at which revision, on which date. */
.record {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 28px 0 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}
.record > div { padding: 12px 16px; border-left: 1px solid var(--rule); }
.record > div:first-child { border-left: 0; }
.record dt { font-size: 13px; color: var(--muted); }
.record dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  border-left: 2px solid var(--rule);
  padding-left: 14px;
}
.note p { margin-bottom: 8px; }

pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  line-height: 1.5;
}

.steps { padding-left: 1.4em; }
.steps li::marker { color: var(--muted); font-weight: 600; }

.mermaid {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  font-family: var(--sans);
  overflow-x: auto;
}

/* Charts */
.chart {
  position: relative;
  margin: 8px 0 32px;
  padding: 18px 18px 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.chart-title { margin: 0; font-size: 17px; font-weight: 600; }
.chart-subtitle { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.chart svg { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.chart svg text { font-family: var(--sans); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.chart-legend li { display: flex; align-items: center; gap: 6px; margin: 0; }
.chart-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.chart-legend .key.line { height: 2px; width: 14px; border-radius: 1px; }
.chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chart-foot button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.chart table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14px; }
.chart th, .chart td { padding: 6px 8px; border-bottom: 1px solid var(--rule); text-align: left; }
.chart td.num, .chart th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .mark-hover { filter: brightness(1.12); }

.tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  min-width: 120px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(15, 20, 24, 0.12);
  font-size: 13px;
  line-height: 1.4;
}
.tooltip[hidden] { display: none; }
.tooltip .tt-head { color: var(--ink-2); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 12px; }
.stat { border-left: 2px solid var(--axis); padding-left: 14px; }
.stat-value { font-size: clamp(26px, 7vw, 34px); line-height: 1.1; font-weight: 600; white-space: nowrap; }
.stat-label { font-size: 14px; color: var(--ink-2); }
.stat-note { font-size: 12px; color: var(--muted); }

footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 900px) {
  section { grid-template-columns: minmax(0, 1fr); }
  section > .note { grid-column: 1; grid-row: auto; margin-top: 8px; }
  .record > div { border-left: 0; border-top: 1px solid var(--rule); }
  .record > div:first-child { border-top: 0; }
}

/* Wide diagrams scroll inside their box on phones instead of shrinking below legible size. */
@media (max-width: 600px) {
  .mermaid svg { min-width: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
