/* =========================================================
   Cary — Capa de efectos "futuristas"
   Cargar después de styles.css
   ========================================================= */

/* ---------- Preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 40%, #ffffff 0%, #f3fbfb 60%, #e8f6f6 100%);
  transition: opacity .45s ease, visibility .45s;
}
.preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader__mark { width: 74px; height: 74px; position: relative; animation: preSpin 1.1s cubic-bezier(.5,0,.3,1) infinite; }
.preloader__mark span { position: absolute; border-radius: 999px; background: var(--coral); }
.preloader__mark .p-v { width: 26px; height: 62px; left: 24px; top: 6px; opacity: .95; }
.preloader__mark .p-h { width: 62px; height: 26px; left: 6px; top: 24px; background: var(--teal); mix-blend-mode: multiply; }
.preloader__word { position: absolute; bottom: 30%; font-weight: 800; letter-spacing: .35em; text-transform: uppercase; font-size: .72rem; color: var(--teal-700); opacity: .8; }
@keyframes preSpin { 0%{transform:rotate(0) scale(1)} 50%{transform:rotate(180deg) scale(.82)} 100%{transform:rotate(360deg) scale(1)} }

/* ---------- Barra de progreso de scroll ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 200; transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--coral), var(--teal-600) 60%, var(--cyan));
  box-shadow: 0 0 14px rgba(255,106,110,.5);
}

/* ---------- Aura del cursor ---------- */
.cursor-aura {
  position: fixed; top: 0; left: 0; width: 520px; height: 520px; border-radius: 50%; z-index: 60;
  pointer-events: none; mix-blend-mode: screen; opacity: 0; transition: opacity .4s;
  background: radial-gradient(circle, rgba(255,106,110,.22) 0%, rgba(131,197,190,.14) 40%, transparent 70%);
  transform: translate3d(var(--cx,-50vw), var(--cy,-50vh), 0) translate(-50%, -50%);
  will-change: transform;
}
body.cursor-on .cursor-aura { opacity: 1; }

/* ---------- Rejilla / puntos de fondo (profundidad) ---------- */
.grid-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(131,197,190,.22) 1px, transparent 1.4px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 75%);
  opacity: .7;
}

/* ---------- Constelación (canvas) en bandas oscuras ---------- */
.constellation { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .9; }
.stats .wrap, .cta__box > *:not(.aurora):not(.constellation):not(.grid-bg) { position: relative; z-index: 2; }

/* ---------- Spotlight que sigue el puntero en tarjetas ---------- */
.card, .pillar, .stat { --mx: 50%; --my: 50%; }
.card::after, .pillar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity .35s;
  background: radial-gradient(340px circle at var(--mx) var(--my), rgba(255,106,110,.14), transparent 42%);
}
.card:hover::after, .pillar:hover::after { opacity: 1; }
.card > *, .pillar > * { position: relative; z-index: 1; }
.card.feature-hero::after { background: radial-gradient(340px circle at var(--mx) var(--my), rgba(224,251,252,.18), transparent 45%); }
.stat::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity .35s;
  background: radial-gradient(300px circle at var(--mx) var(--my), rgba(224,251,252,.12), transparent 45%);
}
.stat:hover::after { opacity: 1; }
.stat > * { position: relative; z-index: 1; }

/* ---------- Anillo de luz conic (hero + feature-hero) ---------- */
.glow-ring { position: relative; isolation: isolate; }
.glow-ring::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: -1;
  padding: 2px;
  background: conic-gradient(from var(--a, 0deg), transparent 0deg, var(--coral) 70deg, var(--cyan) 150deg, var(--teal) 230deg, transparent 300deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: ringSpin 8s linear infinite; opacity: .9;
}
.glow-ring::after {
  content: ""; position: absolute; inset: -14px; border-radius: inherit; z-index: -2;
  background: conic-gradient(from var(--a, 0deg), transparent, rgba(255,106,110,.45), transparent 40%, rgba(131,197,190,.4), transparent 70%);
  filter: blur(26px); animation: ringSpin 8s linear infinite; opacity: .6;
}
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes ringSpin { to { --a: 360deg; } }
/* Fallback si @property no existe: rotación por transform del pseudo */
@supports not (background: conic-gradient(from var(--a), red, blue)) {
  .glow-ring::before, .glow-ring::after { animation: none; }
}

/* ---------- Overlay holográfico (scanlines) en el hero stage ---------- */
.holo { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden; z-index: 4; }
.holo::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0) 0 3px, rgba(12,39,46,.035) 3px 4px);
  mix-blend-mode: multiply;
}
.holo::after {
  content: ""; position: absolute; left: 0; right: 0; height: 34%;
  background: linear-gradient(180deg, transparent, rgba(224,251,252,.55), transparent);
  filter: blur(6px); animation: scan 5.5s ease-in-out infinite; opacity: .8;
}
@keyframes scan { 0%,100% { top: -34%; } 50% { top: 100%; } }

/* ---------- Badge "en vivo" ---------- */
.live-badge {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--teal-700);
  background: rgba(255,255,255,.7); border: 1px solid #fff; backdrop-filter: blur(10px);
}
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: #38c47a; box-shadow: 0 0 0 0 rgba(56,196,122,.6); animation: pulse 2s infinite; }

/* ---------- Botones magnéticos + brillo ---------- */
[data-mag] { position: relative; }
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%; z-index: 0;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transition: left .6s ease;
}
.btn-primary:hover::after { left: 140%; }
.btn-primary > * { position: relative; z-index: 1; }

/* ---------- Realce del número de stat al contar ---------- */
.stat__num.counting { color: #fff; text-shadow: 0 0 30px rgba(224,251,252,.35); }

/* ---------- Reduce motion: apaga lo pesado ---------- */
@media (prefers-reduced-motion: reduce) {
  .preloader { display: none; }
  .glow-ring::before, .glow-ring::after, .holo::after, .live-badge i { animation: none; }
  .cursor-aura { display: none; }
  .scroll-progress { transition: none; }
}
@media (hover: none) {
  .cursor-aura { display: none; }
}
