/* =====================================================================================================================
   PDI THEME — one palette, two themes (the founder, 2026-11-07: Light · Dark · Match device on every page, PCIM included).
   theme_head.js sets <html data-theme="light|dark"> before paint. Load this AFTER a page's own stylesheets: it gives the
   tokens their values for each theme, flips the older --ds-* / --shell-* variables with them, and paints the page ground.

   USE THE TOKENS, NEVER A LITERAL. A color written as a hex in a page or in script stays that color in both themes; written
   as var(--pdi-...) it follows her choice. Dark values are the app as it has looked; light values are bright and calm, with
   every accent darkened enough to read on white (the dark theme's #4ECDC4 teal fails on white).

     --pdi-bg            the page                      --pdi-ink        primary text
     --pdi-surface       a card, a panel               --pdi-ink-2      secondary text
     --pdi-surface-2     raised: inputs, wells, chips  --pdi-muted      labels, captions
     --pdi-surface-3     hover, selected               --pdi-faint      disabled, placeholder
     --pdi-line          a border                      --pdi-line-strong  a border that must show
     --pdi-overlay       a modal's scrim               --pdi-shadow     a lifted card's shadow
     accents (text/icon), each with -bg (a tint to sit behind it) and -line (its border):
     --pdi-teal  --pdi-gold  --pdi-blue  --pdi-red  --pdi-amber  --pdi-green  --pdi-violet
   ===================================================================================================================== */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --pdi-bg: #05060a;
  --pdi-surface: #0d1420;
  --pdi-surface-2: #111827;
  --pdi-surface-3: #182235;
  --pdi-line: rgba(255, 255, 255, 0.08);
  --pdi-line-strong: #333a4b;
  --pdi-ink: #f0f4ff;
  --pdi-ink-2: #cbd5e1;
  --pdi-muted: #94a3b8;
  --pdi-faint: #64748b;
  --pdi-overlay: rgba(2, 4, 10, 0.72);
  --pdi-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --pdi-focus: #60a5fa;

  --pdi-teal: #4ecdc4;   --pdi-teal-bg: rgba(78, 205, 196, 0.12);   --pdi-teal-line: rgba(78, 205, 196, 0.35);
  --pdi-gold: #d4a94e;   --pdi-gold-bg: rgba(201, 153, 63, 0.14);   --pdi-gold-line: rgba(201, 153, 63, 0.4);
  --pdi-blue: #60a5fa;   --pdi-blue-bg: rgba(96, 165, 250, 0.12);   --pdi-blue-line: rgba(96, 165, 250, 0.35);
  --pdi-red: #f87171;    --pdi-red-bg: rgba(248, 113, 113, 0.12);   --pdi-red-line: rgba(248, 113, 113, 0.38);
  --pdi-amber: #fbbf24;  --pdi-amber-bg: rgba(251, 191, 36, 0.12);  --pdi-amber-line: rgba(251, 191, 36, 0.38);
  --pdi-green: #34d399;  --pdi-green-bg: rgba(52, 211, 153, 0.12);  --pdi-green-line: rgba(52, 211, 153, 0.35);
  --pdi-violet: #a78bfa; --pdi-violet-bg: rgba(167, 139, 250, 0.12); --pdi-violet-line: rgba(167, 139, 250, 0.35);
}

:root[data-theme="light"] {
  color-scheme: light;
  --pdi-bg: #f6f7f9;
  --pdi-surface: #ffffff;
  --pdi-surface-2: #f1f4f8;
  --pdi-surface-3: #e7ecf3;
  --pdi-line: #e1e6ed;
  --pdi-line-strong: #c3ccd8;
  --pdi-ink: #0f1729;
  --pdi-ink-2: #334155;
  --pdi-muted: #556274;
  --pdi-faint: #8a95a6;
  --pdi-overlay: rgba(15, 23, 41, 0.38);
  --pdi-shadow: 0 8px 24px rgba(15, 23, 41, 0.10);
  --pdi-focus: #1d5fc2;

  --pdi-teal: #0b7f74;   --pdi-teal-bg: rgba(11, 127, 116, 0.09);   --pdi-teal-line: rgba(11, 127, 116, 0.32);
  --pdi-gold: #8a5d0c;   --pdi-gold-bg: rgba(176, 125, 30, 0.11);   --pdi-gold-line: rgba(176, 125, 30, 0.38);
  --pdi-blue: #1d5fc2;   --pdi-blue-bg: rgba(29, 95, 194, 0.08);    --pdi-blue-line: rgba(29, 95, 194, 0.30);
  --pdi-red: #b42318;    --pdi-red-bg: rgba(180, 35, 24, 0.08);     --pdi-red-line: rgba(180, 35, 24, 0.30);
  --pdi-amber: #9a5b06;  --pdi-amber-bg: rgba(217, 140, 10, 0.12);  --pdi-amber-line: rgba(217, 140, 10, 0.38);
  --pdi-green: #157347;  --pdi-green-bg: rgba(21, 115, 71, 0.09);   --pdi-green-line: rgba(21, 115, 71, 0.30);
  --pdi-violet: #6d28d9; --pdi-violet-bg: rgba(109, 40, 217, 0.08); --pdi-violet-line: rgba(109, 40, 217, 0.28);

  /* the older variables, flipped with it (app.css :root keeps their dark values) */
  --ds-bg-primary: var(--pdi-bg);
  --ds-bg-secondary: var(--pdi-surface-2);
  --ds-bg-card: var(--pdi-surface);
  --ds-bg-card-hover: var(--pdi-surface-3);
  --ds-bg-elevated: var(--pdi-surface);
  --ds-accent-blue: var(--pdi-blue);
  --ds-accent-blue-dim: var(--pdi-blue-bg);
  --ds-accent-gold: var(--pdi-gold);
  --ds-accent-gold-dim: var(--pdi-gold-bg);
  --ds-accent-teal: var(--pdi-teal);
  --ds-accent-teal-dim: var(--pdi-teal-bg);
  --ds-text-primary: var(--pdi-ink);
  --ds-text: var(--pdi-ink);
  --ds-text-secondary: var(--pdi-ink-2);
  --ds-text-muted: var(--pdi-muted);
  --ds-border: var(--pdi-line);
  --ds-border-accent: var(--pdi-blue-line);
  --shell-bg: var(--pdi-bg);
  --shell-fg: var(--pdi-ink);
  --shell-panel: var(--pdi-surface);
  --shell-card: var(--pdi-surface);
  --shell-border: var(--pdi-line-strong);
  --shell-text: var(--pdi-ink);
  --shell-muted: var(--pdi-muted);
  --shell-chip: var(--pdi-surface-2);
  --shell-chip-border: var(--pdi-line-strong);
  --shell-input-bg: var(--pdi-surface);
  --shell-danger: var(--pdi-red);
}

/* the page ground, in both themes (app.css paints html/body #05060a as a literal) */
html, body { background: var(--pdi-bg); color: var(--pdi-ink); }

/* ── The switch: Light · Dark · Match device (theme.js draws it in the nav) ────────────────────────────────────────── */
.pdi-theme-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  border: 1px solid var(--pdi-line-strong); border-radius: 999px; background: var(--pdi-surface-2);
  vertical-align: middle; flex-shrink: 0;
}
.pdi-theme-opt {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--pdi-muted); cursor: pointer;
}
.pdi-theme-opt svg { width: 15px; height: 15px; }
.pdi-theme-opt:hover { color: var(--pdi-ink); }
.pdi-theme-opt[aria-pressed="true"] { background: var(--pdi-surface); color: var(--pdi-ink); box-shadow: 0 0 0 1px var(--pdi-line-strong); }
.pdi-theme-opt:focus-visible { outline: 2px solid var(--pdi-focus); outline-offset: 1px; }
