/* ============================================================================
   System Design Bible — reading theme
   Goals: long-form readability, high contrast, calm motion, zero dependencies.
   ========================================================================== */

:root {
  --bg:        #0d1117;
  --bg-soft:   #131a23;
  --bg-raise:  #172029;
  --line:      #263140;
  --line-soft: #1d2733;
  --fg:        #d7e0ea;
  --fg-strong: #f2f7fc;
  --fg-dim:    #8b9bad;
  --accent:    #4da3ff;
  --accent-2:  #7c5cff;
  --good:      #35d07f;
  --warn:      #ffb648;
  --bad:       #ff6b6b;
  --code-bg:   #0a0f16;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --radius:    14px;
  --measure:   74ch;
  --font-ui:   "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-read: "Charter", "Iowan Old Style", "Georgia", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  /* reading preferences — overridden inline by assets/bible.js from saved settings.
     the clamp() gives a sensible responsive default before any preference is saved. */
  --font-size-base: clamp(16.5px, 14.5px + 0.5vw, 18px);
  --line-height-base: 1.72;
}

html[data-theme="light"] {
  --bg:        #f7f8fa;
  --bg-soft:   #ffffff;
  --bg-raise:  #ffffff;
  --line:      #dfe4ea;
  --line-soft: #eceff3;
  --fg:        #2b323b;
  --fg-strong: #10151c;
  --fg-dim:    #667488;
  --accent:    #0b6bd6;
  --accent-2:  #6b3df0;
  --good:      #12885a;
  --warn:      #b56a00;
  --bad:       #d63b3b;
  --code-bg:   #101720;
  --shadow:    0 8px 24px rgba(20,30,50,.10);
}

* { box-sizing: border-box; }

:root { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

html {
  scroll-behavior: smooth; scroll-padding-top: 24px;
  scrollbar-width: thin; scrollbar-color: var(--line) var(--bg);
}
html::-webkit-scrollbar { width: 12px; }
html::-webkit-scrollbar-track { background: var(--bg); }
html::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid var(--bg); }
html::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }
body.no-scroll { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-read);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* dyslexia-friendly reading mode: a touch more breathing room between
   letters/words, which is the part of "easy to read" a font choice alone
   doesn't fix */
body.font-dyslexic { letter-spacing: .01em; word-spacing: .06em; }
body.font-dyslexic p, body.font-dyslexic li { line-height: max(var(--line-height-base), 1.8); }

/* ---------------------------------------------------------------- progress */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 60;
}
.progress span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .12s linear;
}

/* ---------------------------------------------------------------- sidebar
   Layout is driven by flex `order` rather than DOM order, so the markup the
   generator emits stays untouched:
     1 title block · 2 controls toolbar · 3 section TOC (grows) · 4 chapter list
   ------------------------------------------------------------------------ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 310px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 50;
  font-family: var(--font-ui);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.side-head {
  order: 1; flex: none;
  padding: 20px 16px 14px; border-bottom: 1px solid var(--line-soft);
}
.side-title {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.side-sub { font-size: 15px; color: var(--fg-strong); font-weight: 650; margin-top: 5px; line-height: 1.35; }

/* controls toolbar — one evenly spaced block directly under the title */
.side-foot {
  order: 2; flex: none;
  display: flex; gap: 8px; padding: 10px 12px 0; border: 0;
}
.side-foot + .side-foot { padding: 8px 12px 12px; border-bottom: 1px solid var(--line-soft); }
.ctl {
  flex: 1 1 0; min-width: 0; cursor: pointer;
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px; min-height: 36px; white-space: nowrap;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-raise); color: var(--fg-dim);
  transition: color .15s, border-color .15s, background .15s;
}
.ctl:hover { color: var(--fg-strong); border-color: var(--accent); background: var(--bg-soft); }
.ctl-wide { width: 100%; }

.toc {
  order: 3; flex: 1 1 auto; min-height: 120px;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 8px 14px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; scrollbar-gutter: stable;
}
.toc::-webkit-scrollbar { width: 7px; }
.toc::-webkit-scrollbar-track { background: transparent; }
.toc::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.toc::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }
.toc a {
  display: block; padding: 5px 12px; margin: 1px 0;
  color: var(--fg-dim); text-decoration: none; font-size: 13.5px;
  line-height: 1.4; border-left: 2px solid transparent; border-radius: 0 7px 7px 0;
  transition: background .15s, color .15s, border-color .15s;
}
.toc a.t3 { padding-left: 26px; font-size: 12.5px; opacity: .88; }
.toc a:hover { background: var(--bg-raise); color: var(--fg-strong); }
.toc a.active {
  color: var(--accent); border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 620;
}

/* ---------------------------------------------------------- settings panel */
.settings-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(8,11,16,.55);
  opacity: 0; visibility: hidden; transition: opacity .2s ease;
  backdrop-filter: blur(1.5px);
}
.settings-overlay.open { opacity: 1; visibility: visible; }

.settings-panel {
  position: fixed; z-index: 90; top: 50%; left: 50%;
  transform: translate(-50%, -46%) scale(.97); width: min(420px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px)); overflow-y: auto; overflow-x: hidden;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); font-family: var(--font-ui);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s ease, transform .18s cubic-bezier(.2,.8,.3,1), visibility .18s;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.settings-panel::-webkit-scrollbar { width: 7px; }
.settings-panel::-webkit-scrollbar-track { background: transparent; }
.settings-panel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.settings-panel::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }
.settings-panel.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--bg-soft); z-index: 1;
}
.settings-head span { font-size: 15px; font-weight: 700; color: var(--fg-strong); }
.settings-close {
  cursor: pointer; width: 30px; height: 30px; border-radius: 8px; line-height: 1;
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--fg-dim); font-size: 17px;
}
.settings-close:hover { color: var(--fg-strong); border-color: var(--accent); }

.settings-body { padding: 6px 18px 18px; }
.settings-group { margin-top: 16px; }
.settings-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
  color: var(--fg-dim); margin-bottom: 8px;
}

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg.seg-col { flex-direction: column; }
.seg button {
  cursor: pointer; flex: 1; min-width: 64px; font-family: var(--font-ui); font-size: 12.5px;
  font-weight: 600; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-raise); color: var(--fg-dim); transition: .15s; text-align: center;
}
.seg.seg-col button { text-align: left; flex: none; }
.seg button:hover { color: var(--fg-strong); border-color: var(--accent); }
.seg button.active {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 700;
}

.swatches { display: flex; gap: 10px; }
.swatch {
  cursor: pointer; width: 34px; height: 34px; border-radius: 50%; padding: 0;
  border: 2px solid transparent; background: var(--sw); position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.swatch.active { border-color: var(--fg-strong); }
.swatch.active::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

.settings-reset {
  margin-top: 20px; width: 100%; cursor: pointer; font-family: var(--font-ui); font-size: 12.5px;
  font-weight: 650; padding: 10px; border-radius: 9px; border: 1px dashed var(--line);
  background: transparent; color: var(--fg-dim);
}
.settings-reset:hover { color: var(--bad); border-color: var(--bad); }

/* chapter switcher — pinned to the bottom, self-scrolling so it can never
   starve the section TOC above it */
.file-nav {
  order: 4; flex: 0 0 auto; position: relative;
  display: grid; gap: 2px; align-content: start;
  /* min-content rows, or a capped container would squeeze the rows flat
     instead of scrolling them */
  grid-auto-rows: min-content;
  padding: 0 8px 8px; max-height: 34vh;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-top: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.file-nav::before {
  content: "All chapters";
  position: sticky; top: 0; z-index: 1;
  margin: 0 -8px 4px; padding: 10px 14px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-dim); background: var(--bg);
}
.file-nav::-webkit-scrollbar { width: 7px; }
.file-nav::-webkit-scrollbar-track { background: transparent; }
.file-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.file-nav::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }
.fn {
  font-size: 12.5px; line-height: 1.45; text-decoration: none; color: var(--fg-dim);
  padding: 6px 10px; border-radius: 8px; transition: background .15s, color .15s;
}
.fn:hover { background: var(--bg-raise); color: var(--fg-strong); }
.fn.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 650; }

.nav-toggle {
  position: fixed; top: 12px; left: 12px; z-index: 70; display: none;
  width: 44px; height: 44px; border-radius: 11px; cursor: pointer;
  background: var(--bg-raise); color: var(--fg); border: 1px solid var(--line);
  font-size: 18px; box-shadow: var(--shadow);
}

.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 49; background: rgba(8,11,16,.5);
  opacity: 0; visibility: hidden; transition: opacity .2s ease; display: none;
}
.sidebar-backdrop.open { opacity: 1; visibility: visible; }

/* ---------------------------------------------------------------- content */
.content {
  margin-left: 310px;
  padding: 64px clamp(20px, 5vw, 76px) 120px;
  max-width: calc(var(--measure) + 220px);
}

.page-head { margin-bottom: 46px; }
.eyebrow {
  font-family: var(--font-ui); font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 10px;
}
h1 {
  font-family: var(--font-ui); font-size: clamp(30px, 4.6vw, 46px); line-height: 1.12;
  color: var(--fg-strong); margin: 0 0 8px; font-weight: 800; letter-spacing: -.02em;
}

h2, h3 {
  font-family: var(--font-ui); color: var(--fg-strong);
  line-height: 1.25; letter-spacing: -.01em; position: relative;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
h2 {
  font-size: clamp(23px, 3vw, 30px); font-weight: 760;
  margin: 72px 0 20px; padding-top: 26px; border-top: 1px solid var(--line);
}
h3 { font-size: clamp(18px, 2.2vw, 21.5px); font-weight: 700; margin: 44px 0 14px; }

.h-num {
  font-variant-numeric: tabular-nums; font-size: .72em; font-weight: 800;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  padding: 2px 9px; border-radius: 8px; flex: none;
}
h3 .h-num { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 13%, transparent);
            border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.h-txt { flex: 1 1 auto; min-width: 0; }
.anchor {
  opacity: 0; text-decoration: none; color: var(--fg-dim); font-weight: 500;
  font-size: .7em; transition: opacity .15s;
}
h2:hover .anchor, h3:hover .anchor { opacity: .6; }

p { max-width: var(--measure); margin: 0 0 20px; }
strong { color: var(--fg-strong); font-weight: 700; }
em { color: var(--fg); }
a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }

code {
  font-family: var(--font-mono); font-size: .84em;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--fg-strong); padding: 1.5px 6px; border-radius: 6px;
  /* wrap instead of forcing horizontal page scroll on narrow screens */
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}

.secref, .fileref {
  font-family: var(--font-ui); font-size: .78em; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  color: color-mix(in srgb, var(--accent-2) 82%, var(--fg));
  border: 1px solid color-mix(in srgb, var(--accent-2) 26%, transparent);
}
.fileref { background: color-mix(in srgb, var(--good) 13%, transparent);
           color: color-mix(in srgb, var(--good) 88%, var(--fg));
           border-color: color-mix(in srgb, var(--good) 26%, transparent); }
.wikiref { font-family: var(--font-ui); font-size: .85em; color: var(--accent); }

/* ------------------------------------------------------------------ lists */
.listwrap { max-width: var(--measure); margin: 0 0 22px; }
.md-list { margin: 0 0 6px; padding-left: 1.35em; }
.md-list li { margin: 0 0 11px; padding-left: 4px; }
.md-list li::marker { color: var(--accent); font-weight: 700; }
.md-list.ord > li::marker { color: var(--accent-2); }
.md-list .md-list { margin-top: 11px; }

/* ------------------------------------------------------------- blockquote */
.callout {
  max-width: var(--measure); margin: 26px 0; padding: 18px 22px;
  background: linear-gradient(100deg,
      color-mix(in srgb, var(--accent) 11%, var(--bg-soft)),
      var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.callout p { margin: 0 0 10px; }
.callout p:last-child { margin: 0; }

.hold-this {
  max-width: var(--measure); padding: 16px 20px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--good) 10%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--good) 30%, transparent);
  border-left: 4px solid var(--good);
}

/* ----------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto; margin: 26px 0 30px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-soft); box-shadow: var(--shadow);
  scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar { height: 9px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; }
table {
  border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: 14.5px;
  /* keep columns readable instead of letting one long cell squash the rest */
  table-layout: auto; min-width: 100%;
}
thead th {
  background: var(--bg-raise); color: var(--fg-strong);
  text-align: left; font-weight: 700; font-size: 13px;
  letter-spacing: .03em; padding: 13px 16px; border-bottom: 2px solid var(--line);
  white-space: nowrap; vertical-align: bottom;
}
tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top;
  line-height: 1.6; min-width: 128px; overflow-wrap: anywhere;
}
tbody td code, thead th code { white-space: pre-wrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .13s; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
tbody td:first-child { color: var(--fg-strong); font-weight: 600; }

/* ------------------------------------------------------------ code blocks */
.codeblock {
  margin: 26px 0 30px; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.code-label {
  font-family: var(--font-ui); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--fg-dim); padding: 9px 16px; background: rgba(255,255,255,.03);
  border-bottom: 1px solid var(--line); font-weight: 700;
}
.codeblock pre { margin: 0; padding: 18px; overflow-x: auto; scrollbar-width: thin; }
.codeblock pre::-webkit-scrollbar { height: 9px; }
.codeblock pre::-webkit-scrollbar-thumb { background: #2b3a4d; border-radius: 9px; }
.codeblock code {
  font-family: var(--font-mono); font-size: 12.6px; line-height: 1.58;
  background: none; border: 0; padding: 0; color: #b9c8da; white-space: pre;
}
.diagram code { color: #9fd0ff; }

hr.rule { border: 0; height: 1px; background: var(--line); margin: 40px 0; opacity: .55; }

/* --------------------------------------------------------------- figures */
.fig {
  margin: 30px 0 34px; padding: 20px 20px 16px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); position: relative;
  overflow: hidden;
}
.fig::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--good));
  opacity: .85;
}
.fig-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
  font-family: var(--font-ui);
}
.fig-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--bg); background: var(--accent); padding: 3px 8px; border-radius: 6px;
}
.fig-title { font-size: 15.5px; font-weight: 700; color: var(--fg-strong); }
/* overflow:hidden so a stray label can never spill onto the prose below */
.fig svg { display: block; width: 100%; height: auto; margin: 10px 0 6px; overflow: hidden; }
.fig text { paint-order: stroke fill; }        /* keeps labels legible over shapes */
.fig-note {
  font-family: var(--font-ui); font-size: 13.5px; color: var(--fg-dim);
  line-height: 1.6; border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 8px;
}
.fig-note strong { color: var(--fg); }

/* shared SVG text styles */
.fig text { font-family: var(--font-ui); fill: var(--fg); }
.fig .lbl   { font-size: 12px; font-weight: 650; }
.fig .lbl-s { font-size: 10.5px; fill: var(--fg-dim); font-weight: 600; }
.fig .lbl-m { font-size: 13.5px; font-weight: 750; fill: var(--fg-strong); }
.fig .mono  { font-family: var(--font-mono); font-size: 11px; }
.fig .box   { fill: var(--bg-raise); stroke: var(--line); stroke-width: 1.4; }
.fig .box-a { fill: color-mix(in srgb, var(--accent) 16%, var(--bg-raise)); stroke: var(--accent); stroke-width: 1.5; }
.fig .box-g { fill: color-mix(in srgb, var(--good) 16%, var(--bg-raise));   stroke: var(--good);   stroke-width: 1.5; }
.fig .box-w { fill: color-mix(in srgb, var(--warn) 16%, var(--bg-raise));   stroke: var(--warn);   stroke-width: 1.5; }
.fig .box-b { fill: color-mix(in srgb, var(--bad) 16%, var(--bg-raise));    stroke: var(--bad);    stroke-width: 1.5; }
.fig .wire  { stroke: var(--line); stroke-width: 2; fill: none; }
.fig .wire-a{ stroke: var(--accent); stroke-width: 2; fill: none; }
.fig .wire-d{ stroke: var(--fg-dim); stroke-width: 1.6; fill: none; stroke-dasharray: 5 5; }
.fig .dot   { fill: var(--accent); }
.fig .dot-g { fill: var(--good); }
.fig .dot-b { fill: var(--bad); }
.fig .dot-w { fill: var(--warn); }

/* animation master switch (JS toggles .anim-paused on <body>) */
body.anim-paused .fig * { animation-play-state: paused !important; }
body.anim-paused .fig animate,
body.anim-paused .fig animateTransform,
body.anim-paused .fig animateMotion { display: none; }

/* ------------------------------------------------------- reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.shown { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.3,1); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.shown { opacity: 1; transform: none; transition: none; }
  .fig * { animation: none !important; }
}

.page-foot {
  margin-top: 80px; padding-top: 22px; border-top: 1px solid var(--line);
  font-family: var(--font-ui); font-size: 13px; color: var(--fg-dim); max-width: var(--measure);
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); width: min(310px, 86vw); }
  .sidebar.open { transform: none; }
  /* clear the fixed hamburger, which floats above the open drawer */
  .side-head { padding-left: 68px; min-height: 68px; }
  .nav-toggle { display: block; }
  .sidebar-backdrop { display: block; }
  .content { margin-left: 0; padding: 74px 20px 100px; }
}
@media (max-width: 620px) {
  .content { padding: 68px 16px 90px; }
  .table-wrap { border-radius: 10px; }
  table { font-size: 13.5px; }
  thead th, tbody td { padding: 10px 12px; }
  h2 { margin-top: 54px; }
  /* Figures keep a readable minimum size and scroll sideways rather than
     shrinking their labels into an unreadable, overlapping mess. */
  .fig { padding: 16px 14px 12px; overflow-x: auto; overflow-y: hidden; }
  .fig svg { min-width: 560px; }
  .fig-head, .fig-note { position: sticky; left: 0; }
  h2 { font-size: 22px; }
  h3 { font-size: 17.5px; }
  .settings-panel { top: auto; bottom: 0; left: 0; right: 0; width: 100%;
    max-height: min(84vh, 620px); border-radius: 16px 16px 0 0; transform: translateY(100%); }
  .settings-panel.open { transform: translateY(0); }
  .settings-overlay { backdrop-filter: none; }
}

/* an anchor link should never wrap onto its own line */
h2 .anchor, h3 .anchor { flex: none; }
