/*
 * WWin Design System — Animations
 * Transições, keyframes e classes de animação da marca.
 * Princípio: movimentos precisos, controlados, premium — sem bounces.
 */

/* =========================================================
 * PREFERÊNCIA DE MOVIMENTO REDUZIDO
 * ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
 * KEYFRAMES
 * ========================================================= */

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Entrada padrão W.WIN — de baixo para cima */
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-right {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-left {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse do ponto (hero eyebrow) */
@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.75);
  }
}

/* Contador numérico */
@keyframes count-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Linha decorativa crescendo */
@keyframes line-grow {
  from { width: 0; }
  to   { width: 100%; }
}

/* Shimmer (skeleton loading) */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Rotação contínua */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Glow pulsante — sutil */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 16px rgba(140, 171, 214, 0.08);
  }
  50% {
    box-shadow: 0 0 28px rgba(140, 171, 214, 0.18);
  }
}

/* Glow accent — discreto para CTAs */
@keyframes accent-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(62, 129, 255, 0.16);
  }
  50% {
    box-shadow: 0 4px 32px rgba(62, 129, 255, 0.32);
  }
}

/* Flutuação sutil */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-6px); }
}

/* Parallax */
@keyframes bg-drift {
  from { transform: translateY(0) scale(1.04); }
  to   { transform: translateY(-36px) scale(1.04); }
}

/* Cursor de digitação */
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* =========================================================
 * CLASSES DE ANIMAÇÃO
 * ========================================================= */

.animate-ready {
  opacity: 0;
}

.animate-in {
  animation: slide-up var(--transition-enter) forwards;
}

.animate-fade-in {
  animation: fade-in var(--transition-slow) forwards;
}

.animate-scale-in {
  animation: scale-in var(--transition-enter) forwards;
}

.animate-slide-right {
  animation: slide-right var(--transition-enter) forwards;
}

.animate-slide-left {
  animation: slide-left var(--transition-enter) forwards;
}

/* Delays */
.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }
.delay-4 { animation-delay: 320ms; }
.delay-5 { animation-delay: 400ms; }
.delay-6 { animation-delay: 480ms; }

/* Animações contínuas */
.animate-float        { animation: float 4s ease-in-out infinite; }
.animate-glow         { animation: glow-pulse 3.5s ease-in-out infinite; }
.animate-accent-glow  { animation: accent-glow 3s ease-in-out infinite; }

/* =========================================================
 * HOVER EFFECTS — suaves e premium
 * ========================================================= */

.hover-lift {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
}

/* Variante ainda mais sutil */
.hover-lift-sm {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.hover-lift-sm:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

.hover-accent-glow {
  transition: box-shadow var(--transition-base);
}

.hover-accent-glow:hover {
  box-shadow: var(--shadow-accent);
}

/* =========================================================
 * SKELETON LOADING
 * ========================================================= */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-navy-800) 25%,
    var(--color-navy-700) 50%,
    var(--color-navy-800) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text   { height: 1em;   margin-bottom: var(--space-2); }
.skeleton-title  { height: 1.4em; width: 60%; margin-bottom: var(--space-4); }
.skeleton-image  { height: 200px; width: 100%; }

/* =========================================================
 * TRANSIÇÕES DE PÁGINA
 * ========================================================= */

.page-enter {
  opacity: 0;
  transform: translateY(14px);
}

.page-enter-active {
  animation: slide-up 500ms var(--ease-premium) forwards;
}

.page-exit {
  animation: fade-out 200ms ease forwards;
}

/* =========================================================
 * GSAP — estados iniciais e targets
 * ========================================================= */

[data-animate] {
  opacity: 0;
  transform: translateY(18px); /* ← reduzido de 28px — mais sutil e premium */
  /* will-change é aplicado dinamicamente via JS (initScrollAnimations)
     só durante a transição de entrada e removido em seguida — evita
     manter camadas de composição permanentes para dezenas de elementos */
}

[data-animate-stagger] > * {
  opacity: 0;
  transform: translateY(14px); /* ← estado inicial do IntersectionObserver fallback */
  /* will-change também gerenciado dinamicamente via JS — ver initScrollAnimations */
}

/* =========================================================
 * BARRA DE PROGRESSO DE LEITURA
 * ========================================================= */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-blue-300));
  z-index: var(--z-toast);
  transition: width var(--transition-fast);
  box-shadow: 0 0 8px rgba(62, 129, 255, 0.35);
}

/* =========================================================
 * CURSOR DE DIGITAÇÃO
 * ========================================================= */

.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--color-accent);
  vertical-align: text-bottom;
  animation: cursor-blink 1s step-end infinite;
  margin-left: 2px;
}
