/* Acheuli design tokens. Source of truth: design-system/MASTER.md
   Components use SEMANTIC tokens only (--bg, --text, --accent …), never raw hex.
   Light is the default; dark follows the OS, and <html data-theme="light|dark"> overrides it.
   Colours use light-dark(), so each token holds both modes in one place. */

:root {
  color-scheme: light dark;

  /* ── Colour ─────────────────────────────────────────────── */
  --bg:          light-dark(#F3EEE4, #16130F); /* bone / warm charcoal */
  --surface:     light-dark(#E9E1D2, #201C16); /* sand / umber */
  --text:        light-dark(#1D1A16, #ECE5D8); /* ink / bone */
  --text-muted:  light-dark(#5A5347, #B3AA9A);
  --rule:        light-dark(#D3C9B6, #3A342A); /* decorative hairlines only */
  --border:      light-dark(#8C8270, #7A7060); /* form controls, ≥3:1 */
  --accent:      light-dark(#B03815, #F08462); /* iron oxide: the ONE accent */
  --on-accent:   light-dark(#F3EEE4, #16130F);

  /* Hearth: ambient firelight. Atmospheric cousin of the accent, not a second accent. */
  --hearth-core: light-dark(rgb(229 138 60 / .14), rgb(232 112 79 / .16));
  --hearth-edge: light-dark(rgb(229 138 60 / .05), rgb(232 112 79 / .06));

  /* Stone: tones used by the flaking illustration */
  --stone-line:  light-dark(#8C8270, #6B6152);
  --stone-lit:   light-dark(#F2ECDF, #4A4236); /* lit facets */
  --stone-mid:   light-dark(#E4DBC9, #3A342A);
  --stone-shade: light-dark(#CDC1AA, #2A251E); /* shaded facets, cortex */
  --stone-ink:   light-dark(#5A5347, #0E0C09); /* hatch and stipple marks */

  /* ── Typography: Fraunces / Source Sans 3 / IBM Plex Mono (provisional, self-hosted via fonts.css).
        To swap a font: these three variables + css/fonts.css ── */
  --font-display: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --font-body:    "Source Sans 3", "Source Sans 3 Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", "IBM Plex Mono Fallback", ui-monospace, Menlo, Consolas, monospace;

  /* Fluid scale, ratio ≈ 1.25 */
  --step--1: clamp(0.8rem, 0.78rem + 0.1vw, 0.875rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.563rem, 1.35rem + 1vw, 2.1rem);
  --step-3:  clamp(1.953rem, 1.5rem + 2vw, 3rem);
  --step-4:  clamp(2.441rem, 1.6rem + 3.8vw, 4.5rem);
  --step-5:  clamp(3rem, 1.2rem + 5.5vw, 6.5rem); /* display; sized to fit a 5-column hero */

  --leading-body:  1.6;
  --leading-tight: 1.1;
  --measure: 65ch;

  /* ── Space: 4px base ────────────────────────────────────── */
  --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: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --space-section: clamp(var(--space-8), 10vw, var(--space-10));
  --gutter: var(--space-4);
  --wrap-max: 72rem;
  --header-h: 4rem; /* sticky header height; floating over the first section */

  /* ── Shape: hand-cut, slightly uneven. Never pill or bubble ── */
  --radius-hand: 3px 9px 4px 10px;
  --radius-0: 0;

  /* ── Texture ────────────────────────────────────────────── */
  --grain-opacity: .06;
  --grain-color: light-dark(#1D1A16, #ECE5D8);
  --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* ── Motion ─────────────────────────────────────────────── */
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 300ms;
  --ease: cubic-bezier(.2, .6, .2, 1);

  /* Scroll-driven pacing (see motion.css) */
  --reveal-distance: 16px;
  --hearth-opacity-static: .7; /* fixed glow when scroll motion is off */

  /* ── z-index scale ──────────────────────────────────────── */
  --z-hearth: -2;
  --z-grain:  -1;
  --z-base:    0;
  --z-raised: 10;
  --z-sticky: 20;
  --z-overlay: 30;
  --z-modal:  50;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }
