:root {
  --fg: #1a1a1a; --bg: #fff; --muted: #666; --accent: #0b5; --line: #e3e3e3;
  --maxw: 65ch;
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--fg); background: var(--bg); line-height: 1.55; }
body { margin: 0; }
a { color: #06c; text-decoration: none; }
a:hover { text-decoration: underline; }
a.broken-link { color: #c00; border-bottom: 1px dotted #c00; cursor: help; }
.shell { display: grid; grid-template-columns: 16rem 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); padding: 1rem; font-size: .9rem; overflow-y: auto; }
.sidebar h2 { font-size: .75rem; text-transform: uppercase; color: var(--muted); margin: 1rem 0 .25rem; }
.sidebar ul { list-style: none; margin: 0 0 .5rem; padding: 0; }
.content { padding: 1.5rem 2rem; max-width: var(--maxw); }
header.top { grid-column: 1 / -1; border-bottom: 1px solid var(--line); padding: .6rem 1rem; display: flex; gap: 1rem; align-items: baseline; }
header.top .brand { font-weight: 700; }
.meta { color: var(--muted); font-size: .8rem; margin: -.5rem 0 1rem; }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 4px; padding: 0 .4rem; font-size: .75rem; margin-right: .3rem; }
.badge.kind { border-color: var(--accent); color: var(--accent); text-transform: lowercase; }
.backlinks { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1rem; font-size: .9rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 1rem; }

/* Keep wide content from forcing the page to scroll sideways (esp. on mobile).
   `min-width: 0` is the load-bearing one: a grid item defaults to `min-width: auto`, so it
   refuses to shrink below its content's min-content width. A long unbroken heading in the
   table of contents then widened the whole column past the viewport, and a phone showed a
   sideways-scrolling page with the text cut off at the right edge. Found 2026-08-30 from a
   screenshot of research-wiki on a phone. */
.shell > * { min-width: 0; }
.content { overflow-wrap: break-word; min-width: 0; }
.content img, .content video, .content canvas { max-width: 100%; height: auto; }
.content pre { overflow-x: auto; max-width: 100%; }
.content table { display: block; overflow-x: auto; max-width: 100%; }

/* Breadcrumbs */
.breadcrumbs { font-size: .8rem; margin: 0 0 1rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; }
.breadcrumbs li:not(:last-child)::after { content: "›"; color: var(--muted); margin-left: .35rem; }
.breadcrumbs [aria-current="page"] { color: var(--muted); }

/* On-page table of contents */
.toc { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .75rem; margin: 0 0 1.5rem; font-size: .85rem; }
.toc-label { font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-size: .7rem; margin: 0 0 .25rem; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: .15rem 0; }
.toc .toc-d3 { padding-left: 1rem; }

/* Related pages (inbound + outbound internal links) */
.related { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1rem; font-size: .9rem; }
.related h2 { font-size: 1rem; margin: 0 0 .5rem; }
.related-group { margin-bottom: .75rem; }
.related-label { color: var(--muted); text-transform: uppercase; font-size: .75rem; margin: 0 0 .2rem; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { margin: .1rem 0; }

@media (max-width: 40rem) {
  .shell { grid-template-columns: 1fr; }
  header.top { flex-wrap: wrap; gap: .4rem 1rem; }
  .content { order: 1; padding: 1rem 1.1rem; }               /* content right after the header */
  .sidebar { order: 2; border-right: 0; border-top: 1px solid var(--line); max-height: 60vh; }
  /* A spoke landing page is a whole synthesis, so its contents list can run to forty
     headings — the entire first screen on a phone, before a word of the page itself.
     Cap it and let it scroll inside its own box. */
  .toc { max-height: 40vh; overflow-y: auto; }
}

/* Type index + frontmatter fields */
.fields { display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem;
  font-size: .8rem; color: var(--muted); margin: -.25rem 0 1.25rem; }
.fields dt { font-weight: 600; }
.fields dd { margin: 0; }
.fields .sources { word-break: break-word; }
.badge.tier { border-color: var(--accent); }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; }
.type-grid { list-style: none; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .3rem 1.25rem; }
.type-grid li { display: flex; align-items: baseline; gap: .5rem; }
.type-grid li a { flex: 1 1 auto; }

/* Homepage health cards. Astro keeps these in a scoped <style> block in
   src/pages/index.astro; Eleventy has no scoped styles, so they live here. */
.legend { border: 1px solid var(--line); border-radius: 6px; padding: .75rem 1rem; margin: 0 0 1.5rem; font-size: .85rem; }
.bands { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; }
.bands li { display: flex; align-items: baseline; gap: .35rem; }
.swatch { width: .7rem; height: .7rem; border-radius: 2px; background: var(--c); flex: 0 0 auto; align-self: center; }
.range { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend details { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.legend summary { cursor: pointer; color: var(--muted); }
.legend details p { margin: .6rem 0; }
.components { margin: .4rem 0; padding-left: 1.1rem; }
.components li { margin: .15rem 0; }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.card-head h3 { margin: 0; }
.score { display: flex; align-items: baseline; gap: .3rem; flex: 0 0 auto; }
.score .num { font-weight: 600; font-size: 1.15rem; }
.score .band { font-size: .7rem; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; margin: .5rem 0 .6rem; overflow: hidden;
         background: #f1f0ed;                                  /* fallback track */
         background: color-mix(in oklab, var(--c) 16%, #fff);  /* lighter step of the fill's own hue */ }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.card .meta { margin: 0 0 .35rem; }
.facts, .parts { margin: 0; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.parts { margin-top: .2rem; }
.parts b { color: var(--fg); font-weight: 600; }
