/* ============================================================
   themes.css — full dark palette for the academic theme.
   Cool dark navy (never pure black) so the reference-blue accent
   lives in a consistent world. Every surface inherits from var(--…),
   so charts, KaTeX, callouts, code and popovers flip automatically.
   data-theme="dark" is set on <html>.
   ============================================================ */

html[data-theme="dark"]{
  --bg:#141a26;            /* dark navy page */
  --bg2:#1a2233;           /* wells */
  --panel:#111722;         /* cards */
  --ink:#e8eaeb;
  --ink2:#a7afb4;
  --ink3:#7b8799;
  --line:#26314a;
  --line2:#38455f;
  --accent:#7aa7ee;        /* lightened reference blue */
  --accent-ink:#9dc0f5;
  --accent-soft:#1b2740;
  --accent-soft2:#243352;
  --on-accent:#0b1220;     /* a light accent needs a dark label (7.66:1) */
  --brand:#ff6a5e;
  --gold:#dfb77e;
  --ok:#5fc98a;
  --ok-soft:#16281f;
  --warn:#dfb77e;
  --warn-soft:#2b2418;
  --violet:#a99ae0;
  --violet-soft:#221f33;
  --err:#e06a5e;
  --err-soft:#31201e;
  --codebg:#1a2230;
  --codeink:#d8dee2;
  --hover:#1e2940;
  --mark:#4a4127;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 12px 32px rgba(0,0,0,.4);

  /* the top bar stays a navy plate in dark mode too */
  --topbar-bg:linear-gradient(180deg,#182640,#1d2f52);
  --topbar-ink:#ffffff;
  --topbar-ink2:rgba(255,255,255,.80);
  --topbar-line:rgba(255,255,255,.16);
  --topbar-hover:rgba(255,255,255,.12);
  --topbar-plate:rgba(255,255,255,.12);
  --topbar-accent:#f8b551;
  color-scheme:dark;
}

html[data-theme="dark"] body{background:var(--bg);color:var(--ink)}
html[data-theme="dark"] ::selection{background:var(--accent-soft2)}
html[data-theme="dark"] ::-webkit-scrollbar{width:11px;height:11px}
html[data-theme="dark"] ::-webkit-scrollbar-thumb{background:var(--line2);border-radius:6px}
html[data-theme="dark"] input[type="range"]{accent-color:var(--accent)}
html[data-theme="dark"] .katex{color:inherit}
html[data-theme="dark"] .math-disp{background:var(--bg2);border-radius:6px}

/* chart + figure colours the visualizations read from CSS */
html[data-theme="dark"]{
  --plot-grid:#26314a;
  --plot-ink:#c8ced2;
  --plot-accent:#7aa7ee;
  --plot-accent2:#5fc98a;
  --plot-accent3:#dfb77e;
  --plot-accent4:#a99ae0;
}

/* book PNG figures were rendered on white — keep them on white inside the dark theme */
html[data-theme="dark"] .figraw{background:#ffffff;border-color:var(--line)}
html[data-theme="dark"] .figure img{filter:brightness(.98)}
