/* ═══════════════════════════════════════════════════════════════
   animations.css — ImpresoPav
   Todas las animaciones de la web:
     1. Animaciones de entrada al hacer scroll (reveal)
     2. Animaciones del hero (aparición inicial)
     3. Efectos hover en tarjetas y botones
     4. Animaciones de la galería
     5. Animaciones del loader/spinner del formulario
   ═══════════════════════════════════════════════════════════════ */


/* ─── 1. REVEAL AL HACER SCROLL ──────────────────────────────────
   Las secciones aparecen suavemente al entrar en pantalla.
   El JavaScript en main.js añade la clase .visible cuando el
   elemento es visible. Aquí definimos el antes y el después.
   ─────────────────────────────────────────────────────────────── */

/* Estado inicial — invisible y desplazado hacia abajo */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

/* Estado final — visible y en su posición */
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Variante: aparece desde la izquierda */
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Variante: aparece desde la derecha */
.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Retrasos de aparición para elementos en fila (efecto cascada) */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }


/* ─── 2. ANIMACIONES DEL HERO (aparición al cargar la página) ─────
   Se ejecutan una sola vez, nada más entrar en la web.
   ─────────────────────────────────────────────────────────────── */

/* La etiqueta naranja pequeña sobre el título */
.hero-tag {
  animation: fadeInDown 0.6s ease both;
  animation-delay: 0.2s;
}

/* El título grande */
.hero-title {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.4s;
}

/* El subtítulo */
.hero-sub {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.6s;
}

/* Los botones */
.hero-actions {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.8s;
}

/* Las estadísticas del hero */
.hero-stats {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 1s;
}

/* Entrada desde arriba */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Entrada desde abajo */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Aparición simple sin movimiento */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* La línea naranja vertical del hero */
.hero-accent-line {
  animation: growHeight 1.2s ease both;
  animation-delay: 0.3s;
}

@keyframes growHeight {
  from {
    transform: scaleY(0);
    transform-origin: top;
  }
  to {
    transform: scaleY(1);
    transform-origin: top;
  }
}


/* ─── 3. ANIMACIONES DE LA FRANJA NARANJA (features strip) ────── */

.feature-strip-item {
  animation: fadeInUp 0.5s ease both;
}
.feature-strip-item:nth-child(1) { animation-delay: 0.1s; }
.feature-strip-item:nth-child(2) { animation-delay: 0.2s; }
.feature-strip-item:nth-child(3) { animation-delay: 0.3s; }
.feature-strip-item:nth-child(4) { animation-delay: 0.4s; }

/* El icono gira suavemente al hacer hover en la tarjeta */
.feature-strip-item:hover .feature-strip-icon {
  animation: wiggle 0.4s ease;
}

@keyframes wiggle {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(-10deg); }
  75%  { transform: rotate(10deg); }
  100% { transform: rotate(0deg); }
}


/* ─── 4. ANIMACIONES DE LOS PASOS DEL PROCESO ───────────────────
   El icono del círculo se ilumina en naranja al hacer hover.
   (La transición de color ya está en styles.css,
   aquí añadimos el efecto de pulso al entrar en pantalla)
   ─────────────────────────────────────────────────────────────── */

/* Pulso suave al hacer hover en el paso */
.proceso-step:hover .proceso-step-icon {
  animation: pulse 0.4s ease;
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* El número grande de fondo aparece al hacer scroll */
.proceso-step.visible .proceso-step-num {
  animation: fadeIn 1s ease both;
  animation-delay: 0.3s;
}


/* ─── 5. ANIMACIONES DE LA GALERÍA ──────────────────────────────
   Cada foto entra con un pequeño rebote al filtrar.
   ─────────────────────────────────────────────────────────────── */

/* Cuando un item de galería aparece tras filtrar */
@keyframes galleryIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Esta clase la añade gallery.js al mostrar un item */
.gallery-item.appearing {
  animation: galleryIn 0.35s ease both;
}

/* El overlay de texto aparece con deslizamiento desde abajo */
.gallery-item-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

/* El texto dentro del overlay sube ligeramente al hacer hover */
.gallery-item-overlay > div {
  transform: translateY(6px);
  transition: transform 0.3s ease;
}
.gallery-item:hover .gallery-item-overlay > div {
  transform: translateY(0);
}


/* ─── 6. ANIMACIÓN DEL LIGHTBOX ─────────────────────────────────
   La imagen aparece con un suave zoom al abrir el lightbox.
   ─────────────────────────────────────────────────────────────── */

#lightbox.open img {
  animation: lightboxIn 0.3s ease both;
}

@keyframes lightboxIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}


/* ─── 7. ANIMACIONES DE LA CALCULADORA ──────────────────────────
   El precio cambia con un pequeño salto al actualizar.
   ─────────────────────────────────────────────────────────────── */

/* Esta clase la añade calculator.js al actualizar el precio */
.calc-result-price.updated {
  animation: priceJump 0.25s ease both;
}

@keyframes priceJump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); color: #F48C06; }
  100% { transform: scale(1); }
}

/* Las opciones de la calculadora tienen una transición suave */
.calc-option {
  transition: background 0.2s ease, border-color 0.2s ease,
              color 0.2s ease, transform 0.15s ease;
}
.calc-option:active {
  transform: scale(0.97);
}


/* ─── 8. SPINNER DEL FORMULARIO ─────────────────────────────────
   Aparece dentro del botón "Enviando..." mientras procesa.
   ─────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ─── 9. ANIMACIÓN DEL SCROLL INDICATOR (flecha del hero) ───────
   La flecha de "scroll" bota suavemente para llamar la atención.
   ─────────────────────────────────────────────────────────────── */

.hero-scroll {
  animation: bounceScroll 2s ease infinite;
}

@keyframes bounceScroll {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}


/* ─── 10. ANIMACIÓN DE LA LÍNEA NARANJA BAJO TÍTULOS ────────────
   La línea corta debajo de los títulos de sección crece desde
   la izquierda cuando la sección entra en pantalla.
   ─────────────────────────────────────────────────────────────── */

.section-line {
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.6s ease;
}

/* main.js añade .visible al padre .section-header cuando es visible */
.section-header.visible .section-line {
  transform: scaleX(1);
}


/* ─── 11. HOVER EN BOTONES PRINCIPALES ──────────────────────────
   Pequeño desplazamiento hacia arriba al pasar el ratón.
   ─────────────────────────────────────────────────────────────── */

.btn-primary,
.btn-secondary,
.form-submit,
.calc-cta {
  transition: background 0.25s ease, transform 0.2s ease,
              border-color 0.25s ease, color 0.25s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.form-submit:hover,
.calc-cta:hover {
  transform: translateY(-2px);
}

.btn-primary:active,
.btn-secondary:active,
.form-submit:active,
.calc-cta:active {
  transform: translateY(0);
}


/* ─── 12. ANIMACIÓN DEL NAVBAR AL HACER SCROLL ──────────────────
   El navbar cambia de transparente a oscuro con una transición
   suave. La clase .scrolled la añade main.js.
   ─────────────────────────────────────────────────────────────── */

#navbar {
  transition: background 0.4s ease, border-color 0.4s ease,
              box-shadow 0.4s ease;
}


/* ─── 13. CONTADOR DE NÚMEROS DEL HERO ──────────────────────────
   El número parpadea suavemente cuando termina de contar.
   Esta clase la añade main.js al terminar la animación.
   ─────────────────────────────────────────────────────────────── */

.hero-stat-num.done {
  animation: numberDone 0.4s ease both;
}

@keyframes numberDone {
  0%   { color: #ffffff; }
  50%  { color: #F48C06; }
  100% { color: #E85D04; }
}


/* ─── 14. RESPONSIVE — desactivar algunas animaciones en móvil ──
   En pantallas pequeñas algunas animaciones pueden verse raras
   o ralentizar el dispositivo.
   ─────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  /* Simplificar las transiciones del hero en móvil */
  .hero-tag,
  .hero-title,
  .hero-sub,
  .hero-actions,
  .hero-stats {
    animation-duration: 0.4s;
  }

  /* Desactivar el efecto parallax del acento */
  .hero-accent-line {
    animation: none;
  }
}

/* Respetar la preferencia del sistema "reducir movimiento"
   para usuarios con sensibilidad al movimiento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}