/* =========================================================
   INDEX2 — estilos propios de la portada v2 (Fase 4, DISEÑO-2026.md).
   Solo afecta a index2.php. No toca css/site2026.css.
   ========================================================= */

/* ---------- Hero (exploración, sesión 2026-07-13) ---------- */

.i2-hero {
    position: relative;
    overflow: hidden;
    min-height: 380px;
    /* Variante 2 (revisión de color, sesión hero): wash de un solo tono
       azul-lavanda en vez del degradado de dos familias (azul->verde) que
       había antes — sigue leyéndose como "portada" sin sumar una segunda
       paleta que compita con el logo/personaje/píldoras. */
    background: linear-gradient(180deg, #eef1fb 0%, #dde3f5 100%);
}
.i2-hero-ola {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.i2-hero-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    padding: 0 16.667%;
    /* Fila (contenido + personaje) en flex, no absolute — así el ancho
       real disponible para el lema es "lo que queda tras el personaje",
       no un max-width fijo en px desconectado del layout. Antes, el
       lema (max-width:560px fijo) partía a 2 líneas en pantallas anchas
       aunque sobrara sitio de sobra, y en anchos intermedios el
       font-size (vw) encogía más rápido que el hueco real, cabía en 1
       línea y quedaba detrás del personaje. Con flex, el navegador solo
       puede partir a 2 líneas cuando el hueco real ya no da para 1. */
    display: flex;
    align-items: flex-start;
    gap: 24px;
}
.i2-hero-contenido {
    padding-top: 100px; /* deja hueco a la Fila 1 flotante (ver .header2--hero en header2.css) */
    flex: 1 1 auto;
    min-width: 0; /* permite que el lema se encoja/parta según el hueco real, no su ancho intrínseco */
}
.i2-hero-wordmark {
    /* Antes 44% del ancho de .i2-hero-contenido, que ocupaba todo
       .i2-hero-inner. Con .i2-hero-contenido ahora encogido por flex,
       un % relativo a él encogería el logo de más — se pasa a clamp con
       vw (44% de los ~66.67% de ancho que tenía .i2-hero-inner antes)
       para mantener el mismo tamaño visual que antes del cambio a flex. */
    width: clamp(240px, 29.3vw, 600px);
    display: block;
}
.i2-hero-subtitulo {
    margin-top: 12px;
    font-weight: 700;
    /* Antes morado (#7a1fd6) — pasa al azul ya usado en el resto del
       header (píldora "Juegos"/Explorar), una fuente de color menos
       compitiendo en el hero. */
    color: #3b6fd4;
    font-size: clamp(14px, 1.4vw, 20px);
    max-width: 100%; /* el ancho real ya lo fija el flex de .i2-hero-inner, no un tope fijo */
}
.i2-hero-personaje-wrap {
    position: relative;
    flex: 0 0 auto;
    /* Ancla por TOP (margin, no top absoluto ahora que es un ítem flex),
       no por bottom: con bottom, la posición dependía de la altura de la
       imagen (que varía con el ancho), y en anchos intermedios
       (~800-1100px) el personaje subía lo bastante para invadir la Fila 1
       flotante y solaparse con "Cat·En"/"Para docentes". Con top fijo,
       el personaje siempre queda por debajo de la Fila 1 sea cual sea el
       ancho. */
    margin-top: 105px;
    /* width fluido en vez de solo dos estados (20%/25%): evita saltos
       bruscos de tamaño entre el breakpoint móvil y el desktop. */
    width: clamp(130px, 18vw, 240px);
    z-index: 2;
}
.i2-hero-sombra {
    position: absolute;
    left: -6%;
    right: -6%;
    bottom: -10px;
    height: 26px;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 50%;
    filter: blur(7px);
    z-index: 1;
}
.i2-hero-personaje {
    position: relative;
    z-index: 2;
    width: 100%;
    display: block;
}

@media (max-width: 700px) {
    /* Rediseño de niveles (sesión 2026-08-03): Fila 1/Fila 2 dejan de flotar
       sobre el hero (ver header2.css, bloque "hero móvil") y pasan a ser
       celdas de un grid junto a él — el hero ya no necesita reservar hueco
       con padding calculado a mano.
       Rediseño Fila 1 (sesión 2026-09-14): el logo pequeño de Fila 1
       desaparece de la portada (competía con este wordmark, y Fila 1 se
       necesitaba para lupa+idioma+Suscríbete) — el wordmark grande, oculto
       en móvil hasta ahora, pasa a ser la única marca, centrado y a ancho
       de pantalla, con el lema debajo como cierre del bloque superior. */
    .i2-hero {
        min-height: 0;
        padding: 0;
        background: none;
    }
    .i2-hero-ola {
        display: none;
    }
    .i2-hero-inner {
        padding: 0 1%;
        height: auto;
    }
    .i2-hero-contenido {
        padding-top: 0;
    }
    .i2-hero-wordmark {
        display: block;
        width: min(320px, 78vw);
        margin: 4px auto 0;
    }
    .i2-hero-subtitulo {
        margin-top: 0;
        max-width: 100%;
        text-align: center;
        font-weight: 800;
        /* Ajustado a mano (no clamp) para que quepa en 2 líneas a los anchos
           móviles habituales (320-430px) — ver capturas de verificación,
           sesión 2026-08-03. */
        font-size: 16px;
        line-height: 1.32;
    }
    .i2-hero-personaje-wrap {
        /* Ilustración del grupo ocultada en móvil (petición del usuario,
           sesión 2026-08-03): en pantallas estrechas competía por espacio
           con el resto del hero sin aportar información necesaria. */
        display: none;
    }
}

.i2-accesos {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 20px 6px;
}

.i2-grid-principal,
.i2-grid-temas {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.i2-grid-principal {
    margin-bottom: 14px;
}

.i2-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 170px;
    max-width: 260px;
    padding: 14px 18px;
    border-radius: 20px;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.i2-tile:hover,
.i2-tile:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
    color: #fff;
}

.i2-icono {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}
.i2-icono-chico {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.i2-tile-texto {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.i2-tile-texto small {
    font-size: 0.7em;
    font-weight: 400;
    opacity: 0.9;
}

/* Tempo — acento visual: tile más grande, color propio del producto
   (mismo naranja que su píldora en la Fila 2 del header, para reforzar
   la asociación de marca dentro de la misma página) */
.i2-tile-tempo {
    flex: 1.5 1 260px;
    max-width: 340px;
    background: #ff6b35;
    padding: 18px 22px;
    font-size: 1.1rem;
    box-shadow: 0 4px 14px rgba(255, 107, 53, 0.45);
}
.i2-tile-tempo .i2-icono {
    width: 42px;
    height: 42px;
}
.i2-tile-tempo:hover {
    box-shadow: 0 10px 22px rgba(255, 107, 53, 0.5);
}

.i2-tile-masjugados { background: #cf5d7a; }
.i2-tile-inicial { background: #28a745; }
.i2-tile-intermedio { background: #fd7e14; }
.i2-tile-avanzado { background: #6f42c1; }

.i2-tile-chico {
    flex: 1 1 140px;
    max-width: 200px;
    padding: 10px 14px;
    font-size: 0.92rem;
    color: #1f2d3d !important;
}
.i2-tile-notas { background: #7db4f3; }
.i2-tile-ritmo { background: #f2cb62; }
.i2-tile-teoria { background: #ea7f8a; }
.i2-tile-instrumentos { background: #71bfd0; }
.i2-tile-flauta { background: #74c783; }
.i2-tile-cultura { background: #aab0b6; }

.i2-active {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 6px rgba(0, 0, 0, 0.16);
}

/* ---------- Franja "Para docentes" ---------- */

.i2-franja-docentes {
    display: block;
    max-width: 1400px;
    margin: 26px auto 0;
    padding: 14px 24px;
    border-radius: 14px;
    background: linear-gradient(90deg, #f0ecf8, #e6ddf5);
    color: #4a2d75 !important;
    text-decoration: none !important;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
}
.i2-franja-docentes span {
    font-weight: 700;
}
.i2-franja-docentes strong {
    display: inline-block;
    margin-left: 10px;
    color: #ff6b35;
    font-weight: 800;
}
.i2-franja-docentes:hover {
    text-decoration: underline !important;
}

@media (max-width: 600px) {
    .i2-tile {
        flex-basis: 100%;
        max-width: none;
    }
    .i2-tile-tempo {
        flex-basis: 100%;
        max-width: none;
    }
    .i2-tile-chico {
        flex-basis: calc(50% - 6px);
        max-width: none;
    }
}

/* Historia de AprendoMates en la franja de portada. */
.am-home-strip[hidden] { display: none; }
.am-home-strip-item[hidden],
.am-home-strip-controls[hidden] { display: none; }
.am-home-strip-controls {
    grid-area: 2 / 1;
    display: flex;
    justify-content: center;
    gap: 7px;
    padding-top: 9px;
}
.am-home-strip-controls button {
    padding: 4px 11px;
    border: 1px solid #bbc9e6;
    border-radius: 999px;
    background: #fff;
    color: #3c5279;
    font: 700 12px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    cursor: pointer;
}
.am-home-strip-controls button[aria-pressed="true"] {
    border-color: #667bbb;
    background: #e6ebfa;
    color: #243b73;
}
.am-home-strip-controls button:focus-visible { outline: 3px solid #d93658; outline-offset: 2px; }

.am-story {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 270px;
    border: 3px solid #79afc1;
    border-radius: 22px;
    background: linear-gradient(100deg, #eef1fb 0%, #dde3f5 34%, #b8dae4 64%, #8fc8d1 100%);
    box-shadow: 0 12px 30px rgba(45, 75, 109, .27);
    text-align: center;
}
.am-story::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 8px;
    background: linear-gradient(90deg, #587fc3, #7ebaca 56%, #e84c69);
    z-index: 2;
}
.am-story-link {
    position: relative;
    display: grid;
    min-height: 270px;
    padding: 22px 48px 19px;
    color: #21375e !important;
    text-decoration: none !important;
}
.am-story-link:focus-visible {
    outline: 4px solid #b5264c;
    outline-offset: -8px;
    border-radius: 19px;
}
.am-story-staff {
    position: absolute;
    inset: 20px 0;
    opacity: .12;
    background: repeating-linear-gradient(to bottom, transparent 0 18px, #355782 19px 20px, transparent 21px 28px);
    mask-image: linear-gradient(90deg, #000, transparent 35%, transparent 65%, #000);
    pointer-events: none;
}
.am-story-clouds {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.am-story-cloud {
    position: absolute;
    border-radius: 60px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 3px 10px rgba(48, 95, 122, .12);
    animation: am-story-cloud-drift 18s linear infinite alternate;
}
.am-story-cloud::before,
.am-story-cloud::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: inherit;
}
.am-story-cloud::before { width: 55%; height: 130%; top: -55%; left: 6%; }
.am-story-cloud::after { width: 45%; height: 100%; top: -40%; right: 8%; }
.am-story-cloud:nth-child(1) { left: 7%; top: 23%; width: 16%; height: 16%; --am-cloud-drift: 42px; }
.am-story-cloud:nth-child(2) { left: 37%; top: 70%; width: 12%; height: 14%; --am-cloud-drift: -36px; animation-duration: 22s; }
.am-story-cloud:nth-child(3) { right: 8%; top: 20%; width: 14%; height: 15%; --am-cloud-drift: 38px; animation-duration: 17s; }
@keyframes am-story-cloud-drift {
    to { transform: translateX(var(--am-cloud-drift)); }
}
.am-story-mascot {
    position: absolute;
    z-index: 0;
    bottom: -17px;
    display: block;
    height: auto;
    max-width: none;
    transform-origin: center bottom;
    --am-bounce-rise: -12px;
    filter: drop-shadow(0 3px 5px rgba(39, 65, 83, .2));
}
.am-story-mascot-music { left: -12px; width: 128px; }
.am-story-mascot-mates { right: -25px; width: 155px; }
.am-story-hook,
.am-story-final {
    position: relative;
    z-index: 1;
    grid-area: 1 / 1;
    align-self: center;
    justify-self: stretch;
}
.am-story-hook {
    display: none;
    justify-items: center;
    gap: 14px;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: clamp(25px, 3.7vw, 38px);
    font-weight: 900;
    line-height: 1.13;
    letter-spacing: -.043em;
    text-shadow: 0 2px 8px rgba(255, 255, 255, .75);
}
.am-story-hook-line {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    clip-path: inset(0 100% 0 0);
}
.am-story-underline {
    width: 78%;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #507dc4, #64abc0, #e84c69);
    transform: scaleX(0);
}
.am-story-final {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 14px;
    row-gap: 3px;
    align-items: center;
    opacity: 1;
}
.am-story-half {
    display: grid;
    grid-template-rows: 48px 76px;
    justify-items: center;
    align-items: center;
    min-width: 0;
}
.am-story-half-music { grid-column: 1; grid-row: 1; }
.am-story-half-mates { grid-column: 2; grid-row: 1; }
.am-story-phrase {
    color: #21375e;
    font: 900 clamp(29px, 3.55vw, 39px)/1.08 system-ui, -apple-system, "Segoe UI", sans-serif;
    letter-spacing: -.035em;
    text-shadow: 0 2px 6px rgba(255, 255, 255, .72);
    white-space: nowrap;
}
.am-story-half img {
    display: block;
    height: auto;
    max-height: 74px;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(27, 57, 86, .2));
    transform-origin: center bottom;
    --am-bounce-rise: -8px;
}
.am-story-half-mates img { width: min(36vw, 365px); }
.am-story-half-music img { width: min(34vw, 345px); }
.am-story-cta {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 190px;
    padding: 10px 30px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #e84c69;
    box-shadow: 0 6px 0 #a82749, 0 9px 18px rgba(0, 0, 0, .24);
    color: #fff;
    font: 900 25px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    opacity: 1;
    transition: background .15s ease, transform .15s ease;
}
.am-story-link:hover .am-story-cta { background: #fa5f79; transform: translateY(-2px); }
@media (hover: hover) {
    .am-story-half img:hover,
    .am-story-mascot:hover { animation: am-story-bounce .48s ease-out 1; }
}
@keyframes am-story-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    38% { transform: translateY(var(--am-bounce-rise)) scale(1.045); }
    64% { transform: translateY(2px) scale(.98); }
    82% { transform: translateY(-3px) scale(1.01); }
}
.am-story.is-ready .am-story-hook { display: grid; }
.am-story.is-ready .am-story-final,
.am-story.is-ready .am-story-half,
.am-story.is-ready .am-story-cta { opacity: 0; }
.am-story.is-playing .am-story-hook { animation: am-story-hide .25s 1.95s both; }
.am-story.is-playing .am-story-hook-line { animation: am-story-write .8s .1s both; }
.am-story.is-playing .am-story-underline { animation: am-story-underline .28s .83s both; }
.am-story.is-playing .am-story-final { animation: am-story-show .25s 2.2s both; }
.am-story.is-playing .am-story-half-music { animation: am-story-pop .38s 2.35s both; }
.am-story.is-playing .am-story-half-mates { animation: am-story-pop .38s 2.85s both; }
.am-story.is-playing .am-story-cta { animation: am-story-pop .4s 3.35s both; }
@keyframes am-story-write { to { clip-path: inset(0 0 0 0); } }
@keyframes am-story-underline { to { transform: scaleX(1); } }
@keyframes am-story-hide { to { opacity: 0; visibility: hidden; } }
@keyframes am-story-show { to { opacity: 1; } }
@keyframes am-story-pop {
    from { opacity: 0; transform: translateY(14px) scale(.88); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 760px) {
    .am-story,
    .am-story-link { min-height: 340px; }
    .am-story-link { padding: 32px 14px 24px; }
    .am-story-hook { font-size: clamp(22px, 5.1vw, 30px); }
    .am-story-hook-line { white-space: normal; text-wrap: balance; }
    .am-story-final {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        row-gap: 10px;
    }
    .am-story-half { grid-template-rows: auto auto; row-gap: 5px; }
    .am-story-half-music { grid-column: 1; grid-row: 1; }
    .am-story-half-mates { grid-column: 1; grid-row: 2; }
    .am-story-phrase { font-size: clamp(24px, 6.4vw, 30px); white-space: nowrap; }
    .am-story-half-mates img,
    .am-story-half-music img { width: min(76vw, 290px); }
    .am-story-cta { grid-row: 3; min-width: 150px; padding: 8px 22px; font-size: 21px; }
    .am-story-mascot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .am-story-cloud { animation: none; }
    .am-story-half img:hover,
    .am-story-mascot:hover { animation: none; }
    .am-story.is-playing .am-story-hook,
    .am-story.is-playing .am-story-hook-line,
    .am-story.is-playing .am-story-underline,
    .am-story.is-playing .am-story-final,
    .am-story.is-playing .am-story-half,
    .am-story.is-playing .am-story-cta { animation: none; }
    .am-story.is-ready .am-story-hook { display: none; }
    .am-story.is-ready .am-story-final,
    .am-story.is-ready .am-story-half,
    .am-story.is-ready .am-story-cta { opacity: 1; }
    .am-story-link:hover .am-story-cta { transform: none; }
}
