/* ==========================================================
   SAG · Capa de movimiento (se carga después de apple.css)
   Inspirada en patrones de Animista (entradas CSS), Magic UI (Blur Fade, Shimmer Button, Border Beam)
   y Aceternity UI (Text Generate, Card Spotlight, indicador de navegación). Código propio, sin librerías.
   Reglas: solo transform / opacity (y un desenfoque corto que se retira al terminar) · todo bajo html.anim
   (se apaga con "reducir movimiento" y con ahorro de datos) · lo que corre en bucle se pausa fuera de pantalla.
   ========================================================== */

/* ---------- 1. Entradas: "text-focus-in" / "blur fade" ---------- */
.anim .ln { overflow: visible; }
.anim .ln > span {
  opacity: 0; filter: blur(14px); transform: translateY(34%);
  transition: transform 1.1s var(--ease), opacity .9s ease, filter 1.1s var(--ease);
}
.anim.ready .ln > span { opacity: 1; filter: none; transform: none; }

.anim :is(.lbl, .lead, .hero__lead, .hero__cta, .hero__stats dl > div).reveal {
  filter: blur(10px);
  transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease);
  transition-delay: var(--d, 0s);
}
.anim :is(.lbl, .lead, .hero__lead, .hero__cta, .hero__stats dl > div).reveal.in { filter: none; }
.anim .hero :is(.lbl, .hero__lead, .hero__cta, .hero__stats dl > div).reveal { transition-delay: calc(.5s + var(--d, 0s)); }

/* Titulares de sección: "text generate" palabra por palabra */
.anim [data-words] .w { overflow: visible; }
.anim [data-words] .w > span {
  opacity: 0; filter: blur(10px); transform: translateY(45%);
  transition: transform 1s var(--ease), opacity .8s ease, filter .9s ease;
  transition-delay: calc(var(--i) * 50ms);
}
.anim [data-words].in .w > span { opacity: 1; filter: none; transform: none; }

/* Tarjetas y bloques: aparecen en cascada ("fade-in-bottom" con escalón) */
.anim :is(.mem, .post, .award, .stats__i).reveal { transform: translateY(28px) scale(.985); }
.anim :is(.mem, .post, .award, .stats__i).reveal.in { transform: none; }

/* ---------- 2. Botones: "shimmer" ---------- */
.btn--solid, .head__cta.btn--line { position: relative; overflow: hidden; isolation: isolate; }
.btn--solid::after, .head__cta.btn--line::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent 32%, rgba(255, 255, 255, .38) 50%, transparent 68%);
  transform: translateX(-130%);
}
.btn--solid:hover::after, .head__cta.btn--line:hover::after { transform: translateX(130%); transition: transform .85s var(--ease); }
.anim.ready .hero__cta .btn--solid::after { animation: shimmer 7s ease-in-out 2.6s infinite; }
@keyframes shimmer { 0%, 84% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }

/* ---------- 3. Tarjetas: foco de luz que sigue al cursor ("card spotlight") ---------- */
@media (hover: hover) and (pointer: fine) {
  .svc__c, .post__a, .mem__btn, .sen__c { position: relative; }
  .svc__c::before, .post__a::before, .mem__btn::before, .sen__c::before {
    content: ""; display: block; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
    background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), rgba(0, 113, 227, .09), transparent 70%);
  }
  .svc__c:hover::before, .post__a:hover::before, .mem__btn:hover::before, .sen__c:hover::before { opacity: 1; }
}

/* ---------- 4. Premio principal: borde de luz dorada ("border beam") ---------- */
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.fx-beam { position: relative; }
.fx-beam::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0%, transparent 74%, rgba(236, 216, 164, .85) 94%, #fff 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: beam 7s linear infinite; animation-play-state: paused;
}
.fx-beam.fx-on::after { animation-play-state: running; }
@keyframes beam { to { --ang: 360deg; } }

/* ---------- 5. Navegación: indicador que se desliza a la sección activa ---------- */
@media (min-width: 861px) {
  .nav { position: relative; gap: 2px; }
  .nav a { position: relative; z-index: 1; padding: 7px 12px; transition: color .3s; }
  .nav a.is-active { color: #fff; }
  .nav__ind {
    position: absolute; left: 0; top: 50%; height: 30px; margin-top: -15px; width: 0; border-radius: 99px; z-index: 0; pointer-events: none;
    background: rgba(255, 255, 255, .14); opacity: 0; transform: translateX(0);
    transition: transform .5s var(--ease), width .5s var(--ease), opacity .3s;
  }
  .nav__ind.on { opacity: 1; }
}
@media (max-width: 1100px) and (min-width: 861px) { .nav { gap: 0; } .nav a { padding-inline: 9px; } }

/* ---------- 6. Hero: el titular se desvanece al bajar (solo donde el navegador lo admite, sin JS) ---------- */
@supports (animation-timeline: scroll()) {
  .anim .hero__copy { animation: heroOut linear both; animation-timeline: scroll(root block); animation-range: 0 70vh; }
  .anim .hero__bg { animation: heroBg linear both; animation-timeline: scroll(root block); animation-range: 0 100vh; }
  @keyframes heroOut { to { opacity: 0; transform: translateY(-48px); } }
  @keyframes heroBg { to { transform: translateY(10vh) scale(1.06); } }
}

/* ---------- 7. Rendimiento: lo que corre en bucle se pausa fuera de pantalla ---------- */
.fx-off, .fx-off *, .fx-off::before, .fx-off::after { animation-play-state: paused !important; }
