/* ============================================================
   ANIMACIONES: COHETES Y LUCES LED - fabi.exe
   Capa decorativa opcional. Se carga después de mejoras.css.
   Respeta prefers-reduced-motion y no bloquea la interacción.
   ============================================================ */

:root {
    --led-violeta: #8b5cf6;
    --led-cian: #22d3ee;
    --led-rosa: #db2777;
    --led-ambar: #fbbf24;
    --led-linea: linear-gradient(90deg,
        transparent 0%,
        var(--led-violeta) 14%,
        var(--led-cian) 32%,
        var(--led-rosa) 54%,
        var(--led-ambar) 72%,
        var(--led-violeta) 88%,
        transparent 100%);
}

/* ============================================================
   Capa decorativa del hero
   ============================================================ */
.hero-decor {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Se pausa desde JS cuando el hero sale de pantalla */
.hero-decor.en-pausa,
.hero-decor.en-pausa *,
.hero-decor.en-pausa .cohete::before,
.hero-decor.en-pausa .hero-led-linea::after {
    animation-play-state: paused !important;
}

/* ============================================================
   Cohetes flotantes
   ============================================================ */
.cohete {
    --rot: -8deg;
    --dur: 8s;
    --retraso: 0s;
    position: absolute;
    aspect-ratio: 160 / 198;
    animation: cohete-flotar var(--dur) ease-in-out var(--retraso) infinite;
    transform-origin: 50% 62%;
    filter: drop-shadow(0 22px 30px rgba(42, 5, 73, 0.16));
    will-change: transform;
}

.cohete img {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Halo de luz detrás de cada cohete */
.cohete::before {
    content: "";
    position: absolute;
    inset: 16% 6% 24%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.34), rgba(34, 211, 238, 0.12) 52%, transparent 72%);
    filter: blur(16px);
    z-index: 0;
    animation: cohete-halo 4.5s ease-in-out infinite;
}

/* Llama del motor */
.cohete-llama {
    position: absolute;
    left: 50%;
    bottom: -30%;
    width: 34%;
    height: 44%;
    z-index: 1;
    transform: translateX(-50%);
    transform-origin: 50% 0;
    border-radius: 46% 46% 52% 52% / 28% 28% 72% 72%;
    background: radial-gradient(ellipse at 50% 0%,
        #fffbe6 0%,
        #fde047 18%,
        #fb923c 42%,
        #f43f5e 62%,
        rgba(219, 39, 119, 0) 80%);
    filter: blur(2px) drop-shadow(0 0 12px rgba(251, 146, 60, 0.8));
    animation: cohete-llama 0.24s ease-in-out infinite alternate;
    opacity: 0.92;
}

.cohete-principal {
    top: 10%;
    left: 2%;
    width: clamp(46px, 5.2vw, 78px);
    --rot: -12deg;
    --dur: 8.5s;
    --retraso: -1.4s;
}

.cohete-secundario {
    top: 62%;
    left: 2%;
    width: clamp(28px, 2.7vw, 40px);
    --rot: 16deg;
    --dur: 10.5s;
    --retraso: -4s;
    opacity: 0.92;
}

.cohete-lanzamiento {
    left: 9%;
    bottom: 3%;
    width: clamp(30px, 3.2vw, 46px);
    --rot: -14deg;
    opacity: 0;
    animation: cohete-despegar 18s cubic-bezier(0.4, 0.05, 0.7, 0.95) 5s infinite;
}

.cohete-lanzamiento .cohete-llama {
    bottom: -56%;
    height: 72%;
    filter: blur(3px) drop-shadow(0 0 18px rgba(251, 146, 60, 0.9));
}

@keyframes cohete-flotar {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(var(--rot));
    }
    50% {
        transform: translate3d(0, -8px, 0) rotate(calc(var(--rot) + 2.5deg));
    }
}

@keyframes cohete-halo {
    0%, 100% { opacity: 0.55; transform: scale(0.94); }
    50% { opacity: 1; transform: scale(1.06); }
}

@keyframes cohete-llama {
    from { transform: translateX(-50%) scale(0.82, 0.9); opacity: 0.72; }
    to { transform: translateX(-50%) scale(1.06, 1.14); opacity: 1; }
}

@keyframes cohete-despegar {
    0% {
        transform: translate3d(0, 46px, 0) rotate(-12deg) scale(0.72);
        opacity: 0;
    }
    3% {
        opacity: 1;
    }
    17% {
        transform: translate3d(-62px, -390px, 0) rotate(-18deg) scale(0.56);
        opacity: 0.85;
    }
    22%, 100% {
        transform: translate3d(-92px, -560px, 0) rotate(-22deg) scale(0.34);
        opacity: 0;
    }
}

/* ============================================================
   Luces LED: orbes, partículas y franja animada
   ============================================================ */
.hero-orbe {
    position: absolute;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.4;
    animation: led-orbe 7s ease-in-out infinite;
}

.hero-orbe-1 {
    top: 10%;
    right: 19%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.85), transparent 68%);
}

.hero-orbe-2 {
    right: 4%;
    bottom: 16%;
    width: 138px;
    height: 138px;
    background: radial-gradient(circle, rgba(219, 39, 119, 0.8), transparent 68%);
    animation-delay: -2.5s;
}

.hero-orbe-3 {
    top: 46%;
    right: 36%;
    width: 96px;
    height: 96px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.85), transparent 68%);
    animation-delay: -4.5s;
}

.led-particula {
    position: absolute;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 7px 1px currentColor, 0 0 18px 5px currentColor;
    opacity: 0;
    animation: led-particula var(--duracion, 7s) ease-in-out var(--retraso, 0s) infinite;
    will-change: transform, opacity;
}

.hero-led-linea {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--led-linea);
    background-size: 220% 100%;
    box-shadow:
        0 0 10px rgba(139, 92, 246, 0.7),
        0 0 30px rgba(34, 211, 238, 0.35),
        0 0 46px rgba(219, 39, 119, 0.25);
    animation: led-recorrido 8s linear infinite;
}

.hero-led-linea::after {
    content: "";
    position: absolute;
    inset: -5px 0 0;
    background: repeating-linear-gradient(90deg,
        transparent 0 26px,
        rgba(255, 255, 255, 0.85) 26px 28px,
        transparent 28px 54px);
    opacity: 0.45;
    filter: blur(0.6px);
    animation: led-recorrido 8s linear reverse infinite;
}

@keyframes led-orbe {
    0%, 100% { opacity: 0.28; transform: scale(0.9); }
    50% { opacity: 0.55; transform: scale(1.12); }
}

@keyframes led-particula {
    0% {
        opacity: 0;
        transform: translate3d(0, 16px, 0) scale(0.5);
    }
    22% {
        opacity: 0.95;
    }
    55% {
        opacity: 0.4;
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--deriva, 0px), -86px, 0) scale(1.15);
    }
}

@keyframes led-recorrido {
    from { background-position: 0% 50%; }
    to { background-position: 220% 50%; }
}

/* ============================================================
   Detalles LED en el resto de la página
   ============================================================ */

/* Punto LED que late en los antetítulos */
.seccion-eyebrow::after {
    content: "";
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--led-violeta);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16), 0 0 10px 2px rgba(139, 92, 246, 0.7);
    animation: led-latir 2.2s ease-in-out infinite;
}

/* Borde LED animado al pasar por las tarjetas */
.tarjeta-servicio::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(from 140deg,
        var(--led-violeta),
        var(--led-cian),
        var(--led-rosa),
        var(--led-ambar),
        var(--led-violeta));
    -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, linear-gradient(#000 0 0);
    mask-composite: exclude;
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.55));
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.tarjeta-servicio:hover::after,
.tarjeta-servicio:focus-visible::after,
.tarjeta-servicio:focus-within::after {
    opacity: 1;
}

/* Destello LED del botón principal */
.btn-principal {
    position: relative;
    overflow: hidden;
}

.btn-principal::after {
    content: "";
    position: absolute;
    top: -60%;
    left: 0;
    width: 32%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
    transform: translateX(-220%) rotate(18deg);
    transition: transform 0.85s cubic-bezier(0.22, 0.61, 0.36, 1);
    pointer-events: none;
}

.btn-principal:hover::after,
.btn-principal:focus-visible::after {
    transform: translateX(420%) rotate(18deg);
}

/* Cohete de la sección de empresas */
.presupuesto-imagen .cohete-empresa {
    top: -2%;
    right: -1%;
    width: 50px;
    --rot: 12deg;
    --dur: 9.5s;
    --retraso: -3s;
    filter: drop-shadow(0 20px 26px rgba(10, 2, 20, 0.38));
}

.presupuesto-imagen .cohete-empresa img {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    object-fit: contain;
}

/* Línea LED superior del footer */
.footer::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--led-linea);
    background-size: 220% 100%;
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.75), 0 0 34px rgba(219, 39, 119, 0.35);
    animation: led-recorrido 10s linear infinite;
    pointer-events: none;
}

@keyframes led-latir {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16), 0 0 10px 2px rgba(139, 92, 246, 0.7);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(139, 92, 246, 0.05), 0 0 16px 4px rgba(34, 211, 238, 0.65);
    }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px) {
    .cohete-secundario {
        display: none;
    }
}

@media (max-width: 900px) {
    .cohete-principal {
        top: 6%;
        left: 2%;
    }

    .cohete-lanzamiento {
        display: none;
    }

    .hero-orbe-3 {
        display: none;
    }

    .presupuesto-imagen .cohete-empresa {
        display: none;
    }
}

@media (max-width: 760px) {
    .cohete-principal {
        display: none;
    }

    .hero-orbe-1 {
        top: 4%;
        right: 4%;
        width: 110px;
        height: 110px;
        opacity: 0.3;
    }

    .hero-orbe-2 {
        bottom: 10%;
        width: 96px;
        height: 96px;
        opacity: 0.28;
    }
}

/* ============================================================
   Movimiento reducido
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .hero-decor {
        transform: none !important;
    }

    .cohete,
    .cohete::before,
    .cohete-llama,
    .hero-orbe,
    .led-particula,
    .hero-led-linea,
    .hero-led-linea::after,
    .seccion-eyebrow::after,
    .btn-principal::after,
    .footer::after {
        animation: none !important;
    }

    .cohete-lanzamiento,
    .led-particula {
        display: none;
    }

    .tarjeta-servicio::after {
        transition: none;
    }
}
