/* ============================================================
   Saraswati  International School
   theme.css — Design tokens & CSS custom properties
   All colors are variables so the Theme Engine can rewrite the
   entire site at runtime. JavaScript (js/theme.js) sets the
   --c-primary / --c-secondary / --c-accent triad and derives
   every shade, gradient, contrast and surface from them.
   ============================================================ */

:root {
  /* ---- Brand triad (overwritten by theme.js) ---- */
  --c-primary:        #2456b8;
  --c-secondary:      #0f2f5e;
  --c-accent:         #f0a500;

  /* ---- Derived primary scale (set by the smart engine) ---- */
  --c-primary-50:     #eef3fc;
  --c-primary-100:    #d6e2f7;
  --c-primary-200:    #adc5ef;
  --c-primary-300:    #84a8e7;
  --c-primary-400:    #4f80d6;
  --c-primary-600:    #1f4aa0;
  --c-primary-700:    #1a3f8f;
  --c-primary-800:    #143372;
  --c-primary-900:    #0f2655;

  --c-primary-hover:  #1f4aa0;
  --c-primary-active: #18397d;
  --c-primary-border: #cdddf6;
  --c-primary-soft:   rgba(36, 86, 184, 0.10);
  --c-primary-softer: rgba(36, 86, 184, 0.05);
  --c-primary-glow:   rgba(36, 86, 184, 0.35);

  /* ---- On-color text (auto-contrast, set by engine) ---- */
  --on-primary:       #ffffff;
  --on-secondary:     #ffffff;
  --on-accent:        #1a1205;

  /* ---- Gradients (rebuilt by engine) ---- */
  --grad-brand:   linear-gradient(135deg, var(--c-primary) 0%, var(--c-secondary) 100%);
  --grad-accent:  linear-gradient(135deg, var(--c-accent) 0%, var(--c-primary) 120%);
  --grad-soft:    linear-gradient(180deg, var(--c-primary-50) 0%, transparent 100%);
  --grad-mesh:
     radial-gradient(at 12% 18%, var(--c-primary-soft) 0px, transparent 45%),
     radial-gradient(at 88% 8%,  var(--c-accent-soft) 0px, transparent 40%),
     radial-gradient(at 70% 92%, var(--c-primary-softer) 0px, transparent 50%);

  --c-accent-soft:    rgba(240, 165, 0, 0.14);

  /* ---- Derived surfaces & status (set by engine) ---- */
  --c-shadow:           rgba(36, 86, 184, 0.20);
  --c-card-tint:        rgba(36, 86, 184, 0.04);
  --c-section-highlight: rgba(36, 86, 184, 0.05);
  --c-ring:             rgba(36, 86, 184, 0.45);
  --alert-info-bg:      rgba(36, 86, 184, 0.12);
  --alert-info-bd:      #5a86d6;
  --alert-accent-bg:    rgba(240, 165, 0, 0.16);
  --alert-accent-bd:    #d6920a;

  /* ---- Neutral surfaces (light theme defaults) ---- */
  --bg:            #ffffff;
  --bg-subtle:     #f5f7fb;
  --bg-muted:      #eef1f7;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --card-bg:       #ffffff;
  --border:        #e4e8f0;
  --border-strong: #cbd3e1;

  /* ---- Ink (text) ---- */
  --ink:           #11151c;
  --ink-soft:      #3a4351;
  --ink-muted:     #6b7585;
  --ink-faint:     #9aa3b2;
  --ink-invert:    #ffffff;

  /* ---- Status ---- */
  --ok:     #1f9d63;
  --warn:   #d98b0a;
  --danger: #d6453d;
  --info:   var(--c-primary);

  /* ---- Typography ---- */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono:    "Space Grotesk", ui-monospace, "Cascadia Code", monospace;

  --fs-eyebrow: 0.78rem;
  --lh-tight: 1.08;
  --lh-snug: 1.3;
  --lh-body: 1.65;
  --tracking-wide: 0.16em;

  /* ---- Radii ---- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --r-pill: 999px;

  /* ---- Shadows (tinted with primary glow) ---- */
  --sh-xs:  0 1px 2px rgba(16, 21, 28, 0.06);
  --sh-sm:  0 4px 14px rgba(16, 21, 28, 0.07);
  --sh-md:  0 14px 34px rgba(16, 21, 28, 0.10);
  --sh-lg:  0 28px 60px rgba(16, 21, 28, 0.14);
  --sh-brand: 0 18px 40px var(--c-primary-glow);

  /* ---- Layout ---- */
  --container: 1240px;
  --gutter: clamp(1rem, 3vw, 2.5rem);
  --section-y: clamp(3.75rem, 7vw, 7rem);
  --header-h: 76px;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms;
  --t-med: 320ms;
  --t-slow: 600ms;
}

/* ====================  DARK THEME  ==================== */
[data-mode="dark"] {
  --bg:            #0c1018;
  --bg-subtle:     #11161f;
  --bg-muted:      #161c27;
  --surface:       #121823;
  --surface-2:     #161d29;
  --card-bg:       #141b27;
  --border:        #24303f;
  --border-strong: #344357;

  --ink:           #eef2f8;
  --ink-soft:      #c3ccda;
  --ink-muted:     #8b96a8;
  --ink-faint:     #5d6776;
  --ink-invert:    #0c1018;

  --sh-xs:  0 1px 2px rgba(0,0,0,0.4);
  --sh-sm:  0 4px 14px rgba(0,0,0,0.45);
  --sh-md:  0 16px 34px rgba(0,0,0,0.5);
  --sh-lg:  0 30px 60px rgba(0,0,0,0.6);
}

/* Background-style variants chosen in the customizer */
[data-bg="mesh"] body   { background-image: var(--grad-mesh); background-attachment: fixed; }
[data-bg="dots"] body   { background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 22px 22px; }
[data-bg="grid"] body   { background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 46px 46px; }
[data-bg="solid"] body  { background-image: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
