/* ================================================
   GLOBALS — Reset, Variables, Themes, Typography
   ================================================ */

/* Reset */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

img,
picture,
video,
svg {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* CSS Variables — Light theme (default) */
:root {
  --background: #f0f4f8;
  --foreground: #0f172a;              /* darker — near black, slate-900 */
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #1a1c2c;
  --primary-foreground: #ffffff;
  --secondary: #007acc;
  --secondary-foreground: #ffffff;
  --muted: #f0f4f8;
  --muted-foreground: #1f2937;
  --accent: #007acc;
  --accent-foreground: #ffffff;
  --destructive: #ff4c4c;
  --destructive-foreground: #ffffff;
  --border: #d1d5db;
  --input: #ffffff;
  --ring: rgba(0, 122, 204, 0.5);
  --radius: 0.5rem;

  /* Component-mapped vars (compatibility with existing styles.css) */
  --primary-color: var(--primary);
  --secondary-color: var(--secondary);
  --accent-color: var(--accent);
  --background-color: var(--background);
  --card-background: var(--card);
  --text-primary: var(--foreground);
  --text-secondary: #374151;          /* darker — slate-700 instead of #666 */
  --text-light: #ffffff;
  --border-color: var(--border);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
  --border-radius: var(--radius);

  /* Hero theme-aware variables — LIGHT MODE: clean, white, technical */
  --hero-gradient: linear-gradient(135deg, #ffffff 0%, #eef4fb 50%, #dbe9f7 100%);
  --hero-overlay: rgba(255, 255, 255, 0.0);
  --hero-grid-color: rgba(0, 122, 204, 0.08);
  --hero-glow-1: rgba(0, 122, 204, 0.18);
  --hero-glow-2: rgba(74, 158, 255, 0.14);
  --hero-text-primary: #0f172a;       /* darker hero title */
  --hero-text-secondary: #007acc;
  --hero-text-description: #1f2937;   /* darker hero description */
  --hero-text-strong: #007acc;
  --hero-code-bg: rgba(26, 28, 44, 0.92);
  --hero-code-border: rgba(0, 122, 204, 0.25);
  --hero-btn-secondary-text: #0f172a;
  --hero-btn-secondary-border: #0f172a;
  --hero-scroll-arrow: #0f172a;
}

/* Dark theme */
[data-theme="dark"] {
  --background: #0f1419;
  --foreground: #f0f0f0;
  --card: #1e2328;
  --card-foreground: #f0f0f0;
  --popover: #1e2328;
  --popover-foreground: #f0f0f0;
  --primary: #1a1c2c;
  --primary-foreground: #ffffff;
  --secondary: #4a9eff;
  --secondary-foreground: #ffffff;
  --muted: #1e2328;
  --muted-foreground: #d0d0d0;
  --accent: #4a9eff;
  --accent-foreground: #ffffff;
  --border: #2d3748;
  --input: #1e2328;
  --ring: rgba(74, 158, 255, 0.5);

  --primary-color: var(--primary);
  --secondary-color: var(--secondary);
  --accent-color: var(--accent);
  --background-color: var(--background);
  --card-background: var(--card);
  --text-primary: var(--foreground);
  --text-secondary: #d0d0d0;
  --text-light: #ffffff;
  --border-color: var(--border);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.4);

  /* Dark hero — deep, atmospheric (UNCHANGED) */
  --hero-gradient: linear-gradient(135deg, #05080f 0%, #0f1726 50%, #1a1c2c 100%);
  --hero-overlay: rgba(5, 8, 15, 0.4);
  --hero-grid-color: rgba(74, 158, 255, 0.07);
  --hero-glow-1: rgba(74, 158, 255, 0.18);
  --hero-glow-2: rgba(74, 158, 255, 0.12);
  --hero-text-primary: #ffffff;
  --hero-text-secondary: #4a9eff;
  --hero-text-description: rgba(255, 255, 255, 0.85);
  --hero-text-strong: #4a9eff;
  --hero-code-bg: rgba(0, 0, 0, 0.5);
  --hero-code-border: rgba(74, 158, 255, 0.2);
  --hero-btn-secondary-text: #ffffff;
  --hero-btn-secondary-border: #ffffff;
  --hero-scroll-arrow: #ffffff;
}

/* Typography */
body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit;
  font-weight: 700;
  line-height: 1.2;
}

/* Accessibility helpers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}