:root {
  --bg: #fbfaf7;
  --fg: #1d1d1b;
  --muted: #6b6a65;
  --rule: #e4e1d8;
  --accent: #2f5d8a;
  --code-bg: #f1eee6;
  --max: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --fg: #e8e6df;
    --muted: #9b998f;
    --rule: #2c2b28;
    --accent: #8fb6dc;
    --code-bg: #1f1e1c;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

header.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 3rem;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}

header.site a { color: var(--fg); text-decoration: none; font-weight: 600; }
header.site nav a { color: var(--muted); font-weight: 400; margin-left: 1rem; }
header.site nav a:hover { color: var(--accent); }

h1, h2, h3 {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }

.meta {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

a { color: var(--accent); text-underline-offset: 2px; }

p, ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: 0.35rem; }

code {
  font: 0.88em/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code { background: none; padding: 0; }

.table-scroll { overflow-x: auto; margin: 0 0 1.25rem; }

table {
  border-collapse: collapse;
  width: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

blockquote {
  margin: 0 0 1.1rem;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.posts { list-style: none; padding: 0; }
.posts li { margin-bottom: 1.25rem; }
.posts .date {
  display: block;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.85rem;
}

footer.site {
  margin-top: 4rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.85rem;
}

/* ---- Article components ---- */
:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --card: #f3f1eb;
  --bar: #2a78d6;
  --track: #e8e6df;
  --ink-2: #52514e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --card: #1d1c1a;
    --bar: #3987e5;
    --track: #2a2926;
    --ink-2: #c3c2b7;
  }
}

.lede { font-size: 1.1rem; }

.tldr {
  background: var(--card);
  border-radius: 10px;
  padding: 1.1rem 1.25rem 0.4rem;
  margin: 1.75rem 0 2.25rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
}
.tldr h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.6rem; }
.tldr ul { padding-left: 1.1rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
  font-family: var(--sans);
}
.stat { background: var(--card); border-radius: 10px; padding: 0.85rem 1rem; }
.stat .label { display: block; font-size: 0.8rem; color: var(--muted); }
.stat .value { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
.stat .note { display: block; font-size: 0.78rem; color: var(--muted); }

figure { margin: 1.5rem 0 2rem; }
figcaption { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; }

/* Pipeline diagram */
.pipeline { font-family: var(--sans); font-size: 0.88rem; display: grid; gap: 0.35rem; }
.step { background: var(--card); border-radius: 10px; padding: 0.7rem 0.9rem; }
.step b { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.25rem; font-weight: 600; }
.arrow { text-align: center; color: var(--muted); line-height: 1; font-size: 1rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; }
.row3 .step { text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.15rem; }
.chip { border: 1px solid var(--rule); border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.8rem; }

/* Horizontal bar chart (single series) */
.bars { font-family: var(--sans); font-size: 0.85rem; display: grid; gap: 0.5rem; }
.bar-row { display: grid; grid-template-columns: minmax(7.5rem, 11rem) 1fr; gap: 0.75rem; align-items: center; }
.bar-label { color: var(--fg); line-height: 1.25; }
.bar-label small { display: block; color: var(--muted); font-size: 0.75rem; }
.bar-track { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.bar-fill { height: 20px; background: var(--bar); border-radius: 0 4px 4px 0; flex: none; min-width: 3px; }
.bar-value { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row:hover .bar-fill { filter: brightness(1.12); }

details { font-family: var(--sans); font-size: 0.85rem; margin-top: 0.75rem; }
details summary { cursor: pointer; color: var(--muted); }

.callout {
  border-left: 3px solid var(--bar);
  padding: 0.2rem 0 0.2rem 1rem;
  margin: 0 0 1.25rem;
}
