/*
 * CalcPrism — Editorial Redesign Design Tokens (Stage 9)
 * ======================================================
 * Warm off-white paper, deep ink, forest-green accent.
 * Editorial, timeless, intelligent — replaces the previous
 * "Clean Utility" blue theme.
 */

/* Google Fonts loaded via <link> in base.html.twig with preconnect */

:root {
  /* ═══════════════════════════════════════════
     Editorial palette — new canonical tokens
     ═══════════════════════════════════════════ */

  /* Surfaces & ink */
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --ink: #18181b;
  --ink-2: #44444a;
  --ink-3: #6b6b71; /* WCAG AA: 4.74:1 on --surface-2 (#f3f2ee), 5.27:1 on white */
  --line: #e8e7e1;
  --line-strong: #d6d5cd;

  /* Accent — forest green */
  --accent: #2e5d4e;
  --accent-2: #4a8672;
  --accent-soft: #e8f1ed;

  /* Category palette */
  --amber: #d4883a;
  --amber-soft: #fbf0df;
  --rose: #b14a5e;
  --rose-soft: #f6e5e9;
  --blue: #3e6ea8;
  --blue-soft: #e4edf7;
  --violet: #6d5ba3;
  --violet-soft: #ecebf5;
  --teal: #2a8585;
  --teal-soft: #dcefef;

  /* Radii (editorial — generous, softer) */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius: 14px; /* mockup shorthand */
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Shadows — from mockup */
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04), 0 1px 3px rgba(24, 24, 27, 0.05);
  --shadow-md: 0 4px 24px -8px rgba(24, 24, 27, 0.10), 0 2px 6px -2px rgba(24, 24, 27, 0.04);
  --shadow: 0 4px 24px -8px rgba(24, 24, 27, 0.10), 0 2px 6px -2px rgba(24, 24, 27, 0.04);
  --shadow-lg: 0 24px 60px -20px rgba(24, 24, 27, 0.18), 0 8px 20px -8px rgba(24, 24, 27, 0.08);
  --shadow-xl: 0 32px 80px -24px rgba(24, 24, 27, 0.22), 0 12px 28px -10px rgba(24, 24, 27, 0.10);
  --shadow-glow: none;

  /* ═══════════════════════════════════════════
     Typography
     ═══════════════════════════════════════════ */

  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* ═══════════════════════════════════════════
     Spacing
     ═══════════════════════════════════════════ */

  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ═══════════════════════════════════════════
     Transitions
     ═══════════════════════════════════════════ */

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 350ms ease;

  /* Category gradients — mapped to editorial palette */
  --gradient-finance: var(--accent);
  --gradient-math: var(--violet);
  --gradient-health: var(--rose);
  --gradient-datetime: var(--blue);
  --gradient-converters: var(--teal);
  --gradient-developer: var(--ink-2);
  --gradient-text: var(--amber);
  --gradient-energy: var(--amber);
  --gradient-construction: var(--amber);
  --gradient-geometry: var(--violet);
  --gradient-advanced: var(--violet);
  --gradient-lifestyle: var(--rose);
  --gradient-image: var(--blue);

  /* Icon backgrounds */
  --icon-bg-primary: var(--accent);
  --icon-bg-converters: var(--teal);
  --icon-bg-text: var(--amber);
  --icon-bg-datetime: var(--blue);
  --icon-bg-health: var(--rose);
}

/* ═══════════════════════════════════════════
   Dark Mode Transition (applied during toggle only)
   ═══════════════════════════════════════════ */

.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease !important;
  transition-delay: 0s !important;
}

/* ═══════════════════════════════════════════
   Dark Mode
   ═══════════════════════════════════════════ */

[data-theme='dark'] {
  /* Editorial palette — dark */
  --bg: #0f0f10;
  --surface: #1a1a1c;
  --surface-2: #242427;
  --ink: #f5f5f1;
  --ink-2: #c2c2c0;
  --ink-3: #929298; /* WCAG AA: 4.89:1 on --surface-2 (#242427) */
  --line: #2a2a2d;
  --line-strong: #3a3a3e;

  --accent: #7db49e;
  --accent-2: #a4c9ba;
  --accent-soft: #1e2b27;

  --amber: #d4883a;
  --amber-soft: #2a231a;
  --rose: #b14a5e;
  --rose-soft: #2b1d22;
  --blue: #3e6ea8;
  --blue-soft: #1a2332;
  --violet: #6d5ba3;
  --violet-soft: #221e2f;
  --teal: #2a8585;
  --teal-soft: #1a2828;

  /* Shadows — deeper for dark surfaces */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 3px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 4px 24px -8px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.30);
  --shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.55), 0 8px 20px -8px rgba(0, 0, 0, 0.40);
  --shadow-xl: 0 32px 80px -24px rgba(0, 0, 0, 0.65), 0 12px 28px -10px rgba(0, 0, 0, 0.45);
  --shadow-glow: none;

  /* Icon backgrounds keep stable identity */
  --icon-bg-primary: var(--accent);
  --icon-bg-converters: var(--teal);
  --icon-bg-text: var(--amber);
  --icon-bg-datetime: var(--blue);
  --icon-bg-health: var(--rose);
}

/* ═══════════════════════════════════════════
   System Dark Mode (OS-level preference)
   ═══════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f0f10;
    --surface: #1a1a1c;
    --surface-2: #242427;
    --ink: #f5f5f1;
    --ink-2: #c2c2c0;
    --ink-3: #929298;
    --line: #2a2a2d;
    --line-strong: #3a3a3e;

    --accent: #7db49e;
    --accent-2: #a4c9ba;
    --accent-soft: #1e2b27;

    --amber: #d4883a;
    --amber-soft: #2a231a;
    --rose: #b14a5e;
    --rose-soft: #2b1d22;
    --blue: #3e6ea8;
    --blue-soft: #1a2332;
    --violet: #6d5ba3;
    --violet-soft: #221e2f;
    --teal: #2a8585;
    --teal-soft: #1a2828;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 3px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 4px 24px -8px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.30);
    --shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.55), 0 8px 20px -8px rgba(0, 0, 0, 0.40);
    --shadow-xl: 0 32px 80px -24px rgba(0, 0, 0, 0.65), 0 12px 28px -10px rgba(0, 0, 0, 0.45);
    --shadow-glow: none;

    --icon-bg-primary: var(--accent);
    --icon-bg-converters: var(--teal);
    --icon-bg-text: var(--amber);
    --icon-bg-datetime: var(--blue);
    --icon-bg-health: var(--rose);
  }
}
