/*
 * 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);
  --panel-bg-soft: linear-gradient(160deg,rgba(15,36,42,.94),rgba(10,26,31,.94));
  --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);
  --panel-bg-soft: linear-gradient(160deg,rgba(22,24,29,.94),rgba(15,16,20,.94));
  --pid-border:  #33363f;
  --pid-ink:     #4a4e59;
  --pfoot-bg:    #0b0c0f;
  --bg-radial:   radial-gradient(1100px 520px at 50% -12%, #1a1d24 0%, var(--bg) 60%);
}

/* ── EARTH — forest floor, green ink. ─────────────────────────────────────
   Added 2026-09-22. The theme's identity is its INK, not its accent: --ink is
   celadon #c8e6cd, measured 13.6:1 on the ground and 1.54:1 against the status
   green --good #5cc98a, so ordinary text and "healthy" stay separable by
   lightness. A phosphor-green ink (#6cc47a) measured 1.04:1 against --good —
   visually identical — which is why this theme is light-green, not phosphor.

   PROC-003 HOLDS: --good, --alarm-red and --warn-amber are NOT redefined here.
   Status colour means the same thing in EARTH as in MARS and VENUS. The accent
   is tan #b08d52 (dry earth), deliberately OUT of the green family so nothing
   interactive can be mistaken for a healthy-state indication. */
:root[data-sim-theme="earth"] {
  --bg:          #0e170f;                  /* user ruling: #0b120d +25% */
  --surf:        #16241a;
  --surf-lo:     #111c14;
  --ink:         #c8e6cd;                  /* THE GREEN FONT */
  --ink-dim:     #7f9c85;
  /* ACCENT IS NOT GREEN, DELIBERATELY. A leaf-green accent (#8fbf78) measured
     1.03:1 against --good #5cc98a — the same colour to the eye, so every
     interactive control would have read as a healthy-state indication. Tan is
     out of the green family entirely: 5.90:1 on the ground, and no possible
     confusion with status. The theme's green identity lives in --ink. */
  --accent:      #c9a063;                  /* dry earth tan */
  --accent-glow: rgba(201,160,99,0.5);
  --accent-soft: rgba(201,160,99,0.30);
  --accent-fill: rgba(201,160,99,0.08);
  --accent-2:    #8fbf78;                  /* leaf — footer only, never a control */
  --tile-bg:     linear-gradient(155deg,#1a2c1f,#132117);
  --strip-bg:    linear-gradient(180deg,#1d3122 0%, var(--surf) 55%, #0f1a12 100%);
  --score-bg:    linear-gradient(180deg,#1b2d20,#121e15);
  --simtime-bg:  var(--surf-lo);
  --panel-bg:    linear-gradient(160deg,#142218,#0d160f);
  --panel-bg-soft: linear-gradient(160deg,rgba(20,34,24,.94),rgba(13,22,15,.94));
  --pid-border:  #28402e;
  --pid-ink:     #3d5c46;
  --pfoot-bg:    #081109;
  --bg-radial:   radial-gradient(1200px 620px at 50% -10%, #17301d 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);
}

/* COFFEE-PLANT USES A DIFFERENT CLASS (user report 2026-09-22: the HIC001
   value stayed yellow in VENUS). Its mimic is an inline SVG, so the live
   values are `.tag-value` painted with `fill`, not `.tt-value` with `color` —
   the rule above could never have reached them. `fill` is the SVG property;
   setting `color` on an SVG text node does nothing.

   Same :not([class*="alarm"]) guard, so PROC-003 alarm states keep their own
   colours. EARTH gets it too: its ink is celadon and a yellow value would be
   the one un-themed thing on the page. */
:root[data-sim-theme="venus"] .tag-value:not([class*="alarm"]),
:root[data-sim-theme="earth"] .tag-value:not([class*="alarm"]) {
  fill: var(--accent);
}
/* The HTML chips beside the SVG carry the same value in `.row .v`. */
:root[data-sim-theme="venus"] .chip .row .v:not([class*="alarm"]),
:root[data-sim-theme="earth"] .chip .row .v: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; }
