/* ===========================
   CARRUSEL DE PORTADA HERO
   =========================== */

/* Ajustes al hero principal */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: #000;
}

/* Wrapper del carrusel */
.hero-carousel-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Track del carrusel */
.hero-carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slides individuales */
.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.2s ease-in-out, visibility 0s linear 1.2s;
  z-index: 1;
  background-color: #000; /* Fallback mientras carga */
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 1.2s ease-in-out, visibility 0s linear 0s;
  z-index: 2;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  filter: brightness(0.8) contrast(1.05);
  background-color: #000; /* Fallback mientras carga */
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

/* Primera imagen distribuida (cover) - las demás mantienen contain */
.hero-slide:first-child img {
  object-fit: cover;
}

.hero-slide img.loaded,
.hero-slide img[complete="true"] {
  opacity: 1;
}

/* Asegurar que la primera imagen se vea inmediatamente */
.hero-slide.active img {
  opacity: 1;
}

/* Overlay para cada slide */
.hero-slide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.05) 50%,
    rgba(0, 0, 0, 0.2) 100%
  );
  z-index: 3;
}

/* Botones de navegación */
.hero-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-size: 1.2rem;
  opacity: 0.8;
  pointer-events: auto;
}

.hero-carousel-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  opacity: 1;
  transform: translateY(-50%) scale(1.05);
}

.hero-carousel-prev {
  left: 30px;
}

.hero-carousel-next {
  right: 30px;
}

/* Indicadores */
.hero-carousel-indicators {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 999;
  pointer-events: auto;
}

.hero-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
  pointer-events: auto;
}

.hero-indicator:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.hero-indicator.active {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.2);
}

/* Contenido del hero */
.hero-content {
  position: relative;
  z-index: 5;
  max-width: 800px;
  padding: var(--spacing-md);
  animation: fadeInUp 1.5s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Partículas mantienen su posición */
.particles-container {
  z-index: 4;
}

/* Responsive design */
@media (max-width: 768px) {
  .hero {
    height: 70vh;
    min-height: 500px;
  }
  
  .hero-carousel-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .hero-carousel-prev {
    left: 15px;
  }
  
  .hero-carousel-next {
    right: 15px;
  }
  
  .hero-carousel-indicators {
    bottom: 20px;
    gap: 10px;
  }
  
  .hero-indicator {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  .hero {
    height: 60vh;
    min-height: 400px;
  }
  
  .hero-carousel-btn {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }
  
  .hero-carousel-prev {
    left: 10px;
  }
  
  .hero-carousel-next {
    right: 10px;
  }
  
  .hero-carousel-indicators {
    bottom: 15px;
    gap: 8px;
  }
  
  .hero-indicator {
    width: 8px;
    height: 8px;
  }
}

/* Animaciones específicas */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Efecto de transición suave entre slides */
.hero-slide.transitioning {
  opacity: 0.5;
}

/* Auto-hide controls en móvil tras inactividad */
.hero-carousel-wrapper.auto-hide .hero-carousel-btn,
.hero-carousel-wrapper.auto-hide .hero-carousel-indicators {
  opacity: 0;
  pointer-events: none;
}

.hero-carousel-wrapper:hover .hero-carousel-btn,
.hero-carousel-wrapper:hover .hero-carousel-indicators {
  opacity: 0.8;
  pointer-events: auto;
}

/* Mejoras para accesibilidad */
.hero-carousel-btn:focus {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.hero-indicator:focus {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

/* Preloader para imágenes */
.hero-slide img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.hero-slide img[loading="lazy"].loaded {
  opacity: 1;
}
