/*
 * App colours — the new design (Phase 1, 2026-11-17)
 * Only colour variables: the rules in app-theme.css, visual-designer.css and the components keep working as they are,
 * they just get the approved colours (design-demos/DECISIONS.md, Colours & parts).
 *   Dark  = the approved navy theme.   Light = "clean & crisp" with the colour roles.
 *   The "Soft" light palette (data-palette="soft") is left as it is.
 * The selectors are stronger than the old :root blocks, so the load order does not matter.
 * To roll back: remove this file and its two links (index.html, sites/frontend/config/app.js).
 */

/* ── DARK (navy): every colour is in "THE 48 COLOURS" below; here only the shadows and the rgb numbers ── */
:root:not([data-theme="light"]) {
  --vd-shadow:       0 8px 28px rgba(10,14,22,0.45);
  --vd-shadow-glow:  0 0 0 2px var(--vd-border-glow), 0 8px 28px rgba(10,14,22,0.45);
  --fg-rgb:          238,241,246;
  --border-rgb:      52,62,84;
  --muted-rgb:       141,151,170;
  --bg-rgb:          31,37,53;
  --surface-rgb:     49,58,79;
}

/* ── LIGHT (clean & crisp) — html:root[…] is stronger than :root[data-theme="light"], weaker than the Soft palette ── */
html:root[data-theme="light"] {
  --bg:              #f7f8fa;
  --bg-dark:         #eef1f5;
  --side:            #ffffff;
  --text:            #0f172a;
  --text-muted:      #5f6b7e;
  --border-color:    #e5e8ee;

  --block-bg:        #ffffff;
  --block-text:      #0f172a;
  --block-border:    #e5e8ee;
  --standard-tab:    #f3f5f8;
  --standard-tab-text: #5f6b7e;
  --standard:        #ffffff;
  --standard-text:   #0f172a;
  --hover:           #eef1f5;
  --hover-text:      #0f172a;
  /* main action: the Black accent (black button, white text) */
  --active:          #1f2328;
  --active-text:     #ffffff;
  --disabled:        #f3f5f8;
  --disabled-text:   #9aa4b2;

  /* the colour roles (light, the Base tones) */
  --success:         #16a34a;
  --alert:           #e11d48;
  --info:            #0891b2;
  --warning:         #f59e0b;
  --primary:         #7c3aed;
  --orange:          #ea580c;

  --subtoolbar-bg:   #f3f5f8;
  --subtoolbar-text: #0f172a;
  --button-bg:       #ffffff;
  --button-text:     #0f172a;
  --button-hover-bg: #eef1f5;
  --button-hover-text: #0f172a;
  --button-disabled-bg: #f3f5f8;
  --button-disabled-text: #9aa4b2;

  --vd-accent:       #7c3aed;
  --vd-green:        #16a34a;
  --vd-yellow:       #f59e0b;
  --vd-purple:       #7c3aed;
  --vd-cyan:         #0891b2;
  --vd-red:          #e11d48;
  --vd-surface:      #ffffff;
  --vd-surface-2:    #f3f5f8;
  --vd-border:       #e5e8ee;
  --vd-text:         #0f172a;
  --vd-text-muted:   #5f6b7e;
  --vd-bg:           #f7f8fa;
  --vd-canvas-bg:    #f7f8fa;
  --vd-grid-color:   #e6e9ee;
  --vd-border-glow:  #7c3aed;
  --vd-accent-glow:  var(--acc-line);
  --vd-green-glow:   var(--ok-line-x);
  --vd-yellow-glow:  var(--warn-line-x);
  --vd-shadow:       0 2px 6px rgba(15,23,42,0.06), 0 12px 32px rgba(15,23,42,0.12);
  --vd-shadow-glow:  0 0 0 2px var(--vd-border-glow), 0 12px 32px rgba(124,58,237,0.12);

  --text-2:          #475569;
  --text-muted-2:    #5f6b7e;
  --text-faint:      #8a94a6;
  --accent-text:     #5b21b6;
  --accent-text-2:   #5b21b6;
  --accent-text-3:   #3b0764;
  --accent-text-4:   #7c3aed;
  --red-text:        #e11d48;
  --red-text-2:      #9f1239;
  --orange-text:     #9a3412;
  --yellow-text:     #8a5300;
  --fg-rgb:          15,23,42;
  --border-rgb:      229,232,238;
  --muted-rgb:       95,107,126;
  --bg-rgb:          247,248,250;
  --surface-rgb:     243,245,248;
  --code-bg:         #f1f3f6;
  --scroll-thumb:    #c9d1dc;
  --scroll-thumb-hover: #9aa4b2;
  --view-header-bg:  #ede5fd;
  --tooltip-bg:      #0f172a;
  --tooltip-text:    #ffffff;
}

/* the Settings → Appearance previews show the new colours */
.hm-ts-dark { background: #1f2535; } .hm-ts-dark i { background: #283044; } .hm-ts-dark b { background: #313a4f; border: 1px solid #343e54; } /* theme preview: fixed colours */
.hm-ts-light { background: #f7f8fa; } .hm-ts-light i { background: #ffffff; border-right: 1px solid #e5e8ee; } .hm-ts-light b { background: #ffffff; border: 1px solid #e5e8ee; } /* theme preview: fixed colours */
.hm-ts-coral { background: #c5d5d8; } .hm-ts-coral i { background: #0a2563; } .hm-ts-coral b { background: #ffffff; border: 1px solid #b9cdd1; border-top: 3px solid #36bfa1; } /* theme preview: fixed colours */
.hm-ts-system { background: linear-gradient(135deg, #1f2535 50%, #f7f8fa 50%); } /* theme preview: fixed colours */

/* ══ THE 48 COLOURS (owner 2026-12-03 — design-demos/35-rules.html "Only the 48 colours", 10-system / 33-coral-system
   Colour roles). Fixed hex per theme and accent: nothing is mixed or see-through in the browser.
   8 roles x 4 steps: --c-<role> Base · --<role>-soft backgrounds, hover · --<role>-line borders · --<role>-strong text on Soft
     prim (follows Settings → Accent: violet, blue, turquoise) · sec (neutral) · ok · err · warn · info · gold · drk
   Neutrals: --bg Page · --side Box · --hover Control · --border-color Line · --text-muted · --text · --text-2,
     --rail-text, --rail-sel, --link · Code: --sx-k/n/f/s/c/i.  No Mid: hover = Soft, selected = Soft + an edge.
   Every older name (--success, --vd-accent, --acc-soft, --n-mid …) points at one of these. Light is no longer used. ══ */
html:root:not([data-theme="light"]) {
  /* neutrals */
  --bg: #1f2535; --side: #283044; --hover: #313a4f; --border-color: #343e54; --text-muted: #8d97aa; --text: #eef1f6;
  --text-2: #c3cad7; --rail-text: #8d97aa; --rail-sel: #313a4f;
  /* roles */
  --c-sec: #a3b1c6; --sec-soft: #414a5e; --sec-line: #4d576b; --sec-strong: #aab7cb;
  --c-ok: #3dd68c; --ok-soft: #2c5152; --ok-line: #2e625a; --ok-strong: #4dd995;
  --c-err: #ff6b6b; --err-soft: #533c4c; --err-line: #694250; --err-strong: #ff7777;
  --c-warn: #ffb547; --warn-soft: #534b45; --warn-line: #695845; --warn-strong: #ffbb56;
  --c-info: #22d3ee; --info-soft: #275166; --info-line: #266177; --info-strong: #34d7ef;
  --c-gold: #e3b341; --gold-soft: #4d4a43; --gold-line: #605743; --gold-strong: #e5b950;
  --c-drk: #e6edf3; --drk-soft: #4e5667; --drk-line: #616978; --drk-strong: #e8eef4;
  /* Primary: violet (the default accent) */
  --c-prim: #7c5cff; --prim-soft: #393969; --prim-line: #413d7c; --prim-strong: #a78bfa; --link: #a78bfa; --on-accent: #eef1f6;
  /* code */
  --sx-k: #ff7b72; --sx-n: #79c0ff; --sx-f: #d2a8ff; --sx-s: #7ee787; --sx-c: #8b949e; --sx-i: #ffa657;
}
html:root:not([data-theme="light"])[data-accent="blue"] {
  --c-prim: #407abe; --prim-soft: #2d3f5c; --prim-line: #2f4669; --prim-strong: #6fa3e0; --link: #6fa3e0; --on-accent: #eef1f6;
}
html:root:not([data-theme="light"])[data-accent="turquoise"] {
  --c-prim: #39d0d8; --prim-soft: #2b5062; --prim-line: #2d6070; --prim-strong: #6fe0e6; --link: #6fe0e6; --on-accent: #1f2535;
}
/* the older names in dark, each one of the 48 */
html:root:not([data-theme="light"]), html:root:not([data-theme="light"])[data-accent] {
  --bg-dark: var(--bg); --block-bg: var(--side); --block-text: var(--text); --block-border: var(--border-color);
  --standard-tab: var(--hover); --standard-tab-text: var(--text-muted); --standard: var(--side); --standard-text: var(--text);
  --hover-text: var(--text);
  /* main action: Primary Base with its text (was the near-white "Black accent") */
  --active: var(--c-prim); --active-text: var(--on-accent);
  --disabled: var(--hover); --disabled-text: var(--text-muted);
  --success: var(--c-ok); --alert: var(--c-err); --info: var(--c-info); --warning: var(--c-warn); --primary: var(--prim-strong); --orange: var(--c-gold);
  --subtoolbar-bg: var(--hover); --subtoolbar-text: var(--text);
  --button-bg: var(--hover); --button-text: var(--text); --button-hover-bg: var(--sec-soft); --button-hover-text: var(--text);
  --button-disabled-bg: var(--hover); --button-disabled-text: var(--text-muted);
  --vd-accent: var(--c-prim); --vd-green: var(--c-ok); --vd-yellow: var(--c-warn); --vd-purple: var(--c-prim); --vd-cyan: var(--c-info); --vd-red: var(--c-err);
  --vd-surface: var(--side); --vd-surface-2: var(--hover); --vd-border: var(--border-color); --vd-text: var(--text); --vd-text-muted: var(--text-muted);
  --vd-bg: var(--bg); --vd-canvas-bg: var(--bg); --vd-grid-color: var(--side); --vd-border-glow: var(--c-prim);
  --vd-accent-glow: var(--prim-line); --vd-green-glow: var(--ok-line); --vd-yellow-glow: var(--warn-line);
  --text-muted-2: var(--text-muted); --text-faint: var(--text-muted);
  --accent-text: var(--prim-strong); --accent-text-2: var(--prim-strong); --accent-text-3: var(--prim-strong); --accent-text-4: var(--prim-strong);
  --red-text: var(--err-strong); --red-text-2: var(--err-strong); --orange-text: var(--gold-strong); --yellow-text: var(--warn-strong);
  --code-bg: var(--bg); --scroll-thumb: var(--sec-soft); --scroll-thumb-hover: var(--sec-line); --view-header-bg: var(--prim-soft);
  --tooltip-bg: var(--text); --tooltip-text: var(--bg);
  --purple: var(--c-prim); --cyan: var(--c-info); --accent: var(--prim-strong); --tint-soft: var(--prim-soft); --tint-ink: var(--prim-strong);
  /* the older step names: acc / vio = Primary, org = Gold, n = the neutrals, shade = the Page; Mid = Soft */
  --acc-soft: var(--prim-soft); --acc-mid: var(--prim-soft); --acc-line: var(--prim-line); --acc-strong: var(--prim-strong);
  --vio-soft: var(--prim-soft); --vio-mid: var(--prim-soft); --vio-line: var(--prim-line);
  --org-soft: var(--gold-soft); --org-mid: var(--gold-soft); --org-line: var(--gold-line);
  --ok-mid: var(--ok-soft); --err-mid: var(--err-soft); --warn-mid: var(--warn-soft); --info-mid: var(--info-soft); --prim-mid: var(--prim-soft); --sec-mid: var(--sec-soft);
  --n-soft: var(--hover); --n-mid: var(--sec-soft); --n-line: var(--border-color);
  --shade-soft: var(--bg); --shade-mid: var(--bg); --shade-line: var(--bg);
}
/* light (no longer offered; Coral is built on it): the steps as fixed values, no mixing */
html:root[data-theme="light"] {
  --acc-mid: var(--acc-soft);
  --vio-soft: #e9ddfd; --vio-mid: #e9ddfd; --vio-line: #c4a8f7;
  --ok-soft: var(--ok-soft-x); --ok-mid: var(--ok-soft-x); --ok-line: var(--ok-line-x);
  --err-soft: var(--err-soft-x); --err-mid: var(--err-soft-x); --err-line: var(--err-line-x);
  --warn-soft: var(--warn-soft-x); --warn-mid: var(--warn-soft-x); --warn-line: var(--warn-line-x);
  --info-soft: var(--info-soft-x); --info-mid: var(--info-soft-x); --info-line: var(--info-line-x);
  --org-soft: #ffe2d0; --org-mid: #ffe2d0; --org-line: #fbb284;
  --n-soft: #f3f5f8; --n-mid: #e8ecf1; --n-line: var(--cl-line, #d9dee6);
  --shade-soft: #f1f3f6; --shade-mid: #e4e8ee; --shade-line: #cdd3dc;
}
/* light and Soft keep their own values under the same names (Coral sets its own at the end of css/app-coral.css) */
html:root[data-theme="light"] {
  --text-2: #475569; --link: #5b21b6; --on-accent: #ffffff; --rail-text: #5f6b7e; --rail-sel: #eef1f5;
  --c-prim: #7c3aed; --prim-soft: #e9ddfd; --prim-line: #c4a8f7; --prim-strong: #5b21b6;
  --c-sec: #64748b; --sec-soft: #e7ebf0; --sec-line: #c2cad5; --sec-strong: #3b4656;
  --c-ok: #16a34a; --ok-strong: #14662f; --c-err: #e11d48; --err-strong: #9f1239;
  --c-warn: #f59e0b; --warn-strong: #8a5300; --c-info: #0891b2; --info-strong: #155e75;
  --c-gold: #a16207; --gold-soft: #f2e6d2; --gold-line: #d8bd92; --gold-strong: #6b4210;
  --c-drk: #1e293b; --drk-soft: #d5dbe3; --drk-line: #a9b3c1; --drk-strong: #0f172a;
  --sx-k: #cf222e; --sx-n: #0550ae; --sx-f: #8250df; --sx-s: #116329; --sx-c: #6e7781; --sx-i: #953800;
}
/* Coral: the 48 colours are at the end of css/app-coral.css (it loads last) */
