/* ==========================================================================
   personaleventos.cl — animaciones.css
   1. Solo se anima transform y opacity.
   2. Todo el movimiento va dentro de (prefers-reduced-motion: no-preference):
      con "reducir movimiento" la página queda quieta y completa.
   3. Nada se esconde sin JavaScript vivo (.js / .sin-sda / .palabras-ok).
   4. Primero lo nativo (animation-timeline), IntersectionObserver de respaldo.
   Los focos del hero están en critico.css.
   ========================================================================== */

/* Transiciones entre páginas */
@view-transition { navigation: auto; }
.cabecera { view-transition-name: cabecera; }
.titulo-vt { view-transition-name: titulo; }
::view-transition-old(root) { animation: .25s var(--ease) both vt-salida; }
::view-transition-new(root) { animation: .45s var(--ease) both vt-entrada; }
@keyframes vt-salida { to { opacity: 0; transform: scale(.985); } }
@keyframes vt-entrada { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Cinta */
  .cinta__pista { animation: cinta 32s linear infinite; }
  .cinta--oscura .cinta__pista { animation-direction: reverse; animation-duration: 40s; }
  @keyframes cinta { to { transform: translateX(-50%); } }

  /* WhatsApp: pulso */
  .wa-flotante__bulbo::before { animation: pulso 2.8s var(--ease) infinite; }
  @keyframes pulso { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.75); opacity: 0; } }

  /* Entrada del hero al cargar */
  .hero .entra { animation: entra .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms + 100ms); }
  @keyframes entra { from { opacity: 0; transform: translateY(26px); } }
  .hero .resalte { animation: franja .8s var(--ease) .55s both; }
  @keyframes franja { from { background-size: 0% 100%; color: var(--txt); } }

  /* Nativo, ligado al scroll */
  @supports (animation-timeline: view()) {
    .revelar { animation: revelar linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
    .revelar-escala { animation: revelar-escala linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
    .seccion .resalte { animation: franja linear both; animation-timeline: view(); animation-range: entry 40% cover 35%; }
    .proceso__linea span { animation: linea-y linear both; animation-timeline: view(); animation-range: entry 20% cover 60%; }
    @media (min-width: 960px) { .proceso__linea span { animation-name: linea-x; } }
    .cabecera::before { animation: aparecer linear both; animation-timeline: scroll(root); animation-range: 0 120px; }
    .progreso { animation: progreso linear both; animation-timeline: scroll(root); }
    .paralaje { animation: paralaje linear both; animation-timeline: view(); }
    .pie__gigante { animation: pie-gigante linear both; animation-timeline: view(); animation-range: entry 0% cover 50%; }
  }
  @keyframes revelar { from { opacity: 0; transform: translateY(36px); } }
  @keyframes revelar-escala { from { opacity: 0; transform: scale(.93) translateY(24px); } }
  @keyframes linea-y { from { transform: scaleY(0); } }
  @keyframes linea-x { from { transform: scaleX(0); } }
  @keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
  @keyframes progreso { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes paralaje { from { transform: translateY(40px); } to { transform: translateY(-40px); } }
  @keyframes pie-gigante { from { transform: translateX(-6%); opacity: 0; } }

  /* Respaldo con IntersectionObserver */
  .js.sin-sda .revelar, .js.sin-sda .revelar-escala { transition: opacity .8s var(--ease), transform .8s var(--ease); }
  .js.sin-sda .revelar:not(.is-in) { opacity: 0; transform: translateY(36px); }
  .js.sin-sda .revelar-escala:not(.is-in) { opacity: 0; transform: scale(.93) translateY(24px); }
  .js.sin-sda .seccion .resalte { transition: background-size .8s var(--ease) .2s, color .5s .3s; }
  .js.sin-sda .seccion .resalte:not(.is-in) { background-size: 0% 100%; color: var(--txt); }
  .js.sin-sda .proceso__linea span { transition: transform 1.6s var(--ease); }
  .js.sin-sda .proceso:not(.is-in) .proceso__linea span { transform: scaleY(0); }
  @media (min-width: 960px) { .js.sin-sda .proceso:not(.is-in) .proceso__linea span { transform: scaleX(0); } }

  /* Titulares por palabras */
  /* Sin recorte: el recorte cortaba tildes y la parte alta de las mayúsculas */
  .palabras-ok [data-palabras] .p { display: inline-block; vertical-align: baseline; }
  .palabras-ok [data-palabras] .p > span { display: inline-block; transition: transform .85s var(--ease), opacity .85s var(--ease), filter .85s var(--ease); transition-delay: calc(var(--i) * 50ms); }
  .palabras-ok [data-palabras]:not(.is-in) .p > span { transform: translateY(.45em); opacity: 0; filter: blur(4px); }

  /* Botones magnéticos */
  .magnetico { transition: transform .45s var(--ease), background .25s, color .25s, border-color .25s, box-shadow .25s; }
  .magnetico.is-cerca { transition: transform .12s linear; }
}

@media (prefers-reduced-motion: reduce) {
  .resplandor, .confeti { display: none; }
  .servicio { transform: none !important; }
  .progreso { transform: none; opacity: 0; }
}
