/* ==========================================================================
   LÁMPARA VIVA — estilos propios de la sección (página de descargas,
   libro por capítulos y visor del cómic). Solo usa las variables de
   style.css; no redefine nada global.
   ========================================================================== */

/* ── Página de descargas ─────────────────────────────────── */
.descargas-lista {
    display: grid; gap: var(--e5);
    max-width: 820px; margin: var(--e7) auto 0;
}
.descargas-lista .has-visto-tarjeta:hover { transform: none; box-shadow: var(--sombra-m); }

.lv-acciones {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--e3);
    margin-top: auto;
}
.lv-leer {
    display: inline-flex; align-items: center; gap: var(--e2);
    padding: var(--e3) var(--e5);
    font-size: 0.92rem; font-weight: 700;
    color: #fff; background: var(--color-azul-esencial);
    border-radius: var(--radio-pastilla); text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.28);
    transition: background-color 0.2s, transform 0.2s;
}
.lv-leer:hover { background: var(--color-azul-oscuro); transform: translateY(-2px); }

/* ── Libro: índice y capítulos ───────────────────────────── */
.lv-continuar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e4);
    background: var(--azul-tenue); border: 1px solid var(--azul-borde);
    border-radius: var(--radio-l); padding: var(--e5); margin-bottom: var(--e6);
}
.lv-continuar p { margin: 0; color: var(--color-texto); }

.lv-indice h2 {
    /* !important: style.css fuerza h2 a 2rem !important en móvil */
    text-align: left; font-size: 1.1rem !important; margin: var(--e6) 0 var(--e3);
    color: var(--color-marron-madera); font-family: var(--fuente-texto);
    text-transform: uppercase; letter-spacing: 0.1em;
}
.lv-indice h2 small { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--texto-suave); }
.lv-indice ol { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--linea); }
.lv-indice li { border-bottom: 1px solid var(--linea); }
.lv-indice a {
    display: flex; gap: var(--e3); align-items: baseline;
    padding: var(--e3) var(--e2);
    font-family: var(--fuente-titulos); font-size: 1.12rem; font-weight: 600;
    color: var(--color-azul-oscuro); text-decoration: none;
}
.lv-indice a:hover { background: var(--azul-tenue); }
.lv-indice a small { margin-left: auto; font-family: var(--fuente-texto); font-size: 0.8rem; font-weight: 500; color: var(--texto-suave); font-style: italic; }
.lv-indice a.lv-leido::after { content: '✓'; color: var(--color-azul-esencial); font-size: 0.9rem; order: 1; }
.lv-indice a small { order: 2; }

.lv-creditos { margin-top: var(--e7); font-size: 0.85rem; color: var(--texto-suave); text-align: center; }
.lv-creditos p { margin: 0 0 var(--e2); }

.lv-escena { text-align: center; letter-spacing: 0.4em; color: var(--color-marron-madera); margin: 1.6em 0 !important; }
.lv-firma { text-align: right; font-style: italic; }
.voz-cuerpo .lv-escena + p::first-letter { font: inherit; float: none; }

/* ── Visor del cómic ─────────────────────────────────────── */
.lv-visor {
    --lv-fondo: #1d2733;
    background: var(--lv-fondo);
    color: #fff;
    padding: var(--e5) var(--e4) var(--e6);
    user-select: none; -webkit-user-select: none;
}
.lv-visor:fullscreen { display: flex; flex-direction: column; justify-content: center; padding: var(--e3); }

.lv-escenario {
    position: relative;
    margin: 0 auto;
    width: min(100%, calc((100vh - 240px) * 0.75), 760px);
    aspect-ratio: 3 / 4;
    perspective: 2200px;
    touch-action: pan-y;          /* el desplazamiento vertical de la página sigue funcionando */
    overflow: hidden;
    border-radius: var(--radio-s);
    background: #10161d;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    cursor: zoom-in;
}
.lv-visor:fullscreen .lv-escenario { width: min(100%, calc((100vh - 90px) * 0.75)); }
.lv-escenario.lv-con-zoom { touch-action: none; cursor: grab; }
.lv-escenario.lv-arrastrando { cursor: grabbing; }

.lv-hoja {
    position: absolute; inset: 0;
    transform-origin: 0 0;
    will-change: transform;
}
.lv-hoja img {
    width: 100%; height: 100%; object-fit: contain; display: block;
    pointer-events: none;
}

/* La hoja que se va: gira sobre su lomo como la página de un libro */
.lv-volteo {
    position: absolute; inset: 0;
    backface-visibility: hidden;
    background: #10161d;
    z-index: 2;
    pointer-events: none;
}
.lv-volteo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.lv-volteo::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.35));
    opacity: 0; transition: opacity 0.6s ease;
}
.lv-volteo.lv-adelante { transform-origin: left center; animation: lvPasaAdelante 0.6s ease-in forwards; }
.lv-volteo.lv-atras    { transform-origin: right center; animation: lvPasaAtras 0.6s ease-in forwards; }
.lv-volteo.lv-adelante::after, .lv-volteo.lv-atras::after { opacity: 1; }
@keyframes lvPasaAdelante { to { transform: rotateY(-100deg); } }
@keyframes lvPasaAtras    { to { transform: rotateY(100deg); } }

.lv-flecha {
    position: absolute; top: 50%; z-index: 3;
    transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, 0.88); color: var(--color-azul-oscuro);
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    box-shadow: var(--sombra-m);
    transition: opacity 0.2s, background-color 0.2s;
}
.lv-flecha:hover { background: #fff; }
.lv-flecha:disabled { opacity: 0; pointer-events: none; }
.lv-flecha-ant { left: var(--e3); }
.lv-flecha-sig { right: var(--e3); }
.lv-con-zoom .lv-flecha { opacity: 0; pointer-events: none; }

.lv-barra {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--e2);
    margin: var(--e4) auto 0; max-width: 760px;
}
.lv-boton {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--e1);
    min-width: 44px; min-height: 44px; padding: 0 var(--e4);
    font: 600 0.9rem var(--fuente-texto);
    color: #fff; background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.22); border-radius: var(--radio-pastilla);
    cursor: pointer; text-decoration: none;
    transition: background-color 0.2s;
}
.lv-boton:hover { background: rgba(255, 255, 255, 0.2); }
.lv-boton:focus-visible, .lv-flecha:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.lv-contador { min-width: 5.5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.lv-ayuda { text-align: center; font-size: 0.82rem; color: rgba(255, 255, 255, 0.7); margin: var(--e3) 0 0; }

@media (max-width: 640px) {
    .lv-visor { padding: var(--e3) var(--e2) var(--e5); }
    .lv-escenario { width: 100%; }
    .lv-flecha { width: 40px; height: 40px; font-size: 1.25rem; }
    .lv-texto-largo { display: none; }
    .lv-indice a { flex-wrap: wrap; row-gap: 0; }
    .lv-indice a small { margin-left: 0; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .lv-volteo.lv-adelante, .lv-volteo.lv-atras { animation-duration: 0.01s; }
}

/* Cabecera breve sobre el visor */
.lv-cabecera { text-align: center; padding: var(--e6) 16px var(--e5); max-width: 760px; margin: 0 auto; }
.lv-cabecera h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); color: var(--color-azul-oscuro); margin: var(--e2) 0 var(--e3); }
.lv-cabecera p { margin: 0; color: var(--texto-suave); }
.lv-tras-visor { text-align: center; }
.lv-tras-visor .lv-acciones { justify-content: center; margin-top: var(--e5); }

/* Portada de la página de Lámpara viva: el mismo degradado azul del sitio
   sobre la ilustración del cómic */
.hero-lampara-viva {
    background: linear-gradient(rgba(2, 62, 138, 0.62), rgba(0, 40, 100, 0.86)),
                url('hero-lampara-viva.webp') center 12%/cover;
}
