/* Nave de la marca (docs/home-intro.md): la usan el hero de la home y el juego de «Un tipo creativo» (veo_nave_svg()) */
/* Capa que sigue al ratón en horizontal (js/home-intro.js y js/faceta.js) */
.nave__guia {
    display: block;
    will-change: transform;
}

/* Nave: flota y gira sobre su eje; las luces recorren la elipse del borde */
.nave {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    overflow: visible;
    animation: nave-flota 3.2s ease-in-out infinite;
}

.nave__plato { fill: #E6E39E; }
.nave__cupula { fill: var(--cdf-naranja); }
.nave__reflejo { fill: var(--cdf-rojo); }

.nave__luz {
    fill: #fff;
    transform-box: view-box;
    transform-origin: 0 0;
    animation: nave-luz 4s linear infinite;
}

.nave__luz:nth-child(2) { animation-delay: -0.4s; }
.nave__luz:nth-child(3) { animation-delay: -0.8s; }
.nave__luz:nth-child(4) { animation-delay: -1.2s; }
.nave__luz:nth-child(5) { animation-delay: -1.6s; }
.nave__luz:nth-child(6) { animation-delay: -2s; }
.nave__luz:nth-child(7) { animation-delay: -2.4s; }
.nave__luz:nth-child(8) { animation-delay: -2.8s; }
.nave__luz:nth-child(9) { animation-delay: -3.2s; }
.nave__luz:nth-child(10) { animation-delay: -3.6s; }

/* Cada luz recorre la elipse del borde: media vuelta por delante (crece al aparecer y mengua al irse) y media por detrás, oculta */
@keyframes nave-luz {
    0% { transform: translate(47.2px, 94.6px) rotate(-15.8deg) scale(0); }
    2% { transform: translate(45.1px, 98.9px) rotate(-16deg) scale(0.271); }
    4% { transform: translate(45.8px, 103.2px) rotate(-15.9deg) scale(0.559); }
    6% { transform: translate(49.4px, 107.5px) rotate(-15.5deg) scale(0.864); }
    8% { transform: translate(55.7px, 111.6px) rotate(-14.8deg) scale(0.887); }
    10% { transform: translate(64.7px, 115.5px) rotate(-13.9deg) scale(0.91); }
    12% { transform: translate(76.2px, 119.1px) rotate(-12.6deg) scale(0.931); }
    14% { transform: translate(89.9px, 122.3px) rotate(-11.1deg) scale(0.949); }
    16% { transform: translate(105.6px, 125.1px) rotate(-9.4deg) scale(0.966); }
    18% { transform: translate(123px, 127.4px) rotate(-7.5deg) scale(0.979); }
    20% { transform: translate(141.7px, 129.1px) rotate(-5.5deg) scale(0.989); }
    22% { transform: translate(161.4px, 130.3px) rotate(-3.3deg) scale(0.996); }
    24% { transform: translate(181.7px, 130.9px) rotate(-1.1deg) scale(1); }
    26% { transform: translate(202.3px, 130.9px) rotate(1.1deg) scale(1); }
    28% { transform: translate(222.6px, 130.3px) rotate(3.3deg) scale(0.996); }
    30% { transform: translate(242.3px, 129.1px) rotate(5.5deg) scale(0.989); }
    32% { transform: translate(261px, 127.4px) rotate(7.5deg) scale(0.979); }
    34% { transform: translate(278.4px, 125.1px) rotate(9.4deg) scale(0.966); }
    36% { transform: translate(294.1px, 122.3px) rotate(11.1deg) scale(0.949); }
    38% { transform: translate(307.8px, 119.1px) rotate(12.6deg) scale(0.931); }
    40% { transform: translate(319.3px, 115.5px) rotate(13.9deg) scale(0.91); }
    42% { transform: translate(328.3px, 111.6px) rotate(14.8deg) scale(0.887); }
    44% { transform: translate(334.6px, 107.5px) rotate(15.5deg) scale(0.864); }
    46% { transform: translate(338.2px, 103.2px) rotate(15.9deg) scale(0.559); }
    48% { transform: translate(338.9px, 98.9px) rotate(16deg) scale(0.271); }
    50% { transform: translate(336.8px, 94.6px) rotate(15.8deg) scale(0); }
    100% { transform: translate(336.8px, 94.6px) rotate(16deg) scale(0); }
}

@keyframes nave-flota {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
    .nave,
    .nave__luz {
        animation: none;
    }

    .nave__luz:nth-child(1) { transform: translate(45px, 100px) rotate(-16deg) scale(0.82); }
    .nave__luz:nth-child(2) { transform: translate(101.5px, 124.4px) rotate(-9.9deg) scale(0.962); }
    .nave__luz:nth-child(3) { transform: translate(192px, 131px) rotate(0deg) scale(1); }
    .nave__luz:nth-child(4) { transform: translate(282.5px, 124.4px) rotate(9.9deg) scale(0.962); }
    .nave__luz:nth-child(5) { transform: translate(339px, 100px) rotate(16deg) scale(0.82); }
    .nave__luz:nth-child(n+6) { display: none; }
}

/* Bocadillo del marciano (js/marciano.js): habla en un idioma raro y, al pulsarlo, explica el juego (Ivan, 02-12-2026) */
.marciano-burbuja {
    position: absolute;
    z-index: 6;
    max-width: min(340px, calc(100vw - 32px));
    padding: 0.7em 1em;
    border-radius: 18px;
    background: #fff;
    color: #3c3c3b;
    font-family: 'Montserrat Alternates', sans-serif;
    font-size: clamp(14px, 1vw, 18px);
    line-height: 1.35em;
    text-align: left;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    animation: burbuja-entra 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.marciano-burbuja[hidden],
.marciano-burbuja [hidden] {
    display: none;
}

/* El pico, hacia el marciano */
.marciano-burbuja::after {
    content: '';
    position: absolute;
    top: 100%;
    left: calc(var(--pico, 35px) - 9px); /* centrado en el marciano (js/marciano.js, colocar) */
    border: 9px solid transparent;
    border-top-color: #fff;
}

/* Ancho fijo mientras habla: si cambiara con cada frase, el bocadillo se movería (revisión de CWV del 02-12-2026) */
/* Selectores con «p»: en Un tipo creativo el bocadillo está dentro del contenido y el margen de párrafo de Astra
   (.entry-content p) les ponía 30-36 px debajo; en la home, otra regla les quitaba el que sí llevan */
.marciano-burbuja p.marciano-burbuja__alien {
    width: 4.2em;
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    text-align: center;
    color: var(--cdf-rojo);
    font-weight: 700;
    font-size: 1.25em;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.marciano-burbuja p.marciano-burbuja__titulo {
    margin: 0 0 0.3em;
    color: var(--cdf-rojo);
    font-style: italic;
    font-weight: 700;
    font-size: 1.15em;
}

.marciano-burbuja p.marciano-burbuja__texto {
    margin: 0 0 1.1em;
}

/* Tras una partida: una frase que se entiende, en letra normal */
.marciano-burbuja.is-entendido p.marciano-burbuja__alien {
    width: auto;
    max-width: 15em;
    font-style: italic;
    font-size: 1.05em;
    letter-spacing: 0;
    white-space: normal;
    text-align: left;
}

.marciano-burbuja__jugar {
    display: block;
    margin-top: 0.2em;
    min-height: 44px;
    padding: 0.35em 1.3em;
    border: 2px solid var(--cdf-rojo);
    border-radius: 999px;
    background: var(--cdf-rojo);
    color: #fff;
    font: inherit;
    font-style: italic;
    font-weight: 700;
    cursor: pointer;
}

.marciano-burbuja__jugar:hover,
.marciano-burbuja__jugar:focus-visible {
    background: #fff;
    color: var(--cdf-rojo);
}

.marciano-burbuja__jugar:focus-visible {
    outline: 3px solid #3c3c3b;
    outline-offset: 3px;
}

@keyframes burbuja-entra {
    from {
        opacity: 0;
        translate: 0 10px;
    }
}

/* Mientras habla, el marciano se mueve como si hablara; al reírse, tiembla (con scale y rotate: el transform es del hover) */
.is-hablando svg {
    animation: marciano-habla 0.7s ease-in-out infinite;
}

.is-riendo svg {
    animation: marciano-rie 0.12s linear infinite;
}

@keyframes marciano-habla {
    50% {
        scale: 1.06;
    }
}

@keyframes marciano-rie {
    25% {
        rotate: -6deg;
    }

    75% {
        rotate: 6deg;
    }
}

@media (prefers-reduced-motion: reduce) {
    .marciano-burbuja,
    .is-hablando svg,
    .is-riendo svg {
        animation: none;
    }
}
