/* ===========================
   STARFIELD BACKGROUND
=========================== */

/* Starfield container */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: radial-gradient(ellipse at bottom, #0d1117 0%, #020409 100%);
  overflow: hidden;
}

/* Show stars in dark mode */
body.dark-mode .stars {
  opacity: 1;
}

/* Base star */
.star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle ease-in-out infinite;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Star types */
.star.far {
  width: 1px;
  height: 1px;
  opacity: 0.4;
}

.star.mid {
  width: 2px;
  height: 2px;
  opacity: 0.7;
}

.star.near {
  width: 3px;
  height: 3px;
  opacity: 0.9;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
  transition: box-shadow 0.6s ease;
}

/* Twinkle animation */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Near stars glow more near moon */
body.dark-mode .moon ~ .stars .star.near {
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

/* Nebula glow overlay for depth */
.stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(100, 100, 255, 0.05), transparent 70%);
  z-index: -1;
}

/* ===========================
   SHOOTING STARS
=========================== */
.shooting-star {
  position: absolute;
  width: 2px;
  height: 80px;
  background: linear-gradient(white, rgba(255,255,255,0));
  border-radius: 50%;
  transform: rotate(45deg);
  animation: shooting 2s linear infinite;
  opacity: 0;
}

@keyframes shooting {
  0% {
    transform: translateX(0) translateY(0) rotate(45deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-800px) translateY(400px) rotate(45deg);
    opacity: 0;
  }
}

/* ===========================
   MOON
=========================== */
.moon {
  position: fixed;
  top: 15%;
  right: 10%;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #eee 60%, #ccc 100%);
  box-shadow: 0 0 50px 20px rgba(255,255,220,0.2),
              0 0 120px 50px rgba(255,255,200,0.1),
              0 0 200px 100px rgba(255,255,180,0.05);
  pointer-events: none;
  z-index: 2;
  overflow: hidden;

  /* Hidden by default (light mode) */
  opacity: 0;
  animation: none;
  transition: opacity 0.6s ease;
}

/* Show moon in dark mode with animations */
body.dark-mode .moon {
  opacity: 1;
  animation: moonPulse 6s ease-in-out infinite alternate,
             moonFloat 12s ease-in-out infinite alternate,
             moonRotate 60s linear infinite,
             moonFlicker 1.2s ease-in-out infinite;
}

/* Moon craters for depth */
.moon::before,
.moon::after,
.moon .crater-small {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,0.25), transparent 70%);
}

/* Craters */
.moon::before { width: 12px; height: 12px; top: 25%; left: 20%; }
.moon::after { width: 8px; height: 8px; top: 60%; left: 55%; }

/* Small flickering craters */
.moon .crater-small:nth-child(1) { width: 4px; height: 4px; top: 40%; left: 30%; }
.moon .crater-small:nth-child(2) { width: 3px; height: 3px; top: 50%; left: 65%; }
.moon .crater-small:nth-child(3) { width: 5px; height: 5px; top: 70%; left: 40%; }

/* ===========================
   MOON ANIMATIONS
=========================== */
@keyframes moonPulse {
  0% { transform: scale(1); box-shadow: 0 0 50px 20px rgba(255,255,220,0.2), 0 0 120px 50px rgba(255,255,200,0.1); }
  50% { transform: scale(1.03); box-shadow: 0 0 70px 25px rgba(255,255,255,0.25), 0 0 140px 60px rgba(255,255,220,0.15); }
  100% { transform: scale(1); box-shadow: 0 0 50px 20px rgba(255,255,220,0.2), 0 0 120px 50px rgba(255,255,200,0.1); }
}

@keyframes moonFloat {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

@keyframes moonRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes moonFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}
