/* =====================================================
   JoFi Landing — animations.css (refactor producción)
   Reglas: sólo transform + opacity en animaciones
   continuas. Sin filter:blur() en elementos animados.
   ===================================================== */


/* ══════════════════════════════════════════════════
   1. HERO BACKGROUND
   ══════════════════════════════════════════════════ */
#hero { isolation: isolate; }

/* Dot grid — opacity-only pulse (composite) */
#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,204,0,0.12) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: -1;
  mask-image: radial-gradient(ellipse 75% 75% at 50% 50%, black 0%, transparent 70%);
  animation: gridPulse 8s ease-in-out infinite;
}
@keyframes gridPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.85; }
}

/* Líneas verticales: sólo opacity */
.hero-bg-line {
  position: absolute;
  width: 1px;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(255,204,0,0.2) 30%,
    rgba(255,204,0,0.4) 50%,
    rgba(255,204,0,0.2) 70%,
    transparent 100%
  );
  top: 0; bottom: 0;
  animation: lineFade 10s ease-in-out infinite;
}
.hero-bg-line:nth-child(1) { animation-duration: 9s;  animation-delay: 0s; }
.hero-bg-line:nth-child(2) { animation-duration: 12s; animation-delay: 3s; }
.hero-bg-line:nth-child(3) { animation-duration: 10s; animation-delay: 6s; }
@keyframes lineFade {
  0%, 100% { opacity: 0.2; }
  50%       { opacity: 0.7; }
}

/* Orbs de luz ambiental */
.hero-bg::before,
.hero-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
}
.hero-bg::before {
  width: 600px; height: 600px;
  background: rgba(255,204,0,0.06);
  top: -150px; right: -80px;
  animation: orbDrift 18s ease-in-out infinite;
}
.hero-bg::after {
  width: 350px; height: 350px;
  background: rgba(255,120,0,0.04);
  bottom: 0; left: 5%;
  animation: orbDrift 22s ease-in-out infinite reverse;
}
@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -40px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(0.95); }
}


/* ══════════════════════════════════════════════════
   2. HERO ENTRADA — stagger al cargar
   ══════════════════════════════════════════════════ */
.hero-eyebrow  { animation: heroFadeUp 0.7s cubic-bezier(0.22,1,0.36,1) 0.10s both; }
.hero-title    { animation: heroFadeUp 0.8s cubic-bezier(0.22,1,0.36,1) 0.28s both; }
.hero-sub      { animation: heroFadeUp 0.7s cubic-bezier(0.22,1,0.36,1) 0.44s both; }
.hero-actions  { animation: heroFadeUp 0.7s cubic-bezier(0.22,1,0.36,1) 0.58s both; }
.hero-trust    { animation: heroFadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0.72s both; }

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}

/*
  FIX CRÍTICO: el float y la entrada del hero-visual
  estaban en la misma propiedad `animation`, causando
  que se pisaran sus transforms.

  Solución: entrada en .hero-visual (opacity+transform
  único), float en el hijo .ext-mock-wrapper mediante
  un wrapper semántico, o directamente en .ext-mock
  con un keyframe que no interfiera con el tilt de JS.

  Como el tilt de JS setea transform inline en .ext-mock,
  el float va en el padre .hero-visual con translateY
  sólo después de que la entrada terminó.
*/
.hero-visual {
  animation: heroFadeLeft 0.9s cubic-bezier(0.22,1,0.36,1) 0.35s both;
}

/* Float independiente en wrapper interno para no pisar
   el transform de tilt del ext-mock */
.hero-visual-float {
  animation: heroFloat 7s ease-in-out 1.3s infinite;
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes heroFadeLeft {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-14px); }
}


/* ══════════════════════════════════════════════════
   3. EXT-MOCK — efectos internos
   ══════════════════════════════════════════════════ */

/* Glow pulsante — sólo box-shadow (composite en la
   mayoría de navegadores modernos) */
.ext-mock {
  animation: mockGlow 4s ease-in-out infinite;
}
@keyframes mockGlow {
  0%, 100% { box-shadow: var(--shadow-card), 0 0 40px rgba(255,204,0,0.10); }
  50%       { box-shadow: var(--shadow-card), 0 0 70px rgba(255,204,0,0.22); }
}

/* Shimmer del número de tokens */
.ext-tokens-val {
  background: linear-gradient(90deg, var(--gold) 0%, #fff8c5 50%, var(--gold) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: tokenShimmer 3s ease-in-out 2s infinite;
}
@keyframes tokenShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Botón "Abrir asistente" — shimmer con pseudo */
.ext-btn-launch {
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .2s;
}
.ext-btn-launch::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 25%, rgba(255,255,255,0.3) 50%, transparent 75%);
  transform: translateX(-100%) skewX(-15deg);
  animation: btnShimmer 4s ease-in-out 2s infinite;
}
@keyframes btnShimmer {
  0%, 80%, 100% { transform: translateX(-100%) skewX(-15deg); }
  40%            { transform: translateX(200%) skewX(-15deg); }
}
.ext-btn-launch:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(255,204,0,0.4);
}


/* ══════════════════════════════════════════════════
   4. BOTONES — shimmer + hover
   ══════════════════════════════════════════════════ */
.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: -2px; left: 0;
  width: 55%;
  height: calc(100% + 4px);
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.22) 45%, rgba(255,255,255,0.28) 55%, transparent 100%);
  transform: translateX(-150%) skewX(-18deg);
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}
.btn-primary:hover::after { transform: translateX(320%) skewX(-18deg); }
.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 40px rgba(255,204,0,0.5);
}

.btn-ghost {
  position: relative;
  overflow: hidden;
}
.btn-ghost::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.06);
  opacity: 0;
  transition: opacity .2s;
  border-radius: inherit;
}
.btn-ghost:hover::after { opacity: 1; }


/* ══════════════════════════════════════════════════
   5. REVEAL — sin filter:blur (performance)
      El blur en scroll fuerza compositing en capas
      separadas por cada elemento revelado, lo que
      puede saturar la GPU en páginas largas.
   ══════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity   0.65s cubic-bezier(0.22,1,0.36,1),
    transform 0.65s cubic-bezier(0.22,1,0.36,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger steps */
.steps .step {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity   0.6s cubic-bezier(0.22,1,0.36,1),
    transform 0.6s cubic-bezier(0.22,1,0.36,1),
    background 0.2s;
}
.steps.visible .step:nth-child(1) { opacity:1; transform:none; transition-delay: 0.05s; }
.steps.visible .step:nth-child(2) { opacity:1; transform:none; transition-delay: 0.18s; }
.steps.visible .step:nth-child(3) { opacity:1; transform:none; transition-delay: 0.31s; }
.steps.visible .step:nth-child(4) { opacity:1; transform:none; transition-delay: 0.44s; }

.step-num { transition: color 0.6s, text-shadow 0.6s; }
.steps.visible .step:nth-child(1) .step-num { transition-delay: 0.30s; }
.steps.visible .step:nth-child(2) .step-num { transition-delay: 0.43s; }
.steps.visible .step:nth-child(3) .step-num { transition-delay: 0.56s; }
.steps.visible .step:nth-child(4) .step-num { transition-delay: 0.69s; }
.steps.visible .step-num {
  color: rgba(255,204,0,0.35);
  text-shadow: 0 0 40px rgba(255,204,0,0.2);
}
.step:hover .step-num {
  color: rgba(255,204,0,0.6) !important;
  text-shadow: 0 0 30px rgba(255,204,0,0.35) !important;
}

/* Stagger features */
.features-grid .feature-card {
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition:
    opacity      0.55s cubic-bezier(0.22,1,0.36,1),
    transform    0.55s cubic-bezier(0.22,1,0.36,1),
    border-color 0.2s,
    box-shadow   0.2s;
}
.features-grid.visible .feature-card:nth-child(1) { opacity:1; transform:none; transition-delay: 0.05s; }
.features-grid.visible .feature-card:nth-child(2) { opacity:1; transform:none; transition-delay: 0.15s; }
.features-grid.visible .feature-card:nth-child(3) { opacity:1; transform:none; transition-delay: 0.25s; }
.features-grid.visible .feature-card:nth-child(4) { opacity:1; transform:none; transition-delay: 0.35s; }
.features-grid.visible .feature-card:nth-child(5) { opacity:1; transform:none; transition-delay: 0.45s; }
.features-grid.visible .feature-card:nth-child(6) { opacity:1; transform:none; transition-delay: 0.55s; }

/* Stagger pricing */
.pricing-grid .price-card {
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  transition:
    opacity   0.6s cubic-bezier(0.22,1,0.36,1),
    transform 0.6s cubic-bezier(0.22,1,0.36,1),
    box-shadow 0.2s;
}
.pricing-grid.visible .price-card:nth-child(1) { opacity:1; transform:none; transition-delay: 0.05s; }
.pricing-grid.visible .price-card:nth-child(2) { opacity:1; transform:none; transition-delay: 0.20s; }
.pricing-grid.visible .price-card:nth-child(3) { opacity:1; transform:none; transition-delay: 0.35s; }


/* ══════════════════════════════════════════════════
   6. FEATURE CARDS — tilt 3D + hover effects
   ══════════════════════════════════════════════════ */
.feature-card {
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,204,0,0.6), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.feature-card:hover::before { transform: translateX(100%); }

.feature-icon {
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1), box-shadow 0.3s;
}
.feature-card:hover .feature-icon {
  transform: translateZ(8px) scale(1.12) rotate(-3deg);
  box-shadow: 0 8px 24px rgba(255,204,0,0.25);
}


/* ══════════════════════════════════════════════════
   7. PRICE CARDS — hover + featured glow
   ══════════════════════════════════════════════════ */
.price-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,204,0,0.15);
}
.price-card.featured {
  animation: featuredGlow 5s ease-in-out infinite;
}
@keyframes featuredGlow {
  0%, 100% { box-shadow: 0 0 0 1px var(--gold), 0 0 30px rgba(255,204,0,0.15), 0 8px 32px rgba(0,0,0,0.5); }
  50%       { box-shadow: 0 0 0 1px var(--gold), 0 0 60px rgba(255,204,0,0.28), 0 8px 32px rgba(0,0,0,0.5); }
}
.price-card.featured:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 80px rgba(255,204,0,0.35), 0 24px 60px rgba(0,0,0,0.6);
}
.price-perk { transition: color 0.2s, transform 0.2s; }
.price-card:hover .price-perk { transform: translateX(3px); color: var(--text); }


/* ══════════════════════════════════════════════════
   8. NAV scroll state
   ══════════════════════════════════════════════════ */
#nav.scrolled {
  background: rgba(14,14,14,0.88);
  border-bottom: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(255,204,0,0.1), 0 8px 32px rgba(0,0,0,0.3);
}


/* ══════════════════════════════════════════════════
   9. CTA beam sweep
   ══════════════════════════════════════════════════ */
#cta { position: relative; }
#cta::after {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: ctaBeam 7s ease-in-out 1s infinite;
  pointer-events: none;
}
@keyframes ctaBeam {
  0%   { left: -60%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}


/* ══════════════════════════════════════════════════
   10. CURSOR GLOW
       left/top fijos en 0 — el posicionamiento real
       lo hace JS con transform:translate() (composite)
   ══════════════════════════════════════════════════ */
#cursor-glow {
  position: fixed;
  top: 0; left: 0;           /* posición base fija */
  width: 500px; height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    circle,
    rgba(255,204,0,0.045) 0%,
    rgba(255,140,0,0.02) 40%,
    transparent 70%
  );
  will-change: transform;    /* hint correcto: la propiedad que cambia */
}


/* ══════════════════════════════════════════════════
   11. FAQ accordion
   ══════════════════════════════════════════════════ */
.faq-item { transition: box-shadow 0.25s; }
.faq-item.open { box-shadow: 0 0 0 1px rgba(255,204,0,0.15), 0 4px 20px rgba(0,0,0,0.3); }
.faq-q { transition: background 0.15s, color 0.15s; }
.faq-item.open .faq-q { color: var(--gold); }
.faq-a { transition: max-height 0.4s cubic-bezier(0.22,1,0.36,1); }
.faq-item.open .faq-a-inner {
  animation: faqReveal 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes faqReveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════════════
   12. SEPARADORES con luz
   ══════════════════════════════════════════════════ */
#sites { position: relative; }
#sites::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,204,0,0.2), transparent);
}
#features::before,
#pricing::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

/* Números tabulares para el counter */
[data-count] { font-variant-numeric: tabular-nums; }


/* ══════════════════════════════════════════════════
   13. ACCESIBILIDAD: reducir movimiento
   ══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════════
   14. MOBILE
   ══════════════════════════════════════════════════ */
@media (max-width: 860px) {
  #cursor-glow { display: none; }
  /* En mobile, el float va directo en hero-visual
     ya que no hay tilt de JS */
  .hero-visual {
    animation: heroFadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.3s both;
  }
  .hero-visual-float {
    animation: heroFloat 7s ease-in-out 1.3s infinite;
  }
}