/*
 * Design tokens.
 *
 * The colour tokens here are only the pre-JavaScript defaults — `palette.js`
 * overwrites them on :root the moment a mood resolves. Everything else (type
 * scale, spacing, motion) is fixed and mood-independent.
 */

:root {
  /* Type — one ratio, clamped so it scales without media queries. */
  --font-sans:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: clamp(1.125rem, 0.9rem + 0.9vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.1rem + 1.8vw, 2.125rem);
  --text-display: clamp(2.125rem, 1.15rem + 3.4vw, 3.5rem);

  /* Spacing — a 4px base, named by role rather than t-shirt size. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shell-width: 1320px;
  --shell-gutter: clamp(1rem, 4vw, 2.5rem);

  /* Motion — one easing curve for entrances, one for exits. */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 140ms;
  --duration-base: 260ms;
  --duration-slow: 520ms;

  --shadow-sm: 0 1px 2px var(--shadow-color);
  --shadow-md: 0 4px 16px -4px var(--shadow-color);
  --shadow-lg: 0 24px 60px -18px var(--shadow-color);

  /* Pre-JavaScript fallbacks, matching the `calm` mood in light mode. */
  --hue: 178;
  --bg: oklch(0.967 0.007 178);
  --surface: oklch(0.99 0.005 178);
  --surface-raised: oklch(1 0.005 178);
  --border: oklch(0.882 0.014 178);
  --border-strong: oklch(0.812 0.014 178);
  --text: oklch(0.215 0.013 178);
  --text-muted: oklch(0.475 0.016 178);
  --accent: oklch(0.545 0.109 178);
  --accent-hover: oklch(0.49 0.109 178);
  --accent-text: oklch(0.44 0.098 178);
  --accent-text-hover: oklch(0.37 0.098 178);
  --accent-soft: oklch(0.93 0.038 178);
  --on-accent: oklch(0.99 0.008 178);
  --ring: oklch(0.545 0.109 178 / 0.45);
  --glow: oklch(0.545 0.109 178 / 0.18);
  --shadow-color: oklch(0.35 0.03 178 / 0.13);
  --swatch-1: oklch(0.34 0.06 156);
  --swatch-2: oklch(0.46 0.08 167);
  --swatch-3: oklch(0.58 0.09 178);
  --swatch-4: oklch(0.7 0.08 189);
  --swatch-5: oklch(0.82 0.06 200);
}

/* Matching defaults for visitors whose system is set to dark, again only until
   JavaScript writes the real palette. */
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --bg: oklch(0.196 0.007 178);
    --surface: oklch(0.251 0.005 178);
    --surface-raised: oklch(0.286 0.005 178);
    --border: oklch(0.316 0.014 178);
    --border-strong: oklch(0.406 0.014 178);
    --text: oklch(0.955 0.013 178);
    --text-muted: oklch(0.72 0.016 178);
    --accent: oklch(0.775 0.109 178);
    --accent-hover: oklch(0.825 0.109 178);
    --accent-text: oklch(0.83 0.098 178);
    --accent-text-hover: oklch(0.89 0.098 178);
    --accent-soft: oklch(0.3 0.038 178);
    --on-accent: oklch(0.18 0.008 178);
    --shadow-color: oklch(0.02 0.01 178 / 0.55);
  }
}
