/* Dark mode for the prototype's screens. theme_boot.js sets data-theme on
   <html> before the page paints; this file, linked last in <head>, re-points the
   design tokens for dark and fixes the few colours the stylesheets write out.
   Light is the stylesheets as they are: nothing here touches it.

   Screen only: printing (the report's "Print or save as PDF") stays light. */
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    /* common.css (the app's base: page, nav, inputs) */
    --ink-rgb: 226, 232, 240;
    --on-accent: #0b1120;
    --bg: #0b1120;
    --surface: #121a2b;
    --raised: #1a2336;
    --border: #2a3550;
    --text: #e2e8f0;
    --muted: #9aa7b8;
    --accent: #9db1ff;
    --purple: #b9a8ff;
    --green: #5fd3a3;
    --amber: #f5b75c;
    --cyan: #67d4ea;
    --err: #ff9b93;
    --ok: #5fd3a3;
    --rose: #fb8aa0;
  }

  /* surface.css (the prototype's design system) */
  html[data-theme="dark"] body.bx-surface {
    --s-bg: #0b1120;
    --s-surface: #121a2b;
    --s-well: #1a2336;
    --s-border: #2a3550;
    --s-ink: #f1f5f9;
    --s-text: #d7dee8;
    --s-muted: #9aa7b8;
    /* The brand navy, lifted to read on dark; what sits on it goes dark. */
    --s-navy: #9db1ff;
    --s-navy-deep: #bccaff;
    --s-navy-tint: #1c2647;
    --s-navy-tint-2: #172040;
    --s-on-navy: #0b1120;
    --s-eval: #3ccf91;
    --s-eval-2: #7be8bd;
    --s-eval-rgb: 60, 207, 145;
    --s-ok: #6bdca6;        --s-ok-bg: #11301f;
    --s-warn: #f6c177;      --s-warn-bg: #33250f;  --s-warn-edge: #4d3612;
    --s-risk: #fb9a5b;
    --s-err: #ff9b93;       --s-err-bg: #3b1a1a;
    --s-source: #4d3c10;    /* highlighted source term */
    --s-change: #3a3412;    /* text added in a report v2 */
    --s-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
    --s-shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.5);
    background: var(--s-bg);
    color: var(--s-text);
  }
  html[data-theme="dark"] body.bx-surface.is-app {
    --s-bg: var(--s-surface);
    --bx-side-grey: #0c1322;
  }

  /* The wordmark is a dark image: drawn light. */
  html[data-theme="dark"] .nav-logo img { filter: brightness(0) invert(0.94); }

  /* Colours the stylesheets write out rather than take from a token */
  html[data-theme="dark"] body.bx-surface .bx-btn.is-eval:hover { background: var(--s-eval-2); border-color: var(--s-eval-2); }
  html[data-theme="dark"] body.bx-surface .bx-toast-action { color: #22389c; }
  html[data-theme="dark"] body.bx-surface .bx-tabs { background: #080d18; }
  html[data-theme="dark"] body.bx-surface :is(.bx-tabs-search:hover, .bx-tabs-search[aria-expanded="true"], .bx-tab:hover, .bx-tabs-all-btn:hover) { background: rgba(255, 255, 255, 0.07); }
  html[data-theme="dark"] body.bx-surface .bx-tab-x:hover { background: rgba(255, 255, 255, 0.12); }
  html[data-theme="dark"] body.bx-surface .bx-tab-spin { border-color: rgba(157, 177, 255, 0.25); border-top-color: var(--s-navy); }
  html[data-theme="dark"] body.bx-surface .bx-scrim { background: rgba(0, 0, 0, 0.55); }
  html[data-theme="dark"] body.bx-surface .bx-owner-link { text-decoration-color: #5b6880; }
  html[data-theme="dark"] body.bx-surface :is(.bx-bell-panel, .bx-tabs-menu) { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
  html[data-theme="dark"] body.bx-surface .ad-request.is-sent { border-color: #1f5136; }
  html[data-theme="dark"] body.bx-surface .ac-switch span { background: #46536b; }
  html[data-theme="dark"] body.bx-surface .rp-act-footer .bx-btn { border-color: rgba(11, 17, 32, 0.35); }

  /* The site map (site/index.html draws it with its own strokes) */
  html[data-theme="dark"] .map-node rect { stroke: #3a4763; }
  html[data-theme="dark"] .map-node.is-missing rect { stroke: #5b6880; }
  html[data-theme="dark"] .map-node.is-missing .code { fill: #8190a6; }
  html[data-theme="dark"] .map-edge.is-stub { stroke: #e0a050; }
  html[data-theme="dark"] #arrow-link path { fill: var(--s-navy); }
  html[data-theme="dark"] #arrow-stub path { fill: #e0a050; }
}
