/* ==========================================================================
   WITCODE — magic-ui.css
   Efectos interactivos inspirados en componentes gratuitos de Magic UI
   (magicui.design, licencia MIT), recreados en CSS puro para el sitio
   estático (sin React / Tailwind / Motion). Se carga en index.html y en
   diagnostico-gasto-ia.html (landing Design Partners, desde 22/10/2026;
   ver bloque "Variantes para diagnostico-gasto-ia.html" más abajo).

   Intensidad: SUTIL (decisión del usuario, 22/10/2026).

   Componentes recreados (nombre Magic UI → clase local):
     - Shimmer Button           → .mu-shimmer        (botón "Comunidad Witcode" del hero)
     - Animated Gradient Text   → .hero h1 em        ("A Negocios" del hero)
     - Magic Card (spotlight)   → .mu-spotlight      (tarjetas de Servicios)
     - Border Beam              → .mu-beam           (imágenes de Novedades + recuadro FAQ)
     - Dot Pattern              → .mu-dots           (secciones oscuras)
     - Meteors                  → .mu-meteors        ("¿Qué hacemos?")
     - Ripple                   → .mu-ripple         (ícono de contacto)
     - Confetti                 → JS (magic-ui.js)   (al copiar el mail)

   Todo respeta prefers-reduced-motion (ver bloque final).
   ========================================================================== */

/* Ángulo animable para el Border Beam (Chrome/Edge, Safari 16.4+, Firefox 128+).
   En navegadores sin @property el borde queda estático, sin errores. */
@property --mu-angle{
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ---------------------------------------------------------------------- */
/* Shimmer Button — destello de luz que cruza el botón cada ~4s            */
/* ---------------------------------------------------------------------- */
.mu-shimmer{
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.mu-shimmer::after{
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg,
    transparent 0%,
    rgba(255,255,255,.0) 20%,
    rgba(255,255,255,.38) 50%,
    rgba(255,255,255,.0) 80%,
    transparent 100%);
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 1;
  animation: mu-shimmer-sweep 4.2s ease-in-out infinite;
}
.mu-shimmer > *{ position: relative; z-index: 2; }
@keyframes mu-shimmer-sweep{
  0%   { left: -60%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}

/* ---------------------------------------------------------------------- */
/* Animated Gradient Text — el degradé de marca se desplaza lentamente     */
/* ---------------------------------------------------------------------- */
.hero h1 em{
  background: linear-gradient(90deg,
    var(--blue) 0%,
    var(--violet) 30%,
    var(--cyan) 55%,
    var(--violet) 75%,
    var(--blue) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: mu-gradient-pan 9s ease-in-out infinite;
}
@keyframes mu-gradient-pan{
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ---------------------------------------------------------------------- */
/* Magic Card — brillo que sigue al cursor sobre la imagen de la tarjeta   */
/* + anillo de borde que se ilumina del lado del cursor.                   */
/* Las coordenadas (--mu-x / --mu-y) las actualiza magic-ui.js.            */
/* ---------------------------------------------------------------------- */
.mu-spotlight .feature-image{
  position: relative;
  --mu-x: 50%;
  --mu-y: 50%;
}
.mu-spotlight .feature-image::after{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(280px circle at var(--mu-x) var(--mu-y),
    rgba(124,92,255,.28), rgba(47,107,255,.12) 45%, transparent 72%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 1;
}
.mu-spotlight .feature-image::before{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: radial-gradient(240px circle at var(--mu-x) var(--mu-y),
    rgba(124,92,255,1), rgba(0,208,255,.7) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 2;
}
.mu-spotlight:hover .feature-image::after,
.mu-spotlight:hover .feature-image::before,
.mu-spotlight:focus-visible .feature-image::after,
.mu-spotlight:focus-visible .feature-image::before{ opacity: 1; }

/* ---------------------------------------------------------------------- */
/* Border Beam — un haz de luz que recorre el borde del contenedor         */
/* ---------------------------------------------------------------------- */
.mu-beam{
  position: relative;
}
.mu-beam::before{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--mu-angle),
    transparent 0deg,
    transparent 270deg,
    rgba(0,208,255,.0) 280deg,
    rgba(0,208,255,.9) 325deg,
    rgba(124,92,255,1) 350deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
  animation: mu-beam-spin 9s linear infinite;
}
@keyframes mu-beam-spin{
  to { --mu-angle: 360deg; }
}
/* Escalonado para que las 3 tarjetas de Novedades no giren sincronizadas */
.news-card:nth-child(2) .mu-beam::before{ animation-delay: -3s; }
.news-card:nth-child(3) .mu-beam::before{ animation-delay: -6s; }

/* Variante para fondos claros (recuadro de respuestas del FAQ) */
.ai-guide-right.mu-beam{ border-radius: var(--r-lg); }
.mu-beam.mu-beam-light::before{
  background: conic-gradient(from var(--mu-angle),
    transparent 0deg,
    transparent 270deg,
    rgba(47,107,255,.0) 280deg,
    rgba(47,107,255,.75) 325deg,
    rgba(124,92,255,.9) 350deg,
    transparent 360deg);
  animation-duration: 11s;
}

/* ---------------------------------------------------------------------- */
/* Dot Pattern — grilla de puntos tenue con bordes difuminados             */
/* ---------------------------------------------------------------------- */
.mu-dots{ isolation: isolate; }
.mu-dots::before{
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(238,241,248,.14) 1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.mu-dots > .container{ position: relative; z-index: 1; }

/* ---------------------------------------------------------------------- */
/* Meteors — estelas diagonales ocasionales (las genera magic-ui.js)       */
/* ---------------------------------------------------------------------- */
.mu-meteors{
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.mu-meteor{
  position: absolute;
  top: -10px;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: rgba(238,241,248,.85);
  box-shadow: 0 0 0 1px rgba(238,241,248,.06), 0 0 6px rgba(124,145,255,.6);
  transform: rotate(215deg);
  opacity: 0;
  animation: mu-meteor-fall linear infinite;
}
.mu-meteor::before{
  content: "";
  position: absolute;
  top: 50%; left: 1px;
  width: 70px; height: 1px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(150,180,255,.65), transparent);
}
@keyframes mu-meteor-fall{
  0%   { transform: rotate(215deg) translateX(0); opacity: 0; }
  6%   { opacity: .9; }
  70%  { opacity: .9; }
  100% { transform: rotate(215deg) translateX(-620px); opacity: 0; }
}

/* ---------------------------------------------------------------------- */
/* Ripple — ondas suaves que salen del ícono de contacto                   */
/* ---------------------------------------------------------------------- */
.mu-ripple{
  position: relative;
  animation: mu-ripple-pulse 3.2s ease-out infinite;
}
@keyframes mu-ripple-pulse{
  0%   { box-shadow: 0 0 0 0 rgba(47,107,255,.40), 0 0 0 0 rgba(124,92,255,.22); }
  70%  { box-shadow: 0 0 0 16px rgba(47,107,255,0), 0 0 0 30px rgba(124,92,255,0); }
  100% { box-shadow: 0 0 0 16px rgba(47,107,255,0), 0 0 0 30px rgba(124,92,255,0); }
}

/* ---------------------------------------------------------------------- */
/* Confetti — partículas creadas por magic-ui.js al copiar el mail         */
/* ---------------------------------------------------------------------- */
.mu-confetti-piece{
  position: fixed;
  top: 0; left: 0;
  width: 7px; height: 7px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 1300;
  will-change: transform, opacity;
}

/* ====================================================================== */
/* Variantes para diagnostico-gasto-ia.html (landing Design Partners)      */
/* Esa página usa sim-styles.css, donde algunos elementos ya tienen        */
/* pseudo-elementos propios (ej. .console::before = borde degradé), así    */
/* que acá van variantes que no los pisan.                                 */
/* ====================================================================== */

/* Animated Gradient Text genérico (ej. ".grad-text" del simulador) */
.grad-text.mu-grad-anim,
.mu-grad-anim{
  background-image: linear-gradient(90deg, #7fa6ff 0%, #a98dff 30%, #5fe1ff 55%, #a98dff 75%, #7fa6ff 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: mu-gradient-pan 9s ease-in-out infinite;
}

/* Border Beam sobre ::after (para elementos que ya usan ::before) */
.mu-beam-after{ position: relative; }
.mu-beam-after::after{
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--mu-angle),
    transparent 0deg,
    transparent 270deg,
    rgba(0,208,255,.0) 280deg,
    rgba(0,208,255,.9) 325deg,
    rgba(124,92,255,1) 350deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
  animation: mu-beam-spin 10s linear infinite;
}

/* Magic Card aplicado a la tarjeta misma (no a una imagen interna).
   El brillo va DETRÁS del contenido y el anillo sobre el borde. */
.mu-spotlight-self{
  --mu-x: 50%;
  --mu-y: 50%;
  isolation: isolate;
}
.mu-spotlight-self > *{ position: relative; z-index: 1; }
.mu-spotlight-self::after{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--mu-x) var(--mu-y),
    rgba(124,92,255,.18), rgba(47,107,255,.08) 45%, transparent 72%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 0;
}
.mu-spotlight-self::before{
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: radial-gradient(240px circle at var(--mu-x) var(--mu-y),
    rgba(124,92,255,1), rgba(0,208,255,.6) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 2;
}
.mu-spotlight-self:hover::after,
.mu-spotlight-self:hover::before{ opacity: 1; }

/* Meteors dentro de un contenedor con contenido propio (ej. .cta-final):
   el contenido queda por encima de las estelas. */
.mu-has-meteors > :not(.mu-meteors){ position: relative; z-index: 1; }

/* Blur Fade escalonado: los ítems de una lista aparecen uno por uno.
   magic-ui.js agrega .mu-blur-ready (estado inicial) y luego .mu-in.
   Sin JS, la lista se ve normal. */
.mu-blur-ready > *{
  opacity: 0;
  filter: blur(6px);
  transform: translateY(10px);
  transition: opacity .6s ease, filter .6s ease, transform .6s ease;
  transition-delay: calc(var(--mu-i, 0) * 120ms + 150ms);
}
.mu-blur-ready.mu-in > *{
  opacity: 1;
  filter: none;
  transform: none;
}

/* ---------------------------------------------------------------------- */
/* Accesibilidad: sin movimiento para quien lo pidió en su sistema         */
/* ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  .mu-shimmer::after{ animation: none; display: none; }
  .hero h1 em{ animation: none; }
  .mu-beam::before{ animation: none; }
  .mu-meteors{ display: none; }
  .mu-ripple{ animation: none; }
  .mu-grad-anim{ animation: none; }
  .mu-beam-after::after{ animation: none; }
  .mu-blur-ready > *{ opacity: 1; filter: none; transform: none; transition: none; }
}
