/* ============================================================
   NOMADOLOGY — design tokens
   ============================================================ */

:root {
  /* Type scale — fluid clamp() */
  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.25vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.375rem, 1.15rem + 1vw, 2rem);
  --text-2xl: clamp(1.875rem, 1.3rem + 2.2vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1rem + 4.5vw, 5.5rem);
  --text-hero: clamp(3.25rem, 0rem + 10vw, 8.75rem);

  /* Spacing — 4px system */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  --radius-sm: 0.2rem;
  --radius-md: 0.35rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --content-narrow: 640px;
  --content-default: 780px;
  --content-wide: 1180px;
  --content-full: 100%;

  --font-display: 'Clash Grotesk', 'General Sans', 'Arial Narrow', sans-serif;
  --font-body: 'General Sans', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
}

/* ---------- Light mode (default) — sand / paper / war-map ---------- */
:root,
[data-theme='light'] {
  --color-bg: oklch(0.965 0.01 78);
  --color-surface: oklch(0.98 0.008 78);
  --color-surface-2: oklch(0.99 0.006 78);
  --color-surface-offset: oklch(0.925 0.013 72);
  --color-surface-offset-2: oklch(0.89 0.016 68);
  --color-surface-dynamic: oklch(0.86 0.02 64);
  --color-divider: oklch(0.83 0.018 64);
  --color-border: oklch(0.76 0.02 60);

  --color-text: oklch(0.22 0.018 55);
  --color-text-muted: oklch(0.46 0.02 55);
  --color-text-faint: oklch(0.62 0.016 55);
  --color-text-inverse: oklch(0.97 0.008 78);

  --color-primary: oklch(0.56 0.155 48);
  --color-primary-hover: oklch(0.47 0.15 46);
  --color-primary-active: oklch(0.4 0.14 45);
  --color-primary-highlight: oklch(0.9 0.05 55);

  --color-system: oklch(0.5 0.11 155);
  --color-system-highlight: oklch(0.88 0.05 150);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 60 / 0.08);
  --shadow-md: 0 6px 16px oklch(0.2 0.02 60 / 0.1);
  --shadow-lg: 0 16px 40px oklch(0.2 0.02 60 / 0.16);
}

/* ---------- Dark mode — graphite / war-room / phosphor ---------- */
[data-theme='dark'] {
  --color-bg: oklch(0.155 0.008 55);
  --color-surface: oklch(0.185 0.009 55);
  --color-surface-2: oklch(0.21 0.01 55);
  --color-surface-offset: oklch(0.2 0.01 52);
  --color-surface-offset-2: oklch(0.24 0.011 52);
  --color-surface-dynamic: oklch(0.28 0.013 52);
  --color-divider: oklch(0.31 0.013 52);
  --color-border: oklch(0.36 0.015 52);

  --color-text: oklch(0.91 0.01 65);
  --color-text-muted: oklch(0.68 0.014 60);
  --color-text-faint: oklch(0.47 0.014 60);
  --color-text-inverse: oklch(0.18 0.01 55);

  --color-primary: oklch(0.74 0.15 55);
  --color-primary-hover: oklch(0.8 0.14 56);
  --color-primary-active: oklch(0.66 0.16 53);
  --color-primary-highlight: oklch(0.32 0.06 55);

  --color-system: oklch(0.72 0.15 152);
  --color-system-highlight: oklch(0.28 0.05 150);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 6px 20px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 20px 50px oklch(0 0 0 / 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: oklch(0.155 0.008 55);
    --color-surface: oklch(0.185 0.009 55);
    --color-surface-2: oklch(0.21 0.01 55);
    --color-surface-offset: oklch(0.2 0.01 52);
    --color-surface-offset-2: oklch(0.24 0.011 52);
    --color-surface-dynamic: oklch(0.28 0.013 52);
    --color-divider: oklch(0.31 0.013 52);
    --color-border: oklch(0.36 0.015 52);
    --color-text: oklch(0.91 0.01 65);
    --color-text-muted: oklch(0.68 0.014 60);
    --color-text-faint: oklch(0.47 0.014 60);
    --color-text-inverse: oklch(0.18 0.01 55);
    --color-primary: oklch(0.74 0.15 55);
    --color-primary-hover: oklch(0.8 0.14 56);
    --color-primary-active: oklch(0.66 0.16 53);
    --color-primary-highlight: oklch(0.32 0.06 55);
    --color-system: oklch(0.72 0.15 152);
    --color-system-highlight: oklch(0.28 0.05 150);
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-md: 0 6px 20px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 20px 50px oklch(0 0 0 / 0.55);
  }
}

@property --grain-shift {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}
