  :root {
    color-scheme: light dark;
    --bg: #ffffff; --surface: #f5f4f0; --ink: #16181d; --muted: #5f6570; --line: #e3e2dc;
    --accent: #d6402e; --accent-soft: #fbe9e6; --ok: #1f8a4c; --node: #ffffff; --node-line: #c9c8c0; --flow: #d6402e;
    --mast: #16223f; --mast-ink: #ffffff; --mast-muted: #aab6d3; --mast-accent: #ff7a66;
    --serif: "Iowan Old Style", "Charter", Georgia, serif;
    --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
  }
  @media (prefers-color-scheme: dark) { :root { --bg:#0d1117; --surface:#131b26; --ink:#e6edf3; --muted:#8b98a8; --line:#232d3b; --accent:#ff7a66; --accent-soft:#2a1c1c; --ok:#5ef2c2; --node:#101a27; --node-line:#2c4560; --flow:#5ef2c2; --mast:#101a33; } }

  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.7; }
  a { color: inherit; text-underline-offset: 4px; }
  a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
  figure svg, .figbox svg, .thumb svg { display: block; width: 100%; height: auto; }
  .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  /* Masthead and section bar (every page; the article page uses the slim masthead) */
  .mast { background: var(--mast); color: var(--mast-ink); }
  .mast .in, .sections .in { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
  .mast-top { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--mast-muted); padding: 8px 0 0; }
  .mast-top a, .mast .home { color: var(--mast-muted); }
  .logo { display: block; padding: 14px 0 18px; font: 800 38px/1 var(--sans); letter-spacing: -1.2px; color: var(--mast-ink); text-decoration: none; }
  .logo b { color: var(--mast-accent); }
  .mast.slim .in { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .mast.slim .logo { font-size: 26px; padding: 14px 0; }
  .mast .home { font-size: 12px; }
  .sections { position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); background: var(--bg); }
  .sections .in { display: flex; gap: 26px; font: 600 14px var(--sans); overflow-x: auto; }
  .sections a { padding: 13px 0; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
  .sections a:hover { color: var(--ink); }
  .sections a.on { color: var(--ink); border-bottom-color: var(--accent); }
  .sections a:focus-visible { outline-offset: -3px; } /* the bar scrolls sideways, so an outside ring is clipped */

  /* Front page and topic pages: the river and the sidebar */
  .front { max-width: 1180px; margin: 26px auto 60px; padding: 0 24px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
  .ptitle { font: 700 34px/1.15 var(--serif); letter-spacing: -.8px; margin: 0 0 18px; }
  .row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; padding: 20px 0; border-bottom: 1px solid var(--line); }
  .row:first-of-type { padding-top: 0; }
  .row > a { display: block; }
  .row .thumb { aspect-ratio: 16 / 10; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 8px; }
  .row .thumb svg { width: 100%; height: 100%; }
  .thumb.ph span { font: 800 28px var(--mono); color: var(--node-line); }
  .row h3 { font: 700 22px/1.25 var(--sans); margin: 0 0 8px; letter-spacing: -.3px; }
  .row h3 a { text-decoration: none; }
  .row h3 a:hover { color: var(--accent); }
  .rmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
  .rtags { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; font-size: 11.5px; }
  .row p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
  .empty { color: var(--muted); font-size: 16px; margin: 0; padding: 20px 0; }
  .side section { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 22px; }
  .side h2 { margin: 0 0 12px; font: 800 13px var(--sans); text-transform: uppercase; letter-spacing: 1.2px; }
  .toplist { margin: 0; padding-left: 20px; }
  .toplist li { margin: 0 0 12px; font: 600 14px/1.35 var(--sans); }
  .toplist li:last-child { margin-bottom: 0; }
  .toplist li a { text-decoration: none; }
  .toplist li a:hover { text-decoration: underline; }
  .toplist time { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
  .side .none { margin: 0; color: var(--muted); font-size: 13.5px; }
  .topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
  .topics a { font: 700 12px var(--sans); text-decoration: none; color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px; }
  .about p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.55; }

  /* Article page. Figures are never wider than the 700px text column:
     .wide is kept only so published bodies that use it render at column width. */
  .art { padding-bottom: 60px; }
  .col, .wide { max-width: 700px; margin: 0 auto; padding: 0 24px; }
  figure.col, figure.wide { margin: 30px auto; }
  .art > .stats { max-width: 700px; margin: 34px auto; padding: 0 24px; } /* a body's stat row, in the column too */

  .tags { margin-top: 48px; display: flex; flex-wrap: wrap; gap: 8px; }
  .tag { font: 700 11px var(--sans); letter-spacing: 1.3px; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 9px; border-radius: 4px; }
  h1 { font: 700 48px/1.06 var(--serif); letter-spacing: -1.2px; margin: 16px 0 14px; }
  .dek { font-size: 20px; line-height: 1.5; color: var(--muted); margin: 0 0 22px; }
  .meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); padding-bottom: 22px; border-bottom: 1px solid var(--line); }
  .avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #f2a65a); display: grid; place-items: center; color: #fff; font: 800 13px var(--mono); }
  .meta strong { color: var(--ink); }

  figure { margin: 0; }
  .figbox { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
  figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; }
  figcaption b { color: var(--ink); }

  article p { font-size: 18px; margin: 0 0 22px; }
  article h2 { font: 700 26px/1.25 var(--serif); margin: 42px 0 12px; }

  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 34px 0; }
  .stat { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--bg); }
  .stat strong { display: block; font: 800 34px/1.1 var(--sans); letter-spacing: -1px; }
  .stat strong em { font-style: normal; color: var(--accent); }
  .stat small { color: var(--muted); font-size: 13px; }

  blockquote { margin: 38px 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--accent); font: italic 25px/1.4 var(--serif); }

  .svgt { font-family: var(--sans); }
  .n { fill: var(--node); stroke: var(--node-line); stroke-width: 1.5; }
  .n-hot { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
  .n-ok { fill: var(--ok); }
  .t { fill: var(--ink); font-weight: 650; font-size: 14px; }
  .ts { fill: var(--muted); font-size: 11.5px; }
  .tok { fill: var(--bg); font-weight: 800; font-size: 14px; }
  .f { stroke: var(--flow); stroke-width: 2; fill: none; }
  .ah { fill: var(--flow); }
  .bar-old { fill: var(--muted); opacity: .45; }
  .bar-new { fill: var(--accent); }
  .grid-l { stroke: var(--line); }

  .related { border-top: 1px solid var(--line); margin-top: 60px; padding-top: 26px; }
  .related h3 { font: 800 12px var(--sans); letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
  .related-link { font-size: 16px; margin: 0 0 6px; }

  /* Phones: one column, the thumbnail above the text, the sidebar below the river */
  @media (max-width: 860px) {
    .front { grid-template-columns: 1fr; }
    .row { grid-template-columns: 1fr; gap: 14px; }
    .logo { font-size: 28px; }
    .mast-top { flex-wrap: wrap; }
    .stats { grid-template-columns: 1fr; }
    h1 { font-size: 34px; }
    .dek { font-size: 18px; }
  }
