/* PANEL-50 Wave 8 cluster A, item 59 — dark theme.
   Loaded by ALL THREE shells (base.html desk + artist, and
   pp_base.html partner) AFTER each shell's main styles (see
   INTEGRATION NOTES in the wave report). In the partner shell
   it is a PERSONAL overlay only, in the Wave 4 display-prefs
   sense: pp_base still serves the label's desk-chosen globe
   theme in its :root block and that stored theme is never
   touched — when the person's choice is light (or device on a
   light device) these rules match nothing and the label theme
   renders exactly as served (decision in display_prefs.py).

   ACTIVATION — one definition, two paths. The dark VALUES are
   defined exactly once, as --dp-dark-* tokens on the two
   html[data-theme] selectors that may ever consume them. Both
   activation paths then MAP the consumed variables onto those
   tokens, so the two paths can never drift apart:
     * explicit dark:  html[data-theme="dark"] — always applies.
     * follow device:  html[data-theme="device"] inside
       @media (prefers-color-scheme: dark) — applies only when
       the device itself is in dark mode.
   html[data-theme="light"] matches nothing here: light leaves
   the shell's parity theme exactly as served. The server-side
   mirror of this logic is display_prefs.resolve_theme().

   SPECIFICITY: html[data-theme="dark"] (0,1,1) beats the :root
   blocks in style.css (0,1,0), the partner_panels theme_style
   :root block (0,1,0), and pp_base's inline :root theme block
   (0,1,0), regardless of load order; the device path carries
   the same specificity inside its media query. That is what
   makes the partner-shell overlay safe: it wins for the
   person's session without editing the served theme.

   NO NEW COLOURS. Every token value is the panel house theme's
   own value, verbatim (partner_panels THEMES['house'] — the
   panel's existing dark + gold theme), stated variable by
   variable in the token block below. The desk aliases follow
   the exact mapping static/style.css's :root already uses
   (globe-theme parity): --bg<---pp-bg, --bg2<---pp-chrome,
   --card/--card2<---pp-panel, --fg<---pp-text,
   --muted<---pp-muted, --accent<---pp-accent,
   --accent-dim<---pp-gold-dim, --line/--line-soft<---pp-hairline.
   --accent-soft and --gold-hair are NOT redefined: style.css
   derives both from --accent with color-mix on the same <html>
   element, so they recompute from the dark accent on their own.
   The status variables --green / --red / --blue are NOT part of
   the parity set and are not touched. */

/* ---- the dark values, defined ONCE (house theme, verbatim) -- */
html[data-theme="dark"],
html[data-theme="device"] {
  --dp-dark-bg: #0d0d10;        /* house --pp-bg */
  --dp-dark-panel: #16161c;     /* house --pp-panel */
  --dp-dark-text: #f2ead8;      /* house --pp-text */
  --dp-dark-accent: #e8b13c;    /* house --pp-accent */
  --dp-dark-hairline: #3a3220;  /* house --pp-hairline */
  --dp-dark-muted: #a89f8a;     /* house --pp-muted */
  --dp-dark-chrome: #121216;    /* house --pp-chrome */
  --dp-dark-gold-dim: #906e25;  /* house --pp-gold-dim */
  --dp-dark-accent-2: #a89f8a;  /* house --pp-accent-2 (= muted) */
}

/* ---- path 1: explicit dark, always ---- */
html[data-theme="dark"] {
  /* parity variables (partner shell set, consumed by both shells) */
  --pp-bg: var(--dp-dark-bg);
  --pp-panel: var(--dp-dark-panel);
  --pp-text: var(--dp-dark-text);
  --pp-accent: var(--dp-dark-accent);
  --pp-hairline: var(--dp-dark-hairline);
  --pp-muted: var(--dp-dark-muted);
  --pp-chrome: var(--dp-dark-chrome);
  --pp-gold-dim: var(--dp-dark-gold-dim);
  --pp-accent-2: var(--dp-dark-accent-2);
  /* desk aliases (style.css :root mapping, same sources) */
  --bg: var(--dp-dark-bg);
  --bg2: var(--dp-dark-chrome);
  --card: var(--dp-dark-panel);
  --card2: var(--dp-dark-panel);
  --fg: var(--dp-dark-text);
  --muted: var(--dp-dark-muted);
  --accent: var(--dp-dark-accent);
  --accent-dim: var(--dp-dark-gold-dim);
  --line: var(--dp-dark-hairline);
  --line-soft: var(--dp-dark-hairline);
  color-scheme: dark;
}

/* ---- path 2: follow the device, dark devices only ---- */
@media (prefers-color-scheme: dark) {
  html[data-theme="device"] {
    /* parity variables (partner shell set, consumed by both shells) */
    --pp-bg: var(--dp-dark-bg);
    --pp-panel: var(--dp-dark-panel);
    --pp-text: var(--dp-dark-text);
    --pp-accent: var(--dp-dark-accent);
    --pp-hairline: var(--dp-dark-hairline);
    --pp-muted: var(--dp-dark-muted);
    --pp-chrome: var(--dp-dark-chrome);
    --pp-gold-dim: var(--dp-dark-gold-dim);
    --pp-accent-2: var(--dp-dark-accent-2);
    /* desk aliases (style.css :root mapping, same sources) */
    --bg: var(--dp-dark-bg);
    --bg2: var(--dp-dark-chrome);
    --card: var(--dp-dark-panel);
    --card2: var(--dp-dark-panel);
    --fg: var(--dp-dark-text);
    --muted: var(--dp-dark-muted);
    --accent: var(--dp-dark-accent);
    --accent-dim: var(--dp-dark-gold-dim);
    --line: var(--dp-dark-hairline);
    --line-soft: var(--dp-dark-hairline);
    color-scheme: dark;
  }
}
