/* ============================================================
   Moxico_Leste - Animações profissionais
   Respeita prefers-reduced-motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Keyframes --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes lineExpand {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}

@keyframes iconPop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Classes de animação (entrada) --- */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.animate-fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
  opacity: 0;
  animation: fadeInDown 0.5s ease-out forwards;
}

.animate-scale-in {
  opacity: 0;
  animation: scaleIn 0.4s ease-out forwards;
}

.animate-slide-in-right {
  opacity: 0;
  animation: slideInRight 0.5s ease-out forwards;
}

.animate-slide-in-left {
  opacity: 0;
  animation: slideInLeft 0.5s ease-out forwards;
}

.animate-fade-in-scale {
  opacity: 0;
  animation: fadeInScale 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-icon-pop {
  opacity: 0;
  animation: iconPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Atrasos para efeito em cascata */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }

/* --- Animação ao scroll (activada por JS) --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.animate-scale {
  transform: translateY(28px) scale(0.98);
}
.animate-on-scroll.animate-scale.is-visible {
  transform: translateY(0) scale(1);
}

/* Cascata para filhos (ex.: grid de cards) */
.stagger-children > *:nth-child(1) .animate-on-scroll.is-visible { transition-delay: 0s; }
.stagger-children > *:nth-child(2) .animate-on-scroll.is-visible { transition-delay: 0.06s; }
.stagger-children > *:nth-child(3) .animate-on-scroll.is-visible { transition-delay: 0.12s; }
.stagger-children > *:nth-child(4) .animate-on-scroll.is-visible { transition-delay: 0.18s; }
.stagger-children > *:nth-child(5) .animate-on-scroll.is-visible { transition-delay: 0.24s; }
.stagger-children > *:nth-child(6) .animate-on-scroll.is-visible { transition-delay: 0.3s; }
.stagger-children > *:nth-child(7) .animate-on-scroll.is-visible { transition-delay: 0.36s; }
.stagger-children > *:nth-child(8) .animate-on-scroll.is-visible { transition-delay: 0.42s; }
.stagger-children > *:nth-child(n+9) .animate-on-scroll.is-visible { transition-delay: 0.48s; }

/* --- Transições suaves (hover) --- */
.transition-smooth {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card com zoom na imagem no hover */
.card-img-zoom {
  overflow: hidden;
}
.card-img-zoom .card-img-top,
.card-img-zoom img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover .card-img-zoom .card-img-top,
.card:hover .card-img-zoom img {
  transform: scale(1.08);
}

/* Link com sublinhado animado */
.link-underline {
  position: relative;
}
.link-underline::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--ml-primary);
  transition: width 0.3s ease;
}
.link-underline:hover::after {
  width: 100%;
}

/* Botão com brilho suave no hover */
.btn-glow:hover {
  box-shadow: 0 0 20px rgba(196, 30, 58, 0.4);
}

/* Hero: entrada suave (forwards para não voltar a desaparecer) */
.hero-card {
  animation: scaleIn 0.5s ease-out forwards;
}

/* Lista lateral: entrada escalonada */
.hero-sidebar-item {
  opacity: 0;
  animation: slideInRight 0.5s ease-out forwards;
}
.hero-sidebar-item:nth-child(1) { animation-delay: 0.2s; }
.hero-sidebar-item:nth-child(2) { animation-delay: 0.3s; }
.hero-sidebar-item:nth-child(3) { animation-delay: 0.4s; }
.hero-sidebar-item:nth-child(4) { animation-delay: 0.5s; }

/* Hero: texto em cascata */
.hero-caption .badge { animation: fadeInUp 0.5s ease-out 0.15s forwards; opacity: 0; }
.hero-caption .h2 { animation: fadeInUp 0.5s ease-out 0.25s forwards; opacity: 0; }
.hero-caption p { animation: fadeInUp 0.5s ease-out 0.35s forwards; opacity: 0; }
.hero-caption .small { animation: fadeInUp 0.5s ease-out 0.45s forwards; opacity: 0; }

/* Section title: entrada ao scroll (classe animate-on-scroll no HTML) */

/* Cards: entrada suave ao scroll + hover */
.card-hover-lift {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}
.card-hover-lift:hover {
  transform: translateY(-8px);
}

/* Nav: transição nos links */
.main-nav .nav-link {
  transition: color 0.25s ease, background 0.25s ease, transform 0.2s ease;
}
.main-nav .nav-link:hover {
  transform: translateY(-1px);
}

/* Botões e ícones: micro-interacção */
.btn-hover-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-hover-lift:hover {
  transform: translateY(-2px);
}
.social-links a,
.theme-toggle {
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.social-links a:hover,
.theme-toggle:hover {
  transform: translateY(-3px) scale(1.1);
}

/* Empty state: entrada suave */
.empty-state {
  animation: fadeInScale 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Newsletter: entrada ao scroll (classe animate-on-scroll no HTML) */

/* ============================================================
   Animações de publicidade
   ============================================================ */

/* Banner topo: entrada suave de cima */
.ad-banner.ad-top {
  opacity: 0;
  animation: fadeInDown 0.6s ease-out forwards;
}
.ad-banner.ad-top a {
  display: block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, opacity 0.35s ease;
}
.ad-banner.ad-top a:hover {
  transform: scale(1.02);
  opacity: 0.95;
}
.ad-banner.ad-top img {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.ad-banner.ad-top a:hover img {
  transform: scale(1.03);
}

/* Banner lateral (sidebar): entrada da direita + hover */
.ad-sidebar {
  opacity: 0;
  animation: slideInRight 0.55s ease-out forwards;
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}
.ad-sidebar a {
  display: block;
  overflow: hidden;
  border-radius: var(--ml-radius, 0.5rem);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.ad-sidebar a:hover {
  transform: scale(1.03);
}
.ad-sidebar a img {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.ad-sidebar a:hover img {
  transform: scale(1.06);
}
.ad-sidebar:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Publicidade no meio do artigo: entrada ao scroll + brilho suave no hover */
.ad-in-article {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.35s ease;
}
.ad-in-article.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.ad-in-article a {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.ad-in-article a:hover {
  transform: scale(1.02);
}
.ad-in-article img {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.ad-in-article a:hover img {
  transform: scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}
.ad-in-article:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
