/* biblioteca.css — Cuentos+ (Ultra-Responsive, Full-Bleed 5-6 & Scroll-Optimized) */

@font-face {
  font-family: 'Andika';
  src: url('../../assets/fonts/andika-v27-latin-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'Andika';
  src: url('../../assets/fonts/andika-v27-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
}

:root {
  --color-fondo: #080d1a;
  --color-tarjeta: #121a2c;
  --color-oro: #F59E0B;
  --color-oro-brillante: #FBBF24;
  --color-teal: #14B8A6;
  --color-crema: #F8FAFC;
  --color-texto-mutado: #94A3B8;
  --fuente-base: 'Andika', system-ui, sans-serif;
  --radio-tarjeta: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
  font-family: var(--fuente-base);
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-fondo);
  color: var(--color-crema);
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--fuente-base);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   HEADER NO FIJO / NO PERMANENTE (Scroll natural)
   ========================================================================== */

.encabezado-biblioteca {
  position: relative;
  padding: 14px clamp(14px, 3.5vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  width: 100%;
}

.btn-home-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-home-svg:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.btn-home-svg svg {
  width: 22px;
  height: 22px;
}

.logo-cuentos-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logo-cuentos-img {
  height: 38px;
  width: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

.logo-cuentos-texto {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #FFFFFF 0%, #FBBF24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-hamburguesa {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.btn-hamburguesa:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--color-oro);
  transform: scale(1.05);
}

.btn-hamburguesa span {
  display: block;
  width: 20px;
  height: 2.5px;
  background-color: #FFFFFF;
  border-radius: 2px;
}

/* ==========================================================================
   DRAWER / MENÚ LATERAL SUAVE
   ========================================================================== */

.menu-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 500;
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.menu-drawer-backdrop.abierto {
  opacity: 1;
  pointer-events: auto;
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 85%;
  max-width: 330px;
  background: #0f172a;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -12px 0 35px rgba(0, 0, 0, 0.85);
  z-index: 510;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.menu-drawer.abierto {
  transform: translateX(0);
  pointer-events: auto;
}

.menu-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-drawer__titulo {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: #FFFFFF;
}

.menu-drawer__cerrar {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.menu-drawer__cerrar:hover {
  background: rgba(255, 255, 255, 0.25);
}

.menu-seccion-titulo {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-oro);
  margin: 0 0 10px;
}

.grid-3-edades {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 26px;
}

.btn-edad-menu {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  color: #E2E8F0;
  font-weight: 700;
  padding: 10px 4px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.btn-edad-menu:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.btn-edad-menu.activo {
  background: var(--color-oro);
  color: #080d1a;
  border-color: var(--color-oro);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.btn-edad-todos {
  grid-column: span 3;
  margin-top: 4px;
  padding: 8px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.lista-categorias-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-categoria-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 14px;
  border-radius: 12px;
  color: #F1F5F9;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.item-categoria-menu:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--color-teal);
  transform: translateX(4px);
}

/* ==========================================================================
   CARRUSEL TOP 1 AL 5 HORIZONTAL INFINITO
   ========================================================================== */

.seccion-top5 {
  margin: 8px 0 32px;
  position: relative;
}

.seccion-top5__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(14px, 3.5vw, 40px);
  margin-bottom: 12px;
}

.seccion-top5__titulo {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 700;
  margin: 0;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  gap: 8px;
}

.carrusel-nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.carrusel-nav-btn:hover {
  background: var(--color-oro);
  color: #080d1a;
}

.top5-carrusel-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.top5-carrusel-track {
  display: flex;
  gap: 32px;
  overflow-x: auto;
  padding: 8px clamp(14px, 3.5vw, 40px) 20px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.top5-carrusel-track::-webkit-scrollbar {
  display: none;
}

.tarjeta-top5 {
  display: inline-flex;
  align-items: flex-end;
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tarjeta-top5__numero {
  font-size: clamp(90px, 13vw, 125px);
  font-weight: 900;
  line-height: 0.72;
  color: #080d1a;
  -webkit-text-stroke: 3px #64748b;
  user-select: none;
  margin-right: -22px;
  z-index: 1;
  filter: drop-shadow(4px 4px 8px rgba(0,0,0,0.85));
  transition: all 0.25s ease;
}

.tarjeta-top5:hover .tarjeta-top5__numero {
  -webkit-text-stroke-color: var(--color-oro);
  transform: translateY(-4px);
}

.tarjeta-top5 .tarjeta-cuento__portada-wrap {
  width: 140px;
  height: 195px;
  max-width: 140px;
  max-height: 195px;
  z-index: 2;
}

/* ==========================================================================
   CARRUSELES POR CATEGORÍA
   ========================================================================== */

.categoria-fila {
  margin-bottom: 28px;
}

.categoria-fila__titulo {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 700;
  margin: 0 0 10px;
  padding: 0 clamp(14px, 3.5vw, 40px);
  color: #F8FAFC;
}

.categoria-fila__carrusel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px clamp(14px, 3.5vw, 40px) 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.categoria-fila__carrusel::-webkit-scrollbar { height: 6px; }
.categoria-fila__carrusel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

/* ==========================================================================
   TARJETAS DE CUENTO CON TAMAÑO ESTRICTO Y HOVER CON MINI RESUMEN
   ========================================================================== */

.tarjeta-cuento {
  flex: 0 0 145px;
  width: 145px;
  max-width: 145px;
  scroll-snap-align: start;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  border-radius: var(--radio-tarjeta);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), z-index 0.25s;
}

.tarjeta-cuento__portada-wrap {
  position: relative;
  width: 145px;
  height: 205px;
  max-width: 145px;
  max-height: 205px;
  border-radius: var(--radio-tarjeta);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  background: var(--color-tarjeta);
  flex-shrink: 0;
}

.tarjeta-cuento__portada {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, filter 0.25s ease;
}

.tarjeta-cuento__insignia {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 3;
}

.tarjeta-cuento__hover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 8px 8px;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 13, 26, 0.9) 25%, rgba(8, 13, 26, 0.98) 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.25s ease;
  z-index: 4;
  border-bottom-left-radius: var(--radio-tarjeta);
  border-bottom-right-radius: var(--radio-tarjeta);
}

.tarjeta-cuento__hover-edad {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-oro-brillante);
  text-transform: uppercase;
}

.tarjeta-cuento__hover-resumen {
  font-size: 0.7rem;
  line-height: 1.25;
  color: #E2E8F0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tarjeta-cuento__hover-cta {
  margin-top: 2px;
  background: var(--color-oro);
  color: #080d1a;
  font-weight: 700;
  font-size: 0.72rem;
  text-align: center;
  padding: 4px 6px;
  border-radius: 6px;
}

.tarjeta-cuento:hover, .tarjeta-top5:hover {
  transform: scale(1.05) translateY(-4px);
  z-index: 10;
}

.tarjeta-cuento:hover .tarjeta-cuento__portada,
.tarjeta-top5:hover .tarjeta-cuento__portada {
  filter: brightness(0.92);
}

.tarjeta-cuento:hover .tarjeta-cuento__hover-info,
.tarjeta-top5:hover .tarjeta-cuento__hover-info {
  opacity: 1;
  transform: translateY(0);
}

.tarjeta-cuento__titulo {
  font-size: 0.84rem;
  font-weight: 700;
  margin: 6px 0 0;
  color: #F1F5F9;
  line-height: 1.25;
}

/* ==========================================================================
   LECTOR VERTICAL INMERSIVO (PANTALLA COMPLETA & SCROLL OPTIMIZADO)
   ========================================================================== */

.lector {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-fondo);
  color: white;
  overflow: hidden;
  z-index: 100;
}

.lector__barra {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 40;
  position: relative;
  flex-shrink: 0;
}

.lector__cerrar {
  color: white;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

.lector__progreso {
  flex: 1;
  max-width: 420px;
  height: 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.lector__progreso-relleno {
  height: 100%;
  background: var(--color-oro);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.lector__escenario {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
  padding: 0;
}

/* Vista de preguntas: alineación superior con scroll natural */
.lector__escenario:has(.preguntas),
.lector__escenario.con-preguntas {
  align-items: flex-start;
  justify-content: flex-start;
  padding: 70px 16px 40px;
}

.lector__controles {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 40;
}

.lector__controles[hidden] {
  display: none !important;
}

.boton-nav {
  font-family: var(--fuente-base);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.boton-nav--primario {
  background: var(--color-oro);
  border-color: var(--color-oro);
  color: #080d1a;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.boton-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==========================================================================
   FORMATO 5-6 AÑOS: IMAGEN A PANTALLA COMPLETA TOTAL CON DIFUMINADO INFERIOR
   ========================================================================== */

.pagina--pantalla-difuminada-56 {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #000;
  border-radius: 0;
}

.pagina--pantalla-difuminada-56 .pantalla__imagen-fondo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  z-index: 1;
}

.pagina--pantalla-difuminada-56 .pantalla__degradado-difuminado {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, 
    rgba(8, 13, 26, 0) 0%, 
    rgba(8, 13, 26, 0.05) 30%, 
    rgba(8, 13, 26, 0.85) 60%, 
    rgba(8, 13, 26, 0.98) 88%);
  pointer-events: none;
}

.pagina--pantalla-difuminada-56 .pantalla__texto {
  position: relative;
  z-index: 3;
  font-family: var(--fuente-base);
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  font-weight: 700;
  line-height: 1.5;
  color: #FFFFFF;
  text-align: center;
  margin: 0;
  padding: 20px 24px 85px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
}

/* ==========================================================================
   IMÁGENES COMPLETAS RESPONSIVE CON ZOOM INTERACTIVO DEL 20%
   ========================================================================== */

.pagina--solo-imagen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  padding: 60px 16px 80px;
}

.pagina--solo-imagen img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pagina--solo-imagen.zoom-activo {
  cursor: zoom-out;
}

.pagina--solo-imagen.zoom-activo img {
  transform: scale(1.2);
}

/* ==========================================================================
   PÁGINA SOLO TEXTO
   ========================================================================== */

.pagina--solo-texto {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 80px;
  height: 100%;
}

.pagina--solo-texto .pagina__texto {
  font-family: var(--fuente-base);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  line-height: 1.7;
  text-align: left;
  max-width: 620px;
  margin: 0 auto;
  color: #F8FAFC;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* ==========================================================================
   PREGUNTAS DE COMPRENSIÓN (SCROLL FLUIDO & ACCESIBLE EN MÓVIL)
   ========================================================================== */

.preguntas {
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 22px clamp(16px, 4vw, 28px);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  margin: 0 auto 30px;
  z-index: 50;
  flex-shrink: 0;
}

.preguntas__titulo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-oro);
  margin: 0 0 16px;
  text-align: center;
}

.pregunta-item {
  margin-bottom: 16px;
}

.pregunta-item__texto {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #F1F5F9;
}

.pregunta-item__opcion {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--fuente-base);
  font-size: 0.9rem;
  font-weight: 400;
  padding: 11px 14px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #E2E8F0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pregunta-item__opcion:hover {
  background: rgba(255, 255, 255, 0.15);
}

.pregunta-item__opcion[aria-pressed="true"] {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--color-oro);
  color: #FFFFFF;
  font-weight: 700;
}

.pregunta-item__opcion.correcta {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: #10B981 !important;
  color: #FFFFFF !important;
}

.pregunta-item__opcion.incorrecta {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: #EF4444 !important;
  color: #FFFFFF !important;
}

.estado-vacio {
  text-align: center;
  color: var(--color-texto-mutado);
  font-size: 0.95rem;
  padding: 30px 20px;
}
