/* BM FX — loader, overlay cuadriculado, microinteracciones de CTAs y skeletons.
   Sutil y liviano: solo transform/opacity (se animan en GPU), sin librerías.
   Respeta prefers-reduced-motion. Reutilizable fuera de la landing (usa --bg/--pink/--purple/--cyan con fallback). */

:root {
  --fx-bg: var(--bg, #080810);
  --fx-pink: var(--pink, #FF2D78);
  --fx-purple: var(--purple, #B44BFF);
  --fx-cyan: var(--cyan, #00F5FF);
  --fx-ease: cubic-bezier(.22, 1, .36, 1);          /* easeOutQuint: arranca rápido y aterriza suave */
}

/* ── LOADER + OVERLAY CUADRICULADO ───────────────────
   El <div class="fx-loader"> vive en el HTML (así existe en el primer paint) pero solo se muestra
   si <html> tiene .fx-loading, que agrega un script inline en el <head> (primera visita de la sesión). */
.fx-loader { display: none; }
html.fx-loading { overflow: hidden; }
html.fx-loading .fx-loader, html.fx-leaving .fx-loader { display: block; }   /* fx-leaving: mientras se disuelve */

.fx-loader, .fx-cover {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--fx-bg);
}
.fx-loader.is-out { background: transparent; pointer-events: none; }

.fx-grid { position: absolute; inset: 0; display: grid; }
.fx-cell {
  background: var(--fx-bg);
  box-shadow: inset 0 0 0 .5px rgba(240, 238, 255, .055);   /* la trama: líneas finísimas, casi imperceptibles */
  opacity: 1; will-change: opacity;
  transition: opacity .5s ease;
}
.fx-out .fx-cell { opacity: 0; }

.fx-logo {
  position: absolute; left: 50%; top: 50%;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(28px, 6vw, 40px); letter-spacing: -.5px;
  color: var(--text, #F0EEFF); white-space: nowrap;
  transform: translate(-50%, -50%); opacity: 0; filter: blur(6px);
  transition: opacity .6s ease, filter .6s ease, transform .5s var(--fx-ease);
}
.fx-logo .p {
  background: linear-gradient(90deg, var(--fx-pink), var(--fx-purple));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.fx-logo.is-in { opacity: 1; filter: blur(0); }
.fx-out .fx-logo { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); transition-duration: .35s; }

.fx-bar {
  position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--fx-pink), var(--fx-purple), var(--fx-cyan));
  transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .25s linear;
}
.fx-out .fx-bar { opacity: 0; transition: opacity .3s ease; }

/* Mientras el loader está arriba, las animaciones de entrada del hero esperan (así no se "gastan" detrás del overlay). */
html.fx-loading .hero, html.fx-loading .hero *, html.fx-loading .cta-group { animation-play-state: paused !important; }

/* ── CTAs: texto e ícono se mueven con una leve diferencia ─
   .fx-arrow → el texto cede un poco y la flecha avanza más y un instante después.
   .fx-roll  → el texto sube y entra una copia desde abajo (para CTAs sin ícono). */
.fx-cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.fx-l, .fx-a { display: inline-block; }
.fx-l { transition: transform .45s var(--fx-ease); }
.fx-a { transition: transform .6s var(--fx-ease) .03s; }

.fx-roll { display: inline-block; position: relative; overflow: hidden; white-space: nowrap; height: 1.3em; line-height: 1.3em; vertical-align: middle; }
.fx-roll > span { display: block; transition: transform .5s var(--fx-ease); }

@media (hover: hover) {
  .fx-arrow:hover .fx-l { transform: translateX(-3px); }
  .fx-arrow:hover .fx-a { transform: translateX(6px); }
  .fx-cta:hover .fx-roll > span { transform: translateY(-100%); }
}
.fx-cta:active { transform: scale(.985); }
.btn-primary.fx-cta:active { transform: translateY(0) scale(.985); }
.fx-cta:focus-visible, .step-export-link.fx-cta:focus-visible { outline: 2px solid var(--fx-cyan); outline-offset: 3px; }

/* ── SKELETONS ────────────────────────────────────── */
.fx-skeleton { position: relative; overflow: hidden; display: inline-block; vertical-align: middle; background: rgba(255, 255, 255, .06); border-radius: 6px; }
.fx-skeleton::after, .is-loading::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .09), transparent);
  animation: fx-shimmer 1.4s ease-in-out infinite;
}
.is-loading { position: relative; overflow: hidden; pointer-events: none; }
@keyframes fx-shimmer { to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  .fx-cell, .fx-logo, .fx-bar, .fx-l, .fx-a, .fx-roll > span { transition: none !important; }
  .fx-skeleton::after, .is-loading::after { animation: none; }
}
