/* ===== ANIMATED RACING BACKGROUND ===== */
.hero-videos {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #05070c;
}

.hero-videos video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.hero-videos video.active {
  opacity: 1;
}

.racing-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  background: transparent;
}

/* Asphalt base */
.racing-bg .asphalt {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(5, 7, 12, 0.78) 0%,
    rgba(5, 7, 12, 0.34) 42%,
    rgba(5, 7, 12, 0.62) 100%);
}

/* Subtle noise / grain */
.racing-bg .asphalt::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
}

/* Horizon glow */
.racing-bg .horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 35%;
  height: 180px;
  background: radial-gradient(ellipse 80% 100% at 50% 100%, 
    rgba(0, 212, 255, 0.18) 0%, 
    rgba(0, 168, 204, 0.08) 40%, 
    transparent 70%);
  filter: blur(2px);
}

/* Perspective track lines */
.racing-bg .track-lines {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 140%;
  height: 55%;
  transform: translateX(-50%);
  background: 
    linear-gradient(to top, 
      transparent 0%, 
      transparent 100%),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 48px,
      rgba(0, 212, 255, 0.07) 48px,
      rgba(0, 212, 255, 0.07) 50px
    );
  mask-image: linear-gradient(to top, black 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(to top, black 0%, transparent 85%);
  animation: trackMove 12s linear infinite;
  transform-origin: center bottom;
  perspective: 400px;
}

.racing-bg .track-lines::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to top, 
    rgba(255, 193, 7, 0.6) 0%, 
    rgba(255, 193, 7, 0.15) 40%, 
    transparent 100%);
  transform: translateX(-50%);
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
}

/* Neon curbs (left & right) */
.racing-bg .neon-curbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.racing-bg .neon-curbs::before,
.racing-bg .neon-curbs::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 8px;
  height: 50%;
  background: linear-gradient(to top, 
    var(--cyan, #00d4ff) 0%, 
    rgba(0, 212, 255, 0.4) 30%, 
    transparent 100%);
  filter: blur(1px);
  opacity: 0.7;
}

.racing-bg .neon-curbs::before {
  left: 12%;
  box-shadow: -4px 0 25px rgba(0, 212, 255, 0.4);
  animation: curbPulse 3s ease-in-out infinite;
}

.racing-bg .neon-curbs::after {
  right: 12%;
  box-shadow: 4px 0 25px rgba(0, 212, 255, 0.4);
  animation: curbPulse 3s ease-in-out infinite 1.5s;
}

/* Grid lights (starting lights style) */
.racing-bg .grid-lights {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  opacity: 0.25;
  z-index: 2;
}

.racing-bg .grid-lights span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #333;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
  animation: lightSequence 4s ease-in-out infinite;
}

.racing-bg .grid-lights span:nth-child(1) { animation-delay: 0s; }
.racing-bg .grid-lights span:nth-child(2) { animation-delay: 0.3s; }
.racing-bg .grid-lights span:nth-child(3) { animation-delay: 0.6s; }
.racing-bg .grid-lights span:nth-child(4) { animation-delay: 0.9s; }
.racing-bg .grid-lights span:nth-child(5) { animation-delay: 1.2s; }

/* Particles container */
#particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(0, 212, 255, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.6);
  animation: particleFloat linear infinite;
}

/* Animations */
@keyframes trackMove {
  0% { background-position: 0 0; }
  100% { background-position: 0 80px; }
}

@keyframes curbPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

@keyframes lightSequence {
  0%, 20% { 
    background: #222; 
    box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
  }
  30%, 60% { 
    background: #ff3b3b; 
    box-shadow: 0 0 12px #ff3b3b, 0 0 0 2px rgba(255,59,59,0.3);
  }
  70%, 100% { 
    background: #00ff66; 
    box-shadow: 0 0 14px #00ff66, 0 0 0 2px rgba(0,255,102,0.3);
  }
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}

/* Speed lines (optional extra) */
.racing-bg .speed-lines {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.15;
}

.racing-bg .speed-lines span {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.8), transparent);
  animation: speedLine 2.5s linear infinite;
}

@keyframes speedLine {
  0% { transform: translateX(-100%) scaleX(0.3); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateX(100vw) scaleX(1); opacity: 0; }
}
