/* Movimento. Os estados iniciais só valem com .movimento no <html>, que o rota.js põe
   quando o visitante não pediu "reduzir movimento". Sem JS, tudo aparece parado e inteiro. */

@media (prefers-reduced-motion: no-preference) {
  /* Faixas da pintura entram varrendo, como o ônibus passando */
  .hero-foto img { animation: foto-entra 1.3s .15s var(--curva) both; }
  .hero-foto .faixas i { animation: faixa-entra 1s var(--curva) both; }
  .hero-foto .faixas i:nth-child(2) { animation-delay: .08s; }
  .hero-foto .faixas i:nth-child(3) { animation-delay: .16s; }
  .capa > picture img, .capa > img { animation: capa-entra 2.2s var(--curva) both; }
  .capa .faixas i { animation: faixa-sobe 1.1s .2s var(--curva) both; }
  .capa .faixas i:nth-child(2) { animation-delay: .28s; }
  .capa .faixas i:nth-child(3) { animation-delay: .36s; }
  .capa-texto > * { animation: sobe 1s var(--curva) both; }
  .capa-texto > :nth-child(2) { animation-delay: .12s; }
  .capa-texto > :nth-child(3) { animation-delay: .24s; }
  .capa-texto > :nth-child(4) { animation-delay: .36s; }
  .hero h1, .hero-lede, .hero .acoes, .hero-assinatura { animation: sobe 1s var(--curva) both; }
  .hero h1 { animation-delay: .9s; }
  .hero-lede { animation-delay: 1s; }
  .hero .acoes { animation-delay: 1.1s; }
  .hero-assinatura { animation-delay: 1.3s; }
  .painel-destino .luz { animation: pisca 1.6s ease-in-out infinite; }
}
@keyframes foto-entra { from { clip-path: polygon(100% 0, 100% 0, 100% 100%, 78% 100%); } }
@keyframes faixa-entra { from { transform: translateX(120vw); } }
@keyframes faixa-sobe { from { transform: translateY(110%); } }
@keyframes capa-entra { from { transform: scale(1.12); } }
@keyframes sobe { from { opacity: 0; transform: translateY(22px); } }
@keyframes pisca { 50% { opacity: .35; } }

/* Painel: cada letra vira sozinha (o JS troca o caractere; aqui só a dobra) */
.movimento .painel-letra.virando { animation: vira .09s linear; }
@keyframes vira { 0% { transform: rotateX(0); } 50% { transform: rotateX(70deg); filter: brightness(.6); } 100% { transform: rotateX(0); } }

/* Destino: cada letra nova cai no lugar; a barrinha enche até a próxima troca */
.movimento .painel-destino b span.chega { animation: letra-cai .32s var(--curva) both; animation-delay: calc(var(--i, 0) * 28ms); }
@keyframes letra-cai { from { opacity: 0; transform: translateY(-60%) rotateX(80deg); } }
.movimento .painel-destino-tempo.corre::after { animation: enche var(--intervalo, 3.6s) linear both; }
@keyframes enche { to { transform: scaleX(1); } }

/* Revelação por rolagem */
.movimento [data-revela] { opacity: 0; transform: translateY(36px); transition: opacity .9s var(--curva), transform 1s var(--curva); transition-delay: calc(var(--i, 0) * 110ms); }
.movimento [data-revela].visivel { opacity: 1; transform: none; }
.movimento [data-revela="cortina"] { opacity: 1; transform: none; }
.movimento [data-revela="cortina"] img { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); transform: scale(1.12); transition: clip-path 1.3s var(--curva), transform 1.8s var(--curva); transition-delay: calc(var(--i, 0) * 120ms); }
.movimento [data-revela="cortina"].visivel img { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transform: scale(1); }

/* Bilhetes entram um a um, levemente girados, e assentam */
.movimento .bilhete[data-revela] { transform: translateY(60px) rotate(2deg); }
.movimento .bilhete[data-revela].visivel { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); }

/* Odômetro: cada dígito é uma coluna 0–9 que rola até o valor */
.movimento .odometro-digito > span { transition: transform 1.8s var(--curva); transition-delay: calc(var(--d, 0) * 120ms); }

/* Linha do tempo: a parada se acende quando o ônibus chega */
.movimento .parada { opacity: .35; transition: opacity .6s; }
.movimento .parada.chegou { opacity: 1; }
.movimento .parada::before { transform: skewX(var(--inclina)) scaleX(0); transform-origin: left; transition: transform .6s var(--curva); }
.movimento .parada.chegou::before { transform: skewX(var(--inclina)) scaleX(1); }

/* Perguntas abrem com altura animada (onde houver suporte) */
@media (prefers-reduced-motion: no-preference) {
  .duvidas details::details-content { block-size: 0; overflow: clip; transition: block-size .5s var(--curva), content-visibility .5s allow-discrete; }
  .duvidas details[open]::details-content { block-size: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
