/**
 * Northforge Digital — Design Tokens v2
 * Source of truth: dashboard/data/brand-lab.json (palette_v2)
 * Approved: 2026-05-25 (D-3, D-5, D-6, D-13)
 *
 * Theme: Dark-mode dominant (D-13). Light mode is opt-in (later wave).
 *
 * Usage discipline (D-3.meta):
 *   - ember + frost = PRIMARY DUET (default UI, buttons, links, state)
 *   - navy           = editorial gravitas (books, about, cornerstones)
 *   - violet         = aurora moments (premium, hero, /books/forge-within/)
 *   - life           = affirmation (success, in-print, completion)
 *   - semantic       = state only, never decorative
 */

:root {
  /* ============================================================
   * SURFACE — midnight navy cast (6 stops)
   * ============================================================ */
  --nfd-surface-0: #050810;  /* deepest — page background */
  --nfd-surface-1: #0a1018;  /* anchor — primary canvas */
  --nfd-surface-2: #131c2a;  /* card / panel */
  --nfd-surface-3: #1f2a3d;  /* elevated card */
  --nfd-surface-4: #2a364c;  /* hover / pressed */
  --nfd-surface-5: #3d4a59;  /* divider, subtle border */

  /* ============================================================
   * TEXT — frost whites, cool cast (5 stops)
   * ============================================================ */
  --nfd-text-primary:   #f0f4f7;
  --nfd-text-secondary: #b8c4d0;
  --nfd-text-tertiary:  #7889a0;
  --nfd-text-disabled:  #485870;
  --nfd-text-inverse:   #050810;  /* on light backgrounds */

  /* ============================================================
   * EMBER — hot forge accent (5 stops, anchor 500)
   * Primary CTA, brand fire, energy moments
   * ============================================================ */
  --nfd-ember-50:  #fff4ed;
  --nfd-ember-200: #ffc4a3;
  --nfd-ember-500: #ff6b35;  /* ANCHOR — primary brand orange */
  --nfd-ember-700: #c64a1f;
  --nfd-ember-900: #6e2810;

  /* ============================================================
   * FROST — cold north accent (5 stops, anchor 500)
   * Secondary action, info, links, calm
   * ============================================================ */
  --nfd-frost-50:  #ebf4fb;
  --nfd-frost-200: #9cc6e6;
  --nfd-frost-500: #3a8bcc;  /* ANCHOR — primary brand blue */
  --nfd-frost-700: #245a85;
  --nfd-frost-900: #112d44;

  /* ============================================================
   * VALHALLA GOLD — VE Fit / Valhalla Eternal product accent
   * Sourced from VE Fit app theme (theme/colors.ts: accent.gold)
   * Use ONLY on Valhalla Eternal surfaces, not parent NFD brand.
   * ============================================================ */
  --nfd-valhalla-gold: #C9A84C;
  --nfd-valhalla-gold-muted: rgba(201, 168, 76, 0.33);
  --nfd-valhalla-gold-glow: rgba(201, 168, 76, 0.14);
  --nfd-valhalla-gold-tint: rgba(201, 168, 76, 0.10);
  --nfd-valhalla-gold-faint: rgba(201, 168, 76, 0.04);

  /* ============================================================
   * NAVY — editorial gravitas (4 stops, anchor 500)
   * Book pages, About, cornerstone content surfaces
   * ============================================================ */
  --nfd-navy-200: #6f86a5;
  --nfd-navy-500: #1e3a5f;  /* ANCHOR — editorial depth */
  --nfd-navy-700: #142a45;
  --nfd-navy-900: #0a1525;

  /* ============================================================
   * VIOLET — aurora / premium (4 stops, anchor 500)
   * Forge Within trilogy hero, premium tier, signature moments
   * ============================================================ */
  --nfd-violet-200: #c4b3f0;
  --nfd-violet-500: #7c5cdb;  /* ANCHOR — aurora purple */
  --nfd-violet-700: #5538a8;
  --nfd-violet-900: #2d1d5a;

  /* ============================================================
   * LIFE — affirmation green (3 stops, anchor 500)
   * Success, in-print badge, completion, growth
   * ============================================================ */
  --nfd-life-200: #a7f3d0;
  --nfd-life-500: #4ade80;  /* ANCHOR — affirmation green */
  --nfd-life-700: #16a34a;

  /* ============================================================
   * SEMANTIC — state only, NEVER decorative
   * ============================================================ */
  --nfd-success: #4ade80;  /* = life-500 */
  --nfd-warning: #f59e0b;
  --nfd-error:   #ef4444;
  --nfd-info:    #3a8bcc;  /* = frost-500 */

  /* ============================================================
   * TYPOGRAPHY — Inter (sans) + Source Serif Pro (serif)
   * Per D-7 (two-face) + D-8 (free fonts)
   * ============================================================ */
  --nfd-font-sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nfd-font-serif: 'Source Serif Pro', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --nfd-font-mono:  ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;

  /* Type scale — modular ratio 1.25 (major third), base 16px */
  --nfd-text-xs:    0.75rem;   /* 12px */
  --nfd-text-sm:    0.875rem;  /* 14px */
  --nfd-text-base:  1rem;      /* 16px */
  --nfd-text-lg:    1.125rem;  /* 18px */
  --nfd-text-xl:    1.25rem;   /* 20px */
  --nfd-text-2xl:   1.5rem;    /* 24px */
  --nfd-text-3xl:   1.875rem;  /* 30px */
  --nfd-text-4xl:   2.25rem;   /* 36px */
  --nfd-text-5xl:   3rem;      /* 48px */
  --nfd-text-6xl:   3.75rem;   /* 60px */
  --nfd-text-7xl:   4.5rem;    /* 72px */

  /* Line heights */
  --nfd-leading-tight:   1.15;
  --nfd-leading-snug:    1.35;
  --nfd-leading-normal:  1.55;
  --nfd-leading-relaxed: 1.75;

  /* Font weights */
  --nfd-weight-regular:  400;
  --nfd-weight-medium:   500;
  --nfd-weight-semibold: 600;
  --nfd-weight-bold:     700;

  /* ============================================================
   * SPACING — 4px base scale (per D-5)
   * ============================================================ */
  --nfd-space-0:   0;
  --nfd-space-1:   0.25rem;  /*  4px */
  --nfd-space-2:   0.5rem;   /*  8px */
  --nfd-space-3:   0.75rem;  /* 12px */
  --nfd-space-4:   1rem;     /* 16px */
  --nfd-space-5:   1.25rem;  /* 20px */
  --nfd-space-6:   1.5rem;   /* 24px */
  --nfd-space-8:   2rem;     /* 32px */
  --nfd-space-10:  2.5rem;   /* 40px */
  --nfd-space-12:  3rem;     /* 48px */
  --nfd-space-16:  4rem;     /* 64px */
  --nfd-space-20:  5rem;     /* 80px */
  --nfd-space-24:  6rem;     /* 96px */
  --nfd-space-32:  8rem;     /* 128px */

  /* ============================================================
   * RADIUS — sharp + soft, per D-5
   * ============================================================ */
  --nfd-radius-none: 0;
  --nfd-radius-sm:   0.25rem;  /*  4px — inputs, small chips */
  --nfd-radius-md:   0.5rem;   /*  8px — buttons, cards */
  --nfd-radius-lg:   0.75rem;  /* 12px — feature cards */
  --nfd-radius-xl:   1rem;     /* 16px — hero panels */
  --nfd-radius-full: 9999px;   /* pills, avatars */

  /* ============================================================
   * SHADOWS — subtle, on dark surfaces use glow not lift
   * ============================================================ */
  --nfd-shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
  --nfd-shadow-md:    0 4px 12px rgba(0, 0, 0, 0.5);
  --nfd-shadow-lg:    0 12px 32px rgba(0, 0, 0, 0.6);
  --nfd-shadow-ember: 0 0 24px rgba(255, 107, 53, 0.25);
  --nfd-shadow-frost: 0 0 24px rgba(58, 139, 204, 0.25);
  --nfd-shadow-violet:0 0 24px rgba(124, 92, 219, 0.3);

  /* ============================================================
   * MOTION — per D-9
   * ============================================================ */
  --nfd-duration-fast:    150ms;
  --nfd-duration-normal:  250ms;
  --nfd-duration-slow:    400ms;
  --nfd-ease-default:     cubic-bezier(0.4, 0, 0.2, 1);
  --nfd-ease-in:          cubic-bezier(0.4, 0, 1, 1);
  --nfd-ease-out:         cubic-bezier(0, 0, 0.2, 1);

  /* ============================================================
   * LAYOUT
   * ============================================================ */
  --nfd-container-sm:   640px;
  --nfd-container-md:   768px;
  --nfd-container-lg:   1024px;
  --nfd-container-xl:   1280px;
  --nfd-container-2xl:  1440px;
  --nfd-prose-width:    65ch;
}

/* ============================================================
 * LIGHT MODE (opt-in via .light class or prefers-color-scheme)
 * Phase 1 = dark dominant. Light is a later wave.
 * Token names stay identical; values flip.
 * ============================================================ */
@media (prefers-color-scheme: light) {
  :root.respect-system {
    --nfd-surface-0:  #fafbfc;
    --nfd-surface-1:  #f0f3f7;
    --nfd-surface-2:  #ffffff;
    --nfd-surface-3:  #e8edf2;
    --nfd-surface-4:  #d1d9e1;
    --nfd-surface-5:  #b3bec9;

    --nfd-text-primary:   #0a1018;
    --nfd-text-secondary: #2a3645;
    --nfd-text-tertiary:  #5a6b7d;
    --nfd-text-disabled:  #99a8b8;
    --nfd-text-inverse:   #f0f4f7;
  }
}
