/* _tier12_preview.css — COLOR + FONT FIX ROUND (Tier 1 + Tier 2). RELEASED PUBLIC 2026-07-30.
   Implements output/design/COLOR_CONSISTENCY_AUDIT_2026-07-30.md. Was owner-only (scoped under
   `html.hts-tier-preview`); owner approved the full public release, so the preview class prefix was
   stripped and these rules now apply to EVERY user. The LIGHT-mode scoping (the @media
   (prefers-color-scheme:light) + [data-theme="light"] guards) is PERMANENT — token-derived fills
   must only darken in light, because the same token in dark is the inverted light-on-dark value.
   Theme-invariant literals (navy-card chips, cookie button, favourite hearts, sentence-card accent,
   the .wb-stage teaching light vars) apply in both themes (the .wb-stage dark overrides out-specify
   these, so they only bite in light). Measured target: >=4.5:1 (>=3:1 large text).
   ============================================================================================= */

/* ==========================================================================================
   A. THEME-INVARIANT overrides (safe in BOTH themes — literal fills / theme-flat surfaces)
   ========================================================================================== */

/* A1 — Words-breakdown card class chips (navy card, theme-invariant): white-on-accent fills
   darkened one step, hue kept. #16b36b 2.73 / #e08a2b 2.68 / #1f70df 4.73 -> AA. */
:root .wbd__chip--cls[data-cls="HIGH"]{ background:#0f7d4b; box-shadow:0 3px 12px -3px rgba(15,125,75,.7); }
:root .wbd__chip--cls[data-cls="LOW"] { background:#985e1d; box-shadow:0 3px 12px -3px rgba(152,94,29,.7); }
:root .wbd__chip--cls[data-cls="MID"] { background:#155ec2; box-shadow:0 3px 12px -3px rgba(21,94,194,.7); }

/* A2 — cookie consent "Accept all" (JS-inline literal #2f7ce0, white text 4.13 in BOTH themes).
   Inline style => needs !important. */
:root #hts-all{ background:#155ec2 !important; border-color:#155ec2 !important; }

/* A3 — favourite heart: consolidate the drifted reds to ONE canonical fav-red (#ff5a7a) across
   the NON-constellation controls (constellation .cfav/.cpop/tier-3 spark stay untouched). */
:root .favbtn.is-on{ color:#ff5a7a; }
:root .dialog--lg .turn--me .favbtn.is-on{ color:#ff5a7a; }
:root .wbd__heart.is-on{ color:#ff5a7a; border-color:rgba(255,90,122,.5); background:rgba(255,90,122,.14); }
:root .sbd__wheart.is-on{ color:#ff5a7a; border-color:rgba(255,90,122,.5); background:rgba(255,90,122,.14); }

/* A4 — Sentence-breakdown one-off teal #0ca5a0 -> house blue, to match the twin Word-breakdown. */
:root .sbd__eyebrow{ color:var(--blue-500); }
:root .sbd__random{ color:var(--blue-500); }
:root .sbd__random:hover{ border-color:var(--blue-500); }
:root .sbd__search:focus-within{ border-color:var(--blue-500); box-shadow:0 0 0 3px rgba(31,112,223,.16); }

/* A5 — Words TEACHING page (#/words/breakdown) faint LIGHT-mode labels + gold + green.
   These vars are set on the LIGHT `.wb-stage` base; the DARK `.wb-stage` overrides out-specify
   this rule (0,3,0 > 0,2,0) so it only bites in light — dark stays exactly as shipped.
     --paper-dim #8493a2 (2.77-3.15) -> #55677b (>=5.3)
     --wb-gold   #a8760f (3.51-3.99) -> #8a6109 (>=5.1)
     --wb-green  #0d8f54 (3.64)      -> #0a7043 (>=6.0)  */
:root .wb-stage{ --paper-dim:#55677b; --wb-gold:#8a6109; --wb-green:#0a7043; }

/* ==========================================================================================
   B. LIGHT-MODE fill/label darkening (theme-token-derived — MUST be light-only, because the
   same token in dark is the inverted light-on-dark value). Guarded to light two ways (matches
   tokens.css precedence): the OS-light media query, and the explicit override [data-theme="light"]
   for OS-dark + chose-light. Both blocks are IDENTICAL.
   ========================================================================================== */
@media (prefers-color-scheme: light){
  /* B1 — home cockpit primary CTA: var(--cv) fill, white text. amber 2.69 / green 3.78 -> darken. */
  :root:not([data-theme="dark"]) .arc-cell .btn--theme{ background:color-mix(in srgb, var(--cv) 70%, #000); }
  /* B2 — Tones page "hear" pill: var(--tc)=tone colour fill, white text (2.69-4.15). */
  :root:not([data-theme="dark"]) .tc-hear{ background:color-mix(in srgb, var(--tc) 70%, #000); }
  /* B3 — Consonants class badges + count pills (inherit/own --c; card badge inline bg => !important).
     --c fallback: without it the mix is IACVT and the badge paints TRANSPARENT (the invisible
     vowels-legend bug, found 2026-08-23) — a --c-less badge now degrades to a visible blue. */
  :root:not([data-theme="dark"]) .cbadge{ background:color-mix(in srgb, var(--c, var(--blue-500)) 70%, #000) !important; }
  /* B4 — Sounds/Words collection count pills: accent-on-white text -> darker text on a stronger tint. */
  :root:not([data-theme="dark"]) .ccol__n{ color:color-mix(in srgb, var(--c) 62%, #000); background:color-mix(in srgb, var(--c) 18%, transparent); }
  /* B5 — quiz option keys (correct/wrong) white-on-fill (green 3.78 / rose 4.15). */
  :root:not([data-theme="dark"]) .qx__opt.is-correct .qx__optk{ background:var(--green-600); }
  :root:not([data-theme="dark"]) .qx__opt.is-wrong .qx__optk{ background:#b53f52; }
  /* B6 — Read-decode class keys (mid=blue / high=rose / low=green), white-on-fill. */
  :root:not([data-theme="dark"]) .qx__opt--class[data-cls="mid"]  .qx__optk{ background:#155ec2; }
  :root:not([data-theme="dark"]) .qx__opt--class[data-cls="high"] .qx__optk{ background:#b53f52; }
  :root:not([data-theme="dark"]) .qx__opt--class[data-cls="low"]  .qx__optk{ background:var(--green-600); }
  /* B7 — "Live" pill (Read / arcade), white on green-500 3.78. */
  :root:not([data-theme="dark"]) .pmode__live{ background:var(--green-600); }
  /* B8 — Tones minimal-set mark badges (white glyph on tone fill), falling/rising/high fail. */
  :root:not([data-theme="dark"]) .mark.t-falling{ background:#916624; }
  :root:not([data-theme="dark"]) .mark.t-rising { background:#216849; }
  :root:not([data-theme="dark"]) .mark.t-high   { background:#8f3c48; }
  /* B9 — tone-formula "falling" text on white (2.69). */
  :root:not([data-theme="dark"]) .tn--falling{ color:#8a5a0e; }
  /* B10 — Fluency Rules: rule-index number gray on green-tint (2.60) + tag pills on pale. */
  :root:not([data-theme="dark"]) .gx-cat .n{ color:var(--ink-600); }
  :root:not([data-theme="dark"]) .tag--green{ color:#1c6244; }
  :root:not([data-theme="dark"]) .tag--amber{ color:#8a5a0e; }
  :root:not([data-theme="dark"]) .tag--rose { color:#a8283f; }
}
/* --- identical LIGHT block for OS-dark + user-chose-light --- */
:root[data-theme="light"] .arc-cell .btn--theme{ background:color-mix(in srgb, var(--cv) 70%, #000); }
:root[data-theme="light"] .tc-hear{ background:color-mix(in srgb, var(--tc) 70%, #000); }
:root[data-theme="light"] .cbadge{ background:color-mix(in srgb, var(--c, var(--blue-500)) 70%, #000) !important; }
:root[data-theme="light"] .ccol__n{ color:color-mix(in srgb, var(--c) 62%, #000); background:color-mix(in srgb, var(--c) 18%, transparent); }
:root[data-theme="light"] .qx__opt.is-correct .qx__optk{ background:var(--green-600); }
:root[data-theme="light"] .qx__opt.is-wrong .qx__optk{ background:#b53f52; }
:root[data-theme="light"] .qx__opt--class[data-cls="mid"]  .qx__optk{ background:#155ec2; }
:root[data-theme="light"] .qx__opt--class[data-cls="high"] .qx__optk{ background:#b53f52; }
:root[data-theme="light"] .qx__opt--class[data-cls="low"]  .qx__optk{ background:var(--green-600); }
:root[data-theme="light"] .pmode__live{ background:var(--green-600); }
:root[data-theme="light"] .mark.t-falling{ background:#916624; }
:root[data-theme="light"] .mark.t-rising { background:#216849; }
:root[data-theme="light"] .mark.t-high   { background:#8f3c48; }
:root[data-theme="light"] .tn--falling{ color:#8a5a0e; }
:root[data-theme="light"] .gx-cat .n{ color:var(--ink-600); }
:root[data-theme="light"] .tag--green{ color:#1c6244; }
:root[data-theme="light"] .tag--amber{ color:#8a5a0e; }
:root[data-theme="light"] .tag--rose { color:#a8283f; }

/* ==========================================================================================
   TIER 2 — FONT BUMPS, FENCED. Desktop only (>=1024px, so mobile is untouched by construction).
   Only the audit's SAFE-tagged 13-14px inline Thai (auto-height contexts): word tags, grammar
   pattern formulas, scenario/list card Thai subtitles. NOTHING NEEDS-QC.
   ========================================================================================== */
@media (min-width: 1024px){
  :root .tag .thai{ font-size:16px; }                 /* 13 -> 16 (word pills) */
  :root .fm.thai{ font-size:17px; }                   /* 14 -> 17 (pattern formula chip) */
  :root .card__body .thai.muted{ font-size:17px !important; }  /* 14 -> 17 (list-card Thai; inline var(--fs-sm) => !important) */
}
