/* ═══════════════════════════════════════════════════════════════════
   MISDIRECT: SHARED THEME VARIABLES
   Dark mode is the default (:root). Light mode is opt-in via
   data-theme="light" on <html>. The sidebar stays dark in both.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Dark mode (default) ──────────────────────────────────────────── */
:root {
    --bg:             #07080d;
    --surface:        #0f1118;
    --surface-2:      #0a0b12;
    --border:         rgba(196,146,58,0.14);
    --border-soft:    rgba(255,255,255,0.06);
    --accent:         #c4923a;
    --accent-rgb:     196 146 58;   /* for tints: rgb(var(--accent-rgb) / 0.1) */
    --accent-hover:   #e8c070;
    --on-accent:      #14100a;      /* text on a gold fill */
    --text:           #ede8db;
    --text-muted:     #a19d93;
    --text-dim:       #858076;      /* lowest that still reads (WCAG AA 4.5:1 on every surface) */
    --shadow:         none;
    --card-shadow:    none;
    --sidebar-bg:     #08090f;
    --nav-active-bg:  rgba(196,146,58,0.1);
    --nav-hover-bg:   rgba(196,146,58,0.06);
    --stat-bg:        #0c0d14;
    --heatmap-zero:   rgba(255,255,255,0.04);
    --input-bg:       #0a0b12;
    --input-border:   rgba(196,146,58,0.2);
    --input-focus:    rgba(196,146,58,0.5);
    --badge-bg:       rgba(196,146,58,0.1);
    --danger:         #d0605a;
    --danger-bg:      rgba(208,96,90,0.1);
    --success:        #4ade80;
    --success-bg:     rgba(74,222,128,0.1);
    --warning:        #fbbf24;
    --rust:           #c98a4a;      /* "going rusty" */

    /* The four suits, a four-colour deck: tags and badges use these instead of a rainbow. */
    --suit-spade:     #d9d4c7;
    --suit-heart:     #e2766b;
    --suit-diamond:   #7ea6e6;
    --suit-club:      #72c184;
}

/* ── Light mode (deep gold on warm stone, white cards) ────────────────
   The gold is dark enough to read as text on every surface (WCAG AA,
   4.5:1), so gold buttons carry white text. The sidebar stays dark and
   keeps the bright gold (.app-sidebar below). */
html[data-theme="light"] {
    --bg:             #ebe4d6;
    --surface:        #fffcf6;
    --surface-2:      #f5f0e6;
    --border:         rgba(110,78,24,0.2);
    --border-soft:    rgba(110,78,24,0.13);
    --accent:         #865a10;
    --accent-rgb:     134 90 16;
    --accent-hover:   #6e4a0c;
    --on-accent:      #ffffff;
    --text:           #1b150b;
    --text-muted:     #5b4a2e;
    --text-dim:       #6f5f45;
    --shadow:         0 1px 2px rgba(60,40,10,0.08);
    --card-shadow:    0 1px 2px rgba(60,40,10,0.08), 0 4px 14px rgba(60,40,10,0.07);
    --sidebar-bg:     #12151c;
    --nav-active-bg:  rgba(255,255,255,0.08);
    --nav-hover-bg:   rgba(255,255,255,0.05);
    --stat-bg:        #f5f0e6;
    --heatmap-zero:   rgba(110,78,24,0.1);
    --input-bg:       #fffcf6;
    --input-border:   rgba(110,78,24,0.28);
    --input-focus:    rgb(var(--accent-rgb) / 0.55);
    --badge-bg:       rgb(var(--accent-rgb) / 0.12);
    --danger:         #b3362c;
    --danger-bg:      rgba(179,54,44,0.08);
    --success:        #2d7a46;
    --success-bg:     rgba(45,122,70,0.1);
    --warning:        #8f5d00;
    --rust:           #a0561c;

    --suit-spade:     #23262f;
    --suit-heart:     #b3261e;
    --suit-diamond:   #2556a8;
    --suit-club:      #2c7340;
}

/* The always-dark surfaces (sidebar, phone nav, coach header) keep the bright gold in light mode. */
html[data-theme="light"] .app-sidebar,
html[data-theme="light"] .app-bottom-nav,
html[data-theme="light"] .coach-panel__header {
    --accent:       #d4a24c;
    --accent-rgb:   212 162 76;
    --accent-hover: #e8c070;
    --on-accent:    #14100a;
    --text:         #ede8db;
    --text-muted:   #a19d93;
}

/* ── Base resets using vars ───────────────────────────────────────── */
html, body {
    background: var(--bg);
    color: var(--text);
}
html[data-theme="light"] body { background: var(--bg) !important; }
