/* ============================================================
   animations.css — Animações e transições
   Fortal Rastreamentos
   ============================================================ */

/* ═══════════════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════════════ */

/* Pulso do dot de status */
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Pulso do marcador no mapa */
@keyframes marker-pulse {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  60%  { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Ondas de sinal (seção posicionamento) */
@keyframes signal-expand {
  0%   { transform: scale(0.85); opacity: 0.6; }
  60%  { transform: scale(1);    opacity: 0.25; }
  100% { transform: scale(0.85); opacity: 0.6; }
}

/* Linha de varredura (scan) no mapa do hero */
@keyframes scan-line {
  0%   { top: 0%;   opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Badge flutuante suave */
@keyframes float-badge {
  0%   { transform: translateY(0px); }
  50%  { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

/* Entrada fade-up para seções */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in simples */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Entrada do tracking card (da direita) */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Rota no mapa — desenho progressivo */
@keyframes draw-route {
  from { stroke-dashoffset: 400; }
  to   { stroke-dashoffset: 0; }
}

/* Blink do sinal online */
@keyframes blink-online {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Entrada de cima para baixo */
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ═══════════════════════════════════════════════════════════
   CLASSES DE ANIMAÇÃO (ativadas por IntersectionObserver)
   ═══════════════════════════════════════════════════════════ */

/* Estado inicial — elementos aguardando entrada */
.anim-fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.anim-fade-in {
  opacity: 0;
  transition: opacity 0.65s ease;
}

.anim-slide-right {
  opacity: 0;
  transform: translateX(32px);
  transition:
    opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Estado ativo — elemento visível */
.anim-fade-up.is-visible,
.anim-fade-in.is-visible,
.anim-slide-right.is-visible {
  opacity: 1;
  transform: none;
}

/* Delays escalonados para grid de cards */
.anim-delay-1 { transition-delay: 0.08s; }
.anim-delay-2 { transition-delay: 0.16s; }
.anim-delay-3 { transition-delay: 0.24s; }
.anim-delay-4 { transition-delay: 0.32s; }

/* Animações internas do tracking card */
.tracking-card {
  animation: slide-in-right 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.3s;
}

/* Rota SVG no mapa */
.map-route-path {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: draw-route 2s ease forwards;
  animation-delay: 1s;
}

/* Header entra de cima */
.site-header {
  animation: slide-down 0.5s ease both;
}

/* Hero content entra após header */
.hero-content {
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.15s;
}


/* ═══════════════════════════════════════════════════════════
   PREFERS-REDUCED-MOTION
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {

  /* Remove todas as animações */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Garante que elementos ocultos fiquem visíveis */
  .anim-fade-up,
  .anim-fade-in,
  .anim-slide-right {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .tracking-card,
  .hero-content,
  .site-header {
    animation: none;
  }

  .map-route-path {
    stroke-dashoffset: 0;
    animation: none;
  }

  .status-dot,
  .header-status-dot,
  .badge-online::before {
    animation: none;
  }

  .map-marker-pulse {
    animation: none;
  }

  .signal-ring {
    animation: none;
  }
}
