/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Color palette — deep dark with electric accents */
  --bg-primary: #06070a;
  --bg-secondary: #0c0e14;
  --bg-card: rgba(14, 17, 28, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-glass: rgba(255, 255, 255, 0.06);

  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.55);
  --text-muted: rgba(240, 240, 245, 0.3);

  --accent-1: #6366f1; /* Indigo */
  --accent-2: #a78bfa; /* Violet */
  --accent-3: #38bdf8; /* Sky blue */
  --accent-4: #22d3ee; /* Cyan */
  --accent-glow: rgba(99, 102, 241, 0.35);

  /* Gradient */
  --gradient-hero: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  --gradient-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(56, 189, 248, 0.08));

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 700ms;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

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

/* ============================================
   EQUATIONS BACKGROUND
   ============================================ */
.equations-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.equation-float {
  position: absolute;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  opacity: 0;
  animation: floatUp linear forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(20px) rotate(var(--rot, 0deg));
  }
  10% {
    opacity: var(--max-opacity, 0.2);
  }
  85% {
    opacity: var(--max-opacity, 0.2);
  }
  100% {
    opacity: 0;
    transform: translateY(calc(-100vh - 50px)) rotate(var(--rot, 0deg));
  }
}

/* ============================================
   GRID OVERLAY
   ============================================ */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 70%);
}

/* ============================================
   GRADIENT ORBS
   ============================================ */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2), transparent 70%);
  top: -10%;
  right: -10%;
  animation: orbDrift1 20s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 70%);
  bottom: 10%;
  left: -8%;
  animation: orbDrift2 25s ease-in-out infinite;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.1), transparent 70%);
  top: 50%;
  left: 40%;
  animation: orbDrift3 18s ease-in-out infinite;
}

@keyframes orbDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-60px, 40px) scale(1.1); }
  66% { transform: translate(30px, -30px) scale(0.95); }
}

@keyframes orbDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -40px) scale(1.08); }
  66% { transform: translate(-40px, 30px) scale(0.92); }
}

@keyframes orbDrift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -50px) scale(1.15); }
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-md) var(--space-xl);
  transition: background var(--duration-normal) ease, 
              backdrop-filter var(--duration-normal) ease,
              border-color var(--duration-normal) ease;
  border-bottom: 1px solid transparent;
}

.header.scrolled {
  background: rgba(6, 7, 10, 0.8);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom-color: var(--border-glass);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient-hero);
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
}

.nav {
  display: flex;
  gap: var(--space-lg);
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-hero);
  border-radius: 1px;
  transition: width var(--duration-normal) var(--ease-out-expo),
              left var(--duration-normal) var(--ease-out-expo);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
  left: 0;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px var(--space-xl) var(--space-3xl);
  text-align: center;
}

.hero-content {
  max-width: 800px;
}

/* Badge */
.badge,
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-xl);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-3);
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent-3);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Title */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
}

.title-line {
  display: block;
}

.gradient-text {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

/* Subtitle */
.hero-subtitle {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--space-xl);
  line-height: 1.7;
  font-weight: 400;
}

/* Email form */
.cta-row {
  margin-bottom: var(--space-2xl);
}

.email-form {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.04);
  padding: 5px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
}

.email-form:focus-within {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1),
              0 0 30px rgba(99, 102, 241, 0.08);
}

.email-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: var(--space-sm) var(--space-md);
  width: 260px;
}

.email-input::placeholder {
  color: var(--text-muted);
}

.cta-btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  background: var(--gradient-hero);
  border: none;
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) ease;
}

.cta-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.cta-btn:active {
  transform: scale(0.98);
}

/* Stats */
.stats-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xl);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 30px;
  background: var(--border-glass);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: fadeInUp 1s 1.8s ease both;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent-1), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7); }
  50% { opacity: 1; transform: scaleY(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
  position: relative;
  z-index: 1;
  padding: var(--space-3xl) var(--space-xl);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-content {
  max-width: 1100px;
  width: 100%;
  text-align: center;
}

.about-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 700px;
  margin: 0 auto var(--space-2xl);
}

/* About cards */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.about-card {
  position: relative;
  padding: var(--space-xl) var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
  transition: transform var(--duration-normal) var(--ease-out-expo),
              border-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease;
  overflow: hidden;
}

.about-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-subtle);
  opacity: 0;
  transition: opacity var(--duration-normal) ease;
}

.about-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
              0 0 40px rgba(99, 102, 241, 0.06);
}

.about-card:hover::before {
  opacity: 1;
}

.card-icon {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-2);
  margin-bottom: var(--space-md);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.about-card h3 {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.about-card p {
  position: relative;
  z-index: 1;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Floating equation in about */
.about-equation {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.5vw, 1.6rem);
  color: var(--text-muted);
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  display: inline-block;
  letter-spacing: 0.05em;
  animation: eqGlow 4s ease-in-out infinite;
}

@keyframes eqGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.02);
    border-color: var(--border-glass);
  }
  50% {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.12);
  }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  position: relative;
  z-index: 1;
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-glass);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================
   ENTRANCE ANIMATIONS
   ============================================ */
.hero-content .badge,
.hero-content .hero-title,
.hero-content .hero-subtitle,
.hero-content .cta-row,
.hero-content .stats-row {
  opacity: 0;
  transform: translateY(30px);
  animation: revealUp var(--duration-slow) var(--ease-out-expo) forwards;
}

.hero-content .badge        { animation-delay: 0.1s; }
.hero-content .hero-title   { animation-delay: 0.25s; }
.hero-content .hero-subtitle { animation-delay: 0.4s; }
.hero-content .cta-row      { animation-delay: 0.55s; }
.hero-content .stats-row    { animation-delay: 0.7s; }

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* About section reveal on scroll (JS-driven class) */
.about-card,
.about-title,
.section-badge,
.about-equation {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--ease-out-expo),
              transform 0.8s var(--ease-out-expo);
}

.about-card.visible,
.about-title.visible,
.section-badge.visible,
.about-equation.visible {
  opacity: 1;
  transform: translateY(0);
}

.about-card:nth-child(2) { transition-delay: 0.1s; }
.about-card:nth-child(3) { transition-delay: 0.2s; }

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .equation-float,
  .orb,
  .scroll-line {
    animation: none;
  }

  .hero-content .badge,
  .hero-content .hero-title,
  .hero-content .hero-subtitle,
  .hero-content .cta-row,
  .hero-content .stats-row {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .about-card,
  .about-title,
  .section-badge,
  .about-equation {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    flex-direction: column;
    gap: var(--space-md);
  }

  .stat-divider {
    width: 40px;
    height: 1px;
  }

  .email-form {
    flex-direction: column;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 360px;
  }

  .email-input {
    width: 100%;
    text-align: center;
  }

  .cta-btn {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
  }

  .header {
    padding: var(--space-sm) var(--space-md);
  }

  .hero,
  .about {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }
}
