/* ─────────────────────────────────────────
   TOKENS  —  design primitives
   All other CSS files reference these vars.
───────────────────────────────────────── */

:root {
  /* Colours */
  --bg:        #f5f4f0;
  --bg-card:   #eeecea;
  --bg-hover:  #e6e4e0;
  --fg:        #0f0f0f;
  --fg-2:      #6b6b6b;
  --fg-3:      #717171;   /* was #999 — raised to meet WCAG AA on --bg */
  --border:    rgba(0,0,0,0.09);
  --border-s:  rgba(0,0,0,0.16);

  /* Radii */
  --r:     12px;
  --r-sm:   8px;

  /* Typography */
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'Geist Mono', 'SF Mono', monospace;

  /* Layout */
  --nav:    56px;   /* desktop icon sidebar width  */
  --bnav-h: 64px;   /* mobile bottom nav height    */

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t:    150ms;

  /* Smooth "ease-out" deceleration curve for entrances/reveals — slower,
     more premium feel than --ease above, which stays tuned for quick
     UI feedback (hovers, toggles). Both are ease-out shaped (fast start,
     soft landing); this one just lands more gradually. */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --stagger-step: 70ms;   /* per-item delay step for staggered reveals, see js/motion.js */

  /* Pre-loader (css/loader.css + js/loader.js).
     Deliberately NOT theme-aware: the loader is a brand moment, so it looks
     identical in light and dark mode — which is why these live here in
     :root and are not overridden in the body.dark blocks below. */
  --loader-bg:       #ff5a1f;  /* TODO: replace with the exact orange once confirmed from the reference site */
  --loader-fg:       #0f0f0f;  /* = light-mode --fg. Hard-coded rather than var(--fg) because --fg flips to near-white in dark mode, and the loader must look the same in both. */
  --loader-dim:      0.16;     /* opacity of the not-yet-filled logo */
  --loader-line:     rgba(15,15,15,0.22);  /* hairline rules, same role as --border but readable on orange */
  --loader-meta:     0.72;     /* opacity of secondary mono labels (≈4.3:1 on the orange; the % counter is full strength) */
  --loader-pad:      clamp(16px, 2.6vw, 28px);  /* outer frame inset */
  --loader-draw:     900ms;    /* entrance choreography length; js/loader.js overrides it from CONFIG.minFillMs so lines, labels and fill share one clock */
  --loader-line-top-end:    0.78;   /* upper rule reaches its final state at 78% of --loader-draw … */
  --loader-line-bottom-end: 0.86;   /* … lower rule at 86% — both clearly before the logo fill completes (100%) */
  --loader-draw-ease: cubic-bezier(0.645, 0.045, 0.355, 1);  /* one curve for everything: CSS line-draw uses it directly, js/loader.js reads this value to drive the logo fill */
  --loader-logo-w:   clamp(7.5rem, 30vw, 11rem);  /* ≈105px phone → 154px desktop; rem-based so it scales with the site's 14px root */
  --loader-exit:     750ms;    /* curtain lift duration (JS reads this, no second copy to keep in sync) */
  --loader-failsafe: 8s;       /* CSS-only escape hatch if JS never finishes the loader */
}

/* Dark mode overrides */
body.dark {
  --bg:       #141414;
  --bg-card:  #1e1e1e;
  --bg-hover: #252525;
  --fg:       #f0f0f0;
  --fg-2:     #888;
  --fg-3:     #666;   /* raised slightly from #555 for better contrast */
  --border:   rgba(255,255,255,0.07);
  --border-s: rgba(255,255,255,0.13);
}

/* Respect system dark preference for users who haven't manually toggled */
@media (prefers-color-scheme: dark) {
  body:not(.light) {
    --bg:       #141414;
    --bg-card:  #1e1e1e;
    --bg-hover: #252525;
    --fg:       #f0f0f0;
    --fg-2:     #888;
    --fg-3:     #666;
    --border:   rgba(255,255,255,0.07);
    --border-s: rgba(255,255,255,0.13);
  }
}
