:root {
  --bg: #fbfbf9; --fg: #1d1d1f; --muted: #5b5b63; --accent: #2f5bd3;
  --card: #ffffff; --line: #e4e4e0; --tag: #eef2fc;
  /* code, and docs.html's tables as NumPy's docs show them (PyData Sphinx Theme) */
  --code-bg: #f3f4f5; --code-border: #d1d5da; --code-text: #222832;
  --table-head: #f3f4f5; --table-rule: #0a7d91; --table-odd: #f3f4f5; --table-even: #ffffff;
  --table-inner: #e5e7ea; --table-line: #dee2e6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131316; --fg: #ececf0; --muted: #a2a2ad; --accent: #8aa8ff;
    --card: #1c1c21; --line: #2e2e35; --tag: #232a3d;
    --code-bg: #29313d; --code-border: #48566b; --code-text: #ced6dd;
    --table-head: #29313d; --table-rule: #3fb1c5; --table-odd: #29313d; --table-even: #222832;
    --table-inner: #364150; --table-line: #495057;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.7 "Source Serif 4", Georgia, serif; }
main { max-width: 820px; margin: 0 auto; padding: 56px 16px 80px; }
header { text-align: center; margin-bottom: 36px; }
h1 { font: 700 clamp(1.9rem, 4.6vw, 2.5rem)/1.15 Inter, system-ui, sans-serif; margin: 0 0 12px; letter-spacing: -0.02em; }
h2 { font: 600 1.35rem Inter, system-ui, sans-serif; margin: 44px 0 12px; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; }
.callout { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 14px 18px; font: 600 1.05rem Inter, system-ui, sans-serif; margin: 24px 0; }
.figs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 28px 0; }
@media (max-width: 640px) { .figs { grid-template-columns: 1fr; } }
figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
figure img { width: 100%; display: block; border-radius: 6px; background: #fff; }
.figs { align-items: end; }
.placeholder { aspect-ratio: 4/3; display: grid; place-items: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 6px; font: 0.9rem Inter, system-ui, sans-serif; }
figcaption { font: 0.88rem/1.45 Inter, system-ui, sans-serif; color: var(--muted); margin-top: 10px; text-align: center; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.tag { font: 500 0.88rem Inter, system-ui, sans-serif; background: var(--tag); color: var(--fg);
  padding: 4px 12px; border-radius: 999px; }
em { font-style: italic; }
a { color: var(--accent); }
footer { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line);
  font: 0.85rem Inter, system-ui, sans-serif; color: var(--muted); text-align: center; }
figure.wide { margin: 28px 0; }
figure.wide img { max-width: 640px; margin: 0 auto; }
figure.full img { max-width: none; }
h3 { font: 600 1.08rem Inter, system-ui, sans-serif; margin: 30px 0 8px; }
.lead { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin: 0 0 8px; }
.back { font: 500 0.9rem Inter, system-ui, sans-serif; text-decoration: none; }
.more { margin-top: 36px; }
.walkthrough { margin: 28px auto; max-width: 600px; scroll-margin-top: 72px; }
.walkthrough img { width: 100%; height: auto; display: block; border-radius: 6px; background: #fff; cursor: pointer; }
.walkthrough figcaption { min-height: 2.9em; }
/* the step-through diagram: which step it is above, and below, arrows either side of a dot per step;
   the next arrow pulses until the reader first moves */
.wt-badge { display: block; width: max-content; margin: 2px auto 8px; padding: 3px 10px; border-radius: 999px;
  font: 600 0.75rem Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--bg); background: var(--accent); }
.wt-controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 6px; }
.wt-arrow { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--accent); font: 600 1.4rem/1 Inter, system-ui, sans-serif; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
.wt-arrow:hover, .walkthrough.pulse .wt-next { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.walkthrough.pulse .wt-next { animation: wt-pulse 1.8s ease-out infinite; }
@keyframes wt-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 91, 211, 0.5); } 70% { box-shadow: 0 0 0 12px rgba(47, 91, 211, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 91, 211, 0); } }
@media (prefers-reduced-motion: reduce) { .walkthrough.pulse .wt-next { animation: none; } }
.wt-dots { display: flex; gap: 8px; }
.wt-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px; background: var(--muted); opacity: 0.35;
  cursor: pointer; transition: width 0.2s ease; }
.wt-dots button.on { width: 22px; background: var(--accent); opacity: 1; }
.refs { font-size: 0.92rem; line-height: 1.55; padding-left: 1.6em; }
.refs li { margin-bottom: 0.6em; }
.figs3 { grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .figs3 { grid-template-columns: 1fr; } }
.figs figcaption { margin-top: 6px; }
.rowcap { font: 0.88rem/1.45 Inter, system-ui, sans-serif; color: var(--muted); text-align: center; margin-top: -10px; }
.authors { font: 400 1.02rem/1.5 Inter, system-ui, sans-serif; color: var(--muted); margin: 0 0 8px; }
h4 { font: 600 0.98rem Inter, system-ui, sans-serif; margin: 18px 0 6px; color: var(--muted); }
.authors a { text-decoration: none; }
.authors a:hover { text-decoration: underline; }
/* index.html: the logos under the authors; EPIC and Sky have a version for each theme
   (figures/logos/), and the one-colour Berkeley wordmark turns white in dark mode */
.logos { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 36px; margin: 18px 0 0; }
.logos img { display: block; width: auto; }
.logo-berkeley { height: 34px; }
.logo-epic { height: 38px; }
.logo-sky { height: 33px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-berkeley { filter: brightness(0) invert(1); }
}
/* inline code, on every page: monospace in the text's colour on a faint ground; in a link, only the link */
main code { font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  font-size: 0.875em; background: var(--code-bg); border-radius: 0.25rem; padding: 0.1em 0.3em; overflow-wrap: anywhere; }
main a code { background: none; padding: 0; }
/* docs.html */
.doc h2 { scroll-margin-top: 16px; }
.doc h3, .doc h4 { scroll-margin-top: 16px; }
.doc pre { font-size: 0.875em; line-height: 1.25; color: var(--code-text); background: var(--code-bg);
  border: 1px solid var(--code-border); border-radius: 0.25rem; padding: 1rem; overflow-x: auto; margin: 1.5em 0; }
.doc pre code { color: inherit; background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal;
  white-space: pre; }
.doc .highlight pre { margin: 1.5em 0; }
.doc .table-wrap { overflow-x: auto; margin: 0 0 1.2em; }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.92rem; line-height: 1.5; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 0.5rem; border-bottom: 1px solid var(--table-line); }
.doc th ~ th, .doc td ~ td { border-left: 1px solid var(--table-inner); }
.doc thead tr { background: var(--table-head); border-bottom: 2px solid var(--table-rule); }
.doc th { font-weight: 600; color: var(--fg); border-bottom: 0; }
.doc tbody tr:nth-child(odd) { background: var(--table-odd); }
.doc tbody tr:nth-child(even) { background: var(--table-even); }
.doc td code { white-space: nowrap; }
.doc ul { margin: 0 0 1.1em; padding-left: 1.3em; }
.doc li { margin-bottom: 0.35em; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 20px;
  font: 0.92rem/1.6 Inter, system-ui, sans-serif; margin: 0 0 8px; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc ol ol { padding-left: 1.2em; }
.toc a { text-decoration: none; }
.part { font: 600 0.8rem Inter, system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin: 56px 0 -32px; }
.note { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 10px 16px; font-size: 0.95rem; margin: 0 0 1.2em; }
/* docs.html and the blog post (index.html): top bar, side navigation, content */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px;
  padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--line);
  font: 500 0.95rem Inter, system-ui, sans-serif; }
.topbar .brand { font-weight: 700; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; }
.topbar .topnav { margin-left: auto; display: flex; gap: 22px; }
.topbar .topnav a { color: var(--muted); text-decoration: none; }
.topbar .topnav a:hover, .topbar .topnav a[aria-current="page"] { color: var(--fg); }
@media (max-width: 420px) { .topbar { padding: 0 16px; } .topbar .topnav { gap: 14px; } }
.topbar .menu { display: none; font-size: 1.2rem; line-height: 1; background: none; border: 1px solid var(--line);
  border-radius: 6px; color: var(--fg); padding: 5px 9px; cursor: pointer; }
.docs-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }
.sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 28px 16px 40px 20px;
  border-right: 1px solid var(--line); font: 0.9rem/1.45 Inter, system-ui, sans-serif; }
.sidebar a { display: block; color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: 6px; }
.sidebar a:hover { color: var(--fg); background: var(--tag); }
.sidebar a.active { color: var(--accent); background: var(--tag); font-weight: 600; }
.sidebar code { font: 0.82rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sidebar .side-top { font-weight: 600; color: var(--fg); }
.sidebar .side-group { margin: 6px 0 2px; }
.sidebar .side-group a { font: 500 0.88rem/1.4 Inter, system-ui, sans-serif; color: var(--fg); }
.sidebar ul { list-style: none; margin: 0; padding: 0 0 0 4px; }
main.doc { max-width: 860px; margin: 0; padding: 36px 40px 80px; min-width: 0;
  font: 16px/1.65 Inter, system-ui, sans-serif; }
main.doc h1 { text-align: left; font-size: 2.1rem; margin: 0 0 16px; }
main.doc h2 { font-size: 1.6rem; margin: 56px 0 14px; padding-top: 4px; }
main.doc h3 { font-size: 1.2rem; margin: 40px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
main.doc h2 + h3 { border-top: 0; padding-top: 0; }
main.doc h4 { font-size: 1rem; color: var(--fg); margin: 24px 0 8px; }
main.doc .part { margin: 64px 0 -48px; }
main.doc h2, main.doc h3, main.doc h4 { scroll-margin-top: 72px; }
main.doc footer { text-align: left; }
@media (max-width: 900px) {
  .topbar .menu { display: inline-block; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 56px; left: 0; z-index: 15; width: 280px; max-width: 85vw; background: var(--card);
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
  .sidebar.open { transform: none; }
  main.doc { padding: 24px 16px 64px; }
}
main.doc h1 + h2 { margin-top: 8px; }
.sidebar .side-group { display: flex; align-items: center; gap: 2px; }
.sidebar .side-group a { flex: 1; }
.sidebar .caret { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: none;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; margin-left: -6px; }
.sidebar .caret::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease; }
.sidebar .expanded .caret::before { transform: rotate(45deg); }
.sidebar .caret:hover { color: var(--fg); background: var(--tag); }
.sidebar ul[hidden] { display: none; }
/* index.html: the blog post beside the side navigation */
main.post { margin: 0 auto; padding-top: 40px; min-width: 0; }
main.post h2, main.post h3 { scroll-margin-top: 72px; }
/* index.html: the TL;DR under the title, set off by a rule: what it is, the harnesses with their
   logos, the headline results on one line, and links to the code and docs */
.tldr { border-left: 3px solid var(--accent); padding: 2px 0 2px 22px; margin: 0 0 8px; }
.tldr p { margin: 0 0 12px; }
.tldr-label { font: 600 0.75rem Inter, system-ui, sans-serif; letter-spacing: 0.1em; color: var(--accent); }
.tldr .harness { white-space: nowrap; }
.tldr .harness svg { width: 0.85em; height: 0.85em; vertical-align: -0.06em; margin-right: 0.3em; }
.tldr ul { margin: 0 0 12px; padding-left: 1.2em; }
.tldr li { margin: 0 0 6px; }
.tldr li::marker { color: var(--accent); }
.tldr li a { color: inherit; text-decoration: none; }
.tldr li b { font-weight: 600; }
.tldr .links { display: flex; gap: 22px; margin: 0; font: 600 0.95rem Inter, system-ui, sans-serif; }
.tldr .links a { text-decoration: none; }
.tldr .links a:hover { text-decoration: underline; }
@media (max-width: 560px) { .tldr { padding-left: 16px; } }
