/* ==========================================================================
   ट्रक वाला (Truck Wala) - Visual Highway Environment
   ========================================================================== */

.environment-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

/* 1. Sky: 30-Second Infinite Linear Gradient Animation */
.sky {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    #050713 0%,
    #130f2c 16%,
    #2f1147 36%,
    #631e50 54%,
    #a83246 70%,
    #de5d35 84%,
    #f99f43 94%,
    #ffd269 100%
  );
  background-size: 100% 300%;
  animation: skyShift 30s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes skyShift {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 0% 100%;
  }
}

/* 2. Twinkling Sky Stars */
.stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 65%;
  background-image: 
    radial-gradient(2px 2px at 30px 40px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 140px 90px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 280px 150px, rgba(255,255,255,0.85), rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 480px 60px, #ffd166, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 640px 120px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 820px 80px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 980px 140px, #ffb703, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 1180px 50px, #ffffff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 1200px 320px;
  opacity: 0.7;
  z-index: 2;
  animation: starTwinkle 5s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0.35; }
  100% { opacity: 0.85; }
}

/* 3. Glowing Sun in Lower-Left Background */
.sun {
  position: absolute;
  left: 8vw;
  bottom: 21vh;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe6 0%, #ffaa40 45%, #ff5e36 90%);
  box-shadow: 
    0 0 45px 18px rgba(255, 170, 64, 0.75),
    0 0 100px 50px rgba(255, 94, 54, 0.5),
    0 0 180px 90px rgba(255, 60, 0, 0.3);
  z-index: 3;
  animation: sunPulse 6s ease-in-out infinite alternate;
}

@keyframes sunPulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.05); filter: brightness(1.2); }
}

/* 4. Distant Mountain Silhouettes */
.mountains-back {
  position: absolute;
  bottom: 14.8vh;
  left: 0;
  width: 100%;
  height: 24vh;
  background: linear-gradient(to bottom, transparent 0%, rgba(35, 15, 55, 0.75) 40%, #170b24 100%);
  clip-path: polygon(
    0% 100%, 0% 55%, 12% 40%, 25% 65%, 40% 25%, 55% 58%, 
    68% 30%, 82% 62%, 92% 35%, 100% 50%, 100% 100%
  );
  z-index: 4;
  opacity: 0.75;
}

.mountains-front {
  position: absolute;
  bottom: 14.8vh;
  left: 0;
  width: 100%;
  height: 18vh;
  background: linear-gradient(to bottom, transparent 0%, rgba(20, 10, 30, 0.9) 35%, #10081c 100%);
  clip-path: polygon(
    0% 100%, 0% 70%, 15% 50%, 30% 75%, 45% 42%, 60% 70%, 
    75% 48%, 90% 68%, 100% 58%, 100% 100%
  );
  z-index: 5;
  opacity: 0.95;
}

/* 5. Roadside Parallax Scenery (Milestones & Dhabas) */
.roadside-scenery {
  position: absolute;
  bottom: 14.9vh;
  left: 0;
  width: 200%;
  height: 70px;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  gap: 340px;
  animation: sceneryScroll 10s linear infinite;
}

.speed-fast .roadside-scenery { animation-duration: 5s; }
.speed-slow .roadside-scenery { animation-duration: 20s; }

@keyframes sceneryScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.milestone {
  width: 28px;
  height: 40px;
  background: #f1f5f9;
  border-top: 12px solid #eab308;
  border-radius: 14px 14px 0 0;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.6);
  position: relative;
  flex-shrink: 0;
}

.milestone::after {
  content: "NH-44";
  font-size: 6px;
  color: #0f172a;
  font-weight: 800;
  position: absolute;
  top: 14px;
  left: 2px;
  letter-spacing: 0.5px;
}

.dhaba-board {
  background: #b91c1c;
  color: #fef08a;
  border: 2px solid #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.7);
  white-space: nowrap;
  flex-shrink: 0;
}

/* 6. Highway: 15vh Height */
.highway {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 15vh;
  background: linear-gradient(180deg, #23232c 0%, #15151a 50%, #0a0a0d 100%);
  border-top: 3px solid #3d3d4d;
  z-index: 10;
  box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.8);
}

/* Moving Dashed Yellow Center Line */
.highway-line {
  position: absolute;
  top: 50%;
  left: 0;
  width: 200%;
  height: 6px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(
    90deg,
    #facc15 0px,
    #facc15 65px,
    transparent 65px,
    transparent 120px
  );
  animation: highwayDrive 0.8s linear infinite;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
}

.speed-fast .highway-line { animation-duration: 0.4s; }
.speed-slow .highway-line { animation-duration: 1.6s; }

@keyframes highwayDrive {
  0% { transform: translateY(-50%) translateX(0); }
  100% { transform: translateY(-50%) translateX(-120px); }
}

/* 7. Truck Container & Bouncing Animation */
.truck-container {
  position: absolute;
  bottom: 12.8vh;
  left: 14vw;
  width: 230px;
  height: 125px;
  z-index: 15;
  animation: truckBounce 0.45s ease-in-out infinite alternate;
  filter: drop-shadow(0 16px 14px rgba(0, 0, 0, 0.85));
  transition: transform 0.1s ease;
}

.speed-fast .truck-container { animation-duration: 0.25s; }
.speed-slow .truck-container { animation-duration: 0.7s; }

@keyframes truckBounce {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-3.5px) rotate(-0.35deg);
  }
  100% {
    transform: translateY(-0.8px) rotate(0.15deg);
  }
}

/* Truck Honk Shake */
.truck-container.is-honking {
  animation: truckHonkShake 0.15s ease-in-out infinite alternate !important;
}

@keyframes truckHonkShake {
  0% { transform: translateY(-4px) scale(1.02) rotate(-0.5deg); }
  100% { transform: translateY(2px) scale(0.99) rotate(0.5deg); }
}

/* Truck Graphic & Silhouette */
.truck-graphic {
  width: 100%;
  height: 100%;
  background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/e4/Truck_silhouette.svg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center bottom;
  position: relative;
}

.truck-svg-fallback {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Headlight Beams (Low Beam / High Beam / Dipper) */
.headlight-beam {
  position: absolute;
  top: 60px;
  right: -190px;
  width: 260px;
  height: 75px;
  background: linear-gradient(90deg, rgba(255, 245, 170, 0.6) 0%, rgba(255, 235, 120, 0.22) 50%, transparent 100%);
  clip-path: polygon(0% 32%, 100% 0%, 100% 100%, 0% 68%);
  pointer-events: none;
  filter: blur(4px);
  opacity: 0.7;
  transition: all 0.2s ease;
}

/* High Beam Mode */
.lights-high .headlight-beam {
  opacity: 1;
  width: 380px;
  height: 110px;
  top: 45px;
  right: -290px;
  background: linear-gradient(90deg, rgba(255, 255, 220, 0.95) 0%, rgba(255, 245, 150, 0.45) 55%, transparent 100%);
  filter: blur(2px);
}

/* Lights Off Mode */
.lights-off .headlight-beam {
  opacity: 0;
}

/* Dipper Flash Keyframe */
.lights-flashing .headlight-beam {
  animation: dipperFlash 0.15s ease-in-out infinite alternate;
}

@keyframes dipperFlash {
  0% { opacity: 0.1; }
  100% { opacity: 1; filter: brightness(1.5); }
}

/* Visual Slogan Banner */
.truck-slogan-tag {
  position: absolute;
  top: -34px;
  left: 10px;
  background: rgba(10, 10, 18, 0.9);
  border: 1px solid var(--primary-accent);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--primary-accent);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75), 0 0 10px rgba(250, 204, 21, 0.25);
  animation: tagFloat 3s ease-in-out infinite alternate;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.truck-slogan-tag:hover {
  background: rgba(26, 26, 42, 0.95);
  border-color: #ffffff;
  color: #ffffff;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8), 0 0 16px rgba(250, 204, 21, 0.5);
}

.truck-slogan-tag:active {
  transform: scale(0.96);
}

.truck-slogan-tag.slogan-transition {
  opacity: 0;
  transform: translateY(6px) scale(0.9);
}

/* Honk Visual Blast Bubble */
.honk-bubble {
  position: absolute;
  top: -55px;
  right: -20px;
  background: #facc15;
  color: #000000;
  font-weight: 900;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.8);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.honk-bubble.active {
  opacity: 1;
  transform: scale(1.1) rotate(6deg);
}

@media (max-width: 768px) {
  .truck-container {
    width: 175px;
    height: 100px;
    left: 8vw;
    bottom: 13.5vh;
  }
}
