/* aphex · light / dark theme add-on (loaded after the built app.css; see docs/light-theme-notes.md).
   The dark theme is the original design and stays in app.css untouched. This file adds the theme switch,
   tokens for the colours the bundle wrote into its charts (their dark values are the originals), and the
   light theme "Midnight Luxe": porcelain paper (#F0F4FA), navy ink (#0C172A), the blueprint cyan becomes
   Midnight Luxe teal ink (#0F7590), gold UI accents become emerald (#0B7F5E ink / #39C89D fill), and gold
   data highlights become chart gold (#A57700, text #986C00). <html data-theme="light"> switches it;
   assets/theme/theme.js does the switching. */

/* ------------------------------------------------------------------ the switch */

.tt-ico {
  display: inline-grid;
  flex: none;
  width: 22px;
  height: 22px;
}

.tt-ico svg {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.6s var(--ease), opacity 0.35s var(--ease);
}

.tt-moon,
:root[data-theme='light'] .tt-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.45);
}

:root[data-theme='light'] .tt-sun {
  transform: rotate(90deg) scale(0.45);
}

:root[data-theme='light'] .tt-moon {
  opacity: 1;
  transform: none;
}

.rp-hbtn .tt-ico {
  width: 20px;
  height: 20px;
}

/* The new theme grows out of the switch as a circle (theme.js); nothing else animates meanwhile. */
:root[data-theme-switching]::view-transition-old(root),
:root[data-theme-switching]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

:root[data-theme-switching] * {
  view-transition-name: none !important;
}

:root[data-theme-switching] *:not(.tt-sun, .tt-moon),
:root[data-theme-switching] *::before,
:root[data-theme-switching] *::after {
  transition: none !important;
}

/* ------------------------------------------------------------------ chart tokens (dark = the original values) */

:root {
  --ax-ink-soft: rgba(214, 230, 242, 0.55);
  --ax-track: rgba(150, 195, 225, 0.05);
  --ax-ghost: rgba(214, 230, 242, 0.35);
  --ax-link: rgba(214, 230, 242, 0.4);
  --ax-cell-empty: rgba(150, 195, 225, 0.04);
  --ax-heat-mid: #263340;
  --ax-heat-good: #2f9f84;
  --ax-heat-bad: #c2553f;
  --ax-heat-ink: #f3f7fa;
  --ax-forecast: rgba(150, 195, 225, 0.16);
  --ax-rain: rgba(86, 178, 214, 0.42);
  --ax-rain-key: rgba(86, 178, 214, 0.6);
  --ax-weekly: rgba(98, 210, 232, 0.28);
  --ax-weekly-key: rgba(98, 210, 232, 0.35);
  --ax-cell-float: rgba(98, 210, 232, 0.22);
  --ax-cell-none: rgba(150, 195, 225, 0.09);
  --ax-cell-on: rgba(98, 210, 232, 0.5);
  --ax-float-key: rgba(98, 210, 232, 0.3);
  --ax-noid-key: rgba(150, 195, 225, 0.14);
  --ax-baseline-key: rgba(214, 230, 242, 0.6);
  --ax-cyan-mid: rgba(98, 210, 232, 0.45);
  --ax-amber-ink: #f0a04b;
  /* plan legend swatches (the areas themselves are styled in app.css) */
  --pa-promised-line: #a5ebf7;
  --pa-promised-fill: rgba(98, 210, 232, 0.46);
  --pa-planned-line: rgba(98, 210, 232, 0.7);
  --pa-planned-fill: rgba(98, 210, 232, 0.13);
  --pa-clash-line: #ffc78a;
  --pa-clash-fill: rgba(240, 160, 75, 0.5);
  --pa-kept-line: #86e0c4;
  --pa-kept-fill: rgba(79, 195, 161, 0.5);
  --pa-missed-line: #ff9a90;
  --pa-missed-fill: rgba(255, 107, 94, 0.5);
}

/* ------------------------------------------------------------------ light theme: tokens */

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f0f4fa;
  --bg-deep: #e3e9f2;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #e9eef5;
  --line: rgba(12, 23, 42, 0.11);
  --line-strong: rgba(12, 23, 42, 0.21);
  --ink: #1b2b45;
  --text: #0c172a;
  --text-2: #2a3a55;
  --muted: #56657e;
  --faint: #8592a7;
  --cyan: #0f7590;
  --cyan-2: #0b6177;
  --cyan-soft: rgba(0, 161, 193, 0.11);
  --cyan-line: rgba(15, 117, 144, 0.42);
  /* Charts read these tokens directly, so they carry the validated chart steps (as the demo's --chart-*);
     text that uses them is pinned to the inks below (.amber, .teal, .gold, .chip--warn, --ax-amber-ink). */
  --gold: #a57700;
  --gold-2: #986c00;
  --gold-soft: rgba(165, 119, 0, 0.12);
  --gold-line: rgba(152, 108, 0, 0.45);
  --amber: #f38042;
  --amber-soft: rgba(255, 175, 82, 0.2);
  --red: #bf3448;
  --red-soft: rgba(233, 119, 131, 0.16);
  --teal: #0ba880;
  --teal-soft: rgba(57, 200, 157, 0.15);
  --slate: #d3dae4;
  --slate-2: #8592a7;
  --ax-amber-ink: #a95c0a;

  --ax-ink-soft: rgba(12, 23, 42, 0.45);
  --ax-track: rgba(12, 23, 42, 0.05);
  --ax-ghost: rgba(12, 23, 42, 0.25);
  --ax-link: rgba(12, 23, 42, 0.3);
  --ax-cell-empty: rgba(12, 23, 42, 0.04);
  --ax-heat-mid: #eef2f7;
  --ax-heat-good: #02a880;
  --ax-heat-bad: #e2727f;
  --ax-heat-ink: #0c172a;
  --ax-forecast: rgba(12, 23, 42, 0.14);
  --ax-rain: rgba(0, 161, 193, 0.3);
  --ax-rain-key: rgba(0, 161, 193, 0.45);
  --ax-weekly: rgba(15, 117, 144, 0.32);
  --ax-weekly-key: rgba(15, 117, 144, 0.4);
  --ax-cell-float: rgba(0, 161, 193, 0.22);
  --ax-cell-none: rgba(12, 23, 42, 0.07);
  --ax-cell-on: rgba(15, 117, 144, 0.55);
  --ax-float-key: rgba(0, 161, 193, 0.3);
  --ax-noid-key: rgba(12, 23, 42, 0.1);
  --ax-baseline-key: rgba(12, 23, 42, 0.45);
  --ax-cyan-mid: #3eafc7;
  --pa-promised-line: #0f7590;
  --pa-promised-fill: rgba(0, 161, 193, 0.38);
  --pa-planned-line: rgba(15, 117, 144, 0.65);
  --pa-planned-fill: rgba(0, 161, 193, 0.1);
  --pa-clash-line: #a95c0a;
  --pa-clash-fill: rgba(243, 128, 66, 0.42);
  --pa-kept-line: #0b7f5e;
  --pa-kept-fill: rgba(2, 168, 128, 0.5);
  --pa-missed-line: #bf3448;
  --pa-missed-fill: rgba(191, 52, 72, 0.64);

  /* report pack focus scrim (dark falls back to #07090c) */
  --rp-canvas-solid: #e3e9f2;
}

/* ------------------------------------------------------------------ light theme: the drawing sheet */

:root[data-theme='light'] .stage-bg {
  background:
    radial-gradient(52% 48% at 26% 30%, rgba(0, 161, 193, 0.07), transparent 72%),
    radial-gradient(44% 40% at 88% 92%, rgba(243, 203, 135, 0.18), transparent 70%),
    radial-gradient(120% 90% at 50% 40%, #fbfcfe 0%, var(--bg) 55%, var(--bg-deep) 100%);
}

:root[data-theme='light'] .stage-grid {
  background-image:
    linear-gradient(rgba(15, 80, 110, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 80, 110, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(15, 80, 110, 0.085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 80, 110, 0.085) 1px, transparent 1px);
}

/* The B.I Sense wordmark in navy ink on light paper (the file itself is the yellow mark). */
:root[data-theme='light'] img[src*='img/logo.svg'] {
  filter: brightness(0) saturate(100%) invert(9%) sepia(5%) saturate(6993%) hue-rotate(180deg) brightness(94%) contrast(101%);
}

:root[data-theme='light'] .titleblock {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px -22px rgba(12, 23, 42, 0.3);
}

:root[data-theme='light'] .titleblock .tb-qr {
  background: rgba(0, 161, 193, 0.05);
}

/* Gold that was a UI accent becomes the emerald accent; gold that marks data stays gold (--gold). */
:root[data-theme='light'] .titleblock .tb-row em,
:root[data-theme='light'] .t-kicker.gold,
:root[data-theme='light'] .pitch-row i {
  color: #0b7f5e;
}

:root[data-theme='light'] .chip--demo {
  border-color: rgba(11, 127, 94, 0.42);
  color: #0b7f5e;
  background: rgba(57, 200, 157, 0.12);
}

/* Text in the status colours uses the text-safe inks (the tokens themselves are chart steps). */
:root[data-theme='light'] .amber,
:root[data-theme='light'] .chip--warn {
  color: #a95c0a;
}

:root[data-theme='light'] .teal {
  color: #0b7f5e;
}

:root[data-theme='light'] .gold {
  color: #986c00;
}

/* ------------------------------------------------------------------ light theme: controls and surfaces */

:root[data-theme='light'] .chip {
  background: rgba(255, 255, 255, 0.78);
}

:root[data-theme='light'] .chip.chip--demo {
  background: rgba(57, 200, 157, 0.12);
}

:root[data-theme='light'] .chip--cyan {
  background: var(--cyan-soft);
}

:root[data-theme='light'] .chip--warn {
  border-color: rgba(169, 92, 10, 0.4);
  background: var(--amber-soft);
}

:root[data-theme='light'] .btn,
:root[data-theme='light'] .icon-btn {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 2px rgba(12, 23, 42, 0.05);
}

:root[data-theme='light'] .btn:hover,
:root[data-theme='light'] .icon-btn:hover,
:root[data-theme='light'] .btn--on {
  background: rgba(0, 161, 193, 0.11);
}

:root[data-theme='light'] .seg {
  background: rgba(255, 255, 255, 0.86);
}

:root[data-theme='light'] .seg button.on,
:root[data-theme='light'] .pick.on {
  color: #ffffff;
}

:root[data-theme='light'] .glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(250, 252, 254, 0.93));
  box-shadow: 0 30px 80px -26px rgba(12, 23, 42, 0.34);
}

:root[data-theme='light'] .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.82));
  box-shadow: 0 1px 2px rgba(12, 23, 42, 0.04), 0 12px 30px -20px rgba(12, 23, 42, 0.22);
}

:root[data-theme='light'] .scrim {
  background: rgba(12, 23, 42, 0.3);
}

:root[data-theme='light'] .side-story,
:root[data-theme='light'] .deck-item {
  background: rgba(255, 255, 255, 0.84);
}

:root[data-theme='light'] .steps,
:root[data-theme='light'] .pick {
  background: rgba(255, 255, 255, 0.86);
}

:root[data-theme='light'] .step:hover {
  background: rgba(0, 161, 193, 0.07);
}

/* ------------------------------------------------------------------ light theme: portfolio tiles and plans */

:root[data-theme='light'] .tile {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 253, 0.9));
  box-shadow: 0 1px 2px rgba(12, 23, 42, 0.04);
}

:root[data-theme='light'] button.tile:hover {
  box-shadow: 0 18px 44px -16px rgba(12, 23, 42, 0.3), 0 0 0 1px rgba(15, 117, 144, 0.14);
}

:root[data-theme='light'] .tile .tile-plan {
  background: radial-gradient(80% 90% at 50% 40%, rgba(0, 161, 193, 0.07), transparent 75%);
}

:root[data-theme='light'] .tile--pitch {
  background: linear-gradient(160deg, rgba(0, 161, 193, 0.1), rgba(255, 255, 255, 0.92) 60%);
}

:root[data-theme='light'] .proj-plan {
  background: radial-gradient(70% 80% at 50% 45%, rgba(0, 161, 193, 0.06), transparent 78%);
}

:root[data-theme='light'] .pl-contour { stroke: rgba(15, 117, 144, 0.1); }
:root[data-theme='light'] .pl-water path { stroke: rgba(0, 140, 180, 0.55); }
:root[data-theme='light'] .pl-water .glow { stroke: rgba(0, 161, 193, 0.1); }
:root[data-theme='light'] .pl-road .edge { stroke: rgba(12, 23, 42, 0.22); }
:root[data-theme='light'] .pl-road .fill { stroke: #ffffff; }
:root[data-theme='light'] .pl-rail path { stroke: rgba(12, 23, 42, 0.38); }
:root[data-theme='light'] .pl-rail .ties { stroke: rgba(12, 23, 42, 0.2); }
:root[data-theme='light'] .pl-line,
:root[data-theme='light'] .pl-dash,
:root[data-theme='light'] .pl-ring { stroke: rgba(12, 23, 42, 0.25); }
:root[data-theme='light'] .pl-leader path { stroke: rgba(15, 117, 144, 0.5); }
:root[data-theme='light'] .pl-hatch { stroke: rgba(12, 23, 42, 0.16); }
:root[data-theme='light'] .pl-hatch-line { stroke: rgba(12, 23, 42, 0.1); }
:root[data-theme='light'] .pl-night-line { stroke: rgba(12, 23, 42, 0.38); }
:root[data-theme='light'] .pl-label { fill: rgba(42, 58, 85, 0.68); }
:root[data-theme='light'] .pl-zone .outline { fill: rgba(0, 161, 193, 0.04); stroke: rgba(15, 117, 144, 0.5); }
:root[data-theme='light'] .plan--mini .pl-zone .outline { stroke: rgba(15, 117, 144, 0.45); }
:root[data-theme='light'] .pl-zone .cells { stroke: rgba(15, 117, 144, 0.16); }
:root[data-theme='light'] .pl-zone .lanes { stroke: rgba(15, 117, 144, 0.22); }
:root[data-theme='light'] .pl-zone-label { fill: rgba(12, 23, 42, 0.8); }
:root[data-theme='light'] .pl-chain { fill: rgba(42, 58, 85, 0.62); }
:root[data-theme='light'] .pl-area--planned .shape { fill: var(--pa-planned-fill); stroke: var(--pa-planned-line); }
:root[data-theme='light'] .pl-area--promised .shape { fill: var(--pa-promised-fill); stroke: var(--pa-promised-line); }
:root[data-theme='light'] .pl-area--done .shape { fill: rgba(127, 139, 160, 0.1); stroke: rgba(86, 101, 126, 0.45); }
:root[data-theme='light'] .pl-area--kept .shape { fill: var(--pa-kept-fill); stroke: var(--pa-kept-line); }
:root[data-theme='light'] .pl-area--missed .shape { fill: var(--pa-missed-fill); stroke: var(--pa-missed-line); }
:root[data-theme='light'] .pl-area--clash .shape { fill: var(--pa-clash-fill); stroke: var(--pa-clash-line); }
:root[data-theme='light'] .pl-area--dim .shape { fill: rgba(0, 161, 193, 0.05); stroke: rgba(15, 117, 144, 0.2); }
:root[data-theme='light'] .pl-area.is-focus .shape { stroke: #0c172a; }

/* ------------------------------------------------------------------ light theme: timeline, charts, tables */

:root[data-theme='light'] .tm-bar { fill: rgba(0, 161, 193, 0.4); }
:root[data-theme='light'] .tm-bar.low { fill: rgba(243, 128, 66, 0.62); }
:root[data-theme='light'] .tm-bar.on { fill: var(--gold); }
:root[data-theme='light'] .tm-bar.future { fill: rgba(12, 23, 42, 0.08); }
:root[data-theme='light'] .tm-wet { fill: rgba(0, 161, 193, 0.07); }
:root[data-theme='light'] .ch-grid { stroke: rgba(12, 23, 42, 0.08); }
:root[data-theme='light'] .ch-band { fill: rgba(0, 161, 193, 0.08); }
:root[data-theme='light'] .ch-band-label { fill: #0f7590; }

:root[data-theme='light'] .ch-row:hover .ch-label,
:root[data-theme='light'] .ch-hot .ch-label {
  fill: var(--text);
}

:root[data-theme='light'] .rtable-wrap {
  background: rgba(255, 255, 255, 0.86);
}

:root[data-theme='light'] .rtable th {
  background: #f3f6fa;
}

:root[data-theme='light'] .rtable tr:hover td {
  background: rgba(0, 161, 193, 0.06);
}

/* ------------------------------------------------------------------ light theme: report pack (Midnight Luxe, as in the demo) */

.rp-root.theme-light {
  --rp-canvas: radial-gradient(120% 90% at 50% 0%, #f9fbfd 0%, #eef2f8 55%, #e5ebf3 100%);
  --rp-header-bg: linear-gradient(180deg, #14243b, #0c172a);
  --rp-header-line: rgba(57, 200, 157, 0.32);
  --rp-header-title: #f0f4fa;
  --rp-header-muted: #9fb0c8;
  --rp-kicker: #39c89d;
  --rp-card: #ffffff;
  --rp-card-solid: #ffffff;
  --rp-border: #dde4ee;
  --rp-border-strong: #c6d0dd;
  --rp-title: #0c172a;
  --rp-text: #2a3a55;
  --rp-muted: #56657e;
  --rp-grid: #e7ecf3;
  --rp-axis: #b8c3d2;
  --rp-hover: rgba(12, 23, 42, 0.05);
  --rp-row: #f5f7fb;
  --rp-row-strong: #e9eef5;
  --rp-accent: #0b7f5e;
  --rp-accent-soft: rgba(57, 200, 157, 0.14);
  --rp-accent-line: rgba(11, 127, 94, 0.42);
  --rp-select: rgba(57, 200, 157, 0.1);
  --rp-s1: #7194db;
  --rp-s2: #d08319;
  --rp-s3: #02a880;
  --rp-s4: #b84b5a;
  --rp-s5: #a984d7;
  --rp-s6: #b88d3d;
  --rp-s7: #00a1c1;
  --rp-s8: #ba578b;
  --rp-s9: #9aa6b8;
  --rp-s10: #8a9a2e;
  --rp-good: #02a880;
  --rp-warn: #d08319;
  --rp-bad: #bf3448;
  --rp-bad-soft: rgba(233, 119, 131, 0.14);
  --rp-warn-soft: rgba(255, 175, 82, 0.2);
  --rp-on-bar: #0c172a;
  --rp-track: #e7ecf3;
  --rp-databar: rgba(113, 148, 219, 0.3);
  --rp-heat: #02a880;
  --rp-tip-bg: #ffffff;
  --rp-pane-bg: #ffffff;
  --rp-badge-bg: #eef2f8;
  --rp-badge: #2a3a55;
  --rp-highlight: #fbefd6;
  --rp-shadow: 0 12px 30px -8px rgba(12, 23, 42, 0.16);
  color-scheme: light;
}

.rp-root.theme-light .rp-section.on {
  background: rgba(57, 200, 157, 0.16);
  border-color: rgba(57, 200, 157, 0.5);
}

.rp-root.theme-light .rp-hbtn:hover,
.rp-root.theme-light .rp-hbtn.on {
  border-color: rgba(57, 200, 157, 0.55);
}

/* Chips on the navy report header keep light-on-navy colours. */
.rp-root.theme-light .rp-header .chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  color: #c8d5e5;
}

.rp-root.theme-light .rp-header .chip--demo {
  border-color: rgba(57, 200, 157, 0.55);
  color: #39c89d;
  background: rgba(57, 200, 157, 0.1);
}

/* The filter bar's Clear button borrows the header button style; on the light canvas it needs canvas colours. */
.rp-root.theme-light .rp-filterbar .rp-hbtn {
  color: var(--rp-text);
  border-color: var(--rp-border-strong);
  background: var(--rp-card);
}

.rp-root.theme-light .rp-filterbar .rp-hbtn:hover {
  color: var(--rp-title);
  border-color: var(--rp-accent-line);
}

/* The current page number: a bright emerald pill with navy digits. */
.rp-root.theme-light .rp-tab.on .n {
  background: #39c89d;
  color: #0c172a;
}
