/*
 * Landing page (la página de inicio en "/").
 * Mobile-first: en móvil todo va en una columna; desde 900px el texto y la
 * demo del hero se ponen lado a lado.
 * Colores, cabecera, botones y animaciones comunes están en ../common.css.
 */

:root {
    --page-gutter: clamp(16px, 5vw, 80px);
    /* Ancho máximo del contenido: en pantallas grandes todo queda centrado en esta columna */
    --content-width: 1180px;
    --section-gap: clamp(72px, 12vw, 140px);

    --fs-hero: clamp(2.25rem, 5vw + 1rem, 4rem);
    --fs-subtitle: clamp(1.0625rem, 1vw + 0.85rem, 1.375rem);
    --fs-section: clamp(1.75rem, 3vw + 1rem, 2.75rem);
    --fs-text: clamp(1rem, 0.5vw + 0.875rem, 1.1875rem);
    --fs-demo: clamp(1.125rem, 1vw + 0.9rem, 1.5rem);

    /* Los mismos colores por nivel que la lección */
    --level-1: #FF7A7A;
    --level-2: #FFAA5C;
    --level-3: #FFD23F;
    --level-4: #A8DB5E;
    --level-5: #5FD39A;
    --level-learned: #2FBF71;
    --word-1: #FFD6D6;
    --word-2: #FFE2C2;
    --word-3: #FFF0B3;
    --word-4: #E4F5C4;
    --word-5: #CDEFDB;
}

main {
    overflow-x: clip;
}

/* TODO > HERO */
/* Hero y secciones comparten la misma columna centrada, así sus bordes coinciden */
#hero,
.landing-section {
    width: min(100%, calc(var(--content-width) + 2 * var(--page-gutter)));
    margin-inline: auto;
}

#hero {
    padding: clamp(48px, 8vw, 96px) var(--page-gutter) clamp(32px, 6vw, 64px);

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: clamp(40px, 6vw, 72px);
}

.hero-text {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#hero-title {
    font-size: var(--fs-hero);
    font-weight: 700;
    line-height: 1.1;
}

/* "leyendo" subrayado con un trazo amarillo de rotulador */
#hero-title .highlight {
    padding: 0 4px;
    background: linear-gradient(transparent 58%, var(--sunny) 58% 90%, transparent 90%);
}

.hero-subtitle {
    max-width: 52ch;
    font-size: var(--fs-subtitle);
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.hero-actions .btn {
    min-height: 54px;
    padding: 12px 28px;
    font-size: clamp(1.0625rem, 0.5vw + 1rem, 1.25rem);
}
/* ! FIN > HERO */

/* TODO > DEMO */
/* Un "libro" con una frase: las palabras con botón se pueden tocar y suben de nivel */
.demo {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.demo-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--third-dark);
}

/* La flecha da saltitos hacia la frase para invitar a tocarla */
.demo-label .icon {
    animation: bounce 1.6s var(--ease-spring) infinite;
}

.demo-book {
    padding: clamp(20px, 3vw, 32px);
    background-color: var(--surface);
    border: 3px solid var(--fourth-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sticker);
    rotate: -1.5deg;
}

.demo-text {
    font-size: var(--fs-demo);
    line-height: 1.8;
}

/* Las palabras de la demo se ven como las de la lección real */
.demo-word {
    display: inline-block;
    padding: 0 4px;

    font-family: var(--font-body);
    font-size: inherit;
    line-height: inherit;
    background-color: transparent;
    border: none;
    border-bottom: 2px dashed var(--third-color);
    border-radius: 8px 8px 0 0;

    transition: background-color var(--duration-base), transform var(--duration-fast) var(--ease-spring);
}

.demo-word:hover {
    background-color: var(--second-color);
    transform: translateY(-2px);
}

.demo-word.is-selected {
    box-shadow: 0 0 0 3px var(--third-color);
    border-radius: 8px;
    animation: demo-pop 350ms var(--ease-spring);
}

.demo-word[data-level] {
    border-bottom-color: transparent;
}

.demo-word[data-level="1"] { background-color: var(--word-1); }
.demo-word[data-level="2"] { background-color: var(--word-2); }
.demo-word[data-level="3"] { background-color: var(--word-3); }
.demo-word[data-level="4"] { background-color: var(--word-4); }
.demo-word[data-level="5"] { background-color: var(--word-5); }
/* Aprendida: igual que en la lección, verde y subrayada */
.demo-word[data-level="learned"] {
    color: var(--success-color);
    background-color: transparent;
    text-decoration: underline 3px var(--level-learned);
    text-underline-offset: 5px;
    text-decoration-skip-ink: none;
}


@keyframes demo-pop {
    40% {
        transform: scale(1.18) rotate(-3deg);
    }
}

/* Panel con la palabra elegida, como el panel derecho de la lección */
.demo-panel {
    align-self: flex-end;
    width: min(100%, 320px);
    margin-top: -6px;
    padding: 16px 20px;

    display: flex;
    flex-direction: column;
    gap: 6px;

    background-color: var(--sunny);
    border: 3px solid var(--fourth-color);
    border-radius: var(--radius-md);
    box-shadow: 0 5px 0 var(--fourth-color);
    rotate: 2deg;
}

.demo-panel.is-changing {
    animation: pop-in var(--duration-base) var(--ease-spring);
}

.demo-term {
    font-family: var(--font-display);
    font-size: clamp(1.375rem, 1vw + 1.1rem, 1.75rem);
    font-weight: 700;
}

.demo-levels {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}

/* El punto del nivel actual se rellena con su color */
.level-dot {
    width: 18px;
    height: 18px;
    border: 2px solid var(--fourth-color);
    border-radius: 50%;
    background-color: var(--surface);
    transition: background-color var(--duration-base), transform var(--duration-base) var(--ease-spring);
}

.level-dot.is-reached {
    transform: scale(1.15);
}

.level-dot.level-1.is-reached { background-color: var(--level-1); }
.level-dot.level-2.is-reached { background-color: var(--level-2); }
.level-dot.level-3.is-reached { background-color: var(--level-3); }
.level-dot.level-4.is-reached { background-color: var(--level-4); }
.level-dot.level-5.is-reached { background-color: var(--level-5); }
.level-dot.level-learned.is-reached { background-color: var(--level-learned); }
/* ! FIN > DEMO */

/* TODO > SECCIONES */
.landing-section {
    padding: var(--section-gap) var(--page-gutter) 0;
}

.section-title {
    max-width: 22ch;
    margin: 0 auto;
    font-size: var(--fs-section);
    font-weight: 700;
    text-align: center;
    text-decoration: underline wavy var(--sunny) 3px;
    text-underline-offset: 12px;
    text-decoration-skip-ink: none;
}

.section-subtitle {
    margin-top: 20px;
    font-size: var(--fs-subtitle);
    text-align: center;
    color: var(--text-muted);
}

/* Pasos numerados con un círculo de color */
.steps {
    list-style: none;
    counter-reset: step;
    margin-top: clamp(32px, 5vw, 56px);

    /* Columnas fijas (no auto-fit) para que nunca quede una card sola en la última fila */
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(20px, 3vw, 36px);
}

.step,
.feature {
    position: relative;
    padding: clamp(24px, 3vw, 32px);

    display: flex;
    flex-direction: column;
    gap: 10px;

    font-size: var(--fs-text);
    background-color: var(--surface);
    border: 3px solid var(--fourth-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sticker);

    transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base) var(--ease-out);
}

.step:hover,
.feature:hover {
    transform: translateY(-6px) rotate(-1deg);
    box-shadow: 0 12px 0 var(--fourth-color);
}

.step:nth-child(even):hover,
.feature:nth-child(even):hover {
    transform: translateY(-6px) rotate(1deg);
}

.step {
    counter-increment: step;
    padding-top: clamp(36px, 4vw, 44px);
}

.step::before {
    content: counter(step);
    position: absolute;
    top: -22px;
    left: 24px;
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 700;
    color: #ffffff;
    background-color: var(--third-color);
    border: 3px solid var(--fourth-color);
    border-radius: 50%;
}

.step h3,
.feature h3 {
    font-size: clamp(1.25rem, 1vw + 1rem, 1.5rem);
}

.step p,
.feature p {
    color: var(--text-muted);
}

/* Ícono dentro de un círculo de color; el color cambia según la posición de la card */
.step-icon,
.feature-icon {
    width: 60px;
    height: 60px;

    display: grid;
    place-items: center;

    font-size: 1.875rem;
    color: var(--fourth-color);
    background-color: var(--sunny);
    border: 3px solid var(--fourth-color);
    border-radius: 50%;
    transition: transform var(--duration-base) var(--ease-spring);
}

.step:nth-child(3n + 2) .step-icon,
.feature:nth-child(3n + 2) .feature-icon {
    color: #ffffff;
    background-color: var(--third-color);
}

.step:nth-child(3n) .step-icon,
.feature:nth-child(3n) .feature-icon {
    background-color: var(--level-5);
}

.feature:nth-child(4) .feature-icon {
    background-color: var(--coral);
}

.step:hover .step-icon,
.feature:hover .feature-icon {
    animation: wiggle 600ms ease-in-out;
}

.features {
    margin-top: clamp(32px, 5vw, 56px);

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(20px, 3vw, 32px);
}

/* Etiquetas de nivel con los colores de la lección */
.level-list {
    list-style: none;
    margin-top: clamp(28px, 4vw, 44px);

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.level-chip {
    padding: 10px 22px;

    font-family: var(--font-display);
    font-size: clamp(1.0625rem, 0.5vw + 1rem, 1.25rem);
    font-weight: 600;
    border: 3px solid var(--fourth-color);
    border-radius: 999px;
    box-shadow: 0 4px 0 var(--fourth-color);

    transition: transform var(--duration-fast) var(--ease-spring);
}

.level-chip:hover {
    transform: translateY(-4px) scale(1.06);
}

.level-chip.level-1 { background-color: var(--level-1); }
.level-chip.level-2 { background-color: var(--level-2); }
.level-chip.level-3 { background-color: var(--level-3); }
.level-chip.level-4 { background-color: var(--level-4); }
.level-chip.level-5 { background-color: var(--level-5); }
.level-chip.level-learned { background-color: var(--level-learned); }
/* ! FIN > SECCIONES */

/* TODO > LLAMADA FINAL */
/* Franja azul con olas arriba, como la cabecera */
#cta {
    position: relative;
    margin-top: var(--section-gap);
    padding: clamp(56px, 8vw, 96px) var(--page-gutter);

    color: #ffffff;
    text-align: center;
    background-color: var(--third-color);
}

#cta::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 12px;
    background: radial-gradient(circle at 12px 12px, var(--third-color) 12px, transparent 12.5px) 0 0 / 24px 12px repeat-x;
}

.cta-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

#cta h2 {
    font-size: var(--fs-section);
}

#cta p {
    font-size: var(--fs-subtitle);
    opacity: 0.9;
}

#cta .hero-actions {
    justify-content: center;
    margin-top: 8px;
}
/* ! FIN > LLAMADA FINAL */

/* TODO > FOOTER */
#footer {
    padding: clamp(40px, 6vw, 64px) var(--page-gutter) 24px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(28px, 4vw, 40px);

    text-align: center;
    color: #ffffff;
    background-color: var(--fourth-color);
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.team-title {
    font-size: clamp(1.375rem, 1.5vw + 1rem, 1.75rem);
}

.team-list {
    list-style: none;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 320px);
    justify-content: center;
    gap: clamp(16px, 3vw, 28px);
}

/* Tarjeta por integrante: se levanta al pasar el ratón como las del resto de la página.
   Las filas son: iniciales, nombre, rol y enlaces. La fila del nombre absorbe la diferencia
   de largo entre nombres, así el rol y los enlaces quedan a la misma altura en todas las cards */
.team-member {
    padding: 24px 20px;

    display: grid;
    grid-template-rows: auto 1fr auto auto;
    justify-items: center;
    align-items: center;
    gap: 12px;

    background-color: rgb(255 255 255 / 0.06);
    border: 3px solid rgb(255 255 255 / 0.25);
    border-radius: var(--radius-lg);
    transition: transform var(--duration-base) var(--ease-spring), border-color var(--duration-base);
}

.team-member:hover {
    transform: translateY(-6px);
    border-color: var(--sunny);
}

/* Círculo con las iniciales; da un saludo al pasar el ratón por la tarjeta */
.team-avatar {
    width: 64px;
    height: 64px;

    display: grid;
    place-items: center;

    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fourth-color);
    background-color: var(--sunny);
    border: 3px solid #ffffff;
    border-radius: 50%;
}

.team-member:nth-child(even) .team-avatar {
    background-color: var(--level-5);
}

.team-member:hover .team-avatar {
    animation: wiggle 600ms ease-in-out;
}

.team-name {
    font-family: var(--font-display);
    font-size: clamp(1.0625rem, 0.5vw + 1rem, 1.25rem);
    font-weight: 600;
    line-height: 1.3;
}

/* Rol como etiqueta pequeña bajo el nombre */
.team-role {
    margin-top: -4px;
    padding: 2px 12px;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fourth-color);
    background-color: var(--second-color);
    border-radius: 999px;
}

.team-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Enlace con ícono: botón "3D" pequeño en blanco */
.team-link {
    min-height: 44px;
    padding: 6px 16px;

    display: inline-flex;
    align-items: center;
    gap: 8px;

    font-family: var(--font-display);
    font-weight: 600;
    color: var(--fourth-color);
    background-color: #ffffff;
    border-radius: 999px;
    box-shadow: 0 4px 0 rgb(255 255 255 / 0.35);
    transition: transform var(--duration-press) ease-out, box-shadow var(--duration-press) ease-out;
}

.team-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgb(255 255 255 / 0.35);
}

.team-link:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 rgb(255 255 255 / 0.35);
}

.team-link:focus-visible {
    outline-color: var(--sunny);
}

.team-link svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
}

/* Enlace a la organización: discreto, con subrayado al pasar el ratón */
.org-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;

    font-family: var(--font-display);
    font-weight: 600;
    color: #ffffff;
    opacity: 0.85;
    transition: opacity var(--duration-fast);
}

.org-link:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.org-link:hover svg {
    animation: wiggle 600ms ease-in-out;
}

.org-link:focus-visible {
    outline-color: var(--sunny);
}

.org-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.copyright {
    font-size: 0.9375rem;
    opacity: 0.75;
}
/* ! FIN > FOOTER */

/* TODO > APARECER AL HACER SCROLL */
/* script.js agrega .is-visible cuando el elemento entra en pantalla.
   Sin JS (o antes de que cargue) se ve todo normal: solo se oculta si html tiene .js */
.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-spring);
    transition-delay: calc(var(--i, 0) * 90ms);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* Al aparecer ya no hay retraso, así el hover responde al instante */
.js .reveal.is-visible:hover {
    transition-delay: 0ms;
}
/* ! FIN > APARECER AL HACER SCROLL */

/* Escritorio: texto y demo lado a lado */
@media (min-width: 600px) {
    .features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-list {
        grid-template-columns: repeat(2, minmax(0, 320px));
    }
}

@media (min-width: 900px) {
    /* Dos columnas iguales, con el texto y la demo centrados entre sí */
    #hero {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-height: calc(100dvh - var(--header-height));
    }

    .steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .features {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
