/* Intro del hero de la home (docs/home-intro.md) */
.hero-intro {
    --intro-largo: 800vh;
    position: relative;
    height: var(--intro-largo);
    background: var(--cdf-rojo);
    color: #fff;
    font-family: 'Montserrat Alternates', sans-serif;
}

.hero-intro__pin {
    -webkit-user-select: none;
    user-select: none; /* un doble clic en la nave o el marciano no selecciona el texto */
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}

.hero-intro p {
    margin: 0;
}

.hero-intro__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(80vw, 1536px);
    max-width: none;
    height: auto;
    transform: translate(-50%, -50%);
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none;
    z-index: 3;
}

/* El JS lo saca a <body> fijo con z-index 100000: con el menú abierto quedaría encima del panel */
body:has(#ast-mobile-popup.active) > .hero-intro__logo {
    visibility: hidden !important;
}

/* Frases: cada texto en su sitio del vídeo «GUIÓN TEXTO ANIMADO HOME WEB» (01-12-2026), medido a 1920 × 1080.
   --x y --y: centro del texto respecto al de la pantalla; --fs: tamaño. Todo en --u: con 1vw sería el vídeo a 1920,
   que va de punta a punta; se deja en 0,85vw para que respire, y limitado por el alto en pantallas bajas */
.hero-intro {
    --u: min(0.85vw, 1.55vh);
}

.hero-intro__frases,
.hero-lema {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fx {
    position: absolute;
    left: calc(50% + var(--x, 0) * var(--u));
    top: calc(50% + var(--y, 0) * var(--u));
    translate: -50% -50%;
    display: block;
    font-size: calc(var(--fs, 6) * var(--u));
    line-height: 1em;
    white-space: nowrap;
}

.f-blanco {
    z-index: 2;
    color: #fff;
    font-weight: 800;
}

.f-naranja {
    color: var(--cdf-naranja);
    font-style: italic;
    font-weight: 600;
}

.f-mayus {
    text-transform: uppercase;
}

.fx small {
    font-size: 0.42em;
    line-height: 1em;
    font-weight: 700;
    vertical-align: var(--sube, 0.9em);
    margin-right: 0.05em;
}

.fx .f-sobre {
    display: block;
    margin: 0 0 var(--sobre, -0.3em) 0.55em;
    vertical-align: baseline;
    text-align: left;
}

[data-k^="bonito"] > span {
    display: inline-block;
    transform-origin: 0 50%;
}

[data-k="somos"] { --x: 0.26; --y: -2.85; --fs: 20.68; }
[data-k="agencia"] { --y: -0.49; --fs: 6.77; }
[data-k="creativa"] { --y: -8.02; --fs: 13.04; }
[data-k="diferente"] { --y: 8.44; --fs: 14.67; }
[data-k="comprometida"] { --y: 4.85; --fs: 8.87; }
[data-k="marcas"] { --x: -0.05; --y: -0.44; --fs: 7.30; }
[data-k="personalidad"] { --x: -0.03; --y: 7.55; --fs: 8.92; }
[data-k="campanas"] { --y: -0.73; --fs: 10.48; }
[data-k="sorprenden"] { --x: -0.13; --y: -9.02; --fs: 11.14; --sobre: -0.37em; }
[data-k="identidades"] { --y: -0.58; --fs: 9.55; }
[data-k="perduran"] { --x: -7.13; --y: -10.71; --fs: 12.09; --sobre: -0.156em; }
[data-k="perduran"] .f-sobre { font-size: 0.55em; }
[data-k="tiempo"] { --x: 6.49; --y: 7.49; --fs: 12.83; --sube: 0.82em; }
[data-k="estrategias"] { --x: -0.08; --y: -0.63; --fs: 9.02; }
[data-k="definen"] { --x: -0.13; --y: 8.91; --fs: 12.53; }
[data-k="disenamos"] { --x: -0.05; --y: -0.73; --fs: 10.26; }
[data-k="bonito"] { --x: -7.97; --y: -10.0; --fs: 19.55; }
[data-k="efectivo"] { --x: 5.93; --y: 8.28; --fs: 15.24; }
[data-k="juntos"] { --y: -0.44; --fs: 7.67; }
[data-k="hagamos"] { --y: -5.23; --fs: 11.99; }
[data-k="pena"], .hero-lema__crezca { --y: -0.44; --fs: 6.23; }
[data-k="perduran"] .f-sobre { font-size: 0.55em; }

.hero-intro__nave {
    position: absolute;
    right: 15.5%;
    bottom: 24%;
    display: block;
    width: clamp(70px, 7vw, 138px);
    height: auto;
}

.hero-intro__marciano {
    position: absolute;
    left: 5.2%;
    bottom: 11%;
    width: clamp(60px, 6vw, 115px);
    height: auto;
}

/* Minijuego (.claude/docs/minijuego-nave.md): el marciano lo lanza */
.hero-intro__marciano {
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    line-height: 0;
    z-index: 4;
}

.hero-intro__marciano svg {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-intro__marciano:hover,
.hero-intro__marciano:focus {
    background: none;
}

.hero-intro__marciano:hover svg,
.hero-intro__marciano:focus-visible svg {
    transform: scale(1.08) rotate(-8deg);
}

.hero-intro__marciano:focus-visible {
    outline: 3px solid var(--cdf-crema);
    outline-offset: 4px;
}

.hero-intro.is-jugando .hero-intro__marciano {
    pointer-events: none;
}

.hero-lema__crezca {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-intro.is-crezca .hero-lema__crezca {
    opacity: 1;
}

.hero-lema__pena .letra.is-rota {
    visibility: hidden;
}

.hero-juego {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* Jugando, el dedo apunta y dispara: no mueve la página (se sale con «Salir») */
.hero-intro.is-jugando .hero-intro__pin {
    touch-action: none;
    cursor: crosshair;
}

.hero-intro__otra,
.hero-intro__salir {
    position: absolute;
    right: 5.2%;
    bottom: calc(11% + clamp(60px, 6vw, 115px) / 2 - 1.1em);
    padding: 0.45em 1.3em;
    border: 2px solid var(--cdf-crema);
    border-radius: 999px;
    background: var(--cdf-crema);
    color: var(--cdf-rojo);
    font-family: 'Montserrat Alternates', sans-serif;
    font-weight: 700;
    font-size: clamp(14px, 1.1vw, 20px);
    cursor: pointer;
    z-index: 4;
    animation: otra-entra 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-intro__otra:hover,
.hero-intro__otra:focus-visible,
.hero-intro__salir:hover,
.hero-intro__salir:focus-visible {
    background: #fff;
    color: var(--cdf-rojo);
}

/* «Salir», en el sitio de «Otra vez» mientras se juega: en línea, para que no compita con las letras */
/* «Salir»: 44 px de alto y crema con texto oscuro, legible a cualquier tamaño (revisión de accesibilidad, Ivan 02-12-2026) */
.hero-intro__salir {
    min-height: 44px;
    background: var(--cdf-crema);
    color: #1d1c1b;
}

.hero-intro__salir:hover,
.hero-intro__salir:focus-visible {
    background: #fff;
    color: #1d1c1b;
}

.hero-intro__salir[hidden],
.hero-intro__otra[hidden] {
    display: none;
}

/* La nave lanza el juego (vídeo de Ricard, 3:13); la ayuda la da el marciano (js/marciano.js) */
.hero-intro__nave.is-boton {
    cursor: pointer;
}

/* Zona de toque de la nave de al menos 56 px de alto, invisible (en móvil el dibujo mide 70 × 31) */
.hero-intro__nave.is-boton::before {
    content: '';
    position: absolute;
    inset: -14px -8px;
}

/* Al montarse «que crezca tu marca», «HAGAMOS» pasa de naranja a amarillo con un «pom» (vídeo de Ricard, 9:39).
   Con scale y no transform: el transform lo pone la línea de tiempo de la intro */
.hero-intro.is-crezca .hero-lema .hero-lema__hagamos {
    color: var(--cdf-crema);
    animation: hagamos-pom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hagamos-pom {
    40% {
        scale: 1.14;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-intro.is-crezca .hero-lema .hero-lema__hagamos {
        animation: none;
    }
}

@keyframes otra-entra {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.hero-intro__titulo {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14%;
    margin: 0;
    padding: 0 16px;
    text-align: center;
    color: #fff;
    font-family: inherit;
    font-style: italic;
    font-weight: 700;
    font-size: clamp(17px, 1.75vw, 33px);
    line-height: 1.35;
}

.hero-intro__boton {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(5% + 24px); /* deja sitio debajo a la flecha de bajar */
    text-align: center;
}

.boton-linea {
    display: inline-block;
    padding: 0.2em 1.4em;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    font-weight: 500;
    font-size: clamp(14px, 1.2vw, 23px);
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Astra pinta en naranja todo enlace con el foco (a:focus): tras «Saltar intro», que le pasa el foco, se quedaba así */
.boton-linea:focus {
    color: #fff;
}

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

.hero-intro__saltar {
    position: absolute;
    right: 16px;
    bottom: 16px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: 500 13px/1 'Montserrat', sans-serif;
    cursor: pointer;
    z-index: 4;
    transition: opacity 0.3s ease;
}

.hero-intro__saltar:hover,
.hero-intro__saltar:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Invitación a hacer scroll: abajo en el centro durante toda la intro, se va al llegar el hero final */
.hero-intro__invita {
    position: absolute;
    left: 50%;
    bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

/* En el hero final, la misma flecha que al empezar pero sin el ratón: con él no cabe bajo «Cuéntanos tu proyecto» */
.hero-intro__invita.is-final .hero-intro__raton {
    display: none;
}

.hero-intro__invita.is-oculta {
    opacity: 0;
}

.hero-intro__raton {
    position: relative;
    width: 26px;
    height: 42px;
    border: 2px solid #fff;
    border-radius: 14px;
}

.hero-intro__raton::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 8px;
    width: 4px;
    height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background: #fff;
    animation: cdf-rueda 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.hero-intro__flecha {
    width: 14px;
    height: 14px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
    animation: cdf-flecha 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes cdf-rueda {
    0% { transform: translateY(0); opacity: 1; }
    70% { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

@keyframes cdf-flecha {
    0%, 100% { transform: translateY(0) rotate(45deg); opacity: 0.6; }
    50% { transform: translateY(8px) rotate(45deg); opacity: 1; }
}

/* En táctil, solo la flecha, más grande (Ricard, vídeo del 01-12-2026, 0:19: en el móvil no se veía y tiraba el dedo hacia arriba) */
@media (hover: none) {
    .hero-intro__raton {
        display: none;
    }

    .hero-intro__flecha {
        width: 22px;
        height: 22px;
        border-width: 0 3px 3px 0;
    }
}

/* Al aterrizar el logo, «somos» y lo demás entran sin salto */
.hero-intro__pin > * {
    transition: opacity 0.5s ease, visibility 0.5s;
}

/* Sin JS o con movimiento reducido: solo el hero final, las frases quedan para lectores y buscadores */
.hero-intro:not(.is-animada) {
    height: auto;
}

.hero-intro:not(.is-animada) .hero-intro__pin {
    position: relative;
}

.hero-intro:not(.is-animada) .hero-intro__logo,
.hero-intro:not(.is-animada) .hero-intro__saltar,
.hero-intro:not(.is-animada) .hero-lema__juntos {
    display: none;
}

.hero-intro:not(.is-animada) .hero-intro__frases {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

/* Desde el primer pintado y hasta que el logo aterriza, solo el logo sobre el rojo (armado en <head>, inc/frontend/home-intro.php) */
.cdf-intro-armada .hero-intro {
    height: var(--intro-largo);
}

.cdf-intro-armada .hero-intro__pin {
    position: sticky;
}

.cdf-intro-armada .hero-intro__pin > :not(.hero-intro__logo, .hero-intro__invita),
.cdf-intro-armada #masthead {
    visibility: hidden;
    opacity: 0;
}

.cdf-intro-armada .hero-intro .hero-intro__logo {
    display: block;
}

#masthead {
    transition: opacity 0.4s ease;
}

/* Durante la intro, «Saltar intro» ocupa la esquina del botón de subir */
.cdf-en-intro #ast-scroll-top {
    visibility: hidden;
    opacity: 0;
}

/* Mientras el logo grande viaja, el de la cabecera espera; luego aparece de golpe, en el mismo fotograma en que se
   quita el que vuela (con fundido se veía transparente un momento) */
.cdf-intro-logo .site-logo-img img,
.cdf-intro-logo .custom-logo-link img {
    opacity: 0;
}

.home .site-logo-img img,
.home .custom-logo-link img {
    transition: none !important;
}

/* Con JS, cada pieza parte oculta y la pinta home-intro.js */
.hero-intro.is-animada [data-k] {
    opacity: 0;
    will-change: opacity, transform;
}

.hero-intro.is-animada [data-k^="bonito"] > span {
    will-change: auto;
}

@media (max-aspect-ratio: 4/5) {
    .hero-intro {
        --u: 1.05vw;
    }
}

@media (width <=921px) {
    .hero-intro {
        --intro-largo: 700vh;
    }

    /* El h1 ocupa casi todo el ancho: el marciano, por encima */
    .hero-intro__marciano {
        bottom: 22%;
    }

    .hero-intro__otra,
.hero-intro__salir {
        bottom: calc(22% + clamp(60px, 6vw, 115px) / 2 - 1.1em);
    }
}

@media (width <=544px) {
    .hero-intro {
        --intro-largo: 600vh;
    }

    .hero-intro__nave {
        right: 8%;
        bottom: 30%;
    }


    .hero-intro__marciano {
        bottom: 22%;
    }

    .hero-intro__otra,
.hero-intro__salir {
        bottom: calc(22% + clamp(60px, 6vw, 115px) / 2 - 1.1em);
    }

    .hero-intro__titulo {
        bottom: 15%;
    }
}

.hero-intro__marciano:disabled {
    cursor: default;
}

.hero-intro__marciano:disabled svg {
    transform: none;
}
