/**
 * @file tokens.css
 * @description Nova Soul design tokens (v0.2). The single source of truth for
 * colour, typography, spacing, radii, elevation, controls and motion. Every page
 * loads this file first; base.css, components.css, site.css, page.css and
 * report.css only reference these custom properties, never raw values.
 *
 * Loaded by: every HTML page (first stylesheet).
 * Checked by: tools/check-design-tokens.ts (undefined tokens, raw colours,
 * raw shadows, !important, id selectors).
 *
 * Rule of thumb: components use ROLE tokens (--color-text, --shadow-raised,
 * --button-height), never BRAND tokens (--ns-forest) directly. That way a
 * palette or shape change is a one-line edit here.
 *
 * v0.2 (2026-10-16): added elevation, control, tracking, leading and display
 * tokens; one button shape for the whole site; colour roles for scrims, tints
 * and the report desk.
 */

:root {
  /* ------------------------------------------------------------------
   * Brand palette (from logo-brand-style). Only used in this file.
   * ------------------------------------------------------------------ */
  --ns-forest: #22392b;
  --ns-cream-warm: #efe7d4;
  --ns-cream-light: #f3eee1;
  --ns-gold: #a9884a;
  --ns-brown: #84561a;
  --ns-error: #8c2f1c;
  --ns-muted: #4e5e53;

  /* ------------------------------------------------------------------
   * Colour roles. Contrast ratios measured against --color-bg (#F3EEE1).
   * ------------------------------------------------------------------ */
  --color-bg: var(--ns-cream-light);
  --color-surface: var(--ns-cream-warm);          /* selected / raised areas */
  --color-surface-raised: color-mix(in srgb, white 30%, var(--color-bg)); /* cards on the page */
  --color-tint: color-mix(in srgb, var(--ns-cream-warm) 70%, var(--color-bg)); /* summaries, take-aways */
  --color-field: color-mix(in srgb, white 45%, var(--color-bg)); /* form field background */
  --color-desk: color-mix(in srgb, var(--ns-cream-warm) 90%, var(--ns-forest)); /* report reader desk */
  --color-text: var(--ns-forest);                 /* 10.7:1, all text */
  --color-text-muted: var(--ns-muted);            /* 5.9:1, secondary text */
  --color-link: var(--ns-brown);                  /* 5.5:1, links + small accents */
  --color-ornament: var(--ns-gold);               /* 2.9:1, decoration + large type only */
  --color-ornament-soft: color-mix(in srgb, var(--ns-gold) 55%, transparent);
  --color-line: color-mix(in srgb, var(--ns-forest) 16%, transparent);
  --color-line-strong: color-mix(in srgb, var(--ns-forest) 55%, transparent);
  --color-error: var(--ns-error);                 /* 7.1:1 */
  --color-focus: var(--ns-brown);
  --color-scrim: color-mix(in srgb, var(--ns-forest) 30%, transparent);        /* menu backdrop */
  --color-scrim-strong: color-mix(in srgb, var(--ns-forest) 45%, transparent); /* dialog backdrop */
  --color-selection-bg: var(--ns-cream-warm);
  --color-selection-text: var(--ns-brown);

  --color-inverse-bg: var(--ns-forest);
  --color-inverse-text: var(--ns-cream-warm);     /* 10.1:1 */
  --color-inverse-muted: color-mix(in srgb, var(--ns-cream-warm) 75%, var(--ns-forest));
  --color-inverse-line: color-mix(in srgb, var(--ns-cream-warm) 18%, transparent);
  --color-inverse-accent: var(--ns-gold);         /* 3.7:1, large text + icons only */
  --color-inverse-hover: color-mix(in srgb, var(--ns-forest) 86%, black);

  /* ------------------------------------------------------------------
   * Elevation. Four shadows, all tinted with the forest green.
   * ------------------------------------------------------------------ */
  --shadow-color: var(--ns-forest);
  --shadow-raised: 0 14px 36px color-mix(in srgb, var(--shadow-color) 14%, transparent);   /* menus, panels, suggestions */
  --shadow-object: 0 28px 48px -32px color-mix(in srgb, var(--shadow-color) 70%, transparent); /* photos, mockups, cards */
  --shadow-paper: 0 0 0 1px var(--color-line), 0 50px 70px -60px color-mix(in srgb, var(--shadow-color) 80%, transparent); /* report sheets */
  --shadow-overlay: 0 40px 80px -40px color-mix(in srgb, var(--shadow-color) 70%, transparent); /* dialogs */
  --shadow-invalid: 0 0 0.875rem 0.125rem color-mix(in srgb, var(--color-error) 38%, transparent); /* glow on a field that still needs input */
  --shadow-invalid-inset: inset 0 0 0.875rem 0 color-mix(in srgb, var(--color-error) 30%, transparent); /* same, for clipped groups */

  /* ------------------------------------------------------------------
   * Typography.
   * Licensed Garamond Premier Pro (Adobe Fonts) is listed first; the
   * self-hosted open-source Garamonds in assets/fonts are the fallback.
   * Only the weights below are loaded: never use 600 or 700.
   * ------------------------------------------------------------------ */
  --font-display: "garamond-premier-pro-display", "Cormorant Garamond", Garamond, serif;
  --font-text: "garamond-premier-pro", "EB Garamond", Garamond, serif;

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;

  /* Scale: perfect fourth (1.333) on an 18px body, fluid at the top end. */
  --text-xs: 0.8125rem;                                   /* 13px legal, meta, eyebrows */
  --text-s: 0.9375rem;                                    /* 15px help text, buttons */
  --text-m: 1.125rem;                                     /* 18px body */
  --text-l: 1.5rem;                                       /* 24px lead, prices */
  --text-xl: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);     /* section titles */
  --text-2xl: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);     /* page titles, task pages */
  --text-display: clamp(2.5rem, 1.4rem + 4vw, 5rem);      /* hero beside an image, quotes */
  --text-hero: clamp(3rem, 1.5rem + 6.5vw, 7rem);         /* hero without an image */

  --leading-tight: 1.02;
  --leading-display: 1.1;
  --leading-snug: 1.2;
  --leading-quote: 1.35;
  --leading-body: 1.6;

  --tracking-display: -0.01em;                            /* large display titles */
  --tracking-label: 0.04em;                               /* short pill labels (NL, €) */
  --tracking-eyebrow: 0.2em;                              /* uppercase eyebrows and table heads */
  --tracking-wordmark: 0.32em;
  --measure: 34rem;                                       /* ~65 characters */

  /* ------------------------------------------------------------------
   * Space (4px base) and layout.
   * ------------------------------------------------------------------ */
  --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: 5rem;
  --space-9: clamp(5rem, 3rem + 8vw, 10rem);

  --page-max: 76rem;
  --page-gutter: clamp(1.25rem, 0.5rem + 3vw, 3rem);

  /* ------------------------------------------------------------------
   * Shape. Radii follow hierarchy: fields stay crisp, panels soften like
   * the printed card corners, and every button is a pill.
   * ------------------------------------------------------------------ */
  --radius-control: 3px;
  --radius-panel: 14px;
  --radius-round: 999px;
  --border-hairline: 1px solid var(--color-line);

  /* ------------------------------------------------------------------
   * Controls. One button shape and two heights for the whole site;
   * one field height for every form (44px touch target).
   * ------------------------------------------------------------------ */
  --button-radius: var(--radius-round);
  --button-height: 3rem;                                  /* every call to action */
  --button-height-compact: 2.5rem;                        /* header, reader bar, back links */
  --button-padding-inline: var(--space-5);
  --field-height: 2.75rem;

  /* ------------------------------------------------------------------
   * Motion. One orchestrated moment per page; everything else responds
   * to user action. Disabled entirely under prefers-reduced-motion.
   * ------------------------------------------------------------------ */
  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-quick: 160ms;
  --duration-turn: 380ms;
  --duration-deck: 900ms;
  --duration-settle: 1600ms;
  --duration-pulse: 1400ms;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-quick: 0ms;
    --duration-turn: 0ms;
    --duration-deck: 0ms;
    --duration-settle: 0ms;
    --duration-pulse: 0ms;
  }
}

/* ------------------------------------------------------------------
 * Phone sizes. The scale above is tuned for a wide screen; on a phone
 * the largest type ran to four or five lines and the section rhythm ate
 * whole screens. Here the display sizes come down 10–20% and the two
 * largest spacing steps tighten, while the body text, line height and
 * the calm, airy feel stay exactly as they are.
 * Applies to: every page; the components only read these tokens.
 * ------------------------------------------------------------------ */
@media (max-width: 40rem) {
  :root {
    --text-hero: clamp(2.5rem, 1.1rem + 6vw, 3.25rem);
    --text-display: clamp(2.5rem, 1.5rem + 4vw, 2.75rem);
    --text-2xl: clamp(1.9rem, 1.3rem + 2.4vw, 2.25rem);
    --text-xl: clamp(1.5rem, 1.2rem + 1.2vw, 1.75rem);
    --text-l: 1.375rem;

    --space-8: 3.25rem;
    --space-9: 4rem;
  }
}
