/* ==========================================================================
   AJIT BAN — DESIGN TOKENS
   Single source of truth for all visual values.
   Never hard-code hex colors, sizes, or durations elsewhere.

   PHASE 5 — visual system
   Palette: carbon / graphite / warm white / steel + ONE accent (electric cobalt)
   Type:    expressive variable serif display · modern grotesk · technical mono
   Motion:  one centralised rhythm (fast / base / slow) + one easing family
   ========================================================================== */

:root {
  /* ------------------------------------------------------------------
     COLOR SYSTEM
     Carbon ground, warm white light, graphite structure, steel metadata.
     Depth comes from light, opacity, borders and layered surfaces —
     not from gradients. A single electric-cobalt accent carries signal.
     ------------------------------------------------------------------ */
  --color-bg:            #090B10;   /* deep obsidian midnight */
  --color-surface:       #111622;   /* rich midnight slate */
  --color-surface-2:     #171F30;
  --color-surface-3:     #1F2940;

  --color-text:          #F7F5EE;   /* warm ivory white */
  --color-text-muted:    #A8B0C0;
  --color-text-faint:    #828C9F;   /* ≥4.5:1 on dark surfaces */
  --color-steel:         #7C89A0;   /* cool structural slate */

  --color-line:          #222B3D;
  --color-line-strong:   #34415C;

  /* Accent — Warm Champagne Gold & Regal Authority */
  --color-accent:        #E2C376;
  --color-accent-strong: #F5D78E;
  --color-accent-deep:   #A37822;
  --color-accent-soft:   rgba(226, 195, 118, 0.16);
  --color-accent-line:   rgba(226, 195, 118, 0.45);

  /* Text/icon colour for solid accent fills. Stays light in BOTH themes so
     primary buttons and play controls remain readable on --color-accent-deep. */
  --color-on-accent:     #F5F2EA;

  /* Form validation signal (AA on its own ground in both themes). */
  --color-danger:        #FF7A7A;

  --color-overlay:       rgba(8, 8, 10, 0.84);

  /* ------------------------------------------------------------------
     TYPOGRAPHY — FAMILIES
     Display: Fraunces (variable, expressive editorial serif)
     Body:    Manrope (variable modern grotesk)
     Meta:    IBM Plex Mono (technical metadata)
     ------------------------------------------------------------------ */
  --font-display: "Fraunces", "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans:    "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Optical axis / weight for the variable display serif. */
  --display-weight: 420;
  --display-opsz: 120;

  /* ------------------------------------------------------------------
     TYPOGRAPHY — SCALE (fluid, mobile-first via clamp)
     Legacy tokens retained for compatibility; the Phase 5 system adds
     named display / heading / body / metadata roles below.
     ------------------------------------------------------------------ */
  --text-xs:   clamp(0.625rem, 0.58rem + 0.2vw, 0.6875rem);
  --text-sm:   clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-base: clamp(0.9375rem, 0.88rem + 0.28vw, 1.0625rem);
  --text-lg:   clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem);
  --text-xl:   clamp(1.25rem, 1.08rem + 0.8vw, 1.625rem);
  --text-2xl:  clamp(1.625rem, 1.3rem + 1.5vw, 2.375rem);
  --text-3xl:  clamp(2.125rem, 1.55rem + 2.6vw, 3.75rem);
  --text-4xl:  clamp(2.75rem, 1.8rem + 4.4vw, 5.75rem);
  --text-5xl:  clamp(3.75rem, 2.3rem + 6.8vw, 9.5rem);

  /* Phase 5 roles */
  --text-display-xl: clamp(3.25rem, 1.9rem + 8.6vw, 11rem);
  --text-display-lg: clamp(2.75rem, 1.7rem + 5.6vw, 7.5rem);
  --text-display-md: clamp(2.25rem, 1.5rem + 3.6vw, 5.25rem);
  --text-heading-xl: clamp(1.9rem, 1.3rem + 2.9vw, 3.75rem);
  --text-heading-lg: clamp(1.55rem, 1.15rem + 1.9vw, 2.625rem);
  --text-heading-md: clamp(1.325rem, 1.1rem + 1.0vw, 1.75rem);
  --text-body-lg:    clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --text-body:       clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  --text-body-sm:    clamp(0.8125rem, 0.78rem + 0.18vw, 0.875rem);
  --text-metadata:   clamp(0.6875rem, 0.66rem + 0.15vw, 0.75rem);
  --text-archive:    clamp(3.5rem, 1.4rem + 9vw, 11rem);

  --leading-tight:  1.02;
  --leading-snug:   1.2;
  --leading-normal: 1.62;
  --leading-relaxed: 1.85;

  --tracking-label:  0.16em;
  --tracking-mono:   0.06em;
  --tracking-heading: -0.02em;
  --tracking-display: -0.03em;

  /* ------------------------------------------------------------------
     SPACING — 8pt grid, fluid section padding
     ------------------------------------------------------------------ */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;
  --space-9: 3.5rem;
  --space-10: 4rem;
  --space-12: 6rem;
  --space-16: 8rem;

  --container:      1560px;
  --container-pad:  clamp(1.25rem, 4vw, 4rem);
  --section-pad:    clamp(5rem, 11vw, 10rem);
  --header-height:  4.5rem;

  /* ------------------------------------------------------------------
     MOTION
     One rhythm, one easing family. Cinematic range: 260–1100ms.
     ------------------------------------------------------------------ */
  --motion-fast:      260ms;
  --motion-base:      520ms;
  --motion-slow:      820ms;
  --motion-cinematic: 1100ms;

  --dur-instant: 150ms;
  --dur-fast:    var(--motion-fast);
  --dur-base:    var(--motion-base);
  --dur-slow:    var(--motion-slow);
  --dur-cinematic: var(--motion-cinematic);

  --ease-standard:   cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-smooth:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expressive: cubic-bezier(0.16, 1, 0.3, 1);

  /* Legacy aliases */
  --ease-out:      var(--ease-smooth);
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);
  --ease-sharp:    cubic-bezier(0.5, 0, 0.15, 1);

  --stagger-small:  60ms;
  --stagger-medium: 120ms;

  /* ------------------------------------------------------------------
     SHAPE / DEPTH
     Editorial sharpness — no rounded "card" look.
     ------------------------------------------------------------------ */
  --radius:  2px;
  --radius-lg: 4px;
  --border:  1px solid var(--color-line);
  --border-strong: 1px solid var(--color-line-strong);

  /* Glass and Elevation Tokens */
  --glass-bg:            rgba(15, 15, 18, 0.76);
  --glass-border:        rgba(255, 255, 255, 0.08);
  --glass-blur:          blur(16px);
  --shadow-elevation-1:  0 4px 20px -2px rgba(0, 0, 0, 0.35);
  --shadow-elevation-2:  0 16px 40px -6px rgba(0, 0, 0, 0.65);
  --shadow-glow:         0 0 30px -5px var(--color-accent-soft);

  /* ------------------------------------------------------------------
     LAYERS
     ------------------------------------------------------------------ */
  /* Layers */
  --z-cursor:    9999;
  --z-loader:    2000;
  --z-lightbox:  1500;
  --z-header:    1300;
  --z-mobilenav: 1200;

  /* Reveal & timeline defaults */
  --reveal-delay: 0ms;
  --timeline-progress: 0%;
}

/* ---------------------------------------------------------------------
   LIGHT THEME — opt-in via html[data-theme="light"] (applied by js/ui.js,
   bootstrapped before paint). Tuned to the reference "Jurix" legal palette:
   cool light ground + deep navy authority accent. Solid fills keep light text.
   --------------------------------------------------------------------- */
html[data-theme="light"] {
  --color-bg:            #F8FAFC;
  --color-surface:       #FFFFFF;
  --color-surface-2:     #F1F5F9;
  --color-surface-3:     #E2E8F0;

  --color-text:          #0F172A;
  --color-text-muted:    #334155;
  --color-text-faint:    #475569;
  --color-steel:         #64748B;

  --color-line:          #E2E8F0;
  --color-line-strong:   #CBD5E1;

  --color-accent:        #0284C7;
  --color-accent-strong: #0369A1;
  --color-accent-deep:   #0369A1;
  --color-accent-soft:   rgba(2, 132, 199, 0.12);
  --color-accent-line:   rgba(2, 132, 199, 0.35);

  --color-danger:        #E11D48;

  --color-overlay:       rgba(248, 250, 252, 0.88);

  --glass-bg:            rgba(255, 255, 255, 0.94);
  --glass-border:        rgba(2, 132, 199, 0.16);
  --glass-blur:          blur(16px);
  --shadow-elevation-1:  0 4px 20px -2px rgba(15, 23, 42, 0.06);
  --shadow-elevation-2:  0 14px 34px -6px rgba(15, 23, 42, 0.12);
  --shadow-glow:         0 0 25px -5px rgba(2, 132, 199, 0.25);
}

/* ---------------------------------------------------------------------
   REDUCED MOTION — token override
   All decorative motion collapses; usability is preserved.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-slow: 0ms;
    --motion-cinematic: 0ms;
    --stagger-small: 0ms;
    --stagger-medium: 0ms;

    --dur-instant: 0ms;
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
    --dur-cinematic: 0ms;
  }
}
