/* Global color palette. Every color in the app resolves to these tokens.
   No pure black or pure white anywhere: darks carry about 5% navy and lights are warmed, so OLED screens stay easy on the eyes. */
:root{
  /* Palette (neutral grays, navy tinted darks and a warm white) */
  --background:#111118;   /* page background */
  --surface-1:#1d1d23;    /* cards and panels */
  --border:#414147;       /* borders */
  --foreground:#e8e4dc;   /* body text */
  --muted:#b3afa8;        /* secondary text */
  --heading:#c8b89a;      /* section titles and labels, in sand. Only the default dark theme sets it; elsewhere headings keep their usual color */
  --skill:#e5484d;        /* the accent, Kilo's red: primary action buttons only */
  --brand:#e5484d;        /* the Lograr wordmark, in Kilo's red */
  --brand-chrome:#111118; /* header and footer bars */

  --cardio:#e0a46a;
  --lower:#8ab4f8;
  --good:#81c995;
  --warn:#e6c36a;
  --bad:#ef8a80;
  --surface-sunken:#17171d;
  --surface-raised:#222228;
  --surface-overlay:#27272d;
  --surface-floating:#2c2c32;
  --shadow-c:rgba(6,8,28,.5); /* tint for the layered elevation shadows */
  --medal-gold:#e6c36a;--medal-silver:#c4c8d0;--medal-bronze:#cf8f5e;--medal-ink:#111118; /* gold, silver and bronze stay themselves in every theme; ink outlines and stamps them */
  --logo-tile:#fffdf9;    /* behind gym logos on the map, every theme: logos are drawn for a light page */

  color-scheme:dark;
}

/* Semantic tokens used throughout css/ and js/. Also declared on .flip so a flipped panel picks up its own palette. */
:root,.flip{
  --bg:var(--background);
  --surface:var(--surface-1);
  --surface2:var(--border);
  --line:var(--border);
  --grid:var(--border);

  --ink:var(--foreground);
  --ink2:var(--muted);
  --accent:var(--skill);     /* the brand color, kept for the primary action button and nothing else */
  --accent-ink:var(--background);
  --mark:var(--ink);         /* picked, logged and active states, charts: neutral so the accent stands alone */
  --mark-ink:var(--bg);
  --reward:var(--medal-gold); /* earned progress; the accent stays with actions */
  --reward-ink:var(--medal-ink);
  --reward-text:color-mix(in srgb,var(--medal-gold) 55%,var(--ink));
}

/* Themes, picked on the Customize page (js/pages/customize.js). Dark above is the default.
   Each one sets the palette, the status and series colors, and the text color that sits on the accent. */

/* Light: GitHub Primer light */
:root[data-theme="light"]{
  --heading:initial;
  --background:#eeece6;--surface-1:#fffdf9;--border:#d6d3cc;--foreground:#1f2028;--muted:#5d5f6b;--skill:#e5484d;--brand-chrome:#fffdf9;--brand:#e5484d;
  --accent-ink:#111118; /* dark text on the red, since light text on it is too faint */
  --accent-ink:#1f2028;
  --cardio:#bc4c00;--lower:#0969da;--good:#1a7f37;--warn:#9a6700;--bad:#d1242f;
  --surface-sunken:#e6e3dd;--surface-raised:#fffdf9;--surface-overlay:#fffefa;--surface-floating:#fffefa;
  --shadow-c:rgba(24,26,48,.12);
  --medal-gold:#dcae3f;--medal-silver:#b4b8c2;--medal-bronze:#bd7c48;--medal-ink:#1f2028;
  color-scheme:light;
}
/* Pastel: Catppuccin Mocha */
:root[data-theme="pastel"]{
  --heading:initial;
  --background:#1e1e2e;--surface-1:#313244;--border:#45475a;--foreground:#cdd6f4;--muted:#a6adc8;--skill:#cba6f7;--brand-chrome:#181825;--brand:var(--skill);
  --accent-ink:#1e1e2e;
  --cardio:#fab387;--lower:#89b4fa;--good:#a6e3a1;--warn:#f9e2af;--bad:#f38ba8;
  --surface-sunken:#252536;--surface-raised:#363748;--surface-overlay:#3b3c4d;--surface-floating:#414253;
  --shadow-c:rgba(6,8,28,.45);
  --medal-gold:#f9e2af;--medal-silver:#cdd6f4;--medal-bronze:#e8a27c;--medal-ink:#1e1e2e;
  color-scheme:dark;
}
/* Blue: Nord */
:root[data-theme="blue"]{
  --heading:initial;
  --background:#2e3440;--surface-1:#3b4252;--border:#4c566a;--foreground:#eceff4;--muted:#d8dee9;--skill:#88c0d0;--brand-chrome:#2e3440;--brand:var(--skill);
  --accent-ink:#2e3440;
  --cardio:#d08770;--lower:#81a1c1;--good:#a3be8c;--warn:#ebcb8b;--bad:#bf616a;
  --surface-sunken:#343a46;--surface-raised:#404756;--surface-overlay:#454c5b;--surface-floating:#4b5261;
  --shadow-c:rgba(6,8,28,.45);
  --medal-gold:#ebcb8b;--medal-silver:#d8dee9;--medal-bronze:#d08770;--medal-ink:#2e3440;
  color-scheme:dark;
}
/* Brown: Gruvbox dark */
:root[data-theme="brown"]{
  --heading:initial;
  --background:#282828;--surface-1:#3c3836;--border:#504945;--foreground:#ebdbb2;--muted:#a89984;--skill:#d5c4a1;--brand-chrome:#282828;--brand:var(--skill);
  --accent-ink:#282828;
  --cardio:#fe8019;--lower:#83a598;--good:#b8bb26;--warn:#fabd2f;--bad:#fb4934;
  --surface-sunken:#302c2a;--surface-raised:#423e3c;--surface-overlay:#474341;--surface-floating:#4d4947;
  --shadow-c:rgba(6,8,28,.45);
  --medal-gold:#fabd2f;--medal-silver:#d5c4a1;--medal-bronze:#d0793a;--medal-ink:#282828;
  color-scheme:dark;
}
/* Pink: Rosé Pine Dawn */
:root[data-theme="pink"]{
  --heading:initial;
  --background:#f2eae0;--surface-1:#fffaf3;--border:#dfdad9;--foreground:#575279;--muted:#797593;--skill:#b4637a;--brand-chrome:#faf4ed;--brand:var(--skill);
  --accent-ink:#fffaf3;
  --cardio:#ea9d34;--lower:#907aa9;--good:#286983;--warn:#d7827e;--bad:#b4637a;
  --surface-sunken:#e9e1d7;--surface-raised:#fffaf3;--surface-overlay:#fffdf8;--surface-floating:#fffefa;
  --shadow-c:rgba(87,82,121,.14);
  --medal-gold:#e8b04a;--medal-silver:#bdb8cc;--medal-bronze:#c67f5c;--medal-ink:#3f3b5c;
  color-scheme:light;
}

/* Pattern interrupt: the screens that ask for something (install, sign up) flip to the opposite scheme so they break autopilot.
   A picked accent carries over (--accent-pick, set by js/data/prefs.js); otherwise the flipped text color leads. */
.flip{
  --background:#eeece6;--surface-1:#fffdf9;--border:#d6d3cc;--foreground:#1f2028;--muted:#5d5f6b;--brand-chrome:#fffdf9;--heading:initial;
  --skill:var(--accent-pick,#1f2028);--accent-ink:var(--accent-pick-ink,#fffdf9);
  --cardio:#bc4c00;--lower:#0969da;--good:#1a7f37;--warn:#9a6700;--bad:#d1242f;
  --surface-sunken:#e6e3dd;--surface-raised:#fffdf9;--surface-overlay:#fffefa;--surface-floating:#fffefa;
  --shadow-c:rgba(24,26,48,.18);
  color-scheme:light;
}
:root[data-theme="light"] .flip,:root[data-theme="pink"] .flip{
  --background:#111118;--surface-1:#1d1d23;--border:#414147;--foreground:#e8e4dc;--muted:#b3afa8;--brand-chrome:#111118;--heading:#c8b89a;
  --skill:var(--accent-pick,#e8e4dc);--accent-ink:var(--accent-pick-ink,#111118);
  --cardio:#e0a46a;--lower:#8ab4f8;--good:#81c995;--warn:#e6c36a;--bad:#ef8a80;
  --surface-sunken:#17171d;--surface-raised:#222228;--surface-overlay:#27272d;--surface-floating:#2c2c32;
  --shadow-c:rgba(6,8,28,.5);
  color-scheme:dark;
}

/* Shared stacks resolve against each theme's --shadow-c and foreground. */
:root,.flip{
  --shadow-1:0 1px 2px var(--shadow-c),0 4px 8px -4px var(--shadow-c);
  --shadow-2:0 2px 4px -1px var(--shadow-c),0 8px 16px -8px var(--shadow-c);
  --shadow-3:0 5px 10px -4px var(--shadow-c),0 14px 28px -10px var(--shadow-c),0 28px 48px -24px var(--shadow-c);
  --shadow-4:0 8px 14px -5px var(--shadow-c),0 20px 40px -12px var(--shadow-c),0 44px 76px -28px var(--shadow-c);
}
