:root {
  --bg: #050505;
  --surface: #111111;
  --surface-hover: #1a1a1a;
  --border: #222222;
  --text: #ffffff;
  --text-muted: #888888;
  --accent: #00d4aa;
  --accent-glow: rgba(0, 212, 170, 0.15);
  --gradient: linear-gradient(135deg, #00d4aa, #0088ff);
  --mouse-x: 50%;
  --mouse-y: 50%;
}

/* Loading Screen */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  color: var(--accent);
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: typewriter 1.5s steps(18) forwards, blink 0.7s step-end infinite;
}
.loader-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--gradient);
  animation: loadBar 1.8s ease-out forwards;
}
@keyframes typewriter {
  from { width: 0; }
  to { width: 21ch; }
}
@keyframes blink {
  50% { border-color: transparent; }
}
@keyframes loadBar {
  from { width: 0; }
  to { width: 100%; }
}

/* Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient);
  z-index: 9998;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s linear;
}

/* Animated Gradient Mesh (Hero Background) */
.gradient-mesh {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.gradient-mesh::before,
.gradient-mesh::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  animation: meshMove 12s ease-in-out infinite alternate;
}
.gradient-mesh::before {
  background: #00d4aa;
  top: -200px;
  left: -100px;
}
.gradient-mesh::after {
  background: #0088ff;
  bottom: -200px;
  right: -100px;
  animation-delay: -6s;
  animation-direction: alternate-reverse;
}
@keyframes meshMove {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.1); }
  66% { transform: translate(-40px, 80px) scale(0.9); }
  100% { transform: translate(60px, -40px) scale(1.05); }
}

/* Mouse Glow */
.mouse-glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    600px circle at var(--mouse-x) var(--mouse-y),
    rgba(0, 212, 170, 0.06),
    transparent 60%
  );
}

/* Floating Particles */
.particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 8s linear infinite;
}
.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 25%; animation-delay: 1.5s; }
.particle:nth-child(3) { left: 40%; animation-delay: 3s; }
.particle:nth-child(4) { left: 55%; animation-delay: 4.5s; }
.particle:nth-child(5) { left: 70%; animation-delay: 6s; }
.particle:nth-child(6) { left: 85%; animation-delay: 7.5s; }
@keyframes particleFloat {
  0% { transform: translateY(100vh); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-100px); opacity: 0; }
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.stagger-children.revealed > *:nth-child(1) { transition-delay: 0s; }
.stagger-children.revealed > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.revealed > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-children.revealed > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-children.revealed > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-children.revealed > *:nth-child(6) { transition-delay: 0.5s; }
.stagger-children.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* Section Heading Scale */
.scale-heading {
  transform: scale(0.85);
  transition: transform 0.6s ease;
}
.scale-heading.scaled {
  transform: scale(1);
}

/* Text Reveal Wipe */
.text-wipe {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1s ease;
}
.text-wipe.revealed {
  clip-path: inset(0 0% 0 0);
}

/* Card Tilt */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.15s ease;
}
.tilt-card:hover {
  box-shadow: 0 20px 60px rgba(0, 212, 170, 0.1);
}

/* Card Glow Border */
.glow-card {
  position: relative;
  overflow: hidden;
}
.glow-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(from var(--glow-angle, 0deg), transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
.glow-card:hover::before {
  opacity: 1;
}

/* Logo Marquee */
.marquee-track {
  display: flex;
  gap: 4rem;
  animation: marqueeScroll 40s linear infinite;
}
.marquee-track:hover {
  animation-play-state: paused;
}
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Repeating Text Banner */
.text-marquee {
  display: flex;
  gap: 2rem;
  animation: textMarquee 30s linear infinite;
  opacity: 0.08;
}
.text-marquee:hover {
  opacity: 0.15;
}
@keyframes textMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Section Divider Shimmer */
.divider-shimmer {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: -200% 0; }
  50% { background-position: 200% 0; }
}

/* Stat Counter */
.stat-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gradient Text */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glassmorphism */
.glass {
  background: rgba(17, 17, 17, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

/* Mobile Nav Overlay */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(5, 5, 5, 0.95);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.nav-overlay.open {
  opacity: 1;
  visibility: visible;
}
.nav-overlay a {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.nav-overlay.open a:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.nav-overlay.open a:nth-child(2) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.nav-overlay.open a:nth-child(3) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.nav-overlay.open a:nth-child(4) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.nav-overlay.open a:nth-child(5) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.nav-overlay.open a:nth-child(6) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }
.nav-overlay.open a:nth-child(7) { transition-delay: 0.7s; opacity: 1; transform: translateY(0); }

/* Matrix Rain Easter Egg */
.matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.matrix-canvas.active {
  opacity: 1;
}

/* Breathing Pulse */
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Adaptive logos - white in dark mode, dark in light mode */
.logo-adaptive {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

/* Light Mode */
.light .logo-adaptive {
  filter: brightness(0) invert(0);
  opacity: 0.7;
}

.light {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f0f0f0;
  --border: #e0e0e0;
  --text: #111111;
  --text-muted: #666666;
  --accent-glow: rgba(0, 212, 170, 0.1);
}
.light .gradient-mesh::before,
.light .gradient-mesh::after {
  opacity: 0.15;
}
.light .glass {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.05);
}
