/* =========================================================================
   Astrova Studio — animations.css
   Loader, bucles suaves y estados de movimiento. Las escenas vinculadas al
   scroll viven en js/animations.js (GSAP + ScrollTrigger).
   Regla: sin JS o con reducción de movimiento, todo se ve completo y quieto.
   ========================================================================= */

/* ---------- Loader de estrella (máx. 1,2 s, solo la primera visita) ---------- */
.loader { display: none; }
.show-loader .loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(40% 40% at 50% 55%, rgba(169, 139, 214, .25), transparent 70%),
    var(--noche);
  animation: loader-out .38s var(--ease-io) .82s forwards;
  pointer-events: none;
}
.loader__mark { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.loader__star {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  fill: transparent;
  stroke: var(--amarillo);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  filter: drop-shadow(0 0 10px rgba(245, 196, 84, .6));
  animation: star-draw .5s var(--ease) forwards, star-fill .25s var(--ease) .42s forwards, star-hide .2s var(--ease) .6s forwards;
}
.loader__logo {
  width: 100px; height: 100px;
  object-fit: contain;
  opacity: 0;
  transform: scale(.7) rotate(-10deg);
  animation: logo-pop .42s var(--ease-enter) .52s forwards;
}
@keyframes star-draw { to { stroke-dashoffset: 0; } }
@keyframes star-fill { to { fill: var(--amarillo); } }
@keyframes star-hide { to { opacity: 0; transform: scale(1.4); } }
@keyframes logo-pop { to { opacity: 1; transform: none; } }
@keyframes loader-out {
  to { opacity: 0; visibility: hidden; transform: translateY(-2%); }
}

/* ---------- Entrada del hero (enmascarada, una vez) ---------- */
.js .hero__title .mask > span { transform: translateY(105%); }
.js .hero__lead, .js .hero__actions { opacity: 0; transform: translateY(12px); }
.js .hero__cast .cast { opacity: 0; transform: translateY(40px) scale(.96); }
.hero.is-in .hero__title .mask > span {
  transform: none;
  transition: transform .8s var(--ease-enter);
}
.hero.is-in .hero__title .mask:nth-child(2) > span { transition-delay: .09s; }
.hero.is-in .hero__lead,
.hero.is-in .hero__actions {
  opacity: 1;
  transform: none;
  transition: opacity .52s var(--ease-enter) .45s, transform .52s var(--ease-enter) .45s;
}
.hero.is-in .hero__actions { transition-delay: .52s; }
.hero.is-in .cast {
  opacity: 1;
  transform: none;
  transition: opacity .9s var(--ease-enter), transform 1.1s var(--ease-enter);
}
.hero.is-in .cast--dev { transition-delay: .25s; }
.hero.is-in .cast--consultora { transition-delay: .12s; }
.hero.is-in .cast--creativo { transition-delay: .36s; }
.hero.is-in .cast.is-tilting { transition: none; }

/* ---------- Flotación de personajes (en la imagen, para no chocar con GSAP) ---------- */
.float > img, .cast img, .svc-mant__char, .faq__char, .svc-web__char {
  animation: float 6.4s ease-in-out infinite alternate;
}
.cast--dev img { animation-delay: -1.8s; animation-duration: 5.8s; }
.cast--creativo img { animation-delay: -3.2s; animation-duration: 7s; }
.svc-mant__char { animation-duration: 4.6s; }
@keyframes float {
  from { translate: 0 0; }
  to { translate: 0 -12px; }
}

.spark { animation: spark 4.2s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes spark {
  0%, 70%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  80% { transform: scale(1.35) rotate(45deg); opacity: .85; }
  90% { transform: scale(.9) rotate(80deg); opacity: 1; }
}

.hero__cue span { animation: cue 2.2s var(--ease) infinite; }
@keyframes cue {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: 1; }
  80% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- Estado "en línea" ---------- */
.pulse::after { animation: ring 2.4s var(--ease) infinite; }
@keyframes ring {
  0% { transform: scale(.6); opacity: .9; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ---------- Mini reels (bucle de 3,6 s; corre solo en pantalla) ---------- */
.reel__bars i:nth-child(1)::after { transform: scaleX(1); }
.reels.is-playing .reel__bars i:nth-child(2)::after { animation: bar 3.6s linear infinite; }
.reels.is-playing .reel--b .reel__bars i:nth-child(2)::after { animation-delay: -1.2s; }
.reels.is-playing .reel--c .reel__bars i:nth-child(2)::after { animation-delay: -2.4s; }
@keyframes bar {
  0% { transform: scaleX(0); }
  88%, 100% { transform: scaleX(1); }
}
.reels.is-playing .reel__img { animation: kenburns 3.6s ease-in-out infinite alternate; }
.reels.is-playing .reel--b .reel__img { animation-delay: -1.2s; }
.reels.is-playing .reel--c .reel__img { animation-delay: -2.4s; }
@keyframes kenburns {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.08) translateY(-3%); }
}
.reels.is-playing .reel__word { animation: word 3.6s var(--ease-enter) infinite; }
.reels.is-playing .reel--b .reel__word { animation-delay: -1.2s; }
.reels.is-playing .reel--c .reel__word { animation-delay: -2.4s; }
@keyframes word {
  0% { clip-path: inset(0 100% 0 0); transform: translateY(8px); }
  18%, 86% { clip-path: inset(0 0 0 0); transform: none; }
  100% { clip-path: inset(0 0 0 0); transform: none; }
}

/* ---------- Chat: puntos de escritura ---------- */
.msg--typing.is-on { display: inline-flex; }
.msg--typing i { animation: typing 1s ease-in-out infinite; }
.msg--typing i:nth-child(2) { animation-delay: .15s; }
.msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-3px); opacity: 1; } }

/* ---------- Escenas con scroll (solo escritorio y con GSAP activo) ----------
   js/animations.js añade .has-scenes a <html>. Sin esa clase, cada sección
   mide una pantalla y muestra su estado final. */
.dato__stage { position: relative; }
.dato__wash {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(60% 60% at 26% 58%, rgba(169, 139, 214, .35), transparent 70%),
    linear-gradient(180deg, #2E1F36, #3F2A48);
}
.dato__grid { position: relative; z-index: 1; }
@media (min-width: 1024px) {
  .has-scenes .dato { height: 300svh; }
  .has-scenes .dato__stage { position: sticky; top: 0; height: 100svh; min-height: 0; }
  .has-scenes .svc3d { height: 400svh; }
  .has-scenes .svc3d__stage { position: sticky; top: 0; height: 100svh; min-height: 0; }
  .has-scenes .proceso { height: 300svh; }
  .has-scenes .proceso__stage { position: sticky; top: 0; height: 100svh; min-height: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Reducción de movimiento: todo quieto y completo ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
  .loader, .show-loader .loader { display: none !important; }
  .js .hero__title .mask > span,
  .js .hero__lead, .js .hero__actions,
  .js .hero__cast .cast { opacity: 1 !important; transform: none !important; }
  .reel__bars i::after { transform: scaleX(1) !important; }
  .msg--typing { display: none !important; }
  .hero__cue span { opacity: 1; }
}
