/* ==========================================================================
   VASCLAW — Design Tokens (Meta Astryx Design System Architecture)
   - Tokens as Intent: every visual value references a semantic role.
   - Concentric Shapes: nested radii scale cleanly with padding.
   - Motion Bands + Tempo Knob: fast / medium / slow + reduced-motion safety.
   ========================================================================== */

@layer reset, tokens, theme, components, utilities;

@layer tokens {
  :root {
    /* --- Color Palette Primitives --- */
    --raw-cream-50: #fdf8f2;
    --raw-cream-100: #fcf5eb;
    --raw-cream-200: #f5ebdd;
    --raw-taupe-300: #ddd3c6;
    --raw-taupe-400: #bfb3a4;
    --raw-taupe-600: #736a61;
    --raw-taupe-700: #463f3b;

    --raw-ink-950: #000000;
    --raw-ink-900: #121010;
    --raw-ink-850: #171414;
    --raw-ink-800: #221e1e;

    --raw-crimson-950: #44080b;
    --raw-crimson-900: #530d0f; /* Founder preferred blood-red reference */
    --raw-crimson-800: #6b0e13;
    --raw-crimson-700: #750e14;
    --raw-crimson-500: #b21b22;

    --raw-white: #ffffff;

    /* --- Semantic Surface Roles --- */
    --color-canvas: var(--raw-cream-100);
    --color-canvas-soft: var(--raw-cream-50);
    --color-surface-card: var(--raw-white);
    --color-surface-subtle: var(--raw-cream-200);
    --color-surface-obsidian: var(--raw-ink-950);
    --color-surface-dark-card: var(--raw-ink-900);
    --color-surface-footer: var(--raw-ink-850);

    /* --- Semantic Ink Roles --- */
    --color-ink-primary: var(--raw-ink-850);
    --color-ink-secondary: var(--raw-taupe-700);
    --color-ink-muted: var(--raw-taupe-600);
    --color-ink-inverse: #f4eee6;
    --color-ink-inverse-muted: #9e968e;

    /* --- Semantic Accent & Border Roles --- */
    --color-accent: var(--raw-crimson-700);
    --color-accent-deep: var(--raw-crimson-900);
    --color-accent-brush: var(--raw-crimson-800);
    --color-accent-glow: var(--raw-crimson-500);
    --color-line: var(--raw-taupe-300);
    --color-line-strong: var(--raw-taupe-400);
    --color-line-inverse: rgba(244, 238, 230, 0.16);
    --color-focus-ring: var(--raw-crimson-700);

    /* --- Typography Families (100% SIL OFL 1.1 Commercial-Free) --- */
    --font-serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
    --font-editorial: "Playfair Display", "Cormorant Garamond", Georgia, serif;
    --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* --- Fluid Type Scale --- */
    --text-micro: 0.65rem;     /* ~10.4px */
    --text-xs: 0.72rem;        /* ~11.5px */
    --text-sm: 0.875rem;       /* 14px */
    --text-base: 1rem;         /* 16px */
    --text-body-lg: 1.0625rem; /* 17px */
    --text-lead: clamp(1.35rem, 2.4vw, 2.25rem);
    --text-h3: clamp(1.5rem, 2.4vw, 2.15rem);
    --text-h2: clamp(2rem, 3.8vw, 3.25rem);
    --text-display: clamp(3rem, 7vw, 6.25rem);
    --text-article-h1: clamp(2.85rem, 7.2vw, 6.6rem);

    /* --- Spatial Rhythm Scale (4px / 8px base grid) --- */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    --space-24: 6rem;     /* 96px */

    /* --- Container & Layout Metrics (Tighter Edge-to-Edge Margins) --- */
    --container-max: 1680px;
    --container-gutter: clamp(1rem, 2.2vw, 2.15rem);
    --nav-height: 76px;

    /* --- Concentric Radii --- */
    --radius-xs: 4px;
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-card: 36px;
    --radius-feature: clamp(28px, 5vw, 64px);
    --radius-pill-frame: clamp(32px, 8vw, 110px);
    --radius-quote: 64px 8px 64px 8px;
    --radius-full: 9999px;

    /* --- Shadows & Elevation --- */
    --shadow-card: 0 14px 40px -16px rgba(23, 20, 20, 0.12),
      0 2px 8px -2px rgba(23, 20, 20, 0.06);
    --shadow-card-hover: 0 24px 54px -18px rgba(23, 20, 20, 0.18),
      0 4px 12px -2px rgba(23, 20, 20, 0.08);
    --shadow-modal: 0 32px 80px -16px rgba(6, 6, 6, 0.42);

    /* --- Predictable Stacking Scale --- */
    --z-base: 1;
    --z-elevated: 10;
    --z-sticky: 40;
    --z-nav: 60;
    --z-drawer: 80;
    --z-modal: 100;
    --z-toast: 120;

    /* --- Astryx Motion System (Duration Bands + Tempo Knob) --- */
    --motion-tempo: 1;
    --duration-fast-min: calc(130ms * var(--motion-tempo));
    --duration-fast: calc(180ms * var(--motion-tempo));
    --duration-fast-max: calc(230ms * var(--motion-tempo));
    --duration-med-min: calc(310ms * var(--motion-tempo));
    --duration-med: calc(420ms * var(--motion-tempo));
    --duration-med-max: calc(550ms * var(--motion-tempo));
    --duration-slow: calc(780ms * var(--motion-tempo));

    --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-tactile: cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* Astryx Reduced-Motion Safety Cap (<= 200ms, no spatial displacement) */
  @media (prefers-reduced-motion: reduce) {
    :root {
      --duration-fast-min: 100ms;
      --duration-fast: 140ms;
      --duration-fast-max: 160ms;
      --duration-med-min: 180ms;
      --duration-med: 200ms;
      --duration-med-max: 200ms;
      --duration-slow: 200ms;
    }
  }
}
