/* ═══════════════════════════════════════════════════════════════════════════
   DARK V3 — the pair the industry converged on, measured rather than borrowed.

   Full reasoning, sources and verification numbers: COLOR.md at the repo root.
   What changed from V2 and why (short version):

   · V2's conclusion "the pair cannot be improved by hue choice" was WRONG, and
     this file is the correction. Measuring the live palettes of TradingView
     (#089981/#F23645), Binance (#0ECB81/#F6465D), Coinbase CDS (#44C28D/#F0616D)
     and OKX (#31BD65/#EB4B6D) showed every one of them uses a TEAL-leaning
     green, OKLCH hue 151-176 — never the leaf-green H148 V2 picked. Teal keeps
     a blue component that survives deuteranopia: V2's pair separated 1.87:1
     under simulation, TradingView's 3.82:1. Our sweep over the whole readable
     gamut confirmed it: moving green from H148 to H162 buys 2.5:1 with zero
     cost to normal-vision legibility. Same redundant-encoding rules still
     apply (sign, arrow, bar direction, word) — colour is never the only channel.
   · Surfaces are BLUER. V2 used hue 240; the industry's charcoals are H262-271
     (TradingView 269, Binance 271, Coinbase 264, Linear 246). H262, chroma
     0.013 — visibly a cool night surface, not a warm grey.
   · Still computed in OKLCH, emitted as hex. Even ladder: L 0.176 / 0.212 /
     0.248 / 0.280. Still no pure black (#000 halation/OLED smear/reading-speed
     penalties), still chroma-capped (max 0.168) against chromostereopsis.
   · APCA for tuning, WCAG for compliance. Every token verified in both:
     numbers in the table in COLOR.md, reproducible via the scripts referenced
     there.
   · Flat reading surfaces, no glass, no halo — that part of V2 measured well
     and survives. Depth = lightness only. Hover = +0.036 L, twice the noticing
     threshold, half the flicker threshold.

   Additive overlay on [data-theme="v2"]. With the attribute absent the original
   dark theme renders byte-identical; nothing here can reach it.
   ═══════════════════════════════════════════════════════════════════════════ */
:root[data-theme="v2"] {
  /* ── surfaces. Even OKLCH steps, H262 C0.013: L 0.176/0.212/0.248/0.280 ── */
  --ps-bg-page:    #0E1117;   /* L.176 — night-blue charcoal, never #000 */
  --ps-bg-panel:   #15191F;   /* L.212 — cards, table body */
  --ps-bg-panel-2: #1E2128;   /* L.248 — hover: +0.036 L */
  --ps-surface-3:  #25292F;   /* L.280 — active / selected */
  --ps-hairline:   #2C2F36;   /* L.306 */
  --ps-hairline-2: #3E4148;   /* L.376 — border on hover */

  /* ── text, four levels, every one above its APCA floor ─────────────────── */
  --ps-text:       #EBEDEF;   /* APCA 95 — not pure white: halation */
  --ps-text-sec:   #B3B5B9;   /* APCA 61 */
  --ps-text-muted: #92959A;   /* APCA 44 */
  --ps-text-dim:   #7B7D82;   /* APCA 32 — the floor, nothing dimmer */

  /* ── semantics. TEAL green H162 (the industry hue) + coral red H22.
        Pair separates 2.49:1 under deuteranopia vs 1.87 for V2's H148 pair.
        Direction is ALSO carried by sign, arrow and bar side — always. ───── */
  --ps-green:        #36CE93;  /* L.760 C.152 H162 — APCA 62 */
  --ps-green-label:  #36CE93;
  --ps-green-bright: #5EDEA7;  /* L.815 — big numbers, flashes */
  --ps-green-bar:    #26A876;  /* L.650 — fills, bars */
  --ps-red:          #F87272;  /* L.712 C.165 H22 — APCA 48 */
  --ps-red-bright:   #FB8C8A;  /* L.760 */
  --ps-red-bar:      #CA5556;  /* L.600 */

  /* interface accent — focus, links, the price line. Deliberately NOT green or
     red: those two are spoken for by data. */
  --ps-blue:       #5CABE5;
  --ps-neutral:    #92959A;
  --ps-gold:       #D2A249;
  --ps-amber:      #E8AA4E;

  /* colour-vision mode: up turns blue, down stays red — Bloomberg's answer.
     Not wired to a control yet; the token exists so it is one line away. */
  --ps-cvd-up:     #5ABDF2;

  /* ── flat card. Glass stays off reading surfaces (Apple's own Liquid Glass
        retreat, WWDC 2026); depth via lightness, hairline border. ────────── */
  --card-fill:       linear-gradient(180deg, #15191F 0, #13161C 100%);
  --card-fill-hover: linear-gradient(180deg, #1E2128 0, #1B1E25 100%);
  --card-flat:       #15191F;
  --edge-flat:       #2C2F36;
  --card-shadow:     inset 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.28);

  /* the coloured halo around cards stays removed: it carried no information
     and its teal would now ALSO collide with the semantic green. */
  --owl-cr: 255; --owl-cg: 255; --owl-cb: 255;
  --owl-ir: 255; --owl-ig: 255; --owl-ib: 255;
  --owl-outer: 0; --owl-inner: 0; --owl-edge-hi: .06;
}

/* ── card: flat, bordered, lifts on hover by lightness alone ─────────────── */
:root[data-theme="v2"] .card {
  background: var(--card-fill) padding-box, linear-gradient(180deg,#2C2F36 0,#262930 100%) border-box;
}
:root[data-theme="v2"] .card:hover {
  background: var(--card-fill-hover) padding-box, linear-gradient(180deg,#3E4148 0,#2C2F36 100%) border-box;
}
:root[data-theme="v2"] .card::after { display: none; }   /* the halo layer, retired */

/* ── rows: no zebra. The table is narrow and already carries colour in the
      score column; zebra would fight both that and the hover state. ──────── */
:root[data-theme="v2"] .v35-tbl tr:hover td,
:root[data-theme="v2"] .as-t tbody tr:hover td,
:root[data-theme="v2"] .v35-nr:hover { background: var(--ps-bg-panel-2); }
:root[data-theme="v2"] .v35-tbl td,
:root[data-theme="v2"] .as-t td { font-variant-numeric: tabular-nums; }

/* ── navigation and links ───────────────────────────────────────────────── */
:root[data-theme="v2"] .nav-right .nav-link:hover,
:root[data-theme="v2"] .nav-right .nav-link.active { color: var(--ps-text); }
:root[data-theme="v2"] .nav-right .nav-link.active::after { background: var(--ps-green); }
:root[data-theme="v2"] .as-cta .go,
:root[data-theme="v2"] .ab-link .go { color: var(--ps-green); }

/* ── selection and focus use the interface accent, never a data colour ──── */
:root[data-theme="v2"] ::selection { background: var(--ps-blue); color: #0E1117; }
:root[data-theme="v2"] a:focus-visible,
:root[data-theme="v2"] button:focus-visible,
:root[data-theme="v2"] input:focus-visible { outline: 2px solid var(--ps-blue); outline-offset: 2px; }

/* ── theme knob ─────────────────────────────────────────────────────────── */
:root[data-theme="v2"] .v35-tsw-knob { transform: translateX(24px); background: var(--ps-text); color: #0E1117; }
:root[data-theme="v2"] .v35-tsw:hover { border-color: var(--ps-hairline-2); }

/* ═══════════════════════════════════════════════════════════════════════════
   HYBRID — V1's deep glass world wearing V3's measured pair.

   Ilya's ask: keep the original dark theme exactly as it is — the near-black
   #02080D ground, the glass cards, the halos — and transplant ONLY the V3
   semantic colours onto it. So this block overrides nothing but the up/down
   family. Every surface, text and accent token stays V1's; the CVD win of the
   teal pair (2.49:1 vs 1.62:1 for V1's own greens) comes along for free.
   Canvas mirrors live beside the v2 entries in each palette map ('hybrid').
   ═══════════════════════════════════════════════════════════════════════════ */
:root[data-theme="hybrid"] {
  --ps-green:        #36CE93;   /* V3 teal H162 — replaces V1's #67B080 */
  --ps-green-label:  #36CE93;   /*                        and #6CC08C   */
  --ps-green-bright: #5EDEA7;   /*                        and #A2DFBF   */
  --ps-red:          #F87272;   /* V3 coral H22 — replaces V1's #C8645A */
  --ps-red-bright:   #FB8C8A;   /*                        and #DA7A6D   */
}
/* three-position knob: dark left, hybrid centre, v2 right */
:root[data-theme="hybrid"] .v35-tsw-knob { transform: translateX(12px); background: var(--ps-green); color: #02080D; }
