/* CR38 Design Tokens · v0.1 (proposal, 2026-10-16)
   Three layers:
     1. Primitives (--cr-p-*): raw values. Never used directly by components.
     2. Semantic tokens (--cr-*): meaning ("text", "accent"). Components use only these.
     3. Themes: [data-theme] swaps semantic tokens. [data-venture] swaps the accent only.
   Contrast rule: every text/background pair below is checked by qa/design-qa.mjs
   (4.5:1 normal text, 3:1 large text and UI boundaries). */

:root {
  /* 1 · Primitives ------------------------------------------------------ */
  --cr-p-black-950: #0b0b0a;
  --cr-p-black-900: #131311;
  --cr-p-black-800: #1c1c19;
  --cr-p-black-700: #2a2925;

  --cr-p-warm-50:  #f1eee5;   /* the mark's original colour */
  --cr-p-warm-100: #e6e1d4;
  --cr-p-warm-300: #bdb8aa;
  --cr-p-warm-500: #918c80;
  --cr-p-warm-700: #5c584f;

  --cr-p-gold-200: #e3cf9f;
  --cr-p-gold-400: #c4a86e;
  --cr-p-gold-600: #8a7445;
  --cr-p-gold-700: #6f5f3c;
  --cr-p-gold-800: #6a521f;   /* gold for text on light backgrounds */
  --cr-p-gold-950: #3a2f14;

  --cr-p-green-400: #9cc48a;
  --cr-p-amber-300: #f3dfa8;
  --cr-p-red-400:   #ef8f80;

  /* Type families: system stacks today (zero network requests). See README, proposal V1. */
  --cr-font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --cr-font-text: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --cr-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale (fluid where it matters). Body never below 17px. */
  --cr-text-xs: 0.75rem;     /* labels, eyebrows: uppercase + tracking only */
  --cr-text-sm: 0.875rem;
  --cr-text-md: 1.0625rem;   /* body */
  --cr-text-lg: clamp(1.375rem, 2.6vw, 2rem);
  --cr-text-xl: clamp(1.75rem, 3.4vw, 2.625rem);
  --cr-text-2xl: clamp(2rem, 4.6vw, 3.5rem);
  --cr-text-3xl: clamp(2rem, 5.6vw, 4.5rem);
  --cr-text-display: clamp(3rem, 10.5vw, 8.25rem);

  --cr-leading-tight: 1.05;
  --cr-leading-snug: 1.25;
  --cr-leading-body: 1.6;
  --cr-tracking-label: 0.28em;
  --cr-tracking-wordmark: 0.32em;

  /* Spacing: 4px base. */
  --cr-space-1: 4px;
  --cr-space-2: 8px;
  --cr-space-3: 12px;
  --cr-space-4: 16px;
  --cr-space-5: 24px;
  --cr-space-6: 32px;
  --cr-space-7: 48px;
  --cr-space-8: 64px;
  --cr-space-9: 96px;
  --cr-gutter: clamp(16px, 5vw, 64px);
  --cr-section: clamp(80px, 12vw, 150px);
  --cr-max: 1200px;
  --cr-measure: 46ch;

  /* Shape: square corners are part of the identity. Radius only for focus rings and pills. */
  --cr-radius-0: 0;
  --cr-radius-1: 2px;
  --cr-radius-pill: 999px;
  --cr-border: 1px;

  /* Elevation: on dark, structure comes from lines, not shadows. */
  --cr-shadow-none: none;
  --cr-shadow-overlay: 0 24px 60px rgba(0, 0, 0, 0.45);

  /* Motion: subtle, short, never required to read content. */
  --cr-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --cr-dur-fast: 160ms;
  --cr-dur-base: 320ms;
  --cr-dur-slow: 900ms;
  --cr-rise: 14px;           /* entrance offset; entrances move, they do not hide */

  /* Interaction */
  --cr-tap: 48px;            /* minimum touch target */
  --cr-focus-width: 2px;
  --cr-focus-offset: 4px;

  /* 2 · Semantic tokens: default theme "night" ------------------------- */
  --cr-bg: var(--cr-p-black-950);
  --cr-surface: var(--cr-p-black-900);
  --cr-surface-raised: var(--cr-p-black-800);
  --cr-text: var(--cr-p-warm-50);
  --cr-text-muted: var(--cr-p-warm-300);
  --cr-text-subtle: var(--cr-p-warm-500);
  --cr-line: rgba(241, 238, 229, 0.12);
  --cr-line-strong: rgba(241, 238, 229, 0.22);
  --cr-accent: var(--cr-p-gold-400);
  --cr-accent-hover: var(--cr-p-gold-200);
  --cr-accent-line: var(--cr-p-gold-700);
  --cr-on-accent: var(--cr-p-black-950);
  --cr-focus: var(--cr-p-gold-400);
  --cr-notice-bg: var(--cr-p-gold-950);
  --cr-notice-text: var(--cr-p-amber-300);
  --cr-notice-line: var(--cr-p-gold-700);
  --cr-ok: var(--cr-p-green-400);
  --cr-danger: var(--cr-p-red-400);
  --cr-header-bg: rgba(11, 11, 10, 0.82);

  color-scheme: dark;
}

/* 3 · Theme "paper": documents, proposals, light client pages. */
[data-theme="paper"] {
  --cr-bg: var(--cr-p-warm-50);
  --cr-surface: var(--cr-p-warm-100);
  --cr-surface-raised: #ffffff;
  --cr-text: var(--cr-p-black-950);
  --cr-text-muted: #45423b;
  --cr-text-subtle: var(--cr-p-warm-700);
  --cr-line: rgba(11, 11, 10, 0.12);
  --cr-line-strong: rgba(11, 11, 10, 0.24);
  --cr-accent: var(--cr-p-gold-800);
  --cr-accent-hover: var(--cr-p-black-950);
  --cr-accent-line: var(--cr-p-gold-600);
  --cr-on-accent: var(--cr-p-warm-50);
  --cr-focus: var(--cr-p-gold-800);
  --cr-notice-bg: #f3e6c4;
  --cr-notice-text: #4a3a12;
  --cr-notice-line: var(--cr-p-gold-600);
  --cr-ok: #3f6b2e;
  --cr-danger: #9b2f22;
  --cr-header-bg: rgba(241, 238, 229, 0.86);
  color-scheme: light;
}

/* Venture accents: a venture keeps the CR38 structure and changes one colour.
   Example only; CR38 Systems is not modified by this file. */
[data-venture="systems"] {
  --cr-accent: #6fb4ff;
  --cr-accent-hover: #a9d2ff;
  --cr-accent-line: #2f5f8f;
  --cr-focus: #6fb4ff;
}
