/* ===================================================================
 * Alumbra - fondo animado de drones y droides (Soluciones y Contacto)
 *
 * Se activa en cualquier sección con la clase .has-fleet que contenga
 * el bloque .svc-bg. Drones y droides vectoriales sobre el fondo existente.
 * js/flota.js traduce la posición del cursor a las variables --cx, --cy,
 * --px y --py, que mueven al dron principal, desplazan la flota
 * (paralaje) y orientan la mirada de los droides.
 * ------------------------------------------------------------------- */

.has-fleet {
  position: relative;
  overflow: hidden;
  --cx: 90%;
  --cy: 11%;
  --px: 0;
  --py: 0;
}
/* el contenido queda sobre el fondo */
.has-fleet > .row {
  position: relative;
  z-index: 2;
}

.svc-bg {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  color: rgba(255, 255, 255, 0.16);
}

/* -------------------------------------------------------------------
 * piezas comunes
 * ------------------------------------------------------------------- */
.svc-drone,
.svc-droid {
  position: absolute;
  pointer-events: none;
}
.svc-drone svg,
.svc-droid svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.svc-par {
  -webkit-transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* hélices: la elipse se achica y crece para simular el giro */
.svc-rotor {
  transform-box: fill-box;
  transform-origin: center;
  -webkit-animation: svc-spin 0.12s linear infinite alternate;
  animation: svc-spin 0.12s linear infinite alternate;
}
.svc-rotor--r {
  -webkit-animation-delay: -0.06s;
  animation-delay: -0.06s;
}
@keyframes svc-spin {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0.15); }
}

/* vuelo estacionario */
@keyframes svc-hover {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-10px) rotate(1.5deg); }
}

.svc-led {
  fill: #e8125a;
  -webkit-animation: svc-blink 1.6s steps(1) infinite;
  animation: svc-blink 1.6s steps(1) infinite;
}
@keyframes svc-blink {
  0%, 60%   { opacity: 1; }
  61%, 100% { opacity: 0.15; }
}

/* -------------------------------------------------------------------
 * dron principal: persigue al cursor
 * ------------------------------------------------------------------- */
.svc-drone--lead {
  width: 130px;
  margin: -95px 0 0 -65px;
  left: var(--cx);
  top: var(--cy);
  color: rgba(255, 255, 255, 0.55);
  -webkit-transition: left 2.4s cubic-bezier(0.25, 0.8, 0.25, 1), top 2.4s cubic-bezier(0.25, 0.8, 0.25, 1), color 0.6s ease;
  transition: left 2.4s cubic-bezier(0.25, 0.8, 0.25, 1), top 2.4s cubic-bezier(0.25, 0.8, 0.25, 1), color 0.6s ease;
}
.svc-drone--lead svg {
  -webkit-animation: svc-hover 3s ease-in-out infinite;
  animation: svc-hover 3s ease-in-out infinite;
}
.svc-beam {
  fill: #e8125a;
  opacity: 0;
  -webkit-transition: opacity 0.6s ease;
  transition: opacity 0.6s ease;
}

/* -------------------------------------------------------------------
 * flota de fondo: patrulla y se desplaza con el cursor
 * ------------------------------------------------------------------- */
.svc-drone--a {
  width: 90px;
  top: 8%;
  left: 6%;
  -webkit-animation: svc-patrol-a 26s ease-in-out infinite;
  animation: svc-patrol-a 26s ease-in-out infinite;
}
.svc-drone--b {
  width: 70px;
  top: 46%;
  left: 60%;
  -webkit-animation: svc-patrol-b 32s ease-in-out infinite;
  animation: svc-patrol-b 32s ease-in-out infinite;
}
.svc-drone--c {
  width: 56px;
  top: 64%;
  left: 14%;
  color: rgba(255, 255, 255, 0.1);
  -webkit-animation: svc-patrol-c 22s ease-in-out infinite;
  animation: svc-patrol-c 22s ease-in-out infinite;
}
.svc-drone--a svg {
  -webkit-animation: svc-hover 3.6s ease-in-out infinite;
  animation: svc-hover 3.6s ease-in-out infinite;
}
.svc-drone--b svg {
  -webkit-animation: svc-hover 4.2s ease-in-out -1s infinite;
  animation: svc-hover 4.2s ease-in-out -1s infinite;
}
.svc-drone--c svg {
  -webkit-animation: svc-hover 3.2s ease-in-out -2s infinite;
  animation: svc-hover 3.2s ease-in-out -2s infinite;
}

@keyframes svc-patrol-a {
  0%, 100% { transform: translate(0, 0); }
  30%      { transform: translate(28vw, 6vh); }
  60%      { transform: translate(12vw, 22vh); }
}
@keyframes svc-patrol-b {
  0%, 100% { transform: translate(0, 0); }
  35%      { transform: translate(-30vw, -18vh); }
  70%      { transform: translate(14vw, -6vh); }
}
@keyframes svc-patrol-c {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(52vw, -10vh); }
}

/* intensidad del paralaje de cada equipo */
.svc-drone--a .svc-par { transform: translate(calc(var(--px) * 40px), calc(var(--py) * 24px)); }
.svc-drone--b .svc-par { transform: translate(calc(var(--px) * 26px), calc(var(--py) * 16px)); }
.svc-drone--c .svc-par { transform: translate(calc(var(--px) * 14px), calc(var(--py) * 8px)); }
.svc-droid .svc-par    { transform: translateX(calc(var(--px) * 18px)); }

/* -------------------------------------------------------------------
 * droides: recorren la base de la sección y miran hacia el cursor
 * ------------------------------------------------------------------- */
.svc-droid {
  bottom: 2.4rem;
}
.svc-droid--a {
  width: 70px;
  left: 4%;
  -webkit-animation: svc-roll-a 30s ease-in-out infinite;
  animation: svc-roll-a 30s ease-in-out infinite;
}
.svc-droid--b {
  width: 54px;
  left: 70%;
  color: rgba(255, 255, 255, 0.11);
  -webkit-animation: svc-roll-b 24s ease-in-out infinite;
  animation: svc-roll-b 24s ease-in-out infinite;
}
@keyframes svc-roll-a {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(46vw); }
}
@keyframes svc-roll-b {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-34vw); }
}
.svc-wheel {
  stroke-dasharray: 6 4;
  -webkit-animation: svc-wheel 0.8s linear infinite;
  animation: svc-wheel 0.8s linear infinite;
}
@keyframes svc-wheel {
  to { stroke-dashoffset: -20; }
}
.svc-eye {
  fill: #e8125a;
  transform: translate(calc(var(--px) * 13px), calc(var(--py) * 1.5px));
  -webkit-transition: transform 0.6s ease;
  transition: transform 0.6s ease;
}

/* -------------------------------------------------------------------
 * cursor sobre la sección: el dron principal enciende su escáner
 * ------------------------------------------------------------------- */
.has-fleet:hover .svc-beam,
.has-fleet[data-fleet-active] .svc-beam {
  opacity: 0.22;
}
.has-fleet:hover .svc-drone--lead,
.has-fleet[data-fleet-active] .svc-drone--lead {
  color: rgba(255, 255, 255, 0.8);
}

/* -------------------------------------------------------------------
 * pantallas pequeñas: flota reducida
 * ------------------------------------------------------------------- */
@media only screen and (max-width: 800px) {
  .has-fleet {
    --cx: 80%;
  }
  .svc-drone--c,
  .svc-droid--b {
    display: none;
  }
  .svc-drone--lead {
    width: 100px;
    margin: -72px 0 0 -50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .svc-bg *,
  .svc-drone,
  .svc-droid {
    -webkit-animation: none !important;
    animation: none !important;
    -webkit-transition: none !important;
    transition: none !important;
  }
}
