/* Dark-mode legibility fix for CTI reports published before September 2026.
   Cause: the older diagrams hard-code light pastel box fills and light-mode colours in SVG attributes,
   while text inherits `currentColor`, which turns light in dark mode → light text on light boxes.
   Add this file AFTER the report stylesheet:  <link rel="stylesheet" href="../assets/cti-dark-fix.css">  */

/* pastel boxes → dark tinted boxes */
:root[data-theme="dark"] .diagram-box svg rect[fill="#fbe4e0"]{fill:#3a1815}
:root[data-theme="dark"] .diagram-box svg rect[fill="#ffe4d1"]{fill:#3a2a14}
:root[data-theme="dark"] .diagram-box svg rect[fill="#d6e4ff"]{fill:#16233a}
:root[data-theme="dark"] .diagram-box svg rect[fill="#d8ffdb"]{fill:#10301f}
:root[data-theme="dark"] .diagram-box svg rect[fill="#fff3b0"]{fill:#3a3410}

/* solid "ink" boxes (currentColor) become light in dark mode → give them a dark surface so light text stays readable */
:root[data-theme="dark"] .diagram-box svg rect[fill="currentColor"]{fill:var(--bg-2,#121412);stroke:var(--fg,#ecede8);stroke-opacity:.35}
:root[data-theme="dark"] .diagram-box svg text[opacity=".3"]{opacity:.75}
:root[data-theme="dark"] .diagram-box svg text[opacity=".5"]{opacity:.8}

/* accent text and arrows tuned for dark backgrounds */
:root[data-theme="dark"] .diagram-box svg text[fill="#c8382a"]{fill:#ff9f9f}
:root[data-theme="dark"] .diagram-box svg text[fill="#e06a20"]{fill:#f0a640}
:root[data-theme="dark"] .diagram-box svg text[fill="#b45309"]{fill:#f0a640}
:root[data-theme="dark"] .diagram-box svg text[fill="#2a5aa8"]{fill:#8ec2f5}
:root[data-theme="dark"] .diagram-box svg tspan[fill="#b45309"]{fill:#f0a640}
:root[data-theme="dark"] .diagram-box svg path[stroke="#5a5a4f"]{stroke:#a3aea5}
:root[data-theme="dark"] .diagram-box svg rect[stroke="#c8382a"]{stroke:#ff9f9f}
:root[data-theme="dark"] .diagram-box svg rect[stroke="#e06a20"]{stroke:#f0a640}
:root[data-theme="dark"] .diagram-box svg text[opacity=".22"]{opacity:.65}
:root[data-theme="dark"] .diagram-box svg rect[fill="#e06a20"]{fill:#b8501a}
:root[data-theme="dark"] .diagram-box svg rect[fill="#c8382a"]{fill:#b03024}
