/* ===========================
   ANIMACIONES - Header y Hero
   Efectos modernos de entrada
   =========================== */

/* ===========================
   NAVBAR ANIMATIONS
   =========================== */

/* Animación de entrada del navbar */
.navbar {
  animation: slideDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(-100%);
}

@keyframes slideDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animación del logo */
.navbar-brand {
  animation: fadeInScale 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
  opacity: 0;
  transform: scale(0.8);
}

@keyframes fadeInScale {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animación de los nav items */
.nav-item {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

.nav-item:nth-child(1) { animation-delay: 0.4s; }
.nav-item:nth-child(2) { animation-delay: 0.5s; }
.nav-item:nth-child(3) { animation-delay: 0.6s; }
.nav-item:nth-child(4) { animation-delay: 0.7s; }
.nav-item:nth-child(5) { animation-delay: 0.8s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   HERO ANIMATIONS
   =========================== */

/* Animación del fondo hero con zoom sutil */
.hero {
  animation: heroZoom 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: center center;
}

@keyframes heroZoom {
  from {
    transform: scale(1.1);
  }
  to {
    transform: scale(1);
  }
}

/* Overlay animado con gradiente */
.hero__overlay {
  animation: overlayFade 1.2s ease-out forwards;
  opacity: 0;
}

@keyframes overlayFade {
  to {
    opacity: 1;
  }
}

/* Efecto de partículas brillantes */
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(197, 164, 113, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
  animation: particleFloat 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes particleFloat {
  0%, 100% {
    opacity: 0.3;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 0.6;
    transform: translateY(-20px) scale(1.05);
  }
}

/* Animación de líneas decorativas */
.hero::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(
    45deg,
    transparent 48%,
    rgba(255, 255, 255, 0.03) 48%,
    rgba(255, 255, 255, 0.03) 52%,
    transparent 52%
  );
  background-size: 60px 60px;
  opacity: 0.3;
  animation: lineMove 20s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes lineMove {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 60px 60px;
  }
}

/* ===========================
   CONTENT ANIMATIONS
   =========================== */

/* Si hay contenido en el hero (para futuro uso) */
.hero__content {
  animation: contentFadeIn 1s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
  opacity: 0;
  transform: translateY(30px);
}

@keyframes contentFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__title {
  animation: titleSlide 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.7s forwards;
  opacity: 0;
  transform: translateX(-50px);
}

@keyframes titleSlide {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hero__subtitle {
  animation: subtitleSlide 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.9s forwards;
  opacity: 0;
  transform: translateX(50px);
}

@keyframes subtitleSlide {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hero__cta {
  animation: ctaFadeIn 1s cubic-bezier(0.4, 0, 0.2, 1) 1.1s forwards;
  opacity: 0;
  transform: translateY(30px);
}

@keyframes ctaFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   SCROLL EFFECTS
   =========================== */

/* Efecto parallax en scroll (aplicado via JS) */
.hero.parallax {
  transition: transform 0.1s ease-out;
}

/* Navbar con sombra al hacer scroll */
.navbar.scrolled {
  animation: navbarShadow 0.3s ease forwards;
}

@keyframes navbarShadow {
  to {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 991px) {
  /* Reducir complejidad de animaciones en móvil para performance */
  .hero::before,
  .hero::after {
    display: none;
  }
  
  .hero {
    animation: heroZoomMobile 1s ease-out forwards;
  }
  
  @keyframes heroZoomMobile {
    from {
      transform: scale(1.05);
    }
    to {
      transform: scale(1);
    }
  }
}

@media (max-width: 768px) {
  /* Simplificar aún más en pantallas pequeñas */
  .nav-item {
    animation: fadeIn 0.5s ease forwards;
  }
  
  @keyframes fadeIn {
    to {
      opacity: 1;
    }
  }
  
  .hero__content,
  .hero__title,
  .hero__subtitle,
  .hero__cta {
    animation: simpleFadeIn 0.8s ease forwards;
  }
  
  @keyframes simpleFadeIn {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ===========================
   PRELOADER (opcional)
   =========================== */

/* Si quieres agregar un preloader */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #3A5F58 0%, #1E1E1E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: preloaderFade 0.5s ease 1.5s forwards;
}

.preloader__spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(197, 164, 113, 0.3);
  border-top-color: #C5A471;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes preloaderFade {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* ===========================
   HOVER ENHANCEMENTS
   =========================== */

/* Efecto de brillo en nav links */
.nav-link {
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.nav-link:hover::before {
  left: 100%;
}

/* Efecto de elevación en logo */
.navbar-brand {
  transition: transform 0.3s ease;
}

.navbar-brand:hover {
  transform: translateY(-3px);
}

/* ===========================
   SCROLL TO TOP BUTTON
   =========================== */

.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, rgba(58, 95, 88, 1) 0%, rgba(30, 30, 30, 0.98) 100%);
  border: 1px solid rgba(197, 164, 113, 0.3);
  border-radius: 50%;
  color: #C5A471;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  /* backdrop-filter removido - muy costoso en Safari */
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: linear-gradient(135deg, rgba(197, 164, 113, 0.95) 0%, rgba(212, 176, 104, 0.95) 100%);
  color: #1E1E1E;
  border-color: #C5A471;
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(197, 164, 113, 0.4);
}

.scroll-to-top:active {
  transform: translateY(-2px);
}

.scroll-to-top svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.scroll-to-top:hover svg {
  transform: translateY(-3px);
  animation: arrowBounce 0.6s ease infinite;
}

@keyframes arrowBounce {
  0%, 100% {
    transform: translateY(-3px);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Responsive - Botón más pequeño en móvil */
@media (max-width: 768px) {
  .scroll-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }
  
  .scroll-to-top svg {
    width: 20px;
    height: 20px;
  }
}

/* Variante discreta - más pequeña y transparente */
@media (min-width: 1200px) {
  .scroll-to-top {
    width: 45px;
    height: 45px;
    opacity: 0;
  }
  
  .scroll-to-top.visible {
    opacity: 0.7;
  }
  
  .scroll-to-top:hover {
    opacity: 1;
  }
}

/* ===========================
   CASA DONA CATA SECTION ANIMATIONS
   =========================== */

/* Estado inicial de la sección */
#casa-dona-cata {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estado visible */
#casa-dona-cata.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Animación del título */
#casa-dona-cata .section__title {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s,
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

#casa-dona-cata.animate-in .section__title {
  opacity: 1;
  transform: translateY(0);
}

/* Animación del lead text */
#casa-dona-cata .lead {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

#casa-dona-cata.animate-in .lead {
  opacity: 1;
  transform: translateY(0);
}

/* Animación de las columnas (staggered) */
#casa-dona-cata .col-md-4 {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Primera columna */
#casa-dona-cata.animate-in .col-md-4:nth-child(1) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.6s;
}

/* Segunda columna */
#casa-dona-cata.animate-in .col-md-4:nth-child(2) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.8s;
}

/* Tercera columna */
#casa-dona-cata.animate-in .col-md-4:nth-child(3) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1s;
}

/* Animación de los títulos h3 dentro de las columnas */
#casa-dona-cata .col-md-4 h3 {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#casa-dona-cata.animate-in .col-md-4:nth-child(1) h3 {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0.8s;
}

#casa-dona-cata.animate-in .col-md-4:nth-child(2) h3 {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 1s;
}

#casa-dona-cata.animate-in .col-md-4:nth-child(3) h3 {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 1.2s;
}

/* Versión móvil - animaciones más rápidas */
@media (max-width: 768px) {
  #casa-dona-cata,
  #casa-dona-cata .section__title,
  #casa-dona-cata .lead,
  #casa-dona-cata .col-md-4,
  #casa-dona-cata .col-md-4 h3 {
    transition-duration: 0.5s;
  }
  
  #casa-dona-cata.animate-in .col-md-4:nth-child(1),
  #casa-dona-cata.animate-in .col-md-4:nth-child(1) h3 {
    transition-delay: 0.3s;
  }
  
  #casa-dona-cata.animate-in .col-md-4:nth-child(2),
  #casa-dona-cata.animate-in .col-md-4:nth-child(2) h3 {
    transition-delay: 0.4s;
  }
  
  #casa-dona-cata.animate-in .col-md-4:nth-child(3),
  #casa-dona-cata.animate-in .col-md-4:nth-child(3) h3 {
    transition-delay: 0.5s;
  }
}

/* Desactivar animaciones para usuarios con preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  #casa-dona-cata,
  #casa-dona-cata .section__title,
  #casa-dona-cata .lead,
  #casa-dona-cata .col-md-4,
  #casa-dona-cata .col-md-4 h3 {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ===========================
   GALERÍA SECTION ANIMATIONS
   =========================== */

/* Estado inicial de la galería */
#galeria {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estado visible */
#galeria.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Animación de las imágenes de la galería - Sin scale para evitar recuadros */
#galeria .gallery-mosaic__item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered animation para las imágenes */
#galeria.animate-in .gallery-mosaic__item:nth-child(1) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(2) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.2s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(3) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.3s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(4) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.4s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(5) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.5s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(6) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.6s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(7) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.7s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(8) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.8s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(9) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.9s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(10) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(11) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1.1s;
}

#galeria.animate-in .gallery-mosaic__item:nth-child(12) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1.2s;
}

/* Versión móvil - animaciones más rápidas */
@media (max-width: 768px) {
  #galeria,
  #galeria .gallery-mosaic__item {
    transition-duration: 0.5s;
  }
  
  /* Reducir delays en móvil */
  #galeria.animate-in .gallery-mosaic__item {
    transition-delay: 0.05s;
  }
  
  #galeria.animate-in .gallery-mosaic__item:nth-child(n+4) {
    transition-delay: 0.1s;
  }
  
  #galeria.animate-in .gallery-mosaic__item:nth-child(n+7) {
    transition-delay: 0.15s;
  }
}

/* Desactivar animaciones para usuarios con preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  #galeria,
  #galeria .gallery-mosaic__item {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
