/* ============================================================
   PRODUCTION STYLESHEET — palette adoption (paper/olive, from
   dashboard/psx-board-preview.html). Additive only, loaded right
   after themes.css. Redefines the gemini theme's own custom
   properties in place (same selector, later source order = wins)
   so every existing rule that already reads var(--panel)/var(--line)/
   etc repaints automatically — no per-component rewrite needed.
   New reference-only tokens (the --paper, --positive, --negative,
   --focus and --shadow families) are added alongside for the new components (notch tabs,
   statusbar, inspector rail) that style directly off them.
   This is a production stylesheet, not a prototype — dashboard/
   index.html links it right after themes.css for exactly this reason.
   ============================================================ */

body[data-theme=gemini] {
  /* ---- reference tokens, verbatim from psx-board-preview.html ---- */
  /* LIGHT SCHEME — the complete set of every token that varies by
     scheme. Every one of these is overridden again, token-for-token,
     in the two dark blocks directly below. Nothing here may be left
     undefined in dark — an undefined var() referenced inside a
     shorthand (e.g. border:1px solid var(--x)) silently voids the
     whole declaration. */
  --paper:#f7f6f1; --paper-2:#fbfaf6; --paper-3:#fffefb;
  --rpanel:#efeee8; --rpanel-2:#e8e7e0;
  --rink:#20221f; --rmuted:#6f726b; --rhair:#d5d5cc; --rline:#b9bbb2;
  --positive:#28724b; --positive-soft:#e3efe4; --negative:#b44640; --negative-soft:#f3e5e2;
  --focus:#2d6847; --shadow:0 10px 28px rgba(38,39,33,.07);
  --shadow-hard:rgba(0,0,0,.12); --backdrop:rgba(24,25,22,.28);
  /* ---- the global tape (.gstrip) is an INVERTED surface: dark ground in BOTH schemes, because
     a scrolling ticker reads as an instrument panel, not as page paper. It therefore cannot reuse
     --rink/--paper/--up/--dn: those flip with the scheme, so in dark the ground went near-white
     while the numbers stayed near-white too, and in light the ink1 ground carried --dn (#b44640,
     tuned for paper) which is unreadable on a dark bar. Its own six tokens, tuned once against
     the dark ground, and only the ground itself deepens a notch in dark so the tape doesn't
     glow brighter than the page around it. ---- */
  --tape-bg:#1c1e1b; --tape-ink:#f4f2ea; --tape-muted:#b2b0a6; --tape-line:#3b3d38;
  --tape-up:#63c191; --tape-dn:#f2857c;
  /* ---- the run-desk promo bar is the same kind of surface as the tape: a permanently INVERTED
     black band in both schemes. It used to be built out of --ink1/--paper, which flip, so in dark
     the ground went cream while its subtitle/meta/border kept their hardcoded near-white literals
     — near-white ink on a cream ground, i.e. invisible. Fixed tokens, same in both schemes. ---- */
  --run-bg:#141613; --run-ink:#f4f4f0; --run-muted:rgba(244,244,240,.72);
  --run-faint:rgba(244,244,240,.55); --run-hair:rgba(244,244,240,.42);
  /* --ink2 is the secondary ink between --rink and --rmuted. It is a REAL value, not an alias, so
     it must be redeclared in both dark blocks like every other scheme-varying token. */
  --ink2:#43463f;
  /* ---- --paper-3: NOT from psx-board-preview.html — the one token in this
     file with no reference-file source. Continues the paper→paper-2 lightening
     step (each +~4-5 per channel) one notch further, so the main working
     column can read whiter than paper-2 (topbar) and rpanel (side panes)
     both. Consumed only by shell.css .main-col. ---- */

  /* ---- remap the existing gemini tokens onto them ---- */
  --bg:var(--paper); --panel:var(--paper-2); --panel2:var(--rpanel);
  --ink1:var(--rink); --ink3:var(--rmuted);
  --line:var(--rline); --line2:var(--rhair); --surf:var(--rpanel); --hair:var(--rhair);
  --up:var(--positive); --dn:var(--negative); --accent:var(--focus);
}

/* ============================================================
   DARK SCHEME — RULE FOR FUTURE EDITORS:
   every scheme-varying colour is a token, defined once above on
   body[data-theme=gemini] (the light value) and overridden in
   EXACTLY these two blocks (the OS-preference block, then the
   explicit-choice block that must win over it in both directions).
   Never hardcode a colour in a component sheet, and never define a
   colour only inside a media query — the light block above must
   always carry every token's light value explicitly.
   ============================================================ */

@media (prefers-color-scheme: dark) {
  html:not([data-scheme="light"]) body[data-theme=gemini] {
    --paper:#171512; --paper-2:#1f1d19; --paper-3:#24221d;
    --rpanel:#1d1b17; --rpanel-2:#26241f;
    --rink:#ece8de; --rmuted:#a6a29a; --rhair:#6e685a; --rline:#85806e;
    --positive:#5fa97d; --positive-soft:#1e2c23; --negative:#d97b72; --negative-soft:#2e1f1c;
    --focus:#4fb37e; --shadow:0 10px 28px rgba(0,0,0,.45);
    --shadow-hard:rgba(0,0,0,.6); --backdrop:rgba(8,8,6,.6);
    --tape-bg:#100f0d; --tape-ink:#f4f2ea; --tape-muted:#b2b0a6; --tape-line:#33322c;
    --tape-up:#63c191; --tape-dn:#f2857c;
    --ink2:#cfcbc1;
  }
}

/* Theme flip must snap, not crossfade. ~116 elements carry background/colour transitions for
   hover polish; a scheme change re-targets all of them at once, and because both side panes run
   backdrop-filter, every frame of that crossfade re-blurs two full-height panes. The result reads
   as a laggy button. app.js stamps this attribute for one frame around the flip, so the new
   palette lands in a single paint and hover transitions are back immediately after. */
html[data-scheme-switching] *,
html[data-scheme-switching] *::before,
html[data-scheme-switching] *::after {
  transition: none !important;
}

html[data-scheme="dark"] body[data-theme=gemini] {
  --paper:#171512; --paper-2:#1f1d19; --paper-3:#24221d;
  --rpanel:#1d1b17; --rpanel-2:#26241f;
  --rink:#ece8de; --rmuted:#a6a29a; --rhair:#6e685a; --rline:#85806e;
  --positive:#5fa97d; --positive-soft:#1e2c23; --negative:#d97b72; --negative-soft:#2e1f1c;
  --focus:#4fb37e; --shadow:0 10px 28px rgba(0,0,0,.45);
  --shadow-hard:rgba(0,0,0,.6); --backdrop:rgba(8,8,6,.6);
  --tape-bg:#100f0d; --tape-ink:#f4f2ea; --tape-muted:#b2b0a6; --tape-line:#33322c;
  --tape-up:#63c191; --tape-dn:#f2857c;
  --ink2:#cfcbc1;
}
