/* ==========================================================================
   motion.css · o movimento de entrada do site, num lugar só
   Regras: entradas animam só opacity e translate; ease-out; atraso escalonado
   de 30 a 80 ms; nada de transição genérica; reduced-motion desliga tudo.
   Por que `animation` e não `transition`: botões e cards também são .reveal,
   e uma transição aqui (camada mais forte) apagaria o hover deles.
   Efeitos herdados do site antigo (Elementor), recriados e refinados:
   entrada da direita nos serviços, fadeIn nos números, fadeInUp na frase final,
   contador 0 a N (counters.js) e fundo que segue o mouse (parallax.js).
   ========================================================================== */

@layer motion {

  /* Primeira tela: entra ao carregar, em sequência (--i). `backwards` libera o hover depois. */
  .enter {
    animation: rise var(--t-enter) var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * var(--stagger-hero));
  }

  /* Demais blocos: ficam ocultos até o reveal.js marcar .is-in (sem JS, aparecem normal). */
  .js .reveal { opacity: 0; }
  .js .reveal.is-in {
    opacity: 1;
    animation: rise var(--t-enter) var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * var(--stagger));
  }
  .js .reveal[data-reveal="right"].is-in { animation-name: rise-right; }   /* slideInRight do site antigo */
  .js .reveal[data-reveal="fade"].is-in  { animation-name: fade; }         /* fadeIn dos números */

  /* Foco: o bloco entra saindo do desfoque (títulos de seção) */
  .js .reveal[data-reveal="focus"].is-in { animation-name: focus-in; animation-duration: 900ms; }
  @keyframes focus-in { from { opacity: 0; filter: blur(12px); scale: .97; } to { opacity: 1; filter: none; scale: 1; } }

  /* Revelação em caixa (formulário): uma barra vermelha cobre o texto e corre para a direita */
  .box-reveal { position: relative; display: inline-block; }
  .js .reveal[data-reveal="box"] .box-reveal { color: transparent; }
  .js .reveal[data-reveal="box"].is-in .box-reveal { animation: box-text 1ms linear forwards; animation-delay: calc(250ms + var(--i, 0) * 120ms); }
  .js .reveal[data-reveal="box"] .box-reveal::after {
    content: ""; position: absolute; inset: 2px 0; background: var(--c-red); transform-origin: left; scale: 0 1;
  }
  .js .reveal[data-reveal="box"].is-in .box-reveal::after {
    animation: box-bar 650ms var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 120ms);
  }
  @keyframes box-text { to { color: inherit; } }
  @keyframes box-bar {
    0%   { scale: 0 1; transform-origin: left; }
    45%  { scale: 1 1; transform-origin: left; }
    55%  { scale: 1 1; transform-origin: right; }
    100% { scale: 0 1; transform-origin: right; }
  }

  @keyframes rise       { from { opacity: 0; translate: 0 1.5rem; }    to { opacity: 1; translate: none; } }
  @keyframes rise-right { from { opacity: 0; translate: 3.75rem 0; }   to { opacity: 1; translate: none; } }
  @keyframes fade       { from { opacity: 0; }                         to { opacity: 1; } }

  /* Contador: os números não "pulam" de largura enquanto contam */
  .count { font-variant-numeric: tabular-nums; }

  /* Menu: some ao descer, volta ao subir (a saída é mais rápida que a entrada) */
  .site-header--hidden { transition-duration: var(--t-fast); }

  /* Menos movimento: desliga animação, transição e rolagem suave em tudo */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: .01ms !important;
      animation-delay: 0s !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
      transition-delay: 0s !important;
      scroll-behavior: auto !important;
    }
    .js .reveal { opacity: 1; }
  }
}
