/* ============================================
   Theme — portable light/dark token system
   --------------------------------------------
   Defines CSS custom properties for dark (default) and light
   (:root[data-theme="light"]) palettes, plus theme-aware semantic
   tokens (shadows, overlays, nav states, blend modes). Host sites
   override any of these with a later <style> block / stylesheet.

   Expected contract:
     <html data-theme="dark">  — dark mode (default)
     <html data-theme="light"> — light mode

   The companion theme.js wires a [id="themeToggle"] button if you
   include one. The pre-paint snippet in the README must be inline in
   <head> to prevent FOUC.
   ============================================ */

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-card: #18181b;
  --bg-card-hover: #1f1f23;
  --bg-primary-rgb: 10, 10, 11;
  --bg-secondary-rgb: 17, 17, 19;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #9a9aa2;
  --accent: #6B00FF;
  --accent-rgb: 107, 0, 255;
  --accent-hover: #8b5cf6;
  --accent-hover-rgb: 139, 92, 246;
  --accent-glow: rgba(var(--accent-rgb),0.15);
  --border: #27272a;
  --border-light: #3f3f46;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max-w: 1200px;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
  --carousel-speed-testimonials: 90s;
  --carousel-speed-skills: 180s;

  /* ---- Theme-aware semantic tokens (dark defaults) ---- */
  --bg-image-filter: brightness(0.4) saturate(1.4);
  --bg-image-filter-soft: brightness(0.35) saturate(1.3);
  --bg-image-filter-strong: brightness(0.3) saturate(1.5) contrast(1.2);
  --shadow-color-rgb: 0, 0, 0;
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 25px 50px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-drawer: -10px 0 40px rgba(0, 0, 0, 0.5);
  --nav-scrolled-bg: rgba(10, 10, 11, 0.9);
  --scrim-bg: rgba(0, 0, 0, 0.6);
  --hero-aurora-blend: screen;
}

:root[data-theme="light"] {
  --bg-primary: #fafaf9;
  --bg-secondary: #f4f4f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-primary-rgb: 250, 250, 249;
  --bg-secondary-rgb: 244, 244, 245;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --accent: #6B00FF;
  --accent-rgb: 107, 0, 255;
  --accent-hover: #5b21b6;
  --accent-hover-rgb: 91, 33, 182;
  --accent-glow: rgba(var(--accent-rgb),0.15);
  --border: #e4e4e7;
  --border-light: #d4d4d8;

  /* ---- Light overrides for semantic tokens ---- */
  --bg-image-filter: brightness(1) saturate(0.9);
  --bg-image-filter-soft: brightness(1.05) saturate(0.85);
  --bg-image-filter-strong: brightness(0.95) saturate(0.95) contrast(1.02);
  --shadow-card: 0 10px 28px rgba(15, 23, 42, 0.08), 0 3px 10px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 50px -10px rgba(15, 23, 42, 0.15), 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 30px 60px -20px rgba(15, 23, 42, 0.22), 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-drawer: -10px 0 40px rgba(15, 23, 42, 0.14);
  --shadow-color-rgb: 15, 23, 42;
  --nav-scrolled-bg: rgba(250, 250, 249, 0.88);
  --scrim-bg: rgba(15, 23, 42, 0.45);
  --hero-aurora-blend: multiply;
}

/* Theme-swap transition (activated by theme.js only during toggle) */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.25s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease !important;
}

/* ============================================
   Toggle button — default styles
   Host sites may override. Requires:
     <button id="themeToggle" class="theme-toggle">
       <svg class="theme-icon theme-icon-moon">…</svg>
       <svg class="theme-icon theme-icon-sun">…</svg>
     </button>
   ============================================ */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  transform: translateY(-1px);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-toggle .theme-icon { width: 16px; height: 16px }
.theme-icon-sun { display: none }
[data-theme="light"] .theme-icon-moon { display: none }
[data-theme="light"] .theme-icon-sun { display: block }
