/*
  Fold Trail website tokens (website only; the app has its own design system).
  Three layers: primitives (raw values), semantic (what a colour is for), component.
  Light is the default; dark follows the OS setting. www/tokens.json mirrors every
  custom property here, and check.mjs fails if the two drift apart.
*/

@font-face {
  font-family: 'Familjen Grotesk';
  src: url('/fonts/familjen-grotesk.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/figtree.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Primitives */
  --p-white: #ffffff;
  --p-paper-50: #f5f6f8;
  --p-paper-100: #eef0f4;
  --p-paper-200: #e3e6ec;
  --p-paper-300: #dde1e8;
  --p-slate-300: #c3c9d4;
  --p-slate-400: #8d97a8;
  --p-slate-500: #a9b3c4;
  --p-slate-600: #5a6577;
  --p-navy-500: #5b6a86;
  --p-navy-600: #2a3650;
  --p-navy-650: #2a3852;
  --p-navy-700: #1c2a44;
  --p-navy-750: #17233a;
  --p-navy-760: #16233a;
  --p-navy-800: #0f1a2c;
  --p-navy-850: #0e1729;
  --p-navy-900: #101b2e;
  --p-navy-950: #08101e;
  --p-navy-990: #03070f;
  --p-blue-500: #3a62e6;
  --p-blue-600: #1f4bd8;
  --p-blue-700: #1a3fb8;
  --p-highlighter: #ffde3b;
  --p-green-300: #86d9a0;
  --p-green-700: #136c35;
  --p-green-50: #e3f4e8;
  --p-green-950: #12321f;
  --p-orange-300: #f7a866;
  --p-orange-700: #b54708;
  --p-orange-50: #fef0e6;
  --p-orange-950: #3a2412;
  --p-red-300: #f49b91;
  --p-red-700: #b42318;
  --p-red-50: #fdecea;
  --p-red-950: #3b1716;

  --font-display: 'Familjen Grotesk', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --motion-fast: 120ms;
  --motion-base: 200ms;
  --focus-width: 2px;
  --focus-offset: 3px;
  --content-max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);

  /* Semantic */
  --color-bg: var(--p-paper-50);
  --color-surface: var(--p-white);
  --color-text: var(--p-navy-900);
  --color-text-muted: var(--p-slate-600);
  --color-line: var(--p-paper-300);
  --color-soft: var(--p-paper-100);
  --color-accent: var(--p-navy-900);
  --color-cta: var(--p-blue-600);
  --color-cta-hover: var(--p-blue-700);
  --color-cta-text: var(--p-white);
  --color-deep: var(--p-navy-900);
  --color-deep-text: var(--p-white);
  --color-deep-muted: var(--p-slate-300);
  --color-deep-card: var(--p-navy-750);
  --color-deep-card-line: var(--p-navy-600);
  --color-deep-well: var(--p-navy-800);
  --color-header: rgba(245, 246, 248, 0.92);
  --color-crease-dark: rgba(16, 27, 46, 0.11);
  --color-crease-light: var(--p-white);
  --color-grid: rgba(16, 27, 46, 0.045);
  --color-highlight: var(--p-highlighter);
  --color-highlight-text: var(--p-navy-900);
  --color-ok: var(--p-green-700);
  --color-ok-bg: var(--p-green-50);
  --color-warn: var(--p-orange-700);
  --color-warn-bg: var(--p-orange-50);
  --color-bad: var(--p-red-700);
  --color-bad-bg: var(--p-red-50);
  --color-edit: var(--p-navy-900);
  --color-edit-bg: var(--p-paper-200);
  --shadow-card: 0 30px 60px -36px rgba(16, 27, 46, 0.35);

  /* Components: printed paper (receipts and the footer sitemap) stays light in both themes */
  --paper-bg: var(--p-white);
  --paper-text: var(--p-navy-900);
  --paper-muted: var(--p-slate-600);
  --paper-rule: var(--p-slate-400);
  --paper-soft: var(--p-paper-100);
  --trail: var(--p-highlighter);
  --footer-slot: var(--p-navy-990);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: var(--p-navy-850);
    --color-surface: var(--p-navy-760);
    --color-text: var(--p-paper-50);
    --color-text-muted: var(--p-slate-500);
    --color-line: var(--p-navy-650);
    --color-soft: var(--p-navy-700);
    --color-accent: var(--p-paper-50);
    --color-cta: var(--p-blue-600);
    --color-cta-hover: var(--p-blue-500);
    --color-deep: var(--p-navy-950);
    --color-header: rgba(14, 23, 41, 0.92);
    --color-crease-dark: rgba(0, 0, 0, 0.6);
    --color-crease-light: rgba(255, 255, 255, 0.07);
    --color-grid: rgba(255, 255, 255, 0.035);
    --color-ok: var(--p-green-300);
    --color-ok-bg: var(--p-green-950);
    --color-warn: var(--p-orange-300);
    --color-warn-bg: var(--p-orange-950);
    --color-bad: var(--p-red-300);
    --color-bad-bg: var(--p-red-950);
    --color-edit: var(--p-paper-50);
    --color-edit-bg: var(--p-navy-650);
    color-scheme: dark;
  }
}
