/*
 * sim_theme.css — VENUS/MARS palette layer for the simulator pages.
 *
 * F-85 single-definition point. NOT theme.css (that is the 62-page
 * fonts/form/focus layer). This file is pulled in ONLY by pages carrying the
 * simulator strip (sim_strip.js). Values verbatim from the approved
 * theme_demo_venus_mars.html (2026-09-01).
 *
 * ATTRIBUTE: this palette keys on data-sim-theme="mars|venus" — DELIBERATELY NOT
 * data-theme, which BACKGROUND (F-63.4) already owns for black/grey. Two features,
 * two attributes: pressing BACKGROUND must never wipe the palette (F-85.3).
 *
 * MARS is the platform default (F-85.2). The strip's pre-paint script stamps
 * data-sim-theme="mars" on :root when localStorage 'ui_theme' is unset, so a page
 * that never toggles opens in MARS.
 *
 * Consumers read tokens only — never redefine the palette anywhere else (F-44.6).
 *   BLUE  (live/dynamic)  → var(--accent)   : SIM TIME, SCORE, PV values, readouts
 *   GREY  (static labels) → var(--ink-dim)  : faceplate labels, tag names
 *   ALARM/STATUS literals → --alarm-red / --ok-green / --warn-amber / --run-green
 *                           theme-INDEPENDENT — a themed alarm is a PROC-003 defect.
 */

/* ── Theme-independent status literals (PROC-003 — never themed) ───────────── */
:root {
  --run-green:  #52c98a;
  --ok-green:   #46d08a;
  --alarm-red:  #ff5d5d;
  --warn-amber: #f2b64a;
}

/* ── VENUS — full-page ocean. --accent set by the data-venus shade below. ──── */
:root[data-sim-theme="venus"] {
  --bg:          #08171c;                  /* deep warm ocean dark */
  --surf:        #12262e;                  /* tile — warm teal graphite */
  --surf-lo:     #0c1d23;
  --ink:         #d2e2e4;
  --ink-dim:     #6f8a90;                  /* calm grey for STATIC labels */
  --accent-2:    #4fc9a6;                  /* footer accent (ocean green) */
  --good:        #52c98a;                  /* literal — status, not themed */
  --tile-bg:     linear-gradient(155deg,#163038,#102329);
  --strip-bg:    linear-gradient(180deg,#173139 0%, var(--surf) 55%, #0b1c22 100%);
  --score-bg:    linear-gradient(180deg,#173036,#0f2228);
  --simtime-bg:  var(--surf-lo);
  --panel-bg:    linear-gradient(160deg,#0f242a,#0a1a1f);
  --pid-border:  #244149;
  --pid-ink:     #3c5b62;
  --pfoot-bg:    #06141a;
  --bg-radial:   radial-gradient(1200px 620px at 50% -10%, #123840 0%, var(--bg) 60%);
}

/* VENUS shade picker — swaps ONLY the accent family, so the whole ocean colour
   changes from one attribute (F-44.6). LAGOON is the user's pick (F-85.2). */
:root[data-sim-theme="venus"][data-venus="aqua"] {
  --accent:#2fb6c9; --accent-glow:rgba(47,182,201,0.5);
  --accent-soft:rgba(47,182,201,0.30); --accent-fill:rgba(47,182,201,0.08);
}
:root[data-sim-theme="venus"][data-venus="lagoon"] {
  --accent:#38c6b4; --accent-glow:rgba(56,198,180,0.5);
  --accent-soft:rgba(56,198,180,0.30); --accent-fill:rgba(56,198,180,0.08);
}
:root[data-sim-theme="venus"][data-venus="shallow"] {
  --accent:#4bb8e0; --accent-glow:rgba(75,184,224,0.5);
  --accent-soft:rgba(75,184,224,0.30); --accent-fill:rgba(75,184,224,0.08);
}
/* Safety net: VENUS with no data-venus still has an accent (defaults to LAGOON). */
:root[data-sim-theme="venus"]:not([data-venus]) {
  --accent:#38c6b4; --accent-glow:rgba(56,198,180,0.5);
  --accent-soft:rgba(56,198,180,0.30); --accent-fill:rgba(56,198,180,0.08);
}

/* ── MARS (DEFAULT) — frost / copper. ─────────────────────────────────────── */
:root[data-sim-theme="mars"] {
  --bg:          #0d0e11;
  --surf:        #1a1c22;
  --surf-lo:     #131418;
  --ink:         #e2e4ea;
  --ink-dim:     #83879a;
  --accent:      #9fd6ff;                  /* condensate blue-white frost */
  --accent-glow: rgba(159,214,255,0.5);
  --accent-soft: rgba(159,214,255,0.3);
  --accent-fill: rgba(159,214,255,0.06);
  --accent-2:    #c98a5a;                  /* brushed copper filament */
  --good:        #5cc98a;                  /* MARS green — verbatim from source */
  --tile-bg:     linear-gradient(155deg,#1e2027,#171921);
  --strip-bg:    linear-gradient(180deg,#212429 0%, var(--surf) 55%, #141519 100%);
  --score-bg:    linear-gradient(180deg,#22252c,#16181e);
  --simtime-bg:  var(--surf-lo);
  --panel-bg:    linear-gradient(160deg,#16181d,#0f1014);
  --pid-border:  #33363f;
  --pid-ink:     #4a4e59;
  --pfoot-bg:    #0b0c0f;
  --bg-radial:   radial-gradient(1100px 520px at 50% -12%, #1a1d24 0%, var(--bg) 60%);
}

/* Safety net: an un-stamped :root (pre-paint script failed) still gets MARS,
   the platform default (F-85.2) — never an unthemed flash. */
:root:not([data-sim-theme]) {
  --bg:#0d0e11; --surf:#1a1c22; --surf-lo:#131418;
  --ink:#e2e4ea; --ink-dim:#83879a;
  --accent:#9fd6ff; --accent-glow:rgba(159,214,255,0.5);
  --accent-soft:rgba(159,214,255,0.3); --accent-fill:rgba(159,214,255,0.06);
  --accent-2:#c98a5a; --good:#5cc98a;
}

/* ── Semantic value classes the pages consume ────────────────────────────── */
/* Live / dynamic readouts take the theme blue. */
.val-live { color: var(--accent); }
/* Static labels stay grey in every theme. */
.val-label { color: var(--ink-dim); }

/* ── VENUS body theming: live plant readouts go lagoon (user ruling 2026-09-02).
   The migrated sim pages colour their live tag values through `.tt-value`
   (default yellow #ffff00 — kept in MARS). In VENUS ONLY, override the base
   readout to the theme accent so the ocean feel reaches the plant body, not just
   the strip. MARS keeps yellow (this rule doesn't fire in MARS).

   PROC-003 preserved: alarm states (.tt-value.alarm-*) set their colour with
   !important on the page, so they beat this rule and stay red/white. Faceplate
   PID values (.fp-bar-val.op-val green / .sp-val amber) are a DIFFERENT class and
   are not touched — semantic convention, never themed. Base-only via :not(). */
:root[data-sim-theme="venus"] .tt-value:not([class*="alarm"]),
:root[data-sim-theme="venus"] .ft-value:not([class*="alarm"]) {
  color: var(--accent);
}

/* ── TICKER (sim_ticker.js) — user ruling 2026-09-16 ─────────────────────────
   "Link the ticker font colour to the THEME."

   EVERY colour is a token, never a literal. --alarm-red / --warn-amber /
   --ok-green / --ink are redefined per palette above, so VENUS <-> MARS
   re-themes the ticker with the rest of the page and it cannot drift. A hex
   here would look right in one theme and silently wrong in the other.

   The four classes mirror the priority ladder: an ESD must not read the same
   as a procedure step on a strip an operator scans in one pass. */
.tk-esd      { color: var(--alarm-red,  #ff5d5d); font-weight: 700; }
.tk-alarm    { color: var(--warn-amber, #f2b64a); font-weight: 700; }
.tk-radio    { color: var(--ok-green,   #46d08a); }
.tk-done     { color: var(--ok-green,   #46d08a); font-weight: 600; }
.tk-step-now { color: var(--ink,        #d2e2e4); font-weight: 600; }
.tk-step     { color: var(--ink-dim,    #6f8a90); }

/* ── TICKER ANIMATION — shared, so a page needs no copy of its own ───────────
   AUDIT FINDING 2026-09-16 (user: "CHECK FIRST, AUDIT FOR FLAWLESS EXECUTION").
   @keyframes ticker-scroll was defined inline in FOUR pages and nowhere shared.
   MR Train — the page that most needs a ticker — has no copy, so phase 2 would
   have mounted a ticker there that rendered its text and never moved, with no
   error anywhere. A page cannot inherit a keyframe it does not declare.

   Declared here beside the .tk-* colours, so any page loading sim_theme.css
   gets the motion and the palette together. The per-page copies are harmless
   duplicates of an identical rule and are retired with their inline tickers in
   phase 2. */
@keyframes ticker-scroll     { 0% { transform: translateX(100vw); }
                               100% { transform: translateX(-100%); } }
@keyframes ticker-scroll-rtl { 0% { transform: translateX(-100vw); }
                               100% { transform: translateX(100%); } }
/* HOVER TO PAUSE — the affordance the strip's own label advertises. */
#ticker-content:hover { animation-play-state: paused; }
