/* ============================================================
   NeuAnalytics 2026, Design Tokens (CSS Custom Properties)
   Brand Guide v3.0 compliant
   ============================================================ */

:root {
  /* ---- Brand Colors (constant) ---- */
  --neu-blue: #0498FE;
  --midnight: #0B1A2E;
  --deep-navy: #0F2847;
  --ice: #F0F4F8;
  --graphite: #334155;
  --steel: #64748B;
  --silver: #94A3B8;
  --signal-teal: #2DD4BF;
  --warm-amber: #D4915E;
  --accent-amber: #D4915E;
  --accent-amber-rgb: 212, 145, 94;
  --neu-green: #66CC33;
  --white: #FFFFFF;
  --black: #000000;

  /* ---- Brand Gradients ---- */
  --gradient-primary: linear-gradient(135deg, var(--neu-blue), var(--deep-navy));
  --gradient-tech: linear-gradient(135deg, var(--neu-blue), var(--signal-teal));
  --gradient-dark: linear-gradient(135deg, var(--midnight), var(--deep-navy));

  /* ---- Typography ---- */
  --font-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Type Scale */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */
  --text-6xl: 3.75rem;    /* 60px */

  /* Font Weights */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* ---- Spacing ---- */
  --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 */
  --space-32: 8rem;       /* 128px */

  /* ---- Layout ---- */
  --container-max: 1280px;
  --container-narrow: 960px;
  --container-wide: 1440px;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;

  /* ---- Glassmorphism Tokens ---- */
  --glass-light-bg: rgba(255, 255, 255, 0.05);
  --glass-medium-bg: rgba(255, 255, 255, 0.08);
  --glass-strong-bg: rgba(255, 255, 255, 0.12);
  --glass-dark-bg: rgba(10, 10, 10, 0.70);
  --glass-blur: blur(20px);
  --glass-blur-strong: blur(30px);
  --glass-border-subtle: 1px solid rgba(255, 255, 255, 0.10);
  --glass-border-visible: 1px solid rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);

  /* ---- Transitions ---- */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-theme: 350ms ease;
}

/* ============================================================
   DARK THEME (opt-in via the toggle, or a stored preference)

   Selector is :root[data-theme="dark"], not [data-theme="dark"].
   The light block below declares its values on bare :root, which has the
   same specificity as a lone attribute selector and appears later in this
   file, so a plain [data-theme="dark"] would lose the cascade and the
   toggle would silently do nothing. The :root prefix raises specificity
   above that, independent of source order.
   ============================================================ */
:root[data-theme="dark"] {
  --bg-primary: var(--midnight);
  --bg-secondary: var(--deep-navy);
  --bg-tertiary: #132D4F;
  --bg-surface: var(--deep-navy);

  --text-primary: var(--white);
  --text-secondary: var(--silver);
  --text-tertiary: #8899AB;          /* WCAG AA: ~4.6:1 on midnight */
  --text-heading: var(--white);
  --text-accent: var(--neu-blue);

  --border-default: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.20);

  --btn-primary-bg: #0370C8;
  --btn-primary-text: var(--white);
  --btn-primary-hover: #0261B5;
  --btn-secondary-bg: transparent;
  --btn-secondary-text: var(--white);
  --btn-secondary-border: rgba(255, 255, 255, 0.25);
  --btn-secondary-hover-bg: rgba(255, 255, 255, 0.08);

  --nav-bg: rgba(10, 10, 10, 0.70);
  --footer-bg: var(--midnight);

  --card-bg: var(--glass-light-bg);
  --card-border: var(--glass-border-subtle);
  --card-hover-bg: var(--glass-medium-bg);

  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.15);
  --input-text: var(--white);
  --input-placeholder: #8899AB;      /* WCAG AA: ~4.6:1 on midnight */
}

/* ============================================================
   LIGHT THEME (Default)

   Declared on bare :root as well as [data-theme="light"], so a visitor
   with no stored preference gets light immediately, before the inline
   bootstrap or dark-mode.js runs, rather than a flash of dark. Dark is
   opt-in and lives under [data-theme="dark"] only.
   ============================================================ */
[data-theme="light"],
:root {
  --bg-primary: var(--white);
  --bg-secondary: var(--ice);
  --bg-tertiary: #E2E8F0;
  --bg-surface: var(--white);

  --text-primary: var(--graphite);
  --text-secondary: var(--steel);
  --text-tertiary: #6B7B8D;          /* WCAG AA: ~4.6:1 on white */
  --text-heading: var(--midnight);
  --text-accent: var(--neu-blue);

  --border-default: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --btn-primary-bg: #0370C8;
  --btn-primary-text: var(--white);
  --btn-primary-hover: #0261B5;
  --btn-secondary-bg: transparent;
  --btn-secondary-text: var(--graphite);
  --btn-secondary-border: rgba(0, 0, 0, 0.15);
  --btn-secondary-hover-bg: rgba(0, 0, 0, 0.04);

  --nav-bg: rgba(255, 255, 255, 0.85);
  --footer-bg: var(--midnight);

  --card-bg: rgba(255, 255, 255, 0.80);
  --card-border: 1px solid rgba(0, 0, 0, 0.06);
  --card-hover-bg: rgba(255, 255, 255, 0.95);

  --input-bg: var(--white);
  --input-border: rgba(0, 0, 0, 0.12);
  --input-text: var(--graphite);
  --input-placeholder: #6B7B8D;      /* WCAG AA: ~4.6:1 on white */

  /* Override glass tokens for light mode */
  --glass-light-bg: rgba(255, 255, 255, 0.70);
  --glass-medium-bg: rgba(255, 255, 255, 0.80);
  --glass-strong-bg: rgba(255, 255, 255, 0.90);
  --glass-dark-bg: rgba(10, 10, 10, 0.80);
  --glass-border-subtle: 1px solid rgba(0, 0, 0, 0.06);
  --glass-border-visible: 1px solid rgba(0, 0, 0, 0.10);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   THEME TRANSITIONS
   ============================================================ */
html {
  transition:
    background-color var(--transition-theme),
    color var(--transition-theme);
}

body,
.glass,
.glass-strong,
.glass-dark,
.nav,
.footer,
.btn,
.card {
  transition:
    background-color var(--transition-theme),
    color var(--transition-theme),
    border-color var(--transition-theme),
    box-shadow var(--transition-theme);
}
