/* ============================================================
   Eurekant — Cursor + Background FX
   ------------------------------------------------------------
   Estilos para:
   · Cursor custom (dot, ring, spotlight, label, estados contextuales)
   · Trail SVG
   · Click ripple/burst (cursor + fondo)
   · Card spotlight (--mx/--my por card)
   · Magnetic buttons ([data-magnetic])
   · Section reveal on scroll (.fx-revealable)
   · Constellation/particles (canvas — pintado en JS)
   · Aurora reacts to cursor (vars JS)
   · Grain overlay
   ============================================================ */

/* ── Custom cursor: oculta el nativo en TODO ─────────────── */
*, *::before, *::after { cursor: none !important; }

/* ── Cursor: dot ─────────────────────────────────────────── */
.c-dot {
  position: fixed; pointer-events: none;
  z-index: 99999;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #2199ea;
  box-shadow: 0 0 8px rgba(33,153,234,0.9);
  transform: translate(-50%,-50%);
  opacity: 0;
  transition: opacity 200ms, transform 120ms, background 200ms;
  will-change: left, top;
}
.c-dot.click { transform: translate(-50%,-50%) scale(0.5); background: #06a1e4; }

/* ── Cursor: ring (con backdrop-filter — distorsión muy sutil) ─ */
.c-ring {
  position: fixed; pointer-events: none;
  z-index: 99998;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(33,153,234,0.5);
  background: rgba(33,153,234,0.02);
  backdrop-filter: blur(0.5px) saturate(1.04);
  -webkit-backdrop-filter: blur(0.5px) saturate(1.04);
  transform: translate(-50%,-50%);
  opacity: 0;
  transition:
    opacity 200ms,
    width 240ms var(--ease-standard),
    height 240ms var(--ease-standard),
    border-radius 240ms var(--ease-standard),
    border-color 220ms,
    border-width 200ms,
    background 240ms,
    box-shadow 240ms;
  will-change: left, top, transform;
}
.c-ring.click {
  width: 16px; height: 16px;
  border-color: #06a1e4;
  border-width: 2px;
}

/* Estados contextuales por tipo de elemento */
.c-ring.over-btn {
  width: 42px; height: 42px;
  border-color: rgba(33,153,234,0.95);
  border-width: 2px;
  background: rgba(33,153,234,0.08);
  box-shadow: 0 0 28px rgba(33,153,234,0.55), inset 0 0 14px rgba(33,153,234,0.18);
}
.c-ring.over-link {
  width: 28px; height: 28px;
  border-color: rgba(6,161,228,0.85);
  background: rgba(6,161,228,0.06);
}
.c-ring.over-input {
  width: 4px; height: 22px;
  border-radius: 2px;
  border-color: rgba(33,153,234,0.95);
  background: rgba(33,153,234,0.18);
  border-width: 1px;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.c-ring.over-card {
  width: 38px; height: 38px;
  border-radius: 12px;
  border-color: rgba(33,153,234,0.75);
  background: rgba(33,153,234,0.05);
}

/* ── Cursor: spotlight (radial 280px detrás del cursor) ──── */
.c-spotlight {
  position: fixed; pointer-events: none;
  z-index: 1;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(33,153,234,0.22) 0%,
    rgba(33,153,234,0.12) 35%,
    rgba(6,161,228,0.05) 60%,
    transparent 75%
  );
  mix-blend-mode: screen;
  transform: translate(-50%,-50%);
  opacity: 0;
  transition: opacity 320ms ease;
  will-change: left, top;
  filter: blur(4px);
}

/* ── Cursor: label contextual ─────────────────────────────── */
.c-label {
  position: fixed; pointer-events: none;
  z-index: 99998;
  font: 10px/1 var(--font-mono, monospace);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b9e3ff;
  background: rgba(9,21,37,0.88);
  border: 1px solid rgba(33,153,234,0.45);
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 180ms ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

/* ── Cursor: trail (pool de dots que se desvanecen) ──────── */
.c-trail {
  position: fixed; pointer-events: none;
  z-index: 99997;
  border-radius: 50%;
  background: #2199ea;
  transform: translate(-50%,-50%);
  opacity: 0;
  will-change: left, top;
}

/* ── Cursor: trail SVG (alt mode — desactivado por default) ─ */
.c-trail-svg {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 99996;
  width: 100vw; height: 100vh;
}

/* ── Click bursts ────────────────────────────────────────── */
.c-burst-dot {
  position: fixed; pointer-events: none;
  z-index: 99996;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #2199ea;
  box-shadow: 0 0 6px rgba(33,153,234,0.8);
  transform: translate(-50%,-50%);
}
.c-burst-ring {
  position: fixed; pointer-events: none;
  z-index: 99996;
  width: 14px; height: 14px;
  border: 1.5px solid rgba(33,153,234,0.85);
  border-radius: 50%;
  transform: translate(-50%,-50%);
}
.fx-click-ripple {
  position: fixed; pointer-events: none;
  z-index: 1;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(33,153,234,0.22) 0%,
    rgba(33,153,234,0.10) 45%,
    transparent 70%
  );
  transform: translate(-50%,-50%);
  mix-blend-mode: screen;
}

/* ── Card spotlight ───────────────────────────────────────── */
/* Aplica a cualquier card con clase .fx-card-spotlight o .service-card.
   JS setea --mx/--my (en px, relativos a la card) cuando el cursor está adentro. */
.service-card, .fx-card-spotlight { position: relative; }
.service-card::before, .fx-card-spotlight::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    320px circle at var(--mx, -200px) var(--my, -200px),
    rgba(33,153,234,0.16) 0%,
    rgba(33,153,234,0.06) 35%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity 280ms var(--ease-standard);
  pointer-events: none;
  z-index: 0;
}
.service-card.has-spot::before, .fx-card-spotlight.has-spot::before { opacity: 1; }
.service-card > *, .fx-card-spotlight > * { position: relative; z-index: 1; }

/* ── Magnetic buttons ─────────────────────────────────────── */
/* JS setea --mag-x/--mag-y. Opt-in con [data-magnetic].
   Usa la propiedad CSS `translate` (independiente de transform) así
   compone con cualquier transform inline existente (ej. hover lift). */
[data-magnetic] {
  --mag-x: 0px;
  --mag-y: 0px;
  translate: var(--mag-x) var(--mag-y);
  transition: translate 320ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: translate;
}

/* ── Section reveal on scroll ─────────────────────────────── */
.fx-revealable {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 800ms var(--ease-standard),
    transform 800ms var(--ease-standard);
  position: relative;
}
.fx-revealable.revealed {
  opacity: 1;
  transform: translateY(0);
}
.fx-revealable.revealed > .fx-reveal-bloom {
  animation: fxRevealBloom 1400ms ease-out forwards;
}
.fx-reveal-bloom {
  position: absolute;
  inset: -40px -20px auto -20px;
  height: 200px;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center top,
    rgba(33,153,234,0.20) 0%,
    rgba(6,161,228,0.10) 30%,
    transparent 65%
  );
  opacity: 0;
  z-index: 0;
  mix-blend-mode: screen;
}
@keyframes fxRevealBloom {
  0%   { opacity: 0; transform: scaleY(0.6); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scaleY(1.1); }
}

/* ── Grain overlay ────────────────────────────────────────── */
.fx-grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}
