/* The full light palette lives on :root, so the default is complete on its own;
   dark mode only redefines tokens. */
/* Palette and type are kept in step with /writing by hand. The two sites are
   separate repos that deploy independently, so linking one stylesheet across
   them would let a failed deploy here silently unstyle the essays. Duplication
   is the cheaper failure. */
:root {
  --bg: #fbfbfa;
  --fg: #16191c;
  --muted: #4e5860;
  --rule: #e0e3e6;
  --link: #1c4e5c;
  --code-bg: #eef1f2;
  --serif: ui-serif, Georgia, "Iowan Old Style", serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161a;
    --fg: #e5eaee;
    --muted: #a2adb6;
    --rule: #262e36;
    --link: #7fc3d6;
    --code-bg: #1b2228;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto;
  padding: 1.6rem 22px 5.5rem;
  max-width: 720px;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

header.site {
  padding: 26px 0 22px; margin-bottom: 44px;
  border-bottom: 1px solid var(--rule);
}
header.site .name {
  font: 600 15px/1 var(--sans); letter-spacing: 0.01em;
  color: var(--fg); text-decoration: none;
}
header.site .tagline {
  color: var(--muted); font: 400 13.5px/1.4 var(--sans); margin-top: 0.5rem;
}

h1 { font: 600 1.75rem/1.25 var(--sans); letter-spacing: -0.02em; margin: 0 0 0.4rem; }
h2 { font: 600 1.0625rem/1.3 var(--sans); letter-spacing: 0.01em; margin: 3rem 0 0.9rem;
     text-transform: uppercase; color: var(--muted); }
h3 { font: 600 1.0625rem/1.35 var(--sans); margin: 2rem 0 0.5rem; }

.subtitle { color: var(--muted); font-style: italic; margin: 0 0 2rem; }
time.meta { color: var(--muted); font-size: 0.875rem; display: block; margin-bottom: 2.5rem; }

ul.posts { list-style: none; padding: 0; margin: 0; }
ul.posts li { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
ul.posts li:first-child { border-top: 1px solid var(--rule); }
ul.posts .title { font: 600 1.0625rem/1.4 var(--sans); text-decoration: none; color: var(--fg); }
ul.posts .title:hover { color: var(--link); }
ul.posts .date { color: var(--muted); font: 400 12.5px/1.4 var(--sans); display: block; margin-top: 0.25rem; }
ul.posts .excerpt { color: var(--muted); font-size: 0.9375rem; margin-top: 0.35rem; }

code {
  background: var(--code-bg); border-radius: 3px;
  padding: 0.1em 0.35em; font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
pre {
  background: var(--code-bg); border-radius: 6px;
  padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.8125rem; line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: inherit; }

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

table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; margin: 1.5rem 0; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }

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

footer.site {
  font-family: var(--sans);
  margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: 0.875rem;
}
footer.site a { color: var(--muted); }

/* ---- figures ---------------------------------------------------------- */
:root {
  --own: #2f6f62;      /* a span's own work */
  --wait: #dcdcd6;     /* time spent waiting on something below */
  --cause: #8c2f39;    /* the operation that actually caused it */
}
@media (prefers-color-scheme: dark) {
  :root { --own: #6fb3a3; --wait: #343a3e; --cause: #d4707c; }
}
figure.fig { margin: 2rem 0; }
figure.fig svg { width: 100%; height: auto; display: block; overflow: visible; }
figure.fig figcaption {
  color: var(--muted); font-size: 0.8125rem; line-height: 1.5; margin-top: 0.75rem;
}
/* Fallbacks are not decoration. An SVG rect with an unresolvable fill paints
   solid black, so a stale or half-loaded stylesheet turns these figures into
   bar-shaped inkblots rather than degrading. */
.fig .wait { fill: var(--wait, #dcdcd6); }
.fig .own { fill: var(--own, #2f6f62); }
.fig .cause { fill: var(--cause, #8c2f39); }
.fig .rule { stroke: var(--rule, #e2e2dd); stroke-width: 1; }
.fig text {
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  fill: var(--fg, #1a1c1e); dominant-baseline: middle;
}
.fig text.mut { fill: var(--muted, #5d6470); }
.fig text.hd {
  font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  fill: var(--muted, #5d6470); letter-spacing: 0.06em; text-transform: uppercase;
}

/* ---- site nav --------------------------------------------------------- */
nav.site {
  display: flex; gap: 1.1rem; margin-top: 0.55rem;
  font-size: 0.9375rem;
}
nav.site a { color: var(--muted); font-family: var(--sans); text-decoration: none; }
nav.site a:hover { color: var(--link); text-decoration: underline; }

p.lede {
  font-size: 1.1875rem; line-height: 1.55; letter-spacing: -0.005em;
  margin: 0 0 2.5rem;
}

p.note { color: var(--muted); font-size: 0.9375rem; margin: -0.35rem 0 1.1rem; }
