/* Swingalizer design tokens v3 (2026-11-22). Source of truth: docs/design-system/README.md.
   Load before every other stylesheet. Names from v2 are kept so existing pages keep working;
   the new names are --sp-*, --text-*, --font-data, --chart-*, --muted-strong, --info-*.
   Brand colors are owner-set (swingalizer-ios/branding/brand.json) and do not change. */

/* Fonts are self-hosted (SIL OFL 1.1). Point the url() paths at the folder the page copies them to. */
@font-face { font-family: "Fira Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/fira-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/fira-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/fira-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/fira-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Code"; font-weight: 300 700; font-style: normal; font-display: swap; src: url("fonts/fira-code-latin-wght-normal.woff2") format("woff2"); }

:root {
  /* ---- brand (fixed) ---- */
  --forest: #173e32;
  --forest-deep: #102c24;
  --forest-hover: #245844;
  --lime: #d6f27d;
  --cream: #f1f5ee;
  --canvas: #f5f6f0;
  --card: #fffef9;
  --white: #ffffff;
  --ink: #17221e;

  /* ---- text ---- */
  --muted: #56635c;          /* 5.8:1 on canvas. Body-size secondary text. */
  --muted-strong: #4a5750;   /* 7.0:1 on canvas. Use for text under 14px. */
  --link-green: #3f5f34;     /* 7.2:1 on card */
  --kicker: #4f6b3b;         /* 5.6:1 on cream */
  --headline-accent: #557b43;/* large display text only (3:1+) */

  /* ---- lines, fields ---- */
  --line: #dfe5dc;
  --line-soft: #edf0e9;
  --input-line: #86928b;     /* 3.2:1 on white: the field boundary */
  --focus-ring: #4f6b3b;
  --focus-ring-on-dark: var(--lime);
  --focus-border: var(--focus-ring);
  --focus-glow: 0 0 0 4px rgba(214,242,125,.45);

  /* ---- surfaces and fills ---- */
  --hover-tint: #f4f7ef;
  --secondary-fill: #e4eed6;
  --secondary-border: #b5cc9b;
  --secondary-hover: #d5e6c1;
  --icon-fill: #eef5e4;
  --avatar-tint: #e4edd9;
  --plan-current: #f1f6e4;
  --meter-track: #e7eedd;
  --tag-tint: #edf2e4;
  --tag-ink: #3d5a2a;
  --tag-dot: #8aaa49;
  --note-tint: #fbf6e6;
  --ai-note-tint: #e6f2e6;
  --ai-note-ink: #1f4d2a;
  --overlay: rgba(23,34,30,.45);
  --video-black: #111111;
  --sidebar-text: #d6e3d8;
  --sidebar-muted: #9bb5a2;

  /* ---- status (always pair with an icon or word, never color alone) ---- */
  --success-tint: #eef3dc;
  --success-ink: #344820;
  --warning-tint: #f6ecd0;
  --warning-ink: #7a5a12;
  --warning-fill: #c08a1a;
  --danger: #8d3b32;
  --danger-tint: #f6e1dc;
  --error-tint: #f8e8e4;
  --form-error: #8a1f1f;
  --info-tint: #e3eef8;
  --info-ink: #1e4a7a;
  --heart: #c23b4a;
  --flag: #c26a12;

  /* ---- chart palette (all 4.4:1+ on --card; always add a second cue: label, dash or marker) ---- */
  --chart-1: #1f6b54;  /* forest green: primary series, "you" */
  --chart-2: #b45309;  /* amber: comparison / target */
  --chart-3: #2b5c9a;  /* blue */
  --chart-4: #7a3e9d;  /* plum */
  --chart-5: #0e7c86;  /* teal */
  --chart-6: #b83a5a;  /* rose: also "worse than" */
  --chart-7: #6b7f1e;  /* olive */
  --chart-neutral: #6b7770;
  --chart-grid: #dfe5dc;
  --chart-axis: #4a5750;
  --chart-good: #2f6b3a;
  --chart-bad: #b83a5a;

  /* ---- type families ---- */
  --font-display: Georgia, "Times New Roman", serif;   /* brand headlines only (h1/h2 on marketing + gates). Never digits. */
  --font-sans: "Fira Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; /* UI, body, small text, app headings */
  --font-data: "Fira Code", ui-monospace, "SF Mono", Menlo, monospace; /* every number that is a measurement, count, price, date or ID */
  --font-serif: var(--font-display);  /* v2 alias */
  --font-mono: var(--font-data);      /* v2 alias */

  /* ---- type scale (px; 16 is the floor for body copy, 13 the floor for captions) ---- */
  --text-xs: 12px;    /* kicker / overline only, uppercase, weight 600, tracking .06em */
  --text-sm: 13px;    /* captions, table meta, helper text: weight 500 */
  --text-base: 16px;  /* body, inputs (16 prevents iOS zoom) */
  --text-md: 18px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 32px;
  --text-3xl: 40px;
  --text-4xl: 56px;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-body: 1.5;
  --leading-small: 1.45;
  --tracking-display: -0.03em;
  --tracking-small: 0.01em;

  /* ---- spacing: 4px grid ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --sp-7: 32px; --sp-8: 40px; --sp-9: 48px; --sp-10: 64px; --sp-11: 80px; --sp-12: 96px;
  /* v2 names, snapped to the 4px grid */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 12px; --space-5: 16px;
  --space-6: 16px; --space-7: 20px; --space-8: 24px; --space-9: 32px; --space-10: 48px;
  --touch-min: 44px;

  /* ---- radius ---- */
  --radius-xs: 8px;  --radius-sm: 10px; --radius-md: 12px; --radius-lg: 16px;
  --radius-xl: 18px; --radius-2xl: 22px; --radius-3xl: 26px; --radius-pill: 999px;
  --radius-control: 12px;  /* inputs, selects */
  --radius-card: 16px;
  --radius-sheet: 24px;

  /* ---- elevation: flat by default, one soft step, one modal step ---- */
  --shadow-panel: 0 1px 2px rgba(23,34,30,.04);
  --shadow-input: 0 1px 0 rgba(23,62,50,.03);
  --shadow-button: 0 8px 20px rgba(23,62,50,.12);
  --shadow-modal: 0 18px 50px rgba(23,34,30,.3);
  --shadow-save-footer: 0 -6px 18px rgba(23,34,30,.06);

  /* ---- motion ---- */
  --dur-fast: 120ms; --dur-base: 200ms; --dur-slow: 320ms;
  --ease-out: cubic-bezier(.2,.7,.2,1);
}

/* Numbers: anything that is a stat, metric, count, price, date or ID. */
.num, [data-num] {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}
