/* Colour themes. Each sets light-mode tokens on [data-theme] and dark-mode tokens on
   [data-theme][data-scheme="dark"]. Tokens a theme leaves out fall back to app.css (default "Teal Pulse").
   Every --on-primary / --primary pair keeps at least 4.5:1 contrast. */

/* ---------- Default: Whole Well (sage) ---------- */
[data-theme="sage"] {
  --bg: #f7f6f1; --surface: #ffffff; --surface-2: #f1efe8; --border: #e4e0d6; --border-strong: #d3cec1;
  --text: #1f2a24; --muted: #5c6b63;
  --primary: #2f6b4f; --primary-hover: #245640; --primary-soft: #e3eedf; --on-primary: #ffffff;
  --accent: #4f8a3f; --hero-a: #2f6b4f; --hero-b: #1d4535;
  --chart: #2f6b4f; --chart-2: #8db580;
  --heading-font: var(--brand-font); --heading-weight: 800; --heading-spacing: -.012em;
}
[data-theme="sage"][data-scheme="dark"] {
  --bg: #0d1210; --surface: #141b17; --surface-2: #1b241f; --border: #26332c; --border-strong: #34443b;
  --text: #e8efe9; --muted: #9fb0a6;
  --primary: #8fca9f; --primary-hover: #b0dcbb; --primary-soft: #173325; --on-primary: #0b2016;
  --accent: #a3c98f; --chart: #8fca9f; --chart-2: #3a4d42;
}

/* ---------- Bold & strong ---------- */
[data-theme="steel"] {
  --bg: #f2f4f7; --surface: #ffffff; --surface-2: #e8ebf0; --border: #d3d8df;
  --text: #0f172a; --muted: #475569;
  --primary: #1d4ed8; --primary-hover: #1e3a8a; --primary-soft: #dbe5fb; --on-primary: #ffffff;
  --chart: #1d4ed8; --chart-2: #94a3b8; --focus: #f59e0b;
  --radius: 6px; --btn-radius: 4px; --input-radius: 4px;
  --heading-weight: 800; --heading-transform: uppercase; --heading-spacing: .02em;
}
[data-theme="steel"][data-scheme="dark"] {
  --bg: #0b0d10; --surface: #14171c; --surface-2: #1c2027; --border: #2a303a;
  --text: #e5e9f0; --muted: #94a3b8;
  --primary: #60a5fa; --primary-hover: #93c5fd; --primary-soft: #172554; --on-primary: #04122e;
  --chart: #60a5fa; --chart-2: #334155;
}

[data-theme="ember"] {
  --bg: #faf7f5; --surface: #ffffff; --surface-2: #f3ece7; --border: #e6d9d0;
  --text: #1c1210; --muted: #5f4a42;
  --primary: #c2410c; --primary-hover: #9a3412; --primary-soft: #fde7dc; --on-primary: #ffffff;
  --chart: #ea580c; --chart-2: #a8a29e; --focus: #0ea5e9;
  --radius: 8px; --btn-radius: 6px;
  --heading-weight: 900; --heading-spacing: -.02em;
}
[data-theme="ember"][data-scheme="dark"] {
  --bg: #0d0a09; --surface: #17110f; --surface-2: #221915; --border: #3a2a22;
  --text: #f5ebe6; --muted: #b8a49a;
  --primary: #fb923c; --primary-hover: #fdba74; --primary-soft: #3b1a0b; --on-primary: #1f0a00;
  --chart: #fb923c; --chart-2: #44342c;
}

/* ---------- Soft & calm ---------- */
[data-theme="rose"] {
  --bg: #fdf7f9; --surface: #ffffff; --surface-2: #f9eef3; --border: #f0d9e3;
  --text: #2a1520; --muted: #6b4b5a;
  --primary: #be185d; --primary-hover: #9d174d; --primary-soft: #fce7f1; --on-primary: #ffffff;
  --chart: #db2777; --chart-2: #e8bccd; --focus: #7c3aed;
  --radius: 18px; --btn-radius: 999px; --input-radius: 12px;
  --heading-weight: 700;
}
[data-theme="rose"][data-scheme="dark"] {
  --bg: #160d12; --surface: #20141a; --surface-2: #2a1b22; --border: #3d2731;
  --text: #f5e8ee; --muted: #c4a5b4;
  --primary: #f472b6; --primary-hover: #f9a8d4; --primary-soft: #4a1730; --on-primary: #2a0716;
  --chart: #f472b6; --chart-2: #4d3340;
}

[data-theme="lavender"] {
  --bg: #f8f6fc; --surface: #ffffff; --surface-2: #f1edf9; --border: #e2daf3;
  --text: #1e1730; --muted: #5d5470;
  --primary: #6d28d9; --primary-hover: #5b21b6; --primary-soft: #ede7fb; --on-primary: #ffffff;
  --chart: #7c3aed; --chart-2: #cfc3ec; --focus: #db2777;
  --radius: 14px; --btn-radius: 12px; --input-radius: 10px;
  --heading-font: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif; --heading-weight: 600; --heading-spacing: 0;
}
[data-theme="lavender"][data-scheme="dark"] {
  --bg: #110e18; --surface: #1a1524; --surface-2: #241d31; --border: #352b47;
  --text: #ede9f7; --muted: #b0a6c6;
  --primary: #a78bfa; --primary-hover: #c4b5fd; --primary-soft: #2e2150; --on-primary: #1a0b3d;
  --chart: #a78bfa; --chart-2: #3d3254;
}

/* ---------- Age groups ---------- */
[data-theme="neon"] {
  --bg: #fbf7ff; --surface: #ffffff; --surface-2: #f3ebff; --border: #e4d6fa;
  --text: #1a0b2e; --muted: #5b4a72;
  --primary: #a21caf; --primary-hover: #86198f; --primary-soft: #fae8ff; --on-primary: #ffffff;
  --chart: #c026d3; --chart-2: #67e8f9; --focus: #0891b2;
  --radius: 20px; --btn-radius: 999px; --input-radius: 14px;
  --heading-weight: 900; --heading-spacing: -.02em;
}
[data-theme="neon"][data-scheme="dark"] {
  --bg: #0a0614; --surface: #140c24; --surface-2: #1e1433; --border: #33245a;
  --text: #f6eeff; --muted: #b9a7d6;
  --primary: #e879f9; --primary-hover: #f0abfc; --primary-soft: #3b0f4a; --on-primary: #2b0533;
  --chart: #e879f9; --chart-2: #155e75; --focus: #22d3ee;
}

/* Larger text and controls, stronger borders and focus: easier for members 60+ and low-vision users. */
[data-theme="clear"] {
  font-size: 112.5%;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f1f3f6; --border: #8a8f98;
  --text: #000000; --muted: #333a44;
  --primary: #0b3d91; --primary-hover: #072b66; --primary-soft: #e3ebf8; --on-primary: #ffffff;
  --chart: #0b3d91; --chart-2: #9aa3b0; --focus: #c2410c;
  --font: Verdana, "Segoe UI", Tahoma, system-ui, sans-serif;
  --base-size: 18px; --control-h: 50px; --radius: 8px; --btn-radius: 8px; --input-radius: 6px;
  --shadow: none;
}
[data-theme="clear"] :focus-visible { outline-width: 4px; }
/* Phone bottom bar: the larger type can't fit six labels, so show short labels side by side without breaking words. */
@media (max-width: 900px) {
  [data-theme="clear"] .sidenav { justify-content: flex-start; }
  [data-theme="clear"] .sidenav { padding-left: 0; padding-right: 0; }
  [data-theme="clear"] .sidenav a { flex: 1 1 auto; padding: .35rem .1rem; white-space: nowrap; font-size: .62rem; min-width: 0; letter-spacing: -.01em; }
}
.sidenav a span:last-child { white-space: nowrap; }
[data-theme="clear"] a { text-decoration-thickness: 2px; }
[data-theme="clear"][data-scheme="dark"] {
  --bg: #000000; --surface: #0e0e0e; --surface-2: #1a1a1a; --border: #8a8f98;
  --text: #ffffff; --muted: #e0e0e0;
  --primary: #8cc4ff; --primary-hover: #b9dbff; --primary-soft: #0c2a4d; --on-primary: #00142e;
  --chart: #8cc4ff; --chart-2: #5b6470; --focus: #fdba74;
}

/* ---------- Regional ---------- */
[data-theme="desert"] {
  --bg: #fbf7f0; --surface: #fffdf9; --surface-2: #f3ead9; --border: #e6d6bb;
  --text: #2b2014; --muted: #6b5a43;
  --primary: #9a5b13; --primary-hover: #7c4810; --primary-soft: #f6ead6; --on-primary: #ffffff;
  --chart: #b4691f; --chart-2: #d9c29b; --focus: #0e7490;
  --font: "Inter", "Segoe UI", "Noto Sans", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
  --heading-font: Georgia, "Times New Roman", serif; --heading-weight: 700; --heading-spacing: 0;
  --radius: 10px;
}
[data-theme="desert"][data-scheme="dark"] {
  --bg: #14100a; --surface: #1d1710; --surface-2: #2a2116; --border: #3e3122;
  --text: #f4ead9; --muted: #c2ae90;
  --primary: #e0a45c; --primary-hover: #ecc08a; --primary-soft: #3a2a14; --on-primary: #241503;
  --chart: #e0a45c; --chart-2: #4a3b27;
}

[data-theme="emerald"] {
  --bg: #f6faf7; --surface: #ffffff; --surface-2: #ebf4ee; --border: #d3e6da;
  --text: #0f1f17; --muted: #4b6356;
  --primary: #047857; --primary-hover: #065f46; --primary-soft: #dcf3ea; --on-primary: #ffffff;
  --chart: #047857; --chart-2: #e3c77a; --focus: #b45309;
  --font: "Inter", "Segoe UI", "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", system-ui, sans-serif;
  --heading-font: Georgia, "Times New Roman", serif; --heading-weight: 700; --heading-spacing: 0;
  --radius: 12px;
}
[data-theme="emerald"][data-scheme="dark"] {
  --bg: #08130e; --surface: #0f1d16; --surface-2: #16291f; --border: #24402f;
  --text: #e6f4ec; --muted: #9dbbaa;
  --primary: #34d399; --primary-hover: #6ee7b7; --primary-soft: #0d3a28; --on-primary: #022c1c;
  --chart: #34d399; --chart-2: #8a6d1d;
}

[data-theme="sakura"] {
  --bg: #fcfafa; --surface: #ffffff; --surface-2: #f6f0f1; --border: #ece1e3;
  --text: #1f1a1b; --muted: #5e5557;
  --primary: #b4234f; --primary-hover: #8f1c3f; --primary-soft: #fbe8ee; --on-primary: #ffffff;
  --chart: #c2365f; --chart-2: #e9c9d2; --focus: #2563eb;
  --font: "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --radius: 4px; --btn-radius: 4px; --input-radius: 4px; --heading-weight: 600; --heading-spacing: .01em;
  --shadow: none;
}
[data-theme="sakura"][data-scheme="dark"] {
  --bg: #121011; --surface: #1b1819; --surface-2: #252122; --border: #383233;
  --text: #f3ecee; --muted: #b9adb0;
  --primary: #f49ab0; --primary-hover: #f8bccb; --primary-soft: #3d1a24; --on-primary: #33060f;
  --chart: #f49ab0; --chart-2: #4a3a3f;
}

[data-theme="nordic"] {
  --bg: #f4f6f8; --surface: #ffffff; --surface-2: #eaeef2; --border: #d7dee5;
  --text: #1b2733; --muted: #55626f;
  --primary: #2f5f8a; --primary-hover: #234a6c; --primary-soft: #e1ebf3; --on-primary: #ffffff;
  --chart: #3b6f9e; --chart-2: #b8c6d3; --focus: #d97706;
  --radius: 2px; --btn-radius: 2px; --input-radius: 2px; --heading-weight: 600; --heading-spacing: 0;
  --shadow: none;
}
[data-theme="nordic"][data-scheme="dark"] {
  --bg: #0c1117; --surface: #131a22; --surface-2: #1a232d; --border: #2a3644;
  --text: #e3eaf1; --muted: #9fb0c0;
  --primary: #8fb8de; --primary-hover: #b5d0ea; --primary-soft: #1a2f45; --on-primary: #0b1f33;
  --chart: #8fb8de; --chart-2: #2f3d4c;
}

/* ---------- Theme picker ---------- */
fieldset.plain { border: 0; padding: 0; margin: 0 0 .75rem; min-width: 0; }
fieldset.plain legend { padding: 0; margin-bottom: .4rem; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.theme-group-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 1rem 0 .5rem; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: .4rem; padding: .8rem .9rem; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.theme-card:hover { border-color: var(--muted); }
.theme-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-card .tick { position: absolute; top: .55rem; right: .65rem; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center; background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 800; }
.theme-card:has(input:checked) .tick { display: grid; }
.theme-name { font-weight: 700; padding-right: 1.5rem; }
.theme-hint { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.swatches { display: flex; gap: 0; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .12); }
.swatches span { flex: 1; }
.swatches span:first-child { flex: 2; }
.mode-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface-2); margin-bottom: .5rem; }
.mode-switch label { position: relative; padding: .35rem .9rem; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.mode-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-switch label:has(input:checked) { background: var(--surface); box-shadow: var(--shadow); color: var(--primary); }
.mode-switch label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }

/* ---------- Gradient colours per theme (hero cards, logo, chart fills, headline accent) ----------
   --hero-a/--hero-b stay deep in both modes so white text on them keeps contrast. */
[data-theme="steel"] { --accent: #0369a1; --hero-a: #1d4ed8; --hero-b: #0f172a; }
[data-theme="steel"][data-scheme="dark"] { --accent: #38bdf8; }
[data-theme="ember"] { --accent: #b45309; --hero-a: #c2410c; --hero-b: #7f1d1d; }
[data-theme="ember"][data-scheme="dark"] { --accent: #fbbf24; }
[data-theme="rose"] { --accent: #a21caf; --hero-a: #be185d; --hero-b: #7e22ce; }
[data-theme="rose"][data-scheme="dark"] { --accent: #f0abfc; }
[data-theme="lavender"] { --accent: #4f46e5; --hero-a: #6d28d9; --hero-b: #312e81; }
[data-theme="lavender"][data-scheme="dark"] { --accent: #a5b4fc; }
[data-theme="neon"] { --accent: #0e7490; --hero-a: #a21caf; --hero-b: #4338ca; }
[data-theme="neon"][data-scheme="dark"] { --accent: #22d3ee; }
[data-theme="clear"] { --accent: #0b3d91; --hero-a: #0b3d91; --hero-b: #062a63; }
[data-theme="clear"][data-scheme="dark"] { --accent: #8cc4ff; }
[data-theme="desert"] { --accent: #b45309; --hero-a: #9a5b13; --hero-b: #7c2d12; }
[data-theme="desert"][data-scheme="dark"] { --accent: #f59e0b; }
[data-theme="emerald"] { --accent: #a16207; --hero-a: #047857; --hero-b: #064e3b; }
[data-theme="emerald"][data-scheme="dark"] { --accent: #facc15; }
[data-theme="sakura"] { --accent: #be123c; --hero-a: #b4234f; --hero-b: #4a1d2c; }
[data-theme="sakura"][data-scheme="dark"] { --accent: #fda4af; }
[data-theme="nordic"] { --accent: #0e7490; --hero-a: #2f5f8a; --hero-b: #1e293b; }
[data-theme="nordic"][data-scheme="dark"] { --accent: #7dd3fc; }
/* Clear & Large and Sakura use their own type stacks; everyone else gets Inter from app.css. */
