/* Site tokens: inner pages (templates/base.html) take the landing's palette and heading type
 * (static/css/04-pages/landing-shell.css, decision 2026-11-17 "One Dark Table"; site-match
 * plan d1 option a). Loaded last in base.html so it restyles pages through the existing
 * variables instead of touching each stylesheet.
 *
 * Why html[data-theme=...]: the variables are defined twice, as :root / [data-theme="dark"]
 * in 00-settings/_variables.css (bundle) and again in global.css, which loads after the
 * bundle on some pages. Both use one attribute or pseudo-class (0,1,0); html[data-theme]
 * is (0,1,1), so it wins whatever the load order. base-common.js always sets data-theme on
 * <html>, "dark" or "light".
 *
 * Out of scope on purpose: team colours (--team-primary-color), win/loss green and red
 * (--status-*, --success, --error), amber warnings, and button and accent fills
 * (--accent-primary, --cta-primary, --primary-color): white text on those teals is a
 * separate fix, and brightening them in dark made it worse. --site-accent is for lines
 * and live state, as on the landing. */

/* ---------- Dark: near-black page, surfaces about 1% apart, four text grays ---------- */
html[data-theme="dark"] {
    --site-page: #08090A;
    --site-s1: #0F1011;
    --site-s2: #161718;
    --site-s3: #1C1D1F;
    --site-hair: rgba(255, 255, 255, 0.08);
    --site-hair-strong: rgba(255, 255, 255, 0.14);
    --site-t1: #F7F8F8;
    --site-t2: #D0D6E0;
    --site-t3: #8A8F98;
    /* The landing's fourth gray (#62666D) is 3.4:1 on the page; muted text here is still
       read as text, so it sits one step lighter to clear 4.5:1 on every surface. */
    --site-t4: #7E838B;
    --site-accent: #34D399;
    --site-display: 'Saira Condensed', 'Arial Narrow', sans-serif;

    --bg-primary: var(--site-page);
    --bg-secondary: var(--site-s1);
    --bg-tertiary: var(--site-s2);
    --bg-card: var(--site-s1);
    --bg-elevated: var(--site-s2);
    --bg-color: var(--site-page);
    --card-bg-color: var(--site-s1);
    --card-bg-color-rgb: 15, 16, 17;
    --nav-bg: var(--site-page);
    --nav-text: var(--site-t1);
    --input-bg: var(--site-s2);
    --table-bg: var(--site-s1);
    --table-header-bg: var(--site-s2);
    --table-stripe-bg: var(--site-page);
    --player-bg: var(--site-s1);
    --toggle-handle: var(--site-s1);
    --name-bg: rgba(15, 16, 17, 0.9);
    --button-bg: var(--site-s3);
    --button-hover: #2A2C2F;
    --button-secondary-bg: #2A2C2F;
    --button-secondary-hover: #3A3D41;

    --text-primary: var(--site-t1);
    --text-secondary: var(--site-t3);
    --text-muted: var(--site-t4);
    --heading-color: var(--site-t1);
    --emphasis-color: var(--site-t2);

    --border-color: var(--site-hair);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-strong: var(--site-hair-strong);
    --accent-subtle: #62666D;
    --graph-line-color: #62666D;
    --line-marker: rgba(255, 255, 255, 0.18);

    /* Bootstrap 5.3 reads these for body, cards, tables and forms. */
    --bs-body-bg: var(--site-page);
    --bs-body-color: var(--site-t2);
    --bs-emphasis-color: var(--site-t1);
    --bs-secondary-color: var(--site-t3);
    --bs-secondary-bg: var(--site-s1);
    --bs-tertiary-bg: var(--site-s2);
    --bs-border-color: var(--site-hair);
    --bs-heading-color: var(--site-t1);

    background: var(--site-page);
}

/* ---------- Light: the landing's light palette ---------- */
html[data-theme="light"] {
    --site-page: #F7F8F8;
    --site-s1: #FFFFFF;
    --site-s2: #ECEEF0;
    --site-s3: #E2E5E8;
    --site-hair: rgba(8, 9, 10, 0.1);
    --site-hair-strong: rgba(8, 9, 10, 0.18);
    --site-t1: #08090A;
    --site-t2: #30343A;
    --site-t3: #5E636B;
    /* Landing's #8A8F98 is 3.3:1 on white; one step darker keeps muted text legible. */
    --site-t4: #62676F;
    --site-accent: #047857;
    --site-display: 'Saira Condensed', 'Arial Narrow', sans-serif;

    --bg-primary: var(--site-page);
    --bg-secondary: var(--site-s2);
    --bg-tertiary: var(--site-s2);
    --bg-card: var(--site-s1);
    --bg-elevated: var(--site-s2);
    --bg-color: var(--site-page);
    --card-bg: var(--site-s1);
    --card-bg-color: var(--site-s1);
    --card-bg-color-rgb: 255, 255, 255;
    --nav-bg: var(--site-page);
    --nav-text: var(--site-t1);
    --input-bg: var(--site-s1);
    --table-bg: var(--site-s1);
    --table-header-bg: var(--site-s2);
    --table-stripe-bg: var(--site-page);

    --text-primary: var(--site-t1);
    --text-secondary: var(--site-t3);
    --text-muted: var(--site-t4);
    --heading-color: var(--site-t1);
    --emphasis-color: var(--site-t2);

    --border-color: var(--site-hair);
    --border-subtle: rgba(8, 9, 10, 0.06);
    --border-strong: var(--site-hair-strong);
    --accent-subtle: #C9CDD2;

    --bs-body-bg: var(--site-page);
    --bs-body-color: var(--site-t2);
    --bs-emphasis-color: var(--site-t1);
    --bs-secondary-color: var(--site-t3);
    --bs-border-color: var(--site-hair);
    --bs-heading-color: var(--site-t1);

    background: var(--site-page);
}

html[data-theme] body {
    background-color: var(--site-page);
}

/* ---------- Page titles: Saira Condensed capitals, as the landing heading ---------- */
/* Named page-header classes only, so card titles, team names and section headings keep
   their own type. */
html[data-theme] :is(
    .page-title,
    .matchup-browser__title,
    .team-browser__title,
    .coach-browser__title,
    .pw-title,
    .ct-title,
    .hub-title,
    .dashboard-title,
    .support-title,
    .simulation-title,
    .lectures-title,
    .cw-title,
    .cc-title
) {
    font-family: var(--site-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    color: var(--site-t1);
}

/* ---------- Hardcoded navy panels (first screens of Games, Team, Picks, Contact) ---------- */

/* Contact keeps its own --ct-* palette in an inline <style>; remap it the same way. */
html[data-theme="dark"] {
    --ct-bg: var(--site-page);
    --ct-card: var(--site-s1);
    --ct-card-soft: var(--site-s2);
    --ct-ink: var(--site-t1);
    --ct-ink-soft: var(--site-t2);
    --ct-ink-dim: var(--site-t3);
    --ct-ink-mute: var(--site-t4);
    --ct-line: var(--site-hair);
    --ct-line-soft: rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] {
    --ct-bg: var(--site-page);
    --ct-card: var(--site-s1);
    --ct-card-soft: var(--site-s2);
    --ct-ink: var(--site-t1);
    --ct-ink-soft: var(--site-t2);
    --ct-ink-dim: var(--site-t3);
    --ct-ink-mute: var(--site-t4);
    --ct-line: var(--site-hair);
    --ct-line-soft: rgba(8, 9, 10, 0.05);
}

/* Games matchup cards (matchup-analysis.css dark block): slate glass and deep-navy bases.
   The hero's blue/red territory gradient is team colour and stays. */
html[data-theme="dark"] {
    --analysis-bg-deep: #050607;
    --analysis-bg-base: var(--site-page);
    --analysis-bg-surface: var(--site-s1);
    --glass-bg: rgba(15, 16, 17, 0.85);
    --glass-border: var(--site-hair);
    --glass-fallback-bg: rgba(15, 16, 17, 0.95);
    --tile-inner-bg: rgba(22, 23, 24, 0.7);
    --badge-bg: rgba(22, 23, 24, 0.85);
    --logo-wrap-bg: rgba(22, 23, 24, 0.85);
    --ma-text-primary: var(--site-t1);
    --ma-text-secondary: var(--site-t3);
    --ma-text-muted: var(--site-t4);
}

html[data-theme="light"] {
    --ma-text-primary: var(--site-t1);
    --ma-text-secondary: var(--site-t3);
    --ma-text-muted: var(--site-t4);
}

/* Team page report-card glass (team-design-system.css) is slate at 60%. */
html[data-theme="dark"] :is(.team-partial-wrapper, .team-bento-page) {
    --glass-bg: rgba(15, 16, 17, 0.85);
    --glass-border: var(--site-hair);
}
