/* Estilos para el bosque digital encantado */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-color: var(--color-bg);
  overflow: hidden;
}

/* Estrellas transformadas en luciérnagas digitales */
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background-color: var(--color-leaf);
  border-radius: 50%;
  opacity: 0.7;
  animation: firefly linear infinite;
}

.star:nth-child(5n + 1) {
  width: 1px;
  height: 1px;
  background-color: var(--color-primary);
}

.star:nth-child(5n + 2) {
  width: 2px;
  height: 2px;
  box-shadow: 0 0 3px 1px rgba(82, 214, 129, 0.3);
}

.star:nth-child(5n + 3) {
  width: 3px;
  height: 3px;
  box-shadow: 0 0 4px 1px rgba(82, 214, 129, 0.4);
  background-color: var(--color-leaf);
}

.star:nth-child(5n + 4) {
  width: 2px;
  height: 2px;
  box-shadow: 0 0 4px 1px rgba(38, 78, 134, 0.5);
  background-color: var(--color-secondary);
}

.star:nth-child(5n) {
  width: 4px;
  height: 4px;
  box-shadow: 0 0 6px 2px rgba(255, 192, 74, 0.6);
  background-color: var(--color-accent);
}

/* Animación de las luciérnagas mejorada */
@keyframes firefly {
  0% {
    opacity: 0.2;
    transform: scale(0.5) translateY(0);
  }
  25% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
    transform: scale(1) translateY(-10px);
  }
  75% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.2;
    transform: scale(0.5) translateY(0);
  }
}

/* Código binario flotante */
.binary {
  position: absolute;
  color: rgba(82, 214, 129, 0.2);
  font-family: "Courier New", monospace;
  font-size: 14px;
  opacity: 0.1;
  pointer-events: none;
  z-index: -1;
  animation: fade-float linear infinite;
  text-shadow: 0 0 5px rgba(37, 161, 142, 0.3);
}

@keyframes fade-float {
  0% {
    opacity: 0.05;
    transform: translateY(0);
  }
  50% {
    opacity: 0.15;
  }
  100% {
    opacity: 0.05;
    transform: translateY(-150px);
  }
}

/* Efectos para elementos mágicos */
.magic-glow {
  position: relative;
}

.magic-glow::after {
  content: "";
  position: absolute;
  top: -15px;
  left: -15px;
  right: -15px;
  bottom: -15px;
  background: radial-gradient(
    circle,
    rgba(82, 214, 129, 0.3) 0%,
    rgba(38, 78, 134, 0.2) 40%,
    transparent 80%
  );
  border-radius: 20px;
  z-index: -1;
  filter: blur(20px);
  opacity: 0;
  transition: opacity 0.7s ease;
}

.magic-glow:hover::after {
  opacity: 0.9;
}

/* Efectos de partículas de hojas digitales */
.leaf-particle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-image: url("/images/leaf-particle.webp");
  background-size: cover;
  opacity: 0;
  transform-origin: center;
  animation: leaf-float 12s linear infinite;
  pointer-events: none;
  z-index: -1;
  filter: hue-rotate(random(360) + "deg");
}

@keyframes leaf-float {
  0% {
    transform: rotate(0deg) translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: rotate(360deg) translateY(-250px) translateX(120px);
    opacity: 0;
  }
}

/* Efectos de números mágicos y runas */
.number {
  position: absolute;
  font-family: "Courier New", monospace;
  color: var(--color-secondary);
  opacity: 0.25;
  font-size: 16px;
  animation: number-pulse 4s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
  text-shadow: 0 0 8px var(--color-primary);
}

.rune {
  position: absolute;
  font-family: "RuneScape UF", "Cinzel", serif;
  color: var(--color-accent);
  opacity: 0.2;
  font-size: 18px;
  animation: rune-pulse 6s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
  transform: rotate(var(--rotate, 0deg));
  --rotate: calc(random(90) * 1deg);
}

@keyframes number-pulse {
  0% {
    opacity: 0.15;
    transform: scale(0.8) translateY(0);
  }
  50% {
    opacity: 0.35;
    transform: scale(1) translateY(-10px);
  }
  100% {
    opacity: 0.15;
    transform: scale(0.8) translateY(0);
  }
}

@keyframes rune-pulse {
  0% {
    opacity: 0.1;
    transform: scale(0.7) rotate(var(--rotate));
  }
  50% {
    opacity: 0.25;
    transform: scale(1.1) rotate(calc(var(--rotate) + 5deg));
  }
  100% {
    opacity: 0.1;
    transform: scale(0.7) rotate(var(--rotate));
  }
}

/* Efecto de líneas mágicas de código */
.code-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-primary),
    transparent
  );
  opacity: 0.15;
  transform-origin: left;
  z-index: -1;
  animation: code-line 8s ease-in-out infinite;
}

@keyframes code-line {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }
  50% {
    transform: scaleX(1);
    opacity: 0.2;
  }
  100% {
    transform: scaleX(0);
    opacity: 0;
  }
}

/* Efectos de fade-in para secciones */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Efectos de burbujas de luz */
.light-orb {
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8),
    rgba(82, 214, 129, 0.5) 50%,
    transparent
  );
  filter: blur(2px);
  animation: float-orb 15s ease-in-out infinite;
  opacity: 0.6;
  pointer-events: none;
}

@keyframes float-orb {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0.2;
  }
  25% {
    transform: translateY(-50px) translateX(20px) scale(1.2);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-100px) translateX(0) scale(0.8);
    opacity: 0.4;
  }
  75% {
    transform: translateY(-50px) translateX(-20px) scale(1.1);
    opacity: 0.6;
  }
  100% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0.2;
  }
}
