/* athlib design tokens — phone redesign (Topic 5)
   Four themes: volt-dark (default), volt-light, paper-dark, paper-light.
   Set on <html data-theme="volt-dark">. User picks palette + theme in Profile → Appearance;
   persist both and recombine as `${palette}-${theme}`.
   Fonts must be vendored into web/fonts/ (CSP is script-src 'self'; keep font-src 'self' too). */

@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Variable.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/JetBrainsMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  /* type */
  --font-sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace; /* watch workout names only */
  --fs-display: 28px;  /* flow headings, 600, ls -0.02em, lh 1.15 */
  --fs-hero: 34px;     /* time-trial headline, 700, ls -0.025em */
  --fs-title: 22px;    /* week header, sheet titles, 600, ls -0.015em */
  --fs-tab-title: 26px;/* Activities / Progress headings, 600 */
  --fs-heading: 17px;  /* option-card titles, 600 */
  --fs-row: 16px;      /* run row title, 600 */
  --fs-body: 15px;     /* default, lh 1.4 */
  --fs-small: 14px;    /* notes, hints */
  --fs-caption: 13px;  /* secondary lines, labels */
  --fs-micro: 12px;    /* legends, footnotes */
  --fs-tag: 10px;      /* HARD / ALL OUT / MANUAL tags, 700, uppercase, ls .06em */
  --fs-stat: 46px;     /* Progress 5 km prediction, 700, ls -0.03em */
  /* Numbers use font-variant-numeric: tabular-nums app-wide. */

  /* spacing (4-pt) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --page-x: 16px;      /* tab screens */
  --flow-x: 20px;      /* full-screen flows & sheets */

  /* radius */
  --r-chip: 12px; --r-input: 14px; --r-button: 16px; --r-row: 18px; --r-card: 20px; --r-sheet: 28px; --r-pill: 999px;

  /* sizes */
  --tap: 44px;         /* minimum hit target */
  --btn-primary-h: 54px;
  --btn-secondary-h: 50px;
  --input-h: 50px;
  --tabbar-h: 82px;    /* includes ~28px home-indicator inset; use env(safe-area-inset-bottom) */
  --run-marker: 44px;  /* numbered circle in run rows */
  --col-max: 430px;    /* desktop: centred phone-width column */

  /* motion */
  --ease-sheet: cubic-bezier(.2,.8,.2,1);
  --dur-sheet: 340ms;  /* bottom sheet translateY(105%) → 0 */
  --dur-fade: 250ms;   /* scrim, toast */
  --dur-quick: 200ms;  /* tab indicator width, bar heights */

  /* z */
  --z-tabbar: 3; --z-update: 4; --z-scrim: 5; --z-sheet: 6; --z-dialog: 7; --z-splash: 8; --z-toast: 9;
}

/* Token roles
   bg/surface/surface-2   page, cards & rows, insets/tracks/chips
   line                   borders + dividers
   ink/ink-2/muted        primary text, secondary text, tertiary text
   accent                 "now": current week bar, progress fills, tab indicator, step dots (fills only)
   accent-ink             accent used as TEXT (labels like "What changed", "More about this run")
   cta / cta-ink          primary button fill / label
   good, warn, bad        status text; *-bg tinted surfaces for notices
   easy/long/tempo/vo2    run-type colours (run markers, chips)
   band-e … band-r        step-profile bar colours by pace band (E neutral, M=long, T=tempo, I=vo2, R)
   on-type                text on run-type colours */

:root, [data-theme="volt-dark"] {
  --bg:#000000; --surface:#121215; --surface-2:#1c1c21; --line:rgba(255,255,255,0.10);
  --ink:#ffffff; --ink-2:#a1a1a8; --muted:#85858d;
  --accent:#d4ff3a; --accent-ink:#d4ff3a; --cta:#d4ff3a; --cta-ink:#0a0a0c;
  --good:#4ade80; --good-bg:rgba(74,222,128,0.14);
  --warn-ink:#fbbf24; --warn-bg:rgba(251,191,36,0.14);
  --bad-ink:#fb7185; --bad-bg:rgba(251,113,133,0.14);
  --easy:#4ade80; --long:#60a5fa; --tempo:#fbbf24; --vo2:#fb7185;
  --band-e:#34343b; --band-m:var(--long); --band-t:var(--tempo); --band-i:var(--vo2); --band-r:#c084fc;
  --on-type:#0a0a0c; --scrim:rgba(0,0,0,0.6);
  color-scheme: dark;
}
[data-theme="volt-light"] {
  --bg:#f4f4f1; --surface:#ffffff; --surface-2:#ebebe7; --line:rgba(10,10,12,0.10);
  --ink:#0a0a0c; --ink-2:#45454c; --muted:#66666e;
  --accent:#b5e600; --accent-ink:#4d6b00; --cta:#0a0a0c; --cta-ink:#d4ff3a;
  --good:#15803d; --good-bg:rgba(74,222,128,0.18);
  --warn-ink:#8a5a00; --warn-bg:rgba(251,191,36,0.20);
  --bad-ink:#be123c; --bad-bg:rgba(251,113,133,0.16);
  --easy:#4ade80; --long:#60a5fa; --tempo:#fbbf24; --vo2:#fb7185;
  --band-e:#d9d9d4; --band-m:var(--long); --band-t:var(--tempo); --band-i:var(--vo2); --band-r:#c084fc;
  --on-type:#0a0a0c; --scrim:rgba(0,0,0,0.4);
  color-scheme: light;
}
[data-theme="paper-dark"] {
  --bg:oklch(0.165 0.008 60); --surface:oklch(0.205 0.009 60); --surface-2:oklch(0.25 0.01 60); --line:oklch(0.3 0.01 60);
  --ink:oklch(0.95 0.006 75); --ink-2:oklch(0.8 0.008 75); --muted:oklch(0.68 0.01 70);
  --accent:oklch(0.72 0.15 38); --accent-ink:oklch(0.72 0.15 38); --cta:oklch(0.95 0.006 75); --cta-ink:oklch(0.18 0.008 60);
  --good:oklch(0.76 0.13 150); --good-bg:oklch(0.3 0.05 150);
  --warn-ink:oklch(0.87 0.1 82); --warn-bg:oklch(0.3 0.05 75);
  --bad-ink:oklch(0.82 0.11 28); --bad-bg:oklch(0.3 0.06 25);
  --easy:oklch(0.79 0.12 155); --long:oklch(0.78 0.11 235); --tempo:oklch(0.83 0.13 82); --vo2:oklch(0.74 0.15 350);
  --band-e:oklch(0.42 0.015 70); --band-m:var(--long); --band-t:var(--tempo); --band-i:var(--vo2); --band-r:oklch(0.72 0.14 295);
  --on-type:oklch(0.2 0.02 60); --scrim:oklch(0 0 0 / 0.55);
  color-scheme: dark;
}
[data-theme="paper-light"] {
  --bg:oklch(0.972 0.006 75); --surface:oklch(0.997 0.003 75); --surface-2:oklch(0.945 0.008 75); --line:oklch(0.9 0.008 75);
  --ink:oklch(0.21 0.012 60); --ink-2:oklch(0.4 0.012 60); --muted:oklch(0.5 0.01 60);
  --accent:oklch(0.6 0.17 32); --accent-ink:oklch(0.55 0.17 32); --cta:oklch(0.21 0.012 60); --cta-ink:oklch(0.98 0.005 75);
  --good:oklch(0.5 0.12 150); --good-bg:oklch(0.94 0.04 150);
  --warn-ink:oklch(0.4 0.09 65); --warn-bg:oklch(0.95 0.05 85);
  --bad-ink:oklch(0.47 0.16 28); --bad-bg:oklch(0.94 0.035 25);
  --easy:oklch(0.79 0.12 155); --long:oklch(0.78 0.11 235); --tempo:oklch(0.83 0.13 82); --vo2:oklch(0.74 0.15 350);
  --band-e:oklch(0.85 0.015 75); --band-m:var(--long); --band-t:var(--tempo); --band-i:var(--vo2); --band-r:oklch(0.72 0.14 295);
  --on-type:oklch(0.2 0.02 60); --scrim:oklch(0.2 0.01 60 / 0.35);
  color-scheme: light;
}

/* base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-body)/1.4 var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
.scroll { overflow-y: auto; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.mono { font-family: var(--font-mono); font-weight: 500; }

/* deload stripe — used on week-strip bars, ramp previews, mini strips */
.stripe { background: repeating-linear-gradient(135deg, var(--stripe, var(--ink-2)) 0 2.5px, transparent 2.5px 5px); }

/* step-profile bar heights by band (width = step duration share) */
:root { --h-E: 34%; --h-M: 52%; --h-T: 70%; --h-I: 90%; --h-R: 100%; }
