/* Efectos de la página, inspirados en Magic UI, React Bits, Aceternity, Motion Primitives y
   libraries.dev, reescritos en CSS y JS sin frameworks y con los colores de ECOARG:
   barra de progreso, título palabra por palabra, luz en Servicios, línea de Procesos,
   borde con luz en el formulario y contador de la licencia. Lógica en js/fx.js */

/* 1. Barra de progreso de lectura (Scroll Progress: Magic UI / Animate UI / Motion Primitives) */
.fx-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: 3px;
  background: var(--gradient-green);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* 2. Entrada del título palabra por palabra con desenfoque (Blur Text / Text Effect) */
.fx-word {
  display: inline-block;
  animation: fx-blur-in 0.9s var(--ease-out) both;
  animation-delay: calc(var(--i) * 90ms + 120ms);
}
@keyframes fx-blur-in {
  from { opacity: 0; filter: blur(10px); transform: translateY(0.25em); }
  to { opacity: 1; filter: none; transform: none; }
}
/* El título ya no usa la subida general de la portada: la reemplaza la entrada por palabras */
.fx-split { animation: none !important; }

/* 4. Luz que sigue al cursor en las tarjetas de Servicios (Spotlight Card / Magic Card) */
.services .service-card:not(.service-card--featured)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgb(94 181 116 / 0.16), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.services .service-card:not(.service-card--featured):hover::after { opacity: 1; }

/* 5. Línea de recorrido en Procesos que se completa al bajar (Tracing Beam / Timeline) */
.fx-beam { display: none; }
@media (min-width: 1024px) {
  .fx-beam {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: -0.5rem 0 1.5rem;
  }
  .fx-beam__track,
  .fx-beam__fill {
    position: absolute;
    top: 50%;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    margin-top: -1px;
    border-radius: 2px;
  }
  .fx-beam__track { background: rgb(255 255 255 / 0.25); }
  .fx-beam__fill {
    right: auto;
    width: calc(75% * var(--p, 0));
    background: linear-gradient(90deg, var(--white), var(--orange-300));
    box-shadow: 0 0 10px rgb(251 176 78 / 0.6);
  }
  .fx-beam__dot {
    position: relative;
    justify-self: center;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgb(255 255 255 / 0.35);
    background: var(--green-title);
    color: rgb(255 255 255 / 0.7);
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    transition: background-color 0.4s, border-color 0.4s, color 0.4s, transform 0.4s var(--ease-out);
  }
  .fx-beam__dot.is-on { background: var(--orange-300); border-color: var(--orange-300); color: var(--green-night); transform: scale(1.12); }
}

/* 6. Luz que recorre el borde del formulario (Border Beam: Magic UI / libraries.dev) */
@property --fx-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
.form.fx-border-beam { position: relative; isolation: isolate; }
.form.fx-border-beam::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from var(--fx-angle), transparent 0 70%, var(--orange-300) 82%, var(--white) 88%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: fx-spin 6s linear infinite;
  pointer-events: none;
}
.form.fx-border-beam > * { position: relative; z-index: 1; }
@keyframes fx-spin { to { --fx-angle: 360deg; } }

/* Movimiento reducido: todo queda quieto y visible */
@media (prefers-reduced-motion: reduce) {
  .fx-word { animation: none; }
  .form.fx-border-beam::before { animation: none; }
  .fx-beam__fill { transition: none; }
}
