/* ============================================================================
   fx.css — Capa rica (Fase 4)
   Solo se activa en modo FULL (no 3G). Progressive enhancement.
   ============================================================================ */

/* ==========================================================================
   PARTÍCULAS (canvas en hero)
   ========================================================================== */
.fx-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
html[data-mode="full"] .fx-particles {
  opacity: 1;
}
html[data-mode="lite"] .fx-particles {
  display: none;
}

/* ==========================================================================
   LOGO SVG ANIMADO (placeholder hasta que llegue el real)
   ========================================================================== */
.aqf-logo-svg {
  width: 36px;
  height: 36px;
  overflow: visible;
  flex-shrink: 0;
}
.aqf-logo-svg .path-outer,
.aqf-logo-svg .path-inner {
  fill: none;
  stroke: url(#aqfGoldGrad);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}
html[data-mode="full"] .aqf-logo-svg .path-outer {
  animation: draw 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
html[data-mode="full"] .aqf-logo-svg .path-inner {
  animation: draw 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}
html[data-mode="full"] .aqf-logo-svg .logo-text {
  opacity: 0;
  animation: fadeIn 0.6s ease 1.1s forwards;
}
html[data-mode="lite"] .aqf-logo-svg .path-outer,
html[data-mode="lite"] .aqf-logo-svg .path-inner {
  stroke-dashoffset: 0;
}
html[data-mode="lite"] .aqf-logo-svg .logo-text {
  opacity: 1;
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Pulse sutil en hover del logo */
.topbar__logo:hover .aqf-logo-svg {
  animation: pulse-logo 1.2s ease infinite;
}
@keyframes pulse-logo {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.08) rotate(5deg); }
}

/* ==========================================================================
   CURSOR PERSONALIZADO (desktop only, modo FULL)
   ========================================================================== */
html[data-mode="full"] .cursor-dot,
html[data-mode="full"] .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9998;
  border-radius: 50%;
  transform-origin: center;
  mix-blend-mode: difference;
  transition: opacity 0.3s ease, width 0.2s ease, height 0.2s ease;
  will-change: transform;
}
html[data-mode="full"] .cursor-dot {
  width: 6px;
  height: 6px;
  background: #E8C86A;
  margin-left: -3px;
  margin-top: -3px;
  transition: transform 0.05s linear;
}
html[data-mode="full"] .cursor-ring {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(232, 200, 106, 0.6);
  margin-left: -18px;
  margin-top: -18px;
}
html[data-mode="full"] .cursor-ring.is-hover {
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  background: rgba(232, 200, 106, 0.08);
  border-color: rgba(232, 200, 106, 0.9);
}
@media (hover: none), (max-width: 1024px) {
  .cursor-dot, .cursor-ring { display: none !important; }
}
html[data-mode="full"].cursor-active * {
  cursor: none !important;
}

/* ==========================================================================
   TOGGLES FLOTANTES (audio + tema)
   ========================================================================== */
.fx-toolbar {
  position: fixed;
  top: var(--s-5);
  right: var(--s-4);
  display: flex;
  gap: var(--s-2);
  z-index: var(--z-float);
}
@media (max-width: 1023px) {
  .fx-toolbar {
    top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0) + 150px);
  }
}
.fx-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(11, 30, 63, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(232, 200, 106, 0.3);
  color: var(--c-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.fx-toggle:hover {
  background: rgba(232, 200, 106, 0.15);
  border-color: var(--c-gold);
  transform: scale(1.08);
}
html[data-mode="lite"] .fx-toolbar {
  display: none;
}

/* ==========================================================================
   REVEAL ANIMATIONS
   ========================================================================== */
html[data-mode="full"] [data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform, opacity;
}
html[data-mode="full"] [data-reveal="fade-up"].is-revealed {
  opacity: 1;
  transform: translateY(0);
}
html[data-mode="full"] [data-reveal="fade-left"] {
  transform: translateX(-60px);
}
html[data-mode="full"] [data-reveal="fade-left"].is-revealed {
  opacity: 1;
  transform: translateX(0);
}
html[data-mode="full"] [data-reveal="fade-right"] {
  transform: translateX(60px);
}
html[data-mode="full"] [data-reveal="fade-right"].is-revealed {
  opacity: 1;
  transform: translateX(0);
}
html[data-mode="full"] [data-reveal="scale"] {
  transform: scale(0.8);
}
html[data-mode="full"] [data-reveal="scale"].is-revealed {
  opacity: 1;
  transform: scale(1);
}
html[data-mode="full"] [data-reveal="blur"] {
  filter: blur(20px);
  transform: translateY(20px);
}
html[data-mode="full"] [data-reveal="blur"].is-revealed {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* Staggered children */
html[data-mode="full"] [data-reveal-children] > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
html[data-mode="full"] [data-reveal-children].is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}
html[data-mode="full"] [data-reveal-children].is-revealed > *:nth-child(1) { transition-delay: 0s; }
html[data-mode="full"] [data-reveal-children].is-revealed > *:nth-child(2) { transition-delay: 0.08s; }
html[data-mode="full"] [data-reveal-children].is-revealed > *:nth-child(3) { transition-delay: 0.16s; }
html[data-mode="full"] [data-reveal-children].is-revealed > *:nth-child(4) { transition-delay: 0.24s; }
html[data-mode="full"] [data-reveal-children].is-revealed > *:nth-child(5) { transition-delay: 0.32s; }
html[data-mode="full"] [data-reveal-children].is-revealed > *:nth-child(n+6) { transition-delay: 0.4s; }

/* ==========================================================================
   TILT 3D en cards
   ========================================================================== */
html[data-mode="full"] [data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}
html[data-mode="full"] [data-tilt]:hover {
  z-index: 2;
}

/* ==========================================================================
   MAGNETIC buttons
   ========================================================================== */
html[data-mode="full"] [data-magnetic] {
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

/* ==========================================================================
   BOTÓN PRIMARIO con glow pulsante
   ========================================================================== */
html[data-mode="full"] .btn--primary {
  position: relative;
  overflow: hidden;
}
html[data-mode="full"] .btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 25%, rgba(255, 255, 255, 0.4) 50%, transparent 75%);
  transform: translateX(-100%);
  transition: transform 0.8s ease;
}
html[data-mode="full"] .btn--primary:hover::before {
  transform: translateX(100%);
}
html[data-mode="full"] .btn--primary {
  animation: glow-pulse 3s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(232, 200, 106, 0.35); }
  50% { box-shadow: 0 0 42px rgba(232, 200, 106, 0.6); }
}

/* Ripple al hacer click */
html[data-mode="full"] .btn {
  position: relative;
  overflow: hidden;
}
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  transform: scale(0);
  animation: ripple-expand 0.7s ease-out;
}
@keyframes ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ==========================================================================
   SCROLL INDICATOR en hero
   ========================================================================== */
.scroll-indicator {
  position: absolute;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  color: var(--c-gray-2);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  z-index: 2;
}
.scroll-indicator__line {
  width: 2px;
  height: 40px;
  background: linear-gradient(180deg, var(--c-gold), transparent);
  position: relative;
  overflow: hidden;
}
html[data-mode="full"] .scroll-indicator__line::after {
  content: "";
  position: absolute;
  top: -40px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--c-gold);
  animation: scroll-down 2s ease-in-out infinite;
}
@keyframes scroll-down {
  0% { top: -40px; }
  50% { top: 40px; }
  100% { top: 40px; }
}

/* ==========================================================================
   HERO MOLÉCULA (placeholder SVG animado hasta que llegue imagen real)
   ========================================================================== */
.hero-molecule {
  position: absolute;
  right: -10%;
  top: 50%;
  transform: translateY(-50%);
  width: 600px;
  height: 600px;
  max-width: 80vw;
  max-height: 80vh;
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
html[data-mode="full"] .hero-molecule {
  animation: mol-rotate 60s linear infinite;
}
html[data-mode="lite"] .hero-molecule {
  opacity: 0.15;
}
@keyframes mol-rotate {
  to { transform: translateY(-50%) rotate(360deg); }
}
@media (max-width: 768px) {
  .hero-molecule {
    width: 400px;
    height: 400px;
    right: -30%;
    opacity: 0.22;
  }
}

/* ==========================================================================
   SECTION THEMES (cambio de tono al scrollear)
   ========================================================================== */
html[data-mode="full"] .section--theme-warm {
  background: linear-gradient(180deg, transparent 0%, rgba(232, 200, 106, 0.04) 50%, transparent 100%);
}
html[data-mode="full"] .section--theme-cool {
  background: linear-gradient(180deg, transparent 0%, rgba(76, 155, 230, 0.04) 50%, transparent 100%);
}
html[data-mode="full"] .section--theme-dark {
  background: linear-gradient(180deg, transparent 0%, rgba(11, 30, 63, 0.6) 50%, transparent 100%);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast {
  position: fixed;
  top: var(--s-5);
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--c-surface);
  border: 1px solid var(--c-gold);
  color: var(--c-white);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--sh-2);
  z-index: 10000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}
.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   FLOATING SCORE BADGE (aparece tras simulacro)
   ========================================================================== */
.score-badge {
  position: fixed;
  top: 72px;
  right: var(--s-4);
  background: linear-gradient(135deg, var(--c-gold), var(--c-gold-2));
  color: var(--c-bg);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  font-weight: 800;
  font-size: var(--fs-sm);
  box-shadow: var(--sh-gold);
  z-index: var(--z-float);
  animation: score-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes score-pop {
  from { transform: scale(0) rotate(-15deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

/* ==========================================================================
   CARDS con hover premium
   ========================================================================== */
html[data-mode="full"] .card {
  position: relative;
  overflow: hidden;
}
html[data-mode="full"] .card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(232, 200, 106, 0.1), transparent 40%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
html[data-mode="full"] .card:hover::after {
  opacity: 1;
}

/* ==========================================================================
   NUMBER TICKER
   ========================================================================== */
.num-ticker {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   SECTION DIVIDER animado
   ========================================================================== */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  margin: var(--s-7) 0;
  opacity: 0.4;
}
.section-divider__line {
  height: 1px;
  width: 80px;
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}
.section-divider__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-gold);
}
html[data-mode="full"] .section-divider__dot {
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 1; }
}

/* ==========================================================================
   ACCESIBILIDAD: reducir movimiento
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .fx-particles,
  .hero-molecule,
  .scroll-indicator__line::after,
  .btn--primary,
  .aqf-logo-svg .path-outer,
  .aqf-logo-svg .path-inner,
  .aqf-logo-svg .logo-text,
  .section-divider__dot {
    animation: none !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
