/* ============================================================
   Home para invitados (landing) — Luz y Saber
   Plantillas: template-parts/home-guest-hero.php y home-guest-landing.php
   Lógica: inc/guest-landing.php · Carrusel: assets/js/hsc-home-guest.js

   Todo vive dentro de .dh-scope (tokens.css), que fuerza Outfit y
   `color: inherit` en h1-h6/p/span/li/a. Por eso las reglas van con el
   contenedor delante (.hgl-hero .x, .hgl-landing .x): ganan a
   ".dh-scope span" sin necesidad de !important salvo en los titulares.
   ============================================================ */

/* ── Tipografía base de las piezas nuevas ─────────────────── */
body .hgl-hero :is(p, span, li, a, strong, button),
body .hgl-try-head :is(p, span),
body .hgl-landing :is(p, span, li, a, strong, summary, button) {
    font-family: var(--ls-font-body);
}
.hgl-hero :is(h1, h2, h3),
.hgl-landing :is(h1, h2, h3) {
    font-family: var(--ls-font-headline) !important;
    color: var(--ls-on-surface) !important;
}

.hgl-hero .hgl-eyebrow,
.hgl-try-head .hgl-eyebrow {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ls-on-surface-variant);
}

/* ── Botones ──────────────────────────────────────────────── */
.dh-scope .hgl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px;
    border-radius: var(--ls-radius);
    border: 1.5px solid transparent;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: var(--ls-transition);
}
.dh-scope .hgl-btn:focus-visible { outline: 2px solid var(--ls-primary); outline-offset: 2px; }

.dh-scope .hgl-btn--primary {
    background: var(--ls-primary);
    color: var(--ls-on-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.dh-scope .hgl-btn--primary:hover {
    background: var(--ls-on-surface);
    color: var(--ls-on-primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.dh-scope .hgl-btn--primary svg { transition: transform 0.2s ease; }
.dh-scope .hgl-btn--primary:hover svg { transform: translateX(3px); }

.dh-scope .hgl-btn--ghost,
.dh-scope .hgl-btn--outline {
    background: transparent;
    color: var(--ls-on-surface);
    border-color: var(--ls-outline-variant);
}
.dh-scope .hgl-btn--ghost:hover,
.dh-scope .hgl-btn--outline:hover {
    background: var(--ls-surface-container);
    border-color: var(--ls-outline);
    color: var(--ls-on-surface);
}

/* Dorado: solo Premium */
.dh-scope .hgl-btn--gold {
    background: var(--ls-secondary-container);
    color: var(--ls-on-surface);
}
.dh-scope .hgl-btn--gold:hover { background: var(--ls-secondary-fixed); color: var(--ls-on-surface); }

.dh-scope .hgl-btn--light {
    background: var(--ls-surface-lowest);
    color: var(--ls-primary);
}
.dh-scope .hgl-btn--light:hover { background: var(--ls-surface-container); color: var(--ls-primary); }
.dh-scope .hgl-btn--light:focus-visible { outline-color: #fff; }

/* ── Cabecera ─────────────────────────────────────────────── */
.hgl-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: 40px;
    align-items: center;
}
.hgl-hero--solo { grid-template-columns: minmax(0, 1fr); }

.hgl-hero .hgl-hero__title {
    margin: 0 0 16px;
    font-size: clamp(34px, 4.1vw, 52px);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -0.035em;
    text-wrap: balance;
}
.hgl-hero .hgl-hero__lead {
    margin: 0 0 26px;
    max-width: 54ch;
    font-size: 17px;
    line-height: 1.6;
    color: var(--ls-on-surface-variant);
    text-wrap: pretty;
}
.hgl-hero .hgl-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.hgl-hero .hgl-hero__login {
    margin: 14px 0 0;
    font-size: 14px;
    color: var(--ls-on-surface-variant);
}
.hgl-hero .hgl-hero__login a,
.hgl-hero .hgl-hero__login a:hover {
    color: var(--ls-on-surface);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hgl-hero .hgl-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin: 28px 0 0;
    padding: 20px 0 0;
    list-style: none;
    border-top: 1px solid var(--ls-surface-high);
}
.hgl-hero .hgl-stats li {
    font-size: 14px;
    color: var(--ls-on-surface-variant);
}
.hgl-hero .hgl-stats strong {
    margin-right: 2px;
    font-family: var(--ls-font-headline);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ls-on-surface);
}
.hgl-hero .hgl-stats__muted { color: var(--ls-outline); }

/* ── Carrusel: el fondo toma el color del nivel ───────────── */
.hgl-hero .hgl-stage {
    position: relative;
    padding: 30px 30px 18px;
    border-radius: var(--ls-radius-xl);
    background: var(--hgl-tint);
    border: 1px solid var(--hgl-border);
    overflow: hidden;
    isolation: isolate;
    transition: background-color 0.6s ease, border-color 0.6s ease;
}
.hgl-hero .hgl-stage__code {
    position: absolute;
    right: -8px;
    bottom: -34px;
    z-index: -1;
    font-family: var(--ls-font-headline);
    font-size: 170px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.06em;
    color: var(--hgl-border);
    pointer-events: none;
    transition: color 0.6s ease;
}

.hgl-hero .hgl-deck {
    position: relative;
    display: grid;
    max-width: 360px;
    margin: 0 auto;
}
/* Dos cartas de fondo, giradas: sugieren la baraja */
.hgl-hero .hgl-deck::before,
.hgl-hero .hgl-deck::after {
    content: "";
    position: absolute;
    inset: 6px 4px 0;
    border-radius: var(--ls-radius-lg);
    background: var(--ls-surface-lowest);
    box-shadow: var(--ls-shadow-card);
    opacity: 0.55;
    transform: rotate(-4deg);
}
.hgl-hero .hgl-deck::after { opacity: 0.8; transform: rotate(2.5deg); }

.hgl-hero .hgl-slide {
    grid-area: 1 / 1;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: var(--ls-radius-lg);
    background: var(--ls-surface-lowest);
    box-shadow: var(--ls-shadow-card-hover);
    color: var(--ls-on-surface);
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) rotate(-1.5deg) scale(0.97);
    transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 0, 0, 1), visibility 0s linear 0.55s;
}
.hgl-hero .hgl-slide.is-active {
    z-index: 2;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 0, 0, 1), visibility 0s;
}
.hgl-hero .hgl-slide:hover { color: var(--ls-on-surface); }
.hgl-hero .hgl-slide:focus-visible { outline: 2px solid var(--ls-primary); outline-offset: 3px; }

.hgl-hero .hgl-slide__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: var(--ls-radius-md);
    overflow: hidden;
    background: var(--ls-surface-low);
}
.hgl-hero .hgl-slide__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.hgl-hero .hgl-slide:hover .hgl-slide__media img { transform: scale(1.04); }
.hgl-hero .hgl-slide__chip {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 9px;
    border-radius: var(--ls-radius-full);
    background: var(--ls-surface-lowest);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.hgl-hero .hgl-slide__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px 4px;
}
.hgl-hero .hgl-slide__type {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ls-on-surface-variant);
}
.hgl-hero .hgl-slide__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
    font-family: var(--ls-font-headline);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ls-on-surface);
}

.hgl-hero .hgl-stage__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}
.hgl-hero .hgl-dots { display: flex; align-items: center; gap: 2px; }
.hgl-hero .hgl-dot,
.hgl-hero .hgl-pause {
    position: relative;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
/* El punto visible es pequeño; el área táctil, de 24 px */
.hgl-hero .hgl-dot::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: var(--ls-radius-full);
    background: var(--hgl-dark);
    opacity: 0.28;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, opacity 0.3s ease, background-color 0.6s ease;
}
.hgl-hero .hgl-dot.is-active::before { width: 20px; opacity: 1; }
.hgl-hero .hgl-dot:focus-visible,
.hgl-hero .hgl-pause:focus-visible { outline: 2px solid var(--hgl-dark); outline-offset: 1px; border-radius: var(--ls-radius-sm); }

/* Pausa (dos barras) / reanudar (triángulo), dibujados en CSS */
.hgl-hero .hgl-pause::before,
.hgl-hero .hgl-pause::after {
    content: "";
    position: absolute;
    top: 7px;
    width: 3px;
    height: 10px;
    border-radius: 1px;
    background: var(--hgl-dark);
    transition: background-color 0.6s ease;
}
.hgl-hero .hgl-pause::before { left: 8px; }
.hgl-hero .hgl-pause::after { left: 13px; }
.hgl-hero .hgl-pause.is-paused::after { display: none; }
.hgl-hero .hgl-pause.is-paused::before {
    left: 9px;
    width: 0;
    height: 0;
    border-radius: 0;
    background: transparent;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent var(--hgl-dark);
}

/* ── «Pruébalo sin cuenta» (encima de flashcards + Dato del Día) ── */
.hgl-try-head {
    margin-top: 16px;
    padding-top: 28px;
    border-top: 1px solid var(--ls-surface-high);
}
.hgl-try-head .hgl-eyebrow { margin-bottom: 6px; color: var(--ls-on-surface); }
.hgl-try-head .hgl-try-head__text {
    margin: 0;
    font-size: 15px;
    color: var(--ls-on-surface-variant);
}
/* La fila de flashcards va justo debajo */
.hgl-try-head + .dh-two-up { margin-top: 14px !important; }

/* ── Secciones de debajo de la biblioteca ─────────────────── */
.hgl-landing {
    display: flex;
    flex-direction: column;
    gap: 56px;
    margin-top: 24px;
}
.hgl-landing .hgl-section__head { margin-bottom: 22px; }
.hgl-landing .hgl-h2 {
    margin: 0 0 6px;
    font-size: clamp(24px, 2.6vw, 30px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
}
.hgl-landing .hgl-section__lead {
    margin: 0;
    max-width: 62ch;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ls-on-surface-variant);
}

/* Cómo funciona */
.hgl-landing .hgl-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.hgl-landing .hgl-step {
    padding: 22px;
    border-radius: var(--ls-radius-lg);
    background: var(--ls-surface-lowest);
    border: 1px solid var(--ls-surface-container);
    box-shadow: var(--ls-shadow-card);
}
.hgl-landing .hgl-step__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.hgl-landing .hgl-step__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--ls-radius);
    background: var(--ls-surface-low);
    color: var(--ls-on-surface);
}
.hgl-landing .hgl-step__num {
    font-family: var(--ls-font-headline);
    font-size: 14px;
    font-weight: 800;
    color: var(--ls-outline-variant);
}
.hgl-landing .hgl-step__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.hgl-landing .hgl-step__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ls-on-surface-variant);
}

/* Niveles */
.hgl-landing .hgl-levels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.dh-scope .hgl-landing .hgl-level {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border-radius: var(--ls-radius-lg);
    background: var(--lvl-tint);
    border: 1px solid var(--lvl-border);
    color: var(--ls-on-surface);
    text-decoration: none;
    transition: var(--ls-transition);
}
.dh-scope .hgl-landing .hgl-level:hover {
    border-color: var(--lvl-dark);
    box-shadow: var(--ls-shadow-card-hover);
    transform: translateY(-2px);
}
.dh-scope .hgl-landing .hgl-level:focus-visible { outline: 2px solid var(--lvl-dark); outline-offset: 2px; }
.hgl-landing .hgl-level__top { display: flex; align-items: baseline; gap: 10px; }
.hgl-landing .hgl-level__code {
    font-family: var(--ls-font-headline);
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--lvl-dark);
}
.hgl-landing .hgl-level__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--lvl-dark);
}
.hgl-landing .hgl-level__desc {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ls-on-surface-variant);
}
.hgl-landing .hgl-level__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--lvl-dark);
}
.hgl-landing .hgl-level__arrow { margin-left: auto; transition: transform 0.2s ease; }
.hgl-landing .hgl-level:hover .hgl-level__arrow { transform: translateX(3px); }

/* Gratis o Premium */
.hgl-landing .hgl-plans {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.hgl-landing .hgl-plan {
    display: flex;
    flex-direction: column;
    padding: 26px;
    border-radius: var(--ls-radius-lg);
    background: var(--ls-surface-lowest);
    border: 1px solid var(--ls-surface-container);
    box-shadow: var(--ls-shadow-card);
}
.hgl-landing .hgl-plan--premium {
    border: 1.5px solid var(--ls-secondary-container);
    box-shadow: 0 8px 30px rgba(115, 92, 0, 0.10);
}
.hgl-landing .hgl-plan__name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ls-on-surface-variant);
}
.hgl-landing .hgl-plan--premium .hgl-plan__name { color: var(--ls-secondary); }
.hgl-landing .hgl-plan__price {
    margin: 0;
    font-family: var(--ls-font-headline);
    font-size: 38px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--ls-on-surface);
}
.hgl-landing .hgl-plan__period {
    margin: 4px 0 18px;
    font-size: 14px;
    color: var(--ls-on-surface-variant);
}
.hgl-landing .hgl-plan__vat { font-size: 12px; color: var(--ls-outline); }
.hgl-landing .hgl-plan__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 22px;
    padding: 18px 0 0;
    list-style: none;
    border-top: 1px solid var(--ls-surface-container);
    flex: 1;
}
.hgl-landing .hgl-plan__list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--ls-on-surface);
}
.hgl-landing .hgl-plan__list svg { flex-shrink: 0; margin-top: 2px; color: var(--ls-success); }
.hgl-landing .hgl-plan--premium .hgl-plan__list svg { color: var(--ls-secondary); }

/* Profesores */
.dh-scope .hgl-landing .hgl-teachers {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: var(--ls-radius-lg);
    background: var(--ls-surface-low);
    border: 1px solid var(--ls-surface-container);
    color: var(--ls-on-surface);
    text-decoration: none;
    transition: var(--ls-transition);
}
.dh-scope .hgl-landing .hgl-teachers:hover { border-color: var(--ls-outline-variant); background: var(--ls-surface-container); }
.dh-scope .hgl-landing .hgl-teachers:focus-visible { outline: 2px solid var(--ls-primary); outline-offset: 2px; }
.hgl-landing .hgl-teachers__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--ls-radius);
    background: var(--ls-surface-lowest);
    color: var(--ls-on-surface);
}
.hgl-landing .hgl-teachers__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hgl-landing .hgl-teachers__text strong { font-size: 15px; font-weight: 700; color: var(--ls-on-surface); }
.hgl-landing .hgl-teachers__text span { font-size: 14px; line-height: 1.45; color: var(--ls-on-surface-variant); }
.hgl-landing .hgl-teachers__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ls-on-surface);
    white-space: nowrap;
}

/* Preguntas frecuentes */
.hgl-landing .hgl-faq {
    border-radius: var(--ls-radius-lg);
    background: var(--ls-surface-lowest);
    border: 1px solid var(--ls-surface-container);
    box-shadow: var(--ls-shadow-card);
}
.hgl-landing .hgl-faq__item + .hgl-faq__item { border-top: 1px solid var(--ls-surface-container); }
.hgl-landing .hgl-faq__item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ls-on-surface);
    cursor: pointer;
    list-style: none;
}
.hgl-landing .hgl-faq__item summary::-webkit-details-marker { display: none; }
.hgl-landing .hgl-faq__item summary:focus-visible { outline: 2px solid var(--ls-primary); outline-offset: -2px; border-radius: var(--ls-radius-lg); }
.hgl-landing .hgl-faq__chev { flex-shrink: 0; color: var(--ls-on-surface-variant); transition: transform 0.25s ease; }
.hgl-landing .hgl-faq__item[open] .hgl-faq__chev { transform: rotate(180deg); }
.hgl-landing .hgl-faq__item p {
    margin: 0;
    padding: 0 22px 20px;
    max-width: 70ch;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ls-on-surface-variant);
}

/* Cierre */
.hgl-landing .hgl-final {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 32px;
    border-radius: var(--ls-radius-xl);
    background: var(--ls-primary);
}
.hgl-landing .hgl-final .hgl-final__title {
    margin: 0 0 6px;
    font-size: clamp(24px, 2.6vw, 30px);
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--ls-on-primary) !important;
}
.hgl-landing .hgl-final__text { margin: 0; font-size: 15px; color: var(--ls-inverse-primary); }

/* App nativa (v1 sin compras dentro de la app): sin precios ni Premium */
html.is-app .hgl-plans-section { display: none; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
    .hgl-hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .hgl-landing .hgl-steps { grid-template-columns: minmax(0, 1fr); }
    .hgl-landing .hgl-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mismo corte que el orden móvil de front-page.php (display:contents + order) */
@media (max-width: 768px) {
    .hgl-try-head { order: 4 !important; width: 100% !important; margin-top: 0; }
    .hgl-try-head + .dh-two-up { margin-top: 0 !important; }
    .fp-m-landing { order: 7 !important; width: 100% !important; margin-top: 12px; }
}

@media (max-width: 640px) {
    .hgl-hero .hgl-hero__lead { font-size: 16px; }
    .hgl-hero .hgl-hero__actions .hgl-btn { flex: 1 1 100%; }
    .hgl-hero .hgl-stage { padding: 22px 20px 14px; }
    .hgl-hero .hgl-stage__code { font-size: 130px; bottom: -26px; }
    .hgl-landing { gap: 44px; }
    .hgl-landing .hgl-plans { grid-template-columns: minmax(0, 1fr); }
    .dh-scope .hgl-landing .hgl-teachers { flex-wrap: wrap; }
    .hgl-landing .hgl-teachers__link { width: 100%; padding-left: 60px; }
    .hgl-landing .hgl-final { flex-direction: column; align-items: flex-start; padding: 26px 22px; }
    .hgl-landing .hgl-final .hgl-btn { width: 100%; }
}

@media (max-width: 420px) {
    .hgl-landing .hgl-levels { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .hgl-hero .hgl-stage,
    .hgl-hero .hgl-stage__code,
    .hgl-hero .hgl-slide,
    .hgl-hero .hgl-slide.is-active,
    .hgl-hero .hgl-slide__media img,
    .dh-scope .hgl-landing .hgl-level { transition: none; }
    .dh-scope .hgl-landing .hgl-level:hover { transform: none; }
}
