/* ================================================================
   GUÍA DE CAMBIOS DE DISEÑO — EpubLibrary / estilos.css
   ================================================================

   ┌─ PALETA DE COLORES (líneas 3–10) ─────────────────────────────┐
   │  --orange / --orange-dark / --orange-light                    │
   │    Color de acento principal: botones, enlaces hover, dividers │
   │    Cambiar aquí afecta TODA la web (botones, hovers, chips…)  │
   │  --blue / --blue-dark / --blue-light                          │
   │    Color secundario: badge "Completa", btn-blue del modal      │
   │  --paypal / --paypal-dark                                     │
   │    Azul corporativo PayPal: widget de colaboración            │
   └───────────────────────────────────────────────────────────────┘

   ┌─ SOMBRAS ──────────────────────────────────────────────────────┐
   │  Familia neutral (elevación):                                 │
   │    --shadow-xs   header, chips hover sutiles                  │
   │    --shadow-sm   tarjetas en reposo  (alias: --shadow)        │
   │    --shadow-md   tarjetas hover, dropdowns (alias: --shadow-hover)│
   │    --shadow-lg   modal libro                                  │
   │    --shadow-xl   modales grandes (saga, auth, search)         │
   │  Familia acento:                                              │
   │    --shadow-orange / --shadow-orange-hover  botones naranja   │
   │    --shadow-blue                            botones azul      │
   │    --shadow-paypal / --shadow-paypal-hover  widget PayPal     │
   │  Accesibilidad:                                               │
   │    --shadow-focus-orange   ring de foco en inputs/botones     │
   └───────────────────────────────────────────────────────────────┘

   ┌─ FONDOS (líneas 12–16) ────────────────────────────────────────┐
   │  --bg-main    → fondo de secciones blancas (hero, nosotros)   │
   │  --bg-section → fondo gris cálido (biblioteca, sagas)     │
   │  --bg-card    → fondo de tarjetas de libro                    │
   │  --bg-muted   → inputs, chips inactivos, fondo sugerencias    │
   └───────────────────────────────────────────────────────────────┘

   ┌─ TIPOGRAFÍA (líneas 32–38) ───────────────────────────────────┐
   │  Variables de escala: --fs-para, --fs-autor, --fs-titulo, --fs-sub │
   │  Familias (líneas 65–68): .t-title → Playfair Display         │
   │                            .t-quote → Caveat                  │
   │                            .t-author → IM Fell English        │
   │  Para cambiar fuentes, editar también el <link> de Google     │
   │  Fonts en index.html (línea ~9).                              │
   └───────────────────────────────────────────────────────────────┘

   ┌─ HEADER (líneas ~122–198) ────────────────────────────────────┐
   │  Altura → --header-h: 76px (en :root, línea 26)              │
   │  Fondo/transparencia → #header { background: rgba(…) }       │
   │  Logo → .header-logo img { height: 100px }                   │
   │  Nav-links → .nav-link { padding, font-size, hover gradient } │
   └───────────────────────────────────────────────────────────────┘

   ┌─ HERO (líneas ~201–227) ──────────────────────────────────────┐
   │  Altura → min-height: calc(100svh - var(--header-h))          │
   │    Usa 100svh (small viewport height) para evitar el salto     │
   │    de la barra del navegador en iOS/Android. Fallbacks:        │
   │    100dvh → 100vh para navegadores sin soporte.                │
   │  Video → .hero-video-wrap video { opacity: 0.5 }             │
   │  Overlay color → .hero-overlay { background: linear-gradient }│
   │  Título → .hero-title { font-size: clamp(2.8rem,8vw,6rem) }  │
   │  IMPORTANTE: z-index:10 en #hero → no quitar, tapa modales   │
   │    que puedan aparecer antes de que el CSS oculte los overlays│
   └───────────────────────────────────────────────────────────────┘

   ┌─ BIBLIOTECA (líneas ~311–474) ─────────────────────────────────┐
   │  Grid → .bib-grid { grid-template-columns: repeat(auto-fill,  │
   │          minmax(160px, 1fr)) }                                 │
   │  Tarjetas → .lib-book, .lib-book-cover-wrap, .lib-book-body  │
   │  Header sticky → .biblioteca-sticky-header { top, background }│
   └───────────────────────────────────────────────────────────────┘

   ┌─ SAGAS (líneas ~569–897) ──────────────────────────────────────┐
   │  Grid → .sagas-list { grid-template-columns: auto-fill }      │
   │  Tarjeta → .saga-card-block, .saga-card-header               │
   │  Chips de portada → .saga-book-chip, --saga-chip-w: 140px    │
   └───────────────────────────────────────────────────────────────┘

   ┌─ MODAL DE LIBRO (líneas ~953–1189) ───────────────────────────┐
   │  Overlay → #modal-overlay { z-index:2000, backdrop-filter }   │
   │  Layout → .modal-inner { grid-template-columns: clamp(180px,25vw,260px) 1fr } │
   │    Cambiar 260px para hacer la portada más o menos ancha      │
   │  Portada → #modal-cover-wrap { align-self:stretch, sin min-height } │
   │  Sinopsis → .modal-desc { max-height: 170px }                │
   │  Botones → .modal-actions .btn { padding, font-size }        │
   │  Responsive → @media(max-width:680px) línea ~1154            │
   └───────────────────────────────────────────────────────────────┘

   ┌─ MODAL DE SAGA (líneas ~1201–1256) ───────────────────────────┐
   │  .saga-modal { max-width: min(560px, 96vw) }                 │
   │  Pestañas → .saga-modal-tab, .saga-modal-tab.active          │
   └───────────────────────────────────────────────────────────────┘

   ┌─ BÚSQUEDA / SUGERENCIAS (líneas ~1318–1394) ───────────────────┐
   │  Dropdown → #search-suggestions { max-height: 440px }        │
   │  Items → .sugg-item, .sugg-item-main, .sugg-item-sub         │
   └───────────────────────────────────────────────────────────────┘

   ┌─ FOOTER (líneas ~920–950) ─────────────────────────────────────┐
   │  Grid → .footer-main { grid-template-columns: 2fr 1fr 1fr }  │
   │  Logo → .footer-logo-img { height: 100px }                   │
   └───────────────────────────────────────────────────────────────┘

================================================================ */

:root {
  /* ── COLORES DE MARCA ───────────────────────────────────────────
     Cambiar --orange para un rediseño completo del acento principal.
     --blue es el color secundario (saga "Completa", btn leer online).
     Los sufijos -dark/-light son variantes para gradientes y hovers. */
  --orange:       #f07800;
  --orange-light: #ff9a2e;
  --orange-dark:  #c85e00;
  --orange-glow:  rgba(240,120,0,0.25);
  --blue:         #1a6fcc;
  --blue-dark:    #0d4d99;
  --blue-light:   #3b8fe8;
  --blue-glow:    rgba(26,111,204,0.2);

  /* ── PAYPAL — color corporativo del widget de colaboración ─────
     Centralizado aquí para que un solo cambio afecte a todo el panel.
     --paypal-dark es el hover/active. */
  --paypal:       #003087;
  --paypal-dark:  #00439e;
  --paypal-glow:  rgba(0,48,135,0.25);

  /* ── FONDOS ────────────────────────────────────────────────────
     Para modo oscuro: invertir bg-main↔bg-section y ajustar
     --text-primary / --text-secondary a tonos claros. */
  --bg-main:    #ffffff;   /* Fondo de hero, nosotros, contacto    */
  --bg-section: #f8f8f6;   /* Fondo de biblioteca, sagas*/
  --bg-card:    #ffffff;   /* Fondo de tarjetas individuales       */
  --bg-muted:   #f2f2f0;   /* Inputs, chips inactivos, sugerencias */

  /* ── TEXTO Y BORDES ─────────────────────────────────────────── */
  --text-primary:   #111111;           /* Títulos y texto principal   */
  --text-secondary: #444444;           /* Párrafos y descripciones    */
  --text-muted:     #888888;           /* Labels, placeholders, pies  */
  --border:         rgba(0,0,0,0.10);  /* Bordes suaves generales     */
  --border-strong:  rgba(0,0,0,0.18);  /* Bordes de btn-outline       */

  /* ── MEDIDAS ESTRUCTURALES ──────────────────────────────────────
     --header-h: altura del header fijo. Cambiar aquí y el padding-top
     del hero y del mobile-menu se ajustan automáticamente. */
  --header-h:     76px;   /* ← CAMBIAR AQUÍ para header más alto/bajo */
  --transition:   0.32s cubic-bezier(0.4,0,0.2,1);
  --radius:       14px;
  /* ── SOMBRAS ────────────────────────────────────────────────────
     Familia neutral (rgba negra) — 4 niveles de elevación:
       --shadow-xs   elementos flotantes sutiles (header, menú móvil)
       --shadow-sm   tarjetas en reposo
       --shadow-md   tarjetas hover, dropdowns
       --shadow-lg   modales medianos (modal libro)
       --shadow-xl   modales grandes (saga, auth, search)
     Familia de acento — glow con el color de marca:
       --shadow-orange / --shadow-orange-hover  botones y badges naranja
       --shadow-blue                            botones azul, badges saga
     Focus ring (accesibilidad):
       --shadow-focus-orange   inputs y botones al recibir foco        */
  --shadow-xs:            0 2px 16px rgba(0,0,0,0.06);
  --shadow-sm:            0 4px 20px rgba(0,0,0,0.08);   /* antes --shadow */
  --shadow-md:            0 12px 40px rgba(0,0,0,0.14);  /* antes --shadow-hover */
  --shadow-lg:            0 24px 60px rgba(0,0,0,0.26);
  --shadow-xl:            0 40px 100px rgba(0,0,0,0.26);

  --shadow-orange:        0 4px 20px var(--orange-glow);
  --shadow-orange-hover:  0 8px 30px var(--orange-glow);
  --shadow-blue:          0 4px 20px var(--blue-glow);
  --shadow-paypal:        0 4px 18px var(--paypal-glow);
  --shadow-paypal-hover:  0 6px 28px rgba(0,48,135,0.42), 0 2px 8px rgba(0,0,0,0.10);

  --shadow-focus-orange:  0 0 0 3px var(--orange-glow);

  /* Alias de compatibilidad — mantienen el nombre anterior funcional */
  --shadow:       var(--shadow-sm);
  --shadow-hover: var(--shadow-md);

  /* ── ESCALA DE ESPACIADO FLUIDO ────────────────────────────────
     Usar estas variables en padding, gap y margin en lugar de px fijos.
     Escalan suavemente entre móvil (360px) y escritorio (1400px).
     xs → 8–12px  |  sm → 12–20px  |  md → 20–36px
     lg → 36–60px |  xl → 60–100px |  2xl → 80–140px            */
  --space-xs:  clamp(0.5rem,  1vw,   0.75rem);   /*  8px → 12px  */
  --space-sm:  clamp(0.75rem, 1.5vw, 1.25rem);   /* 12px → 20px  */
  --space-md:  clamp(1.25rem, 3vw,   2.25rem);   /* 20px → 36px  */
  --space-lg:  clamp(2.25rem, 5vw,   3.75rem);   /* 36px → 60px  */
  --space-xl:  clamp(3.75rem, 7vw,   6.25rem);   /* 60px → 100px */
  --space-2xl: clamp(5rem,    10vw,  8.75rem);   /* 80px → 140px */

  /* ── ESCALA TIPOGRÁFICA ─────────────────────────────────────────
     Mínimo 0.95rem. De menor a mayor: párrafo → autor → título → subtítulo.
     Modificar aquí afecta de forma global a todo el sitio. */
  --fs-para:  0.95rem;  /* Párrafos, cuerpo de texto, formularios         */
  --fs-autor: 1.10rem;  /* Nombres de autor en tarjetas y modales          */
  --fs-titulo: 1.10rem; /* Títulos de libro en tarjetas y modales          */
  --fs-sub:    1.30rem; /* Subtítulos, nombres de saga, labels de carousel */

  /* ── TARJETAS — control único de tamaño ────────────────────────
     --lib-card-w: ancho base de TODAS las portadas del sitio.
     Biblioteca, sagas, SRM, novedades — todas usan esta variable.
     Mitad del tamaño anterior (≈330px → 160px). */
  --lib-card-w:   clamp(130px, 13vw, 160px);

  --card-w:   clamp(55px, 7vw, 90px);

  /* Tipografía de tarjeta — escala con --lib-card-w */
  --card-fs-title:  clamp(0.72rem, 1.2vw, 0.85rem);
  --card-fs-author: clamp(0.65rem, 1.0vw, 0.76rem);
  --card-fs-badge:  clamp(0.55rem, 0.9vw, 0.65rem);
  --card-icon-size: clamp(24px, 3.5vw, 36px);
  --card-hover-fs:  clamp(0.75rem, 1.5vw, 1.10rem);
}

/* Box-sizing global, sin márgenes ni paddings por defecto */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: clip; }

/* ════════════════════════════════════════════════════════════════
   NOTA: se eliminó una regla que subía el font-size de <html> por
   cada breakpoint móvil (16px→21px). Como casi todo el sitio ya usa
   clamp() con unidades vw para escalar tipografía y espaciado de
   forma fluida, esa capa adicional se sumaba encima y producía un
   doble escalado impredecible: según el ancho exacto del viewport,
   el resultado se veía demasiado grande en algunos dispositivos y
   demasiado pequeño en otros. Ahora <html> se queda en el 16px por
   defecto del navegador y todo el escalado responsive lo controla
   directamente el sistema clamp()/vw ya presente en --space-*,
   --fs-*, --card-fs-*, etc.
════════════════════════════════════════════════════════════════ */

body {
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Libre Baskerville', serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: clip; /* evita scroll horizontal sin romper position:sticky */
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* Scrollbar global con acento naranja */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-muted); }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 3px; }

/* ── Clases de tipografía reutilizables ── */
.t-title  { font-family: 'Playfair Display', serif; font-weight: 900; letter-spacing: -0.02em; }
.t-quote  { font-family: 'Caveat', cursive; font-size: 2rem; }
.t-author { font-family: 'IM Fell English', serif; font-style: italic; letter-spacing: 0.12em; }
.t-body   { font-family: 'Libre Baskerville', serif; line-height: 1.65; }

/* Texto con degradado azul→naranja */
.grad-text {
  background: linear-gradient(90deg, var(--blue-light), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Botones generales ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: 50px;
  font-family: 'Libre Baskerville', serif; font-size: 0.95rem; font-weight: 700;
  transition: var(--transition); white-space: nowrap;
}
.btn-outline { border: 2px solid var(--border-strong); color: var(--text-primary); background: transparent; }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); background: rgba(240,120,0,0.05); }
.btn-primary { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; box-shadow: var(--shadow-orange); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-orange-hover); }
.btn-blue { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; box-shadow: var(--shadow-blue); }
.btn-blue:hover { transform: translateY(-2px); box-shadow: var(--shadow-blue); }

/* Contenedor centrado con padding lateral */
.container { max-width: 1400px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

/* Etiqueta de sección (ej: "✦ Selección Editorial") */
.section-label {
  display: inline-block;
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: 0.88rem; letter-spacing: 0.2em; color: var(--orange);
  text-transform: uppercase; margin-bottom: 12px;
}
/* Título de sección principal */
.section-title {
  font-family: 'Playfair Display', serif; font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 3.8rem); letter-spacing: -0.02em;
  line-height: 1.1; color: var(--text-primary); margin-bottom: 16px;
}
/* Divisor decorativo naranja-azul */
.divider {
  width: 60px; height: 4px;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  border-radius: 2px; margin-bottom: 24px;
}

/* Animación de entrada deslizante desde abajo */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}


#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  background: rgba(255,255,255,0.96); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  box-shadow: var(--shadow-xs);
}
.header-inner { width: 100%; display: flex; align-items: center; gap: 20px; padding: 0 clamp(1rem, 3vw, 1.75rem); }
.header-logo  { display: flex; align-items: center; flex-shrink: 0; }
.header-logo img { height: 100px; width: auto; display: block; }
.logo-fallback { display: flex; align-items: center; gap: 10px; }
.logo-fallback-icon { font-size: 2.4rem; line-height: 1; }

/* Campo de búsqueda del header */
.header-search { flex: 1; max-width: 520px; position: relative; margin: 0 20px; }
.header-search input {
  width: 100%; padding: 11px 50px 11px 20px;
  background: var(--bg-muted); border: 1.5px solid var(--border);
  border-radius: 50px; color: var(--text-primary);
  font-family: 'Libre Baskerville', serif; font-size: 0.9rem;
  transition: var(--transition); outline: none;
}
.header-search input:focus {
  border-color: var(--orange); background: #fff;
  box-shadow: var(--shadow-focus-orange);
}
.header-search input::placeholder { color: var(--text-muted); }
.search-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.search-btn:hover { transform: translateY(-50%) scale(1.1); }
.search-btn svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; }

/* Búsqueda avanzada (legacy, mantenida por compatibilidad) */
.search-advanced { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: none; z-index: 100; box-shadow: var(--shadow-md); }
.search-advanced.show { display: block; }
.search-adv-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.search-adv-grid select, .search-adv-grid input { padding: 9px 14px; background: var(--bg-muted); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 0.84rem; outline: none; transition: var(--transition); }
.search-adv-grid select option { background: #fff; color: var(--text-primary); }
.search-adv-grid select:focus, .search-adv-grid input:focus { border-color: var(--orange); background: #fff; }
.adv-search-label { font-size: 0.78rem; color: var(--orange); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; font-family: 'IM Fell English', serif; font-style: italic; }

/* Navegación principal */
.header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link { padding: 8px 14px; border-radius: 50px; font-size: 0.9rem; color: var(--text-secondary); transition: var(--transition); white-space: nowrap; }
.nav-link:hover { color: #fff; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); box-shadow: var(--shadow-orange); transform: translateY(-1px); }

/* Hamburger para móvil */
.hamburger { display: none; flex-direction: column; gap: 5px; width: 34px; padding: 4px; cursor: pointer; }
.hamburger span { display: block; height: 2px; border-radius: 1px; background: var(--text-primary); transition: transform 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease; transform-origin: center; }

/* Animación → X cuando el menú está abierto */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menú móvil desplegable desde la derecha */
#mobile-menu {
  position: fixed; top: var(--header-h); right: 0; bottom: 0; z-index: 999;
  background: rgba(255,255,255,0.98); backdrop-filter: blur(20px);
  border-left: 1px solid var(--border); padding: 24px 20px;
  display: flex; flex-direction: column; gap: 8px;
  width: fit-content; min-width: 240px;
  transform: translateX(110%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto; box-shadow: var(--shadow-md);
}
#mobile-menu.open { transform: translateX(0); }
.mob-nav-link { display: block; padding: 12px 16px; border-radius: 10px; font-size: 0.95rem; color: var(--text-secondary); transition: var(--transition); }
.mob-nav-link:hover { color: var(--orange); background: rgba(240,120,0,0.06); }


/* ── SECCIÓN HERO ───────────────────────────────────────────────────────
   z-index:10 e isolation:isolate son CRÍTICOS:
   - Impiden que elementos de las secciones siguientes se pinten
     por encima del hero mientras JS carga los datos.
   - El modal overlay también tiene display:none inline en el HTML por
     el mismo motivo; ver comentario en index.html junto a #modal-overlay.
   NO reducir z-index por debajo de 2 sin revisar toda la pila de capas. */
#hero {
  position: relative; overflow: hidden;
  /* 100svh excluye la barra del navegador en móvil (Safari iOS, Chrome Android).
     Fallback: 100dvh (unidades dinámicas, amplio soporte 2023+) → 100vh (legacy). */
  height: calc(100vh - var(--header-h));           /* fallback legacy */
  height: calc(100dvh - var(--header-h));          /* fallback dinámico */
  min-height: calc(100svh - var(--header-h));      /* ← valor real en móvil */
  margin-top: var(--header-h);
  display: flex; align-items: center; justify-content: center;
  background: #111;
  /* z-index: 10 — superior al resto de secciones para que
     el hero tape cualquier elemento de la sección siguiente que
     intente pintarse por encima durante la carga */
  z-index: 10;
  isolation: isolate;
}
.hero-video-wrap { position: absolute; inset: 0; z-index: 0; }
.hero-video-wrap video { width: 100%; height: 100%; object-fit: cover; opacity: 0.5; }
.hero-overlay { position: absolute; inset: 0; z-index: 1; background: linear-gradient(135deg, rgba(0,0,0,0.55) 0%, rgba(13,77,153,0.3) 50%, rgba(200,94,0,0.25) 100%); }
.hero-content { position: relative; z-index: 2; text-align: center; max-width: 900px; padding: 0 clamp(1rem, 4vw, 2rem); color: #fff; }
.hero-eyebrow { font-family: 'IM Fell English', serif; font-style: italic; letter-spacing: 0.25em; font-size: 0.95rem; color: rgba(255,200,100,0.95); text-transform: uppercase; margin-bottom: clamp(0.75rem, 2vw, 1.5rem); animation: fadeUp 0.8s ease both; }
.hero-title { font-family: 'Playfair Display', serif; font-weight: 900; font-size: clamp(2.8rem, 8vw, 6rem); letter-spacing: -0.02em; line-height: 1.05; margin-bottom: clamp(1rem, 2.5vw, 1.75rem); color: #fff; animation: fadeUp 0.8s ease 0.15s both; }
.hero-title .grad-text { background: linear-gradient(90deg, #ffb347, #ff6b35); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-subtitle { font-size: clamp(1rem, 2vw, 1.2rem); color: rgba(255,255,255,0.85); max-width: 680px; margin: 0 auto clamp(1.5rem, 3vw, 2.5rem); animation: fadeUp 0.8s ease 0.3s both; }
.hero-cta { display: flex; gap: clamp(0.6rem, 1.5vw, 1rem); justify-content: center; flex-wrap: wrap; animation: fadeUp 0.8s ease 0.45s both; }
.hero-cta .btn-outline { border-color: rgba(255,255,255,0.6); color: #fff; }
.hero-cta .btn-outline:hover { border-color: #fff; background: rgba(255,255,255,0.15); color: #fff; }
.hero-stats { display: flex; gap: clamp(1.25rem, 4vw, 2.5rem); justify-content: center; margin-top: clamp(2rem, 5vw, 3.75rem); animation: fadeUp 0.8s ease 0.6s both; }
.hero-stat { text-align: center; }
.hero-stat-num { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 2.2rem; color: #ffb347; display: block; }
.hero-stat-label { font-size: 0.8rem; color: rgba(255,255,255,0.7); letter-spacing: 0.1em; text-transform: uppercase; }

#biblioteca {
  padding-top: 0;
}

.biblioteca-sticky-header {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(248,245,240,0.97);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: clamp(1rem, 2.5vw, 1.75rem) 0 clamp(0.6rem, 1.2vw, 1rem);
  box-shadow: var(--shadow-xs);
}

.biblioteca-sticky-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  flex-wrap: wrap;
}

.biblioteca-sticky-text .section-label { margin-bottom: 6px; }
.biblioteca-sticky-text .section-title { margin-bottom: 10px; }
.biblioteca-sticky-text .divider       { margin-bottom: 0; }

.biblioteca-sticky-actions {
  display: flex;
  align-items: center;
  padding-bottom: 4px; /* alinear con la linea divisora */
}

/* En movil el header sticky ocupa todo el ancho */
@media(max-width:768px) {
  .biblioteca-sticky-inner  { flex-direction: column; align-items: flex-start; gap: 12px; }
  .biblioteca-sticky-header { padding: 16px 0 12px; }
  .biblioteca-sticky-text .section-title { font-size: clamp(1.5rem, 6vw, 2.2rem); }
}


#biblioteca {
  background: var(--bg-section);
  position: relative;
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 3.75rem);
}
#biblioteca > .container { padding-bottom: 0; }


.biblioteca-carouseles-wrap {
  padding: clamp(1rem, 2.5vw, 1.75rem) 0 clamp(2rem, 5vw, 3.75rem);
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

/* (toolbar/counter are now in the sticky header via initLibraryToggle) */
.bib-genre-chip {
  padding: 5px 14px;
  border-radius: 50px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.bib-genre-chip:hover,
.bib-genre-chip.active {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(240,120,0,0.06);
}

/* ══════════════════════════════════════════════════════════════
   BIBLIOTECA — Grid de tarjetas verticales, tamaño unificado
   auto-fill con --lib-card-w para coherencia con sagas y SRM
   ══════════════════════════════════════════════════════════════ */
.bib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--lib-card-w), 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.1rem);
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}
.bib-loading-more {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--text-muted);
  background: transparent;
}
.bib-sentinel { grid-column: 1 / -1; height: 1px; }

/* ── Tarjeta vertical de libro ── */
.lib-book {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease,
              opacity 0.4s ease;
  opacity: 0;
  box-shadow: var(--shadow);
}
.lib-book.visible  { opacity: 1; }
.lib-book:hover    {
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
  border-color: rgba(240,120,0,0.3);
}

/* ── Portada: ratio 2:3, ocupa el ancho completo de la tarjeta ── */
.lib-book-cover-wrap {
  flex-shrink: 0;
  width: 100%;
  padding-top: 148%;          /* ratio 2:3 */
  border-radius: 0;
  overflow: hidden;
  background: #f0ece4;
  position: relative;
  box-shadow: none;
  transition: none;
}
.lib-book:hover .lib-book-cover-wrap { transform: none; box-shadow: none; }

.lib-book-cover-wrap .lib-book-cover,
.lib-book-cover {
  position: absolute !important; inset: 0 !important;
  width: 100% !important; height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  display: block !important; visibility: visible !important; opacity: 1 !important;
  transition: transform 0.35s ease;
}
.lib-book:hover .lib-book-cover { transform: scale(1.04); }

.lib-book-cover-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 3rem;
  background: linear-gradient(135deg, #1a2535, #2d3f55);
}

/* Overlay hover sobre portada */
.lib-book-hover-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  border-radius: 0;
}
.lib-book:hover .lib-book-hover-overlay { opacity: 1; }
.lib-hover-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.lib-hover-icon svg {
  width: 18px; height: 18px;
  stroke: #fff; fill: none; stroke-width: 2;
}
.lib-hover-btn { display: none; }

/* Etiqueta de género única, fija sobre la portada (siempre visible).
   max-width + ellipsis evita que un nombre de género largo (p.ej.
   "Vinos, Guías Enológicas") se salga del ancho de la tarjeta e
   invada la tarjeta vecina. */
.lib-book-tag-primary {
  align-self: flex-start;
  margin: 7px 8px 0 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Resto de géneros: solo visibles junto al icono al hacer hover */
.lib-book-tags-hover {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 85%;
  padding: 0 6px;
}
.lib-book-tags-hover .lib-book-tag {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
  backdrop-filter: blur(2px);
}


/* ── Cuerpo de la tarjeta: título + autor + tags ── */
.lib-book-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: clamp(0.5rem, 1vw, 0.75rem);
  background: transparent;
  position: relative;
}
.lib-book-body:hover { background: transparent; }
.lib-book-body::after { display: none; }

.lib-book-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: var(--card-fs-title);
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-book-author {
  font-family: 'IM Fell English', serif !important;
  font-style: italic !important;
  font-size: var(--card-fs-author) !important;
  color: var(--orange) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block !important;
}

/* Tags de género */
.lib-book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.lib-book-tag {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 50px;
  background: rgba(240,120,0,0.08);
  color: var(--orange);
  border: 1px solid rgba(240,120,0,0.2);
  white-space: nowrap;
}

/* Rating */
.lib-book-rating {
  display: flex; align-items: center; gap: 4px; margin-top: 4px;
}
.lib-book-stars   { font-size: 0.65rem; color: var(--orange); letter-spacing: 1px; }
.lib-book-rating-num {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.68rem; color: var(--text-muted);
}

/* Flecha — oculta en layout vertical (redundante con hover de portada) */
.lib-book-arrow { display: none; }

/* Separador de género en el grid */
.bib-genre-section-label {
  grid-column: 1 / -1;
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: var(--fs-sub);
  letter-spacing: -0.01em;
  color: var(--text-primary);
  padding: 28px 0 10px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
}
.bib-genre-section-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.bib-genre-section-sub {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: var(--fs-autor);
  color: var(--orange);
  letter-spacing: 0.03em;
  font-weight: 400;
}

/* ── Responsive biblioteca ── */
@media (max-width: 1200px) {
  :root { --lib-card-w: clamp(120px, 14vw, 150px); }
  .biblioteca-carouseles-wrap { width: 94%; }
}
@media (max-width: 900px) {
  :root { --lib-card-w: clamp(110px, 18vw, 140px); }
  .biblioteca-carouseles-wrap { width: 96%; }
  .bib-genre-filters { display: none; }
}
@media (max-width: 680px) {
  :root { --lib-card-w: clamp(100px, 28vw, 130px); }
  .lib-book-tags { display: none; }
}
@media (max-width: 500px) {
  :root { --lib-card-w: clamp(90px, 44vw, 110px); }
  .lib-book-author { font-size: var(--card-fs-badge) !important; }
}

.genre-carousel { margin-bottom: 48px; width: 100%; }
.carousel-empty {
  padding: 24px 0; font-family: 'Caveat', cursive;
  font-size: 1.15rem; color: var(--text-muted); text-align: center;
}

#nosotros {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  background: var(--bg-main);
  display: flex; align-items: center;
  padding: clamp(2.5rem, 7vw, 5rem) 0; position: relative; overflow: hidden;
}
#nosotros::before { content: ''; position: absolute; bottom: -300px; right: -300px; width: 700px; height: 700px; border-radius: 50%; background: radial-gradient(circle, rgba(240,120,0,0.05), transparent 70%); pointer-events: none; }
.nosotros-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.nosotros-visual { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(1rem, 2.5vw, 1.75rem); }
.nosotros-text p { color: var(--text-secondary); margin-bottom: 16px; font-size: var(--fs-para); }



#sagas {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 3.75rem);
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  position: relative;
}

.sagas-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(0.75rem, 2vw, 1rem);
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
  flex-wrap: wrap;
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}
.sagas-head-text .section-title { margin-bottom: 10px; }
.sagas-head-text .divider        { margin-bottom: 0; }

.sagas-collection-counter {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: var(--orange);
  padding: 4px 16px;
  border: 1px solid rgba(240,120,0,0.35);
  border-radius: 50px;
  background: rgba(240,120,0,0.06);
  white-space: nowrap;
  align-self: center;
}

/* ═══════════════════════════════════════════════════
   OPCIÓN C — SAGAS: filas con scroll horizontal
   Cada saga = fila. Info a la izquierda, portadas
   deslizan a la derecha con scroll snap suave.
   ═══════════════════════════════════════════════════ */

/* Chip de saga = mismo ancho que portada de biblioteca */
:root { --saga-chip-w: var(--lib-card-w); }

/* Mensaje de carga */
.sagas-loading {
  text-align: center;
  padding: 60px 20px;
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--text-muted);
}

/* Lista: columna de filas */
.sagas-list {
  width: 90%;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Fila de saga ── */
.saga-card-block {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
  overflow: hidden;
  position: relative;
}
.saga-card-block:first-child { border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; }
.saga-card-block:last-child  { border-radius: 0 0 16px 16px; }
.saga-card-block:first-child:last-child { border-radius: 16px; }
.saga-card-block:hover { background: var(--bg-section); }

/* ── Columna izquierda: info de la saga ── */
.saga-card-header {
  flex-shrink: 0;
  width: clamp(160px, 22vw, 260px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: clamp(0.875rem, 2vw, 1.25rem) clamp(0.875rem, 2vw, 1.25rem);
  border-right: 1px solid var(--border);
}

/* Oculto: thumbnail en header */
.saga-card-thumb { display: none; }

.saga-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.saga-card-name {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(0.9rem, 1.5vw, 1.15rem);
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.saga-card-meta {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: clamp(0.75rem, 1.1vw, 0.88rem);
  color: var(--orange);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grupo de badges (vol + estado) */
.saga-badge-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Badge estado */
.saga-state-badge {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 50px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.saga-state-badge.completa {
  background: rgba(13,77,153,0.12);
  color: var(--blue);
  border: 1px solid rgba(13,77,153,0.25);
}
.saga-state-badge.incompleta {
  background: rgba(240,120,0,0.1);
  color: var(--orange);
  border: 1px solid rgba(240,120,0,0.3);
}
.saga-state-badge.standalone {
  background: rgba(22,163,74,0.1);
  color: #16a34a;
  border: 1px solid rgba(22,163,74,0.3);
}
.saga-card-block > .saga-state-badge.standalone { display: none; }

/* Badge volúmenes */
.saga-vol-badge {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 50px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

/* ── Columna derecha: portadas — todas visibles con wrap ── */
.saga-card-strip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;              /* todas las portadas visibles sin scroll */
  align-items: flex-start;
  align-content: flex-start;
  gap: clamp(8px, 1.2vw, 14px);
  padding: clamp(0.875rem, 2vw, 1.25rem);
  overflow: visible;
  background: transparent;
  position: relative;
}

/* Carousel (clase dejada por compatibilidad JS — sin efecto visual en desktop) */
.saga-card-strip.is-carousel { overflow: visible; }
.saga-card-strip.is-carousel.at-end { }

/* Chip individual */
.saga-book-chip {
  flex-shrink: 0;
  width: var(--saga-chip-w);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  scroll-snap-align: start;
  transition: transform 0.18s ease;
}
.saga-book-chip:hover { transform: translateY(-4px); }

.saga-chip-img-wrap {
  position: relative;
  width: var(--saga-chip-w);
  padding-top: calc(var(--saga-chip-w) * 1.44);
  border-radius: 7px;
  overflow: hidden;
  background: #1a2535;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.saga-book-chip:hover .saga-chip-img-wrap {
  box-shadow: var(--shadow-md);
}
.saga-chip-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 7px;
  transition: transform 0.3s ease;
}
.saga-book-chip:hover .saga-chip-img-wrap img { transform: scale(1.04); }

/* Hover overlay */
.saga-chip-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 4;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.saga-book-chip:hover .saga-chip-hover-overlay { opacity: 1; pointer-events: all; }

.saga-chip-hover-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  display: flex; align-items: center; justify-content: center;
}
.saga-chip-hover-icon svg {
  width: 13px; height: 13px;
  stroke: #fff; fill: none; stroke-width: 2;
}
.saga-chip-hover-text {
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
  color: #fff;
  pointer-events: none;
}

/* Número vol. */
.saga-chip-num {
  position: absolute;
  top: 4px; left: 4px;
  z-index: 5;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Badge independiente */
.saga-chip-standalone {
  position: absolute;
  bottom: 4px; right: 4px;
  z-index: 5;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
}

/* Placeholder sin portada */
.saga-chip-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: linear-gradient(135deg, #1a2535, #2d3f55);
  border-radius: 7px;
}

/* Título del libro bajo la portada */
.saga-chip-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  margin: 0;
}

/* ── Responsive sagas ── */
@media (max-width: 1100px) {
  .sagas-head, .sagas-list { width: 94%; }
}
@media (max-width: 768px) {
  #sagas { padding: clamp(1.75rem, 5vw, 2.5rem) 0 clamp(1.25rem, 3vw, 2rem); }
  .sagas-head, .sagas-list { width: 96%; }
  .saga-card-header {
    width: clamp(110px, 30vw, 150px);
    padding: 0.75rem;
  }
  .saga-card-name  { font-size: 0.85rem; }
  .saga-card-meta  { display: none; }
  .saga-badge-group { display: none; }
}
@media (max-width: 560px) {
  .saga-card-block  { flex-direction: column; }
  .saga-card-header {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.625rem 0.875rem;
  }
  .saga-card-meta   { display: block; }
  .saga-badge-group { display: flex; }
  .saga-card-strip  { padding: 0.75rem; }
}




#contacto { min-height: calc(100vh - var(--header-h)); min-height: calc(100dvh - var(--header-h)); min-height: calc(100svh - var(--header-h)); background: var(--bg-main); display: flex; align-items: center; padding: clamp(2.5rem, 7vw, 5rem) 0; position: relative; overflow: visible; border-top: 1px solid var(--border); }
.contacto-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.contacto-info p { color: var(--text-secondary); margin-bottom: clamp(1.25rem, 3vw, 2rem); font-size: var(--fs-para); }
.contact-items { display: flex; flex-direction: column; gap: clamp(0.75rem, 1.5vw, 1rem); }
.contact-item { display: flex; align-items: center; gap: clamp(0.75rem, 1.5vw, 0.875rem); padding: clamp(0.75rem, 1.5vw, 1rem); border-radius: 12px; background: var(--bg-section); border: 1px solid var(--border); }
.contact-item-icon { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(240,120,0,0.08); font-size: 1.2rem; }
.contact-item-title { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; letter-spacing: 0.05em; text-transform: uppercase; }
.contact-item-val { font-size: 0.95rem; color: var(--text-primary); }

/* Formulario de contacto */
.contact-form { display: flex; flex-direction: column; gap: clamp(0.875rem, 2vw, 1.125rem); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.82rem; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }
.form-group input, .form-group textarea, .form-group select { padding: clamp(0.75rem, 1.5vw, 0.875rem) clamp(0.875rem, 2vw, 1.125rem); background: var(--bg-muted); border: 1.5px solid var(--border); border-radius: 12px; color: var(--text-primary); font-family: 'Libre Baskerville', serif; font-size: var(--fs-para); transition: var(--transition); outline: none; resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--orange); background: #fff; box-shadow: var(--shadow-focus-orange); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-group select option { background: #fff; color: var(--text-primary); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(0.875rem, 2vw, 1.125rem); }


#footer { background: var(--bg-section); border-top: 1px solid var(--border); padding: clamp(2rem, 5vw, 3.75rem) 0 clamp(1rem, 2.5vw, 1.875rem); }
/* 3 columnas: brand (ancha) + bloque combinado Navegar+Legal */
.footer-main {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
}
/* La columna combinada ocupa 2 celdas del grid y divide su contenido en 2 subcolumnas */
.footer-col-combined {
  grid-column: 2 / 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2.5vw, 2rem);
}
.footer-brand p { color: var(--text-muted); font-size: 0.9rem; max-width: 280px; margin: 16px 0 24px; line-height: 1.7; }
.footer-socials { display: flex; gap: 10px; }
.social-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1rem; transition: var(--transition); cursor: pointer; background: #fff; }
.social-btn:hover { border-color: var(--orange); color: var(--orange); background: rgba(240,120,0,0.06); }
.footer-col h4 { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1rem; margin-bottom: 16px; color: var(--text-primary); }
.footer-col-combined h4 { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1rem; margin-bottom: 16px; color: var(--text-primary); }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links li a { font-size: 0.88rem; color: var(--text-muted); transition: var(--transition); }
.footer-links li a:hover { color: var(--orange); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-bottom p { font-size: 0.82rem; color: var(--text-muted); }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { font-size: 0.82rem; color: var(--text-muted); transition: var(--transition); }
.footer-legal a:hover { color: var(--orange); }
.footer-logo-img { height: 100px; width: auto; }


/* ── OVERLAY DEL MODAL DE LIBRO ────────────────────────────────────────
   BUG HISTORY: este overlay aparecía visible sobre el hero en la carga
   inicial porque solo tenía display:none en CSS, que se aplica después
   de que el navegador ya ha pintado el DOM.
   SOLUCIÓN: se añadió style="display:none" inline en el HTML (index.html)
   y las funciones openBookModal / closeModal en javas.js sincronizan el
   inline style junto con la clase .open.
   ── CAMBIOS DE DISEÑO ──
   • z-index: 2000 → debe quedar por encima de biblioteca (z-index:90)
     y del header (z-index:1000)
   • backdrop-filter: blur(10px) → suavizar para rendimiento en móvil
   • padding: 20px → margen con el borde de pantalla en móvil           */
#modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; padding: clamp(0.75rem, 2vw, 1.25rem);
  overflow: hidden; scrollbar-width: none;
}
#modal-overlay::-webkit-scrollbar { display: none; }
/* Nota: .open también pone display:flex — pero openBookModal()
   establece el inline style directamente para sobreescribir el
   display:none inline del HTML. Ver javas.js → openBookModal(). */
#modal-overlay.open { display: flex; }

/* Animación de apertura del modal */
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(14px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Modal de libro individual ── */
.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 720px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
  /* El modal NO hace scroll — su alto está fijado por max-height.
     El scroll ocurre dentro de .modal-content (columna derecha). */
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;   /* corta todo lo que salga del borde redondeado */
}
.modal::-webkit-scrollbar { display: none; }

/* Grid: portada izquierda fija + columna derecha con scroll.
   height: 100% fuerza al grid a llenar exactamente el alto del .modal,
   evitando que la columna de contenido desborde hacia afuera. */
.modal-inner {
  display: grid;
  grid-template-columns: clamp(180px, 25vw, 260px) 1fr;
  flex: 1;          /* ocupa todo el alto disponible dentro de .modal  */
  min-height: 0;    /* permite que el flex-item se encoja              */
  overflow: hidden; /* contiene cualquier desbordamiento de los hijos  */
}

/* Portada — se estira para igualar el alto de la columna derecha */
#modal-cover-wrap {
  position: relative;
  border-radius: 20px 0 0 20px;
  overflow: hidden;
  background: #0d1520;
  /* align-self:stretch es el default en grid — explícito por claridad */
  align-self: stretch;
}
#modal-cover-wrap img.modal-cover {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center top !important;
  display: block !important;
}
.modal-cover-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #1a2535, #2d3f55);
}

/* Columna derecha — contiene todos los textos y botones.
   overflow-y:auto + min-height:0 son las claves:
   el contenido hace scroll dentro de la columna sin desbordarse
   sobre la portada de la izquierda. */
.modal-content {
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 2.5vw, 1.375rem) clamp(1rem, 2.5vw, 1.625rem);
  min-width: 0;
  min-height: 0;      /* permite que el flex-item se encoja          */
  overflow-y: auto;   /* scroll interno — nunca desborda al exterior  */
  overscroll-behavior: contain;
  gap: 0;
  position: relative;
}

/* Botón cerrar — esquina superior derecha */
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.72rem;
  background: rgba(255,255,255,0.9);
  flex-shrink: 0;
  z-index: 2;
}
.modal-close:hover { border-color: var(--orange); color: var(--orange); }

/* 1. Título del modal — aumentado de 1.25rem a 1.45rem */
.modal-title {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
  margin-top: 2px;
  padding-right: 32px; /* espacio para el botón cerrar */
  color: var(--text-primary);
  flex-shrink: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* 2. Autor del modal — aumentado de 1.0rem a 1.15rem */
.modal-author {
  font-family: 'IM Fell English', serif !important;
  font-style: italic !important;
  color: #f07800 !important;
  font-size: 1.15rem !important;
  margin-bottom: 16px;
  flex-shrink: 0;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* Badges de metadatos (ocultos visualmente, mantienen estructura) */
.modal-meta { display: none !important; }
.modal-badge { padding: 2px 8px; border-radius: 50px; font-size: 0.60rem; background: rgba(26,111,204,0.08); border: 1px solid rgba(26,111,204,0.2); color: var(--blue); }

/* 3. Sinopsis: crece y tiene scroll si necesita */
.modal-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.65;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--orange) transparent;
  flex: 1;
  min-height: 0;
  margin-bottom: 18px;
  padding-right: 4px;
  max-height: none; /* crece para ocupar el espacio disponible */
}
.modal-desc::-webkit-scrollbar { width: 3px; }
.modal-desc::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 2px; }

/* 4. Formatos disponibles — pequeños chips inline */
.modal-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex-shrink: 0;
  margin-bottom: 20px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.modal-formats-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: 'IM Fell English', serif;
  font-style: italic;
  margin-right: 3px;
  flex-shrink: 0;
}
.modal-format-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.66rem;
  font-weight: 700;
  font-family: 'Libre Baskerville', serif;
  background: rgba(26,111,204,0.07);
  border: 1px solid rgba(26,111,204,0.22);
  color: var(--blue);
  letter-spacing: 0.04em;
}

/* 5. Botones de acción — compactos, sin estirar */
.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 8px;
}

/* Compatibilidad retroactiva: .btn dentro de .modal-actions */
.modal-actions .btn {
  flex: 0 0 auto;
  padding: 7px 16px;
  font-size: 0.82rem;
  justify-content: center;
  white-space: nowrap;
}

/* Tamaño reducido para los botones Descargar / Leer Online del modal.
   Más pequeños que el .btn estándar: padding e icono menores. */
.modal-actions .btn.modal-action-sm {
  padding: 5px 13px;
  font-size: 0.76rem;
  gap: 5px;
}
.modal-actions .btn.modal-action-sm svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ── Responsive del modal de libro ──
   ≤ 680px → portada como miniatura vertical centrada (mismo ratio 2:3
   que la imagen real), contenido debajo con scroll.
   Antes la portada era una banda ancha y baja (100% de ancho × 200px)
   con object-fit:cover — al forzar una imagen vertical dentro de una
   caja horizontal, el navegador recorta casi toda la portada y solo
   deja ver una tira del fondo (a menudo un color liso sin el título
   ni la ilustración). Con aspect-ratio:2/3 la caja tiene la misma
   forma que la imagen, así que se ve la portada completa. */
@media (max-width: 680px) {
  .modal {
    max-width: 100%;
    border-radius: 18px;
    max-height: 94vh;
  }
  .modal-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  #modal-cover-wrap {
    border-radius: 12px;
    align-self: auto;
    width: 130px;
    aspect-ratio: 2 / 3;
    height: auto;
    margin: 20px auto 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  }
  .modal-content {
    padding: 14px 16px 16px;
  }
  .modal-title  { font-size: 1.1rem; padding-right: 30px; }
  .modal-desc   { max-height: none; }
  .modal-actions { gap: 8px; margin-top: 12px; }
  .modal-actions .modal-action-btn { padding: 9px 12px; font-size: 0.82rem; gap: 5px; }
}

@media (max-width: 560px) {
  #modal-cover-wrap { width: 110px; }
  .modal-actions              { flex-direction: column; }
  .modal-actions .modal-action-btn { flex: none; width: 100%; }
}

/* Barra de pestañas de saga dentro del modal de libro */
.modal-saga-section { margin-bottom: 16px; }
.modal-saga-label { font-size: 0.62rem; color: var(--orange); font-family: 'IM Fell English', serif; font-style: italic; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 5px; display: block; }
.modal-saga-tabs { display: flex; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; scrollbar-width: none; }
.modal-saga-tabs::-webkit-scrollbar { display: none; }
.modal-saga-tab { flex-shrink: 0; padding: 6px 10px; font-size: 0.68rem; color: var(--text-muted); border-right: 1px solid var(--border); border-bottom: 2px solid transparent; cursor: pointer; transition: var(--transition); white-space: nowrap; font-family: 'Libre Baskerville', serif; background: transparent; }
.modal-saga-tab:last-child { border-right: none; }
.modal-saga-tab.active { color: var(--orange); border-bottom-color: var(--orange); background: rgba(240,120,0,0.05); }
.modal-saga-tab:hover { color: var(--orange); background: rgba(240,120,0,0.04); }

/* ── Overlay del modal de saga ── */
#saga-modal-overlay {
  position: fixed; inset: 0; z-index: 2100;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; padding: clamp(0.75rem, 2vw, 1.25rem);
  overflow: hidden;
}
#saga-modal-overlay.open { display: flex; overscroll-behavior: contain; }

/* Modal de saga */
.saga-modal { background: #fff; border: 1px solid var(--border); border-radius: 20px; max-width: min(560px, 96vw); width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-xl); animation: modalIn 0.3s ease; }

/* Barra de pestañas del saga-modal (oculta cuando se usa nav-link) */
.saga-modal-tabs-bar { display: flex; overflow-x: auto; border-bottom: 2px solid var(--border); scrollbar-width: none; flex-shrink: 0; background: var(--bg-muted); border-radius: 20px 20px 0 0; }
.saga-modal-tabs-bar::-webkit-scrollbar { display: none; }
.saga-modal-tab { flex-shrink: 0; padding: 9px 13px; font-size: 0.79rem; color: var(--text-muted); border-bottom: 3px solid transparent; cursor: pointer; transition: var(--transition); white-space: nowrap; font-family: 'Libre Baskerville', serif; background: transparent; border-right: 1px solid var(--border); }
.saga-modal-tab:last-child { border-right: none; }
.saga-modal-tab.active { color: var(--orange); border-bottom-color: var(--orange); background: rgba(240,120,0,0.07); }
.saga-modal-tab:hover { color: var(--orange); background: rgba(240,120,0,0.04); }

/* Panel del libro activo en el saga-modal
   Layout y dimensiones se controlan en sección 16 (más abajo) */
.saga-modal-body { display: none; }
.saga-modal-body.active { display: flex; }

/* Portada en el saga-modal — misma técnica que #modal-cover-wrap:
   object-fit:cover + object-position:center top para llenar sin franjas. */
.saga-modal-cover-wrap { overflow: hidden; background: #1a2535; align-self: stretch; }
.saga-modal-cover-wrap img { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; object-fit: cover !important; object-position: center top !important; display: block !important; }
.saga-modal-cover-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 4rem; }

/* Contenido derecho del saga-modal */
.saga-modal-content { padding: 12px 16px 16px; display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* Botón cerrar del saga-modal */
.saga-modal-close { position: absolute; top: 8px; right: 10px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); font-size: 0.85rem; background: rgba(255,255,255,0.92); flex-shrink: 0; z-index: 2; }
.saga-modal-close:hover { border-color: var(--orange); color: var(--orange); }

/* Textos del saga-modal — título y autor aumentados */
.saga-modal-num { font-size: 1.05rem; color: var(--orange); font-family: 'IM Fell English', serif; font-style: italic; margin-bottom: 2px; padding-right: 32px; }
.saga-modal-title { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 1.45rem; letter-spacing: -0.02em; line-height: 1.18; margin-bottom: 4px; color: var(--text-primary); }
.saga-modal-author { font-family: 'IM Fell English', serif !important; font-style: italic !important; color: #f07800 !important; font-size: 1.15rem !important; margin-bottom: 8px; }
.saga-modal-meta { display: none !important; }

/* Sinopsis del saga-modal */
.saga-modal-desc { color: var(--text-secondary); font-size: var(--fs-para); line-height: 1.75; margin-bottom: 10px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; flex: 1; min-height: 0; max-height: 200px; }
.saga-modal-desc::-webkit-scrollbar { display: none; }

/* Enlace de navegación al siguiente libro */
.saga-modal-nav-link { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 12px; font-size: 0.82rem; color: var(--blue); cursor: pointer; font-family: 'Libre Baskerville', serif; transition: var(--transition); background: none; border: none; padding: 0; text-align: left; flex-shrink: 0; }
.saga-modal-nav-link:hover { color: var(--orange); }
.saga-modal-nav-link svg { flex-shrink: 0; }

/* Botones de descarga/leer en el saga-modal */
.saga-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.saga-modal-actions .btn { padding: 5px 13px; font-size: 0.76rem; gap: 5px; flex: 0 0 auto; justify-content: center; }
.saga-modal-actions .btn svg { width: 12px; height: 12px; }



/* ── Tooltip de subgéneros en los enlaces de género del footer ── */
.footer-genres-list li a {
  position: relative;
}
.footer-genres-list li a[data-subs]::after {
  content: attr(data-subs);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  max-width: 260px;
  background: #1c1a2e;
  color: rgba(255,255,255,0.82);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.73rem;
  line-height: 1.55;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.09);
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
  white-space: normal;
}
.footer-genres-list li a[data-subs]:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ── Dropdown de sugerencias ── */
/* ══ DROPDOWN PREDICTIVO ══════════════════════════════════════════ */
#search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 800;
  display: none;
  max-height: 520px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--orange) transparent;
  animation: suggIn 0.16s ease;
}
@keyframes suggIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#search-suggestions.show { display: block; }
#search-suggestions::-webkit-scrollbar { width: 4px; }
#search-suggestions::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 2px; }

/* Cabecera de grupo */
.sugg-group-label {
  padding: 8px 14px 5px;
  font-size: 0.67rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--orange); font-family: 'IM Fell English', serif; font-style: italic;
  background: var(--bg-muted); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}

/* ── Item libro (con miniatura de portada) ── */
.sugg-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; cursor: pointer;
  transition: background 0.12s; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.sugg-item:last-child { border-bottom: none; }
.sugg-item:hover, .sugg-item.active { background: rgba(240,120,0,0.07); }

/* Miniatura portada dentro del dropdown */
.sugg-cover {
  width: 34px; height: 50px; flex-shrink: 0;
  border-radius: 4px; overflow: hidden;
  background: var(--bg-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.sugg-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Icono simple (autor, saga, género) */
.sugg-item-icon {
  font-size: 1.1rem; flex-shrink: 0;
  width: 34px; text-align: center;
}

.sugg-item-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.sugg-item-main {
  font-size: 0.88rem; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.35;
}
.sugg-item-main mark { background: none; color: var(--orange); font-weight: 700; }
.sugg-item-sub {
  font-size: 0.74rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sugg-item-sub .match { color: var(--orange); font-weight: 600; }

/* Badge tipo */
.sugg-item-badge {
  font-size: 0.63rem; padding: 2px 7px; border-radius: 50px;
  white-space: nowrap; flex-shrink: 0;
  border: 1px solid rgba(26,111,204,0.2);
  background: rgba(26,111,204,0.07); color: var(--blue);
}
.sugg-item-badge.g { background: rgba(240,120,0,0.08); border-color: rgba(240,120,0,0.25); color: var(--orange-dark); }
.sugg-item-badge.a { background: rgba(0,179,138,0.08); border-color: rgba(0,179,138,0.25); color: #00785e; }
.sugg-item-badge.s { background: rgba(138,74,243,0.08); border-color: rgba(138,74,243,0.25); color: #6b38d4; }

/* Pie: "Ver todos los resultados" */
.sugg-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  text-align: center;
  border-radius: 0 0 16px 16px;
}
.sugg-footer-btn {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.82rem; color: var(--orange); cursor: pointer;
  background: none; border: none; font-weight: 700; transition: color 0.15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.sugg-footer-btn:hover { color: var(--orange-dark); }

/* Estado cargando / sin resultados */
.sugg-loading {
  padding: 16px 14px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 0.85rem;
}
.sugg-spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--orange);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sugg-no-results {
  padding: 20px 14px; text-align: center;
  color: var(--text-muted); font-size: 0.88rem;
}


#search-results-overlay {
  position: fixed; inset: 0; z-index: 2600;
  background: rgba(0,0,0,0.62); backdrop-filter: blur(10px);
  display: none; align-items: flex-start; justify-content: center;
  padding: clamp(3rem, 8vw, 4.5rem) clamp(0.75rem, 2vw, 1rem) clamp(1.25rem, 3vw, 2rem);
  overflow-y: auto;
}
#search-results-overlay.open { display: flex; }

.search-results-modal {
  background: #fff; border-radius: 22px;
  width: 100%; max-width: 900px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.28s ease;
  display: flex; flex-direction: column;
  overflow: hidden;
  margin-bottom: 32px; /* espacio inferior al hacer scroll */
}

/* Cabecera del modal */
.srm-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(0.6rem, 1.5vw, 0.875rem); padding: clamp(1rem, 2.5vw, 1.375rem) clamp(1rem, 2.5vw, 1.75rem) clamp(0.75rem, 1.5vw, 1rem);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.srm-header-left { display: flex; align-items: center; gap: 12px; }
.srm-icon { font-size: 1.7rem; }
.srm-title { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 1.45rem; color: var(--text-primary); margin: 0; }
.srm-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition);
}
.srm-close:hover { border-color: var(--orange); color: var(--orange); }

/* Barra de filtros */
.srm-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: clamp(0.5rem, 1.2vw, 0.75rem) clamp(1rem, 2.5vw, 1.75rem); border-bottom: 1px solid var(--border);
  background: var(--bg-muted); flex-shrink: 0;
}
.srm-filter {
  padding: 5px 14px; border-radius: 50px;
  border: 1.5px solid var(--border); background: #fff;
  font-family: 'Libre Baskerville', serif; font-size: 0.8rem;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.srm-filter.active, .srm-filter:hover {
  border-color: var(--orange); color: var(--orange);
  background: rgba(240,120,0,0.06);
}
.srm-filter-total {
  margin-left: auto;
  font-family: 'Caveat', cursive; font-size: 1.15rem; color: var(--text-muted);
}

/* Cuerpo scrollable */
.srm-body {
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1rem, 2.5vw, 1.75rem) clamp(1.25rem, 3vw, 1.75rem);
  overflow-y: auto; flex: 1;
}
.srm-loading {
  text-align: center; padding: 60px;
  font-family: 'Caveat', cursive; font-size: 1.4rem; color: var(--text-muted);
}


.srm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 28px 56px;
  text-align: center;
  gap: 0;
}

/* Ilustración SVG animada */
.srm-empty-illustration {
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
  animation: empty-float 3.5s ease-in-out infinite;
}
@keyframes empty-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

/* Título del empty state */
.srm-empty-title {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.45rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.25;
}

/* Subtítulo / sugerencia */
.srm-empty-sub {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
  margin-bottom: 22px;
}

/* Chips de sugerencia */
.srm-empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.srm-empty-chip {
  padding: 5px 16px;
  border-radius: 50px;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.srm-empty-chip:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(240,120,0,0.05);
}

/* ── Nombres y query en cabecera modal ── */
.srm-query { font-family: 'IM Fell English', serif; font-style: italic; font-size: 1.15rem; color: var(--orange); margin: 2px 0 0; }

/* Sección dentro del modal (géneros / autores / libros) */
.srm-section { margin-bottom: clamp(1rem, 2.5vw, 1.75rem); }
.srm-section-title {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: 0.76rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}

/* ── Grid de libros en el modal ── */
.srm-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--lib-card-w), 1fr));
  gap: clamp(0.75rem, 1.5vw, 1rem);
}
.srm-book-card {
  border-radius: 12px; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
}
.srm-book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: rgba(240,120,0,0.3); }
.srm-book-cover {
  width: 100%; padding-top: 148%; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1a2535, #2d3f55);
}
.srm-book-cover img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.srm-book-cover-ph {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 2rem;
}
.srm-book-body { padding: clamp(5px, 0.8vw, 8px) clamp(6px, 1vw, 10px) clamp(7px, 1vw, 10px); }
.srm-book-title {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: var(--card-fs-title); line-height: 1.3; color: var(--text-primary); margin-bottom: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.srm-book-author {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: var(--card-fs-author); color: var(--orange);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Chips de género en el modal ── */
.srm-genres-wrap { display: flex; flex-wrap: wrap; gap: clamp(0.5rem, 1.2vw, 0.75rem); }
.srm-genre-chip {
  display: flex; align-items: flex-start; gap: 8px;
  padding: clamp(0.5rem, 1.2vw, 0.75rem) clamp(0.75rem, 1.5vw, 1rem); border-radius: 14px;
  background: var(--bg-section); border: 1.5px solid var(--border);
  cursor: pointer; transition: var(--transition); max-width: 260px;
}
.srm-genre-chip:hover { border-color: var(--orange); background: rgba(240,120,0,0.05); }
.srm-genre-chip-emoji { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.srm-genre-chip-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.srm-genre-chip-label { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 0.92rem; color: var(--text-primary); }
.srm-genre-chip-subs { font-family: 'IM Fell English', serif; font-style: italic; font-size: 0.74rem; color: var(--text-muted); }

/* ── Filas de autores en el modal ── */
.srm-authors-list { display: flex; flex-direction: column; gap: clamp(0.3rem, 0.8vw, 0.5rem); }
.srm-author-row {
  display: flex; align-items: center; gap: 10px;
  padding: clamp(0.5rem, 1.2vw, 0.75rem) clamp(0.75rem, 1.5vw, 0.875rem); border-radius: 10px;
  background: var(--bg-section); border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.srm-author-row:hover { border-color: var(--orange); background: rgba(240,120,0,0.04); }
.srm-author-name { font-family: 'IM Fell English', serif; font-style: italic; font-size: 1.1rem; color: var(--text-primary); flex: 1; }
.srm-author-count { font-family: 'Caveat', cursive; font-size: 1.0rem; color: var(--text-muted); }


.nosotros-chart-wrap { position: relative; width: 220px; height: 220px; flex-shrink: 0; margin: 0 auto; }
.nosotros-donut { width: 220px; height: 220px; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.10)); }
.nosotros-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center-num { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 1.6rem; color: var(--text-primary); line-height: 1; }
.donut-center-lbl { font-family: 'Caveat', cursive; font-size: 1rem; color: var(--orange); }
.nosotros-legend { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; width: 100%; max-width: 300px; }
.nosotros-legend li { display: flex; align-items: center; font-size: 0.88rem; color: var(--text-secondary); gap: 0; }
.nosotros-legend li strong { margin-left: auto; color: var(--text-primary); }

/* Ancla con offset de header para los scrolls anclados */
#nuestra-historia { scroll-margin-top: 100px; }
#escribenos { scroll-margin-top: 150px; }


@media(max-width:1024px) {
  /* Con 3 columnas el footer cabe bien hasta 1024px — no necesita reducirse */
  .nosotros-inner, .contacto-inner { grid-template-columns: 1fr; }
  .nosotros-visual { display: none; }
  /* En tablet las secciones con height fija se vuelven auto */
  #nosotros, #contacto { min-height: 0; height: auto; }
}

@media(max-width:768px) {
  :root { --header-h: 60px; }
  .header-nav { display: none; }
  .hamburger { display: flex; flex-shrink: 0; }

  /* Header en móvil: logo | búsqueda | hamburguesa en una fila ajustada */
  .header-inner {
    padding: 0 12px;
    gap: 8px;
  }

  /* Logo: tamaño reducido para caber en 60px de alto */
  .header-logo { flex-shrink: 0; }
  .header-logo img { height: 40px !important; width: auto; }

  /* Búsqueda: crece pero con límite para dejar sitio al logo y hamburguesa */
  .header-search { flex: 1; min-width: 0; max-width: none; margin: 0; }
  .header-search input { padding: 8px 36px 8px 12px; font-size: 0.82rem; height: 36px; }
  .search-btn { width: 32px; height: 32px; }
  .footer-logo-img { height: 82px; }
  .search-adv-grid { grid-template-columns: 1fr; }

  /* ── TODAS LAS SECCIONES: sin altura fija, scroll natural ── */
  #nosotros   { height: auto; min-height: 0; align-items: flex-start; }
  #contacto   { height: auto; min-height: 0; overflow: visible; align-items: flex-start; }

  /* ── NOSOTROS: todo en columna ── */
  .nosotros-inner  { grid-template-columns: 1fr; }
  .nosotros-visual { display: none; }
  .nosotros-text p { font-size: 0.92rem; }

  /* ── CONTACTO: formulario 100% responsive ── */
  .contacto-inner   { grid-template-columns: 1fr; }
  .contact-form     { gap: 14px; }
  .form-grid-2      { grid-template-columns: 1fr; }
  .form-group input,
  .form-group textarea,
  .form-group select { padding: 12px 14px; font-size: 0.9rem; box-sizing: border-box; width: 100%; }
  .contact-form .btn-primary {
    width: 100% !important; box-sizing: border-box !important;
    display: flex !important; justify-content: center !important;
    align-items: center !important; padding: 15px 20px !important;
    font-size: 0.95rem; min-height: 52px;
  }

  /* Modal de libro en móvil: columna única (≤680px lo gestiona su propio bloque) */
  .modal { max-height: 90vh; max-width: calc(100vw - 24px); }
  .modal-content { overflow-y: auto; }
  .modal-desc { max-height: none; flex: 1; min-height: 0; }

  /* Modal de saga en móvil */
  .saga-modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 95vh; }
  .saga-modal-body.active { grid-template-columns: 1fr; }
  .saga-modal-cover-wrap { min-height: 200px; max-height: 240px; border-radius: 0; }
  .saga-modal-content { padding: 12px 14px; }
  .saga-modal-title { font-size: 1.1rem; }
  .saga-modal-author { font-size: 1rem !important; }
  .saga-modal-desc { max-height: 80px; }
  .saga-modal-actions { flex-wrap: wrap; }

  /* Carousel legacy */
  .carousel-track .lib-book { width: calc((100vw - 64px) / 2); min-width: 130px; max-width: 175px; scroll-snap-align: start; }
  .carousel-track { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scroll-padding-left: 8px; }
  .genre-carousel { width: 96%; }
  .carousel-viewport { padding: 0 36px; }
  .carousel-arrow-left  { left: 0; }
  .carousel-arrow-right { right: 0; }

  .footer-main { grid-template-columns: 1fr; }
  .footer-col-combined { grid-column: 1; grid-template-columns: 1fr 1fr; }
  .hero-stats  { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .section-title { font-size: clamp(1.8rem, 8vw, 2.8rem); }
  .alphabet-nav { gap: 2px; padding: 8px 10px; flex-wrap: wrap; }
  .alphabet-nav a { width: 28px; height: 28px; font-size: 0.78rem; }
}

@media(min-width: 561px) and (max-width: 768px) {
  /* ── Biblioteca: toggle géneros + por autores en una sola línea ── */
  .library-toggle-wrap {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
  }
  #bib-genre-dropdown-wrap { flex-shrink: 0; }
  #ltb-authors              { flex-shrink: 0; white-space: nowrap; }
  /* Contador de libros oculto en esta franja también */
  .bib-counter { display: none !important; }

  /* ── Nombre del autor: fuente un poco mayor ── */
  .lib-book-author  { font-size: 1.05rem !important; }
  .author-card-name { font-size: 1.08rem; }

  /* ── Fluidez de carga en biblioteca: reservar espacio de portada ── */
  .lib-book-cover-wrap {
    content-visibility: auto;
    contain-intrinsic-size: 0 200px;
  }
  /* Animación de entrada acortada */
  .lib-book { transition: opacity 0.15s ease, transform 0.15s ease; }

  /* ── Fluidez en sagas: reservar espacio de cada chip ── */
  .saga-chip-img-wrap {
    content-visibility: auto;
    contain-intrinsic-size: var(--saga-chip-w) calc(var(--saga-chip-w) * 1.44);
  }
}



/* ── Sticker de biblioteca ── */
.library-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(0.5rem, 1.2vw, 0.75rem) 0 clamp(0.75rem, 1.8vw, 1.25rem);
  width: 90%;
  max-width: 1400px;
  margin: 0 auto;
  flex-wrap: nowrap;
}

/* Dropdown de géneros */
.bib-genre-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Disparador — mismo estilo que btn-outline del header */
.bib-genre-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border: 2px solid var(--border-strong);
  border-radius: 50px;
  background: #fff;
  color: var(--text-primary);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.bib-genre-trigger:hover,
.bib-genre-trigger.open {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(240,120,0,0.04);
}
.bib-genre-trigger.has-filter {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-orange);
}
.bib-genre-trigger.has-filter:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-orange-hover);
}
.bib-caret {
  transition: transform 0.22s ease;
  flex-shrink: 0;
}
.bib-genre-trigger.open .bib-caret { transform: rotate(180deg); }

/* Panel desplegable */
.bib-genre-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeUp 0.18s ease;
}
.bib-genre-panel.open { display: flex; }

.bib-genre-panel-list {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--orange) transparent;
  padding: 6px 0;
}
.bib-genre-panel-list::-webkit-scrollbar { width: 4px; }
.bib-genre-panel-list::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 2px; }

.bib-genre-loading {
  padding: 12px 16px;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
}

/* Ítem del panel */
.bib-genre-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.bib-genre-item:hover,
.bib-genre-item:focus,
.bib-genre-item.active {
  background: rgba(240,120,0,0.07);
  color: var(--orange);
  outline: none;
}
.bib-gi-name { flex: 1; min-width: 0; }
.bib-gi-emoji { flex-shrink: 0; width: 20px; text-align: center; font-size: 0.9rem; }
.bib-gi-cnt {
  font-family: 'Caveat', cursive;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.bib-genre-item.active .bib-gi-cnt { color: rgba(240,120,0,0.7); }

.bib-genre-item-all {
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  padding-bottom: 12px;
  font-weight: 700;
  color: var(--text-primary);
  gap: 8px;
}
.bib-genre-item-all:hover,
.bib-genre-item-all.active { color: var(--orange); background: rgba(240,120,0,0.05); }
/* Contador — estilo btn-outline idéntico al botón Entrar del header */
.bib-counter {
  display: inline-flex !important;
  align-items: center !important;
  padding: 7px 16px !important;
  font-family: 'Libre Baskerville', serif !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  border: 2px solid var(--border-strong) !important;
  border-radius: 50px !important;
  color: var(--text-primary) !important;
  background: #fff !important;
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
  margin-left: auto;
  /* No heredar pointer-events del btn */
  pointer-events: none;
}

/* Botón Por autores — btn-outline del header */
.bib-authors-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
.bib-authors-btn.active {
  border-color: var(--orange) !important;
  color: var(--orange) !important;
  background: rgba(240,120,0,0.05) !important;
}

/* Responsive */
@media (max-width: 900px) {
  .library-toggle-wrap { flex-wrap: wrap; gap: 8px; }
  .bib-counter { margin-left: 0; order: 10; width: 100%; justify-content: center; font-size: 0.82rem !important; }
}
@media (max-width: 680px) {
  /* Ocultar contador de libros en móvil — evita apilamiento vertical */
  .bib-counter { display: none !important; }
  .bib-genre-trigger { font-size: 0.82rem; padding: 6px 12px; }
  .bib-authors-btn { font-size: 0.82rem !important; padding: 6px 12px !important; }
}

/* ── Vista por autores ── */

.author-section {
  width: 90%;
  max-width: 1400px;
  margin: 0 auto clamp(1.25rem, 3vw, 2.25rem);
}

.author-section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--orange);
  margin-bottom: 16px;
}

.author-section-letter {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
}

.author-section-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Libre Baskerville', serif;
}

.author-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 18vw, 240px), 1fr));
  gap: clamp(0.5rem, 1.2vw, 0.75rem);
}

.author-card {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 1.2vw, 0.875rem);
  padding: clamp(0.6rem, 1.2vw, 0.875rem) clamp(0.75rem, 1.5vw, 1rem);
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.author-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-orange);
  transform: translateY(-2px);
}

.author-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 900;
  flex-shrink: 0;
}

.author-card-info {
  flex: 1;
  min-width: 0;
}

.author-card-name {
  font-weight: 700;
  font-size: 1.0rem;
  font-family: 'Libre Baskerville', serif;
  color: var(--text-primary);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  line-height: 1.35;
}

.author-card-count {
  font-size: 0.85rem;
  font-family: 'Caveat', cursive;
  color: var(--orange);
  margin-top: 2px;
}

.author-card-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.author-card:hover .author-card-arrow {
  color: var(--orange);
  transform: translateX(3px);
}



.dl-formats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: clamp(0.5rem, 1.2vw, 0.75rem);
}

.dl-format-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(0.75rem, 1.8vw, 1rem) clamp(0.5rem, 1.2vw, 0.75rem);
  border: 2px solid rgba(0,0,0,0.09);
  border-radius: 14px;
  background: var(--bg-section);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Libre Baskerville', serif;
}

.dl-format-btn:hover {
  border-color: var(--orange);
  background: rgba(240,120,0,0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-orange);
}

.dl-format-label {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.dl-format-ext {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}


#saga-modal-overlay .saga-modal {
  max-width: 860px;
  width: 95vw;
  min-height: 440px;
  max-height: 90vh;
}

.saga-modal-body {
  display: flex;
  flex-direction: row;
  gap: 0;
  padding: 0;
  min-height: 400px;  /* ← AJUSTA AQUÍ la altura mínima del modal de saga */
  overflow: hidden;
}

.saga-modal-cover-wrap {
  flex-shrink: 0;
  width: 220px;           /* ← AJUSTA AQUÍ el ancho de la portada en el modal de saga */
  position: relative;
  overflow: hidden;
  background: #1a2535;    /* fondo oscuro para portada completa */
  border-radius: 10px 0 0 10px;
  align-self: stretch;    /* ocupa toda la altura del modal */
}

.saga-modal-cover-wrap img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;    /* portada completa sin recorte */
  object-position: center center !important;
  display: block !important;
  border-radius: 0;
}

/* Badge de estado de saga (completa/incompleta) */
.saga-modal-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;   /* ← AJUSTA AQUÍ el tamaño del badge de estado en el modal */
  font-weight: 700;
  margin-bottom: 8px;
  font-family: 'Libre Baskerville', serif;
  flex-shrink: 0;
}
/* Badge estado modal: mismos colores que en la tarjeta (naranja cristal / azul) */
.saga-modal-status-badge.completa {
  background: rgba(240,120,0,0.14);
  border: 1px solid rgba(240,120,0,0.45);
  color: var(--orange-dark);
}
.saga-modal-status-badge.incompleta {
  background: rgba(26,111,204,0.14);
  border: 1px solid rgba(26,111,204,0.45);
  color: var(--blue);
}

/* Badge de estado en tarjeta saga */
.saga-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 50px;
  font-size: 0.68rem;   /* ← AJUSTA AQUÍ el tamaño del badge de estado en tarjeta */
  font-weight: 700;
  margin-bottom: 6px;
  font-family: 'Libre Baskerville', serif;
  align-self: flex-start;
}
.saga-status-badge.completa {
  background: rgba(34,197,94,0.10);
  border: 1px solid rgba(34,197,94,0.25);
  color: #16a34a;
}
.saga-status-badge.incompleta { background: var(--blue); border: 1px solid var(--blue-dark); color: #fff; }

.saga-modal-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: clamp(0.875rem, 2vw, 1.25rem) clamp(1rem, 2.5vw, 1.375rem); /* ← AJUSTA AQUÍ el padding interno del lado derecho del modal saga */
  overflow: hidden;
}

@media(max-width: 700px) {
  .saga-modal-body {
    flex-direction: column;
  }
  .saga-modal-cover-wrap {
    width: 100%;
    height: 220px; /* ← AJUSTA AQUÍ la altura de portada en modal saga móvil */
    border-radius: 10px 10px 0 0;
    align-self: auto;
  }
}


.alphabet-nav-wrap {
  position: sticky;
  /* top se establece dinámicamente por JS (updateAlphabetStickyTop)
     para quedar justo debajo del sticky-header de biblioteca */
  top: var(--alphabet-sticky-top, calc(var(--header-h) + 120px));
  z-index: 88; /* un nivel por debajo del sticky-header (z-index:90) */
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  margin-bottom: 28px;
}

.alphabet-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 6px 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.alphabet-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}

.alphabet-nav a:hover {
  color: var(--orange);
  background: rgba(240,120,0,0.08);
  border-color: rgba(240,120,0,0.2);
}

.alphabet-nav a.active-filter {
  background: var(--orange);     /* cuadro naranja sobre la letra elegida */
  color: #fff;
  box-shadow: var(--shadow-orange);
  transform: translateY(-2px);
  font-weight: 900;
}
/* .current se usa solo para scroll-spy (sin relleno, solo subrayado) */
.alphabet-nav a.current {
  border-bottom: 2px solid var(--orange);
  color: var(--orange);
}

.alphabet-nav a.empty {
  opacity: 0.25;
  pointer-events: none;
  cursor: default;
}


/* Grid con tarjetas algo mas anchas que el grid de busqueda normal */
.srm-author-books-grid {
  grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 14vw, 168px), 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* Tarjeta del modal de autor */
.srm-author-book-card {
  /* Igual que srm-book-card pero sin overflow para no cortar la portada */
  display: flex;
  flex-direction: column;
}

/* Portada: aspect-ratio 2/3 para que siempre se vea completa */
.srm-author-book-card .srm-book-cover {
  padding-top: 0;              /* eliminar el padding-top% que usa el grid normal */
  aspect-ratio: 2 / 3;        /* proporcion fija libro: alto = 1.5 * ancho */
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f0ebe0, #e5dfd0);
  flex-shrink: 0;
}

.srm-author-book-card .srm-book-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;         /* portada completa sin recorte */
  object-position: center center;
}

/* Cuerpo de la tarjeta: padding generoso */
.srm-author-book-card .srm-book-body {
  padding: 10px 12px 12px;
  flex: 1;
}

/* ── Titulo del libro en el modal de autor ── */
.srm-author-book-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: normal;
}

/* ── Nombre del autor debajo del titulo ── */
.srm-author-book-author {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--orange);
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: normal;
}

/* (srm-author-books-grid ya usa clamp() en minmax — sin necesidad de breakpoint) */




.header-logo img { height: 100px !important; width: auto; }
.footer-logo-img { height: 100px; width: auto; }


/* ── Logo sin cursor de enlace (no tiene href) ── */
.header-logo { cursor: default; }


@media(max-width: 1200px) and (min-width: 1025px) {
  .header-nav { display: none !important; }
  .hamburger { display: flex !important; }

  #nosotros, #contacto { min-height: 0; height: auto; }
  .nosotros-inner  { grid-template-columns: 1fr; }
  .contacto-inner  { grid-template-columns: 1fr; padding: 0; }
  .nosotros-visual { display: none; }
}

@media(max-width: 1024px) and (min-width: 769px) {
  /* ── Tipografía: misma escala que desktop ── */
  :root {
    --fs-para:   0.95rem;
    --fs-autor:  1.10rem;
    --fs-titulo: 1.10rem;
    --fs-sub:    1.30rem;
  }
  body { font-size: 16px; }

  /* ── Header: componentes más grandes y bien distribuidos ── */
  .header-nav { display: none !important; }
  .hamburger { display: flex !important; width: 42px; padding: 6px; }
  .hamburger span { height: 2.5px; }
  /* Logo más grande que el rango ≤768px, pero sin superar la altura
     del header (96px) — antes eran 120px y sobresalían 24px por debajo
     del header, justo donde empieza el overlay del lector. */
  .header-logo img { height: 72px !important; }
  :root { --header-h: 96px; }
  /* Búsqueda: ocupa el espacio disponible, bien centrada entre logo y hamburger */
  .header-inner { gap: 24px; padding: 0 32px; }
  .header-search {
    flex: 1;
    max-width: 560px;
    margin: 0 16px;
  }
  .header-search input {
    padding: 11px 42px 11px 18px;
    font-size: 0.97rem;
    border-radius: 50px;
  }

  /* ── Sticky biblioteca: compensar el header más alto ── */
  .biblioteca-sticky-header { top: var(--header-h) !important; }

  /* ── Secciones ── */
  .section-title { font-size: clamp(2.4rem, 5vw, 3.8rem); }
  #nosotros  { padding-top: 80px; }

  /* ── Botones: tamaño desktop ── */
  .btn { padding: 11px 24px; font-size: 0.95rem; }

  /* ── Biblioteca: grid idéntico a desktop ── */
  .lib-book-cover-wrap { padding-top: 150%; }
  .lib-book-title  { font-size: var(--card-fs-title); }
  .lib-book-author { font-size: var(--card-fs-author) !important; }
  .lib-book-body   { padding: clamp(5px, 0.8vw, 8px); }

  /* ── Sagas: tamaño desktop ── */
  .saga-chip-title { font-size: var(--card-fs-badge); }
  .saga-card-name  { font-size: 1.10rem; }

  /* ── Modales: tamaño desktop ── */
  .modal-title       { font-size: var(--fs-titulo); }
  .modal-author      { font-size: var(--fs-autor) !important; }
  .modal-desc        { font-size: var(--fs-para); }
  .saga-modal-title  { font-size: var(--fs-sub); }
  .saga-modal-author { font-size: var(--fs-titulo) !important; }
  .saga-modal-desc   { font-size: var(--fs-para); }

  /* ── Footer: brand + col combinada (Navegar+Legal) ── */
  .footer-main       { grid-template-columns: 2fr 1fr 1fr; }
  .footer-col-combined { grid-column: 2 / 4; grid-template-columns: 1fr 1fr; }
  .footer-logo-img   { height: 130px !important; }
  .footer-brand p    { font-size: 0.92rem; }
  .footer-col h4     { font-size: 1.05rem; }
  .footer-col-combined h4 { font-size: 1.05rem; }
  .footer-links li a { font-size: 0.92rem; }
  .footer-bottom p   { font-size: 0.86rem; }
  .footer-legal a    { font-size: 0.86rem; }
}


@media(max-width: 560px) {
  /* Botones y layout general */
  .btn { padding: 9px 18px; font-size: 0.86rem; }
  .hero-cta { gap: 10px; flex-direction: column; align-items: center; }
  .hero-cta .btn { width: 100%; max-width: 260px; justify-content: center; }

  #nosotros, #contacto { }

  /* Logo y footer */
  .header-logo img { height: 36px !important; }
  .footer-logo-img { height: 70px; }

  /* Formulario contacto */
  .contact-form .btn-primary {
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    padding: 14px 12px !important;
    font-size: 0.9rem !important;
  }
  /* Biblioteca: botones género + autores en una sola línea */
  #bib-genre-dropdown-wrap { display: inline-flex !important; flex-shrink: 0; }
  #ltb-authors { display: inline-flex !important; flex-shrink: 0; white-space: nowrap; padding: 6px 12px; font-size: 0.78rem; }
  .library-toggle-wrap { flex-wrap: nowrap; gap: 8px; width: 95%; padding: 10px 0 16px; }
  .bib-genre-trigger { padding: 6px 12px; font-size: 0.78rem; white-space: nowrap; }
  .bib-counter { display: none !important; }

  /* Header */
  .header-inner {
    flex-wrap: nowrap;
    padding: 0 8px;
    height: 60px;        /* altura fija explícita — no depende de :root */
    align-items: center;
    gap: 6px;
  }
  .header-nav { display: none !important; }

  /* Logo: pequeño pero legible */
  .header-logo { flex: 0 0 auto; }
  .header-logo img { height: 44px !important; width: auto; }

  /* Hamburger: tamaño fijo pulsable */
  .hamburger {
    display: flex !important;
    flex: 0 0 38px;
    width: 38px; height: 38px;
    align-items: center; justify-content: center;
    margin-left: 0; padding: 5px;
  }

  /* Búsqueda: espacio restante entre logo y hamburger */
  .header-search {
    flex: 1 1 0;
    min-width: 0;
    max-width: 260px;
    margin: 0 4px;
  }
  .header-search input {
    padding: 7px 32px 7px 12px;
    font-size: 0.8rem;
  }
  .header-search input::placeholder { font-size: 0.75rem; }

  /* Dropdown de sugerencias */
  #search-suggestions { left: 0; right: 0; min-width: calc(100vw - 16px); }
  .sugg-item-main { font-size: 0.84rem; }
  .sugg-item-sub  { font-size: 0.72rem; }

  /* ── Hero: margen y altura explícitos con valor fijo para el video ── */
  :root { --header-h: 60px; }
  #hero {
    margin-top: 60px;                         /* valor fijo — no depende de :root */
    height: calc(100vh - 60px);               /* fallback legacy */
    height: calc(100dvh - 60px);             /* fallback dinámico */
    min-height: calc(100svh - 60px);         /* ← excluye barra del navegador móvil */
    min-height: 300px;
    position: relative;
    overflow: hidden;
  }
  /* Asegurar que el video se muestra */
  .hero-video-wrap { display: block !important; position: absolute; inset: 0; z-index: 0; }
  .hero-video-wrap video { width: 100% !important; height: 100% !important; object-fit: cover; opacity: 0.5; display: block !important; }

  .biblioteca-sticky-header { top: var(--header-h) !important; }
  .biblioteca-sticky-text .section-label,
  .biblioteca-sticky-text .section-title,
  .biblioteca-sticky-text .divider { display: block !important; visibility: visible !important; opacity: 1 !important; }
  .biblioteca-sticky-text .section-title { font-size: clamp(1.4rem, 7vw, 2rem); }

  /* ── Botones Géneros y Por autores: en una sola línea, compactos ── */
  #bib-genre-dropdown-wrap { display: inline-flex !important; flex-shrink: 0; }
  #ltb-authors             { display: inline-flex !important; flex-shrink: 0; white-space: nowrap; padding: 6px 12px; font-size: 0.78rem; }
  .library-toggle-wrap     { flex-wrap: nowrap; gap: 8px; width: 95%; padding: 10px 0 16px; }
  .bib-genre-trigger       { padding: 6px 12px; font-size: 0.78rem; white-space: nowrap; }
  .bib-counter             { display: none !important; }

  /* ── Grid biblioteca: columnas normales en ≤560px ────────────
     Con tarjetas de 140px caben 3-4 columnas incluso en móvil.
     El layout horizontal (fila) se reserva solo para ≤380px. */
  .bib-grid {
    grid-template-columns: repeat(auto-fill, minmax(var(--saga-chip-w), 1fr));
    gap: 8px;
  }
  /* Restaurar layout vertical por defecto */
  .lib-book            { flex-direction: column; height: auto; }
  .lib-book-cover-wrap { width: 100%; min-width: unset; padding-top: 150%; height: auto; border-radius: 10px 10px 0 0; }
  .lib-book-body       { flex: none; padding: clamp(4px,1vw,8px); border-radius: 0 0 10px 10px; }
  .lib-book-hover-overlay { display: flex; }

  
  .saga-card-strip {
    /* flex-wrap heredado — no sobreescribir con grid fijo */
    gap: 6px;
    padding: 10px 12px;
  }
  /* Chips de saga: mantener proporciones 2:3 en móvil */
  .saga-book-chip     { flex-direction: column; align-items: stretch; }
  .saga-chip-img-wrap { padding-top: calc(var(--saga-chip-w) * 1.44); height: auto; }
  .saga-chip-title {
    flex: none;
    text-align: center;
    font-size: 0.85rem;
    -webkit-line-clamp: 3;
  }
  :root { --card-fs-title: 0.58rem; --card-fs-author: 0.53rem; --card-fs-badge: 0.48rem; --card-icon-size: 22px; --card-hover-fs: 0.70rem; }
}



.saga-book-item,
.saga-card {
  position: relative;
  overflow: hidden;
}
.saga-book-item .saga-hover-overlay,
.saga-card .saga-hover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26,26,46,0.88) 0%, rgba(26,26,46,0.45) 60%, transparent 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
  z-index: 4;
  border-radius: inherit;
}
.saga-book-item:hover .saga-hover-overlay,
.saga-card:hover .saga-hover-overlay {
  opacity: 1;
  pointer-events: auto;
}
.saga-hover-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 8px 18px;
  font-family: 'Libre Baskerville', serif;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-orange);
  transition: background 0.18s, transform 0.15s;
}
.saga-hover-btn:hover {
  background: var(--orange-dark);
  transform: scale(1.06);
}
.saga-hover-btn svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
  flex-shrink: 0;
}

/* ── Saga modal ── */
#saga-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vw, 1rem);
}
#saga-modal-overlay.open { display: flex; }
.saga-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 760px;
  max-height: 82vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.28s ease;
}
.saga-modal-tabs-bar {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 4px;
  flex-shrink: 0;
  background: var(--bg-section);
}
.saga-modal-tabs-bar::-webkit-scrollbar { display: none; }
#saga-modal-panels {
  overflow: hidden;
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
}



html, body { -webkit-overflow-scrolling: touch; }


.lib-book-cover-wrap {
  content-visibility: auto;
  contain-intrinsic-size: 0 220px;
}

.lib-book {
  will-change: opacity, transform;
  transform: translateZ(0);
}


@media (max-width: 680px) {
  .lib-book {
    transition: opacity 0.18s ease, transform 0.18s ease;
    transform: translateY(4px);
  }
  .lib-book.visible { opacity: 1; transform: none; }
  
  .lib-book:hover { transform: none; }
  .lib-book-cover-wrap:hover .lib-book-cover { transform: none; }
}


@media(max-width: 560px) {
  #library-toggle {
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }
  #bib-counter { display: none !important; }
  #bib-genre-trigger { padding: 6px 10px !important; font-size: 0.76rem !important; }
  #ltb-authors { padding: 6px 10px !important; font-size: 0.76rem !important; white-space: nowrap !important; }
}

/* ================================================================
   RESPONSIVE MEJORADO — bloque unificado
   Orden: 768px → 600px (ya existente arriba, se complementa aquí)
================================================================ */

/* ── Tablet 768px ── */
@media (max-width: 768px) {
  /* Nosotros: una columna */
  .nosotros-inner  { grid-template-columns: 1fr; gap: clamp(1.5rem, 4vw, 2.25rem); }
  .nosotros-visual { display: none; }

  /* Hero: ajustar stats en grid 2×2 */
  .hero-stats      { gap: 24px; flex-wrap: wrap; justify-content: center; }
  .hero-stat       { min-width: 100px; }

  /* Header: ocultar nav y acciones, mostrar hamburger */
  .header-nav { display: none !important; }
  .hamburger       { display: flex !important; }

  /* Sagas: encabezado en columna */
  .sagas-head      { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Móvil medio 600px: hero compacto ── */
@media (max-width: 680px) {
  /* Hero stats: 2 columnas */
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.75rem, 3vw, 1rem);
    margin-top: clamp(1.5rem, 5vw, 2.25rem);
  }
  .hero-stat-num   { font-size: 1.7rem; }

  .saga-card-name  { font-size: 1rem; white-space: normal; }
}

/* ================================================================
   SMF — MODAL COMPLETO DE SAGA (clases smf-*)
   Layout: portada izquierda | columna derecha con datos
   Mismo sistema que el modal de libro pero con navegación de saga
================================================================ */

/* Wrapper principal: grid 2 columnas igual que el modal libro */
.smf-inner {
  display: grid;
  grid-template-columns: clamp(200px, 28vw, 280px) 1fr;
  align-items: stretch;
  height: 100%;
  overflow: hidden;
}

/* ── Columna izquierda: portada completa ── */
.smf-cover-col {
  position: relative;
  background: #f0ece4;
  border-radius: 18px 0 0 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}
.smf-cover-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  max-height: 100%;
}
.smf-cover-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--text-muted);
}

/* ── Columna derecha: datos del libro ── */
.smf-right-col {
  display: flex;
  flex-direction: column;
  padding: clamp(1.1rem, 2.5vw, 1.5rem) clamp(1.1rem, 2.5vw, 1.75rem);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  min-width: 0;
  gap: 0;
}

/* Botón cerrar */
.smf-close-btn {
  position: absolute;
  top: 12px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  z-index: 2;
  flex-shrink: 0;
}
.smf-close-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ── Fila meta: índice · nombre saga · estado ── */
.smf-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding-right: 36px;
  flex-shrink: 0;
}
.smf-index-badge {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(240,120,0,0.10);
  border: 1px solid rgba(240,120,0,0.30);
  color: var(--orange);
  padding: 3px 10px;
  border-radius: 50px;
  letter-spacing: 0.02em;
}
.smf-meta-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.smf-saga-name {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: clamp(0.82rem, 1.2vw, 0.92rem);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.smf-status-badge {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  flex-shrink: 0;
}
.smf-status--complete {
  background: rgba(34,197,94,0.10);
  border: 1px solid rgba(34,197,94,0.30);
  color: #16a34a;
}
.smf-status--ongoing {
  background: rgba(26,111,204,0.10);
  border: 1px solid rgba(26,111,204,0.30);
  color: var(--blue);
}

/* ── Título + navegador ← → ── */
.smf-title-nav-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.smf-title {
  flex: 1;
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
  min-width: 0;
}
.smf-nav-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  margin-top: 3px;
}
.smf-nav-btn:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(240,120,0,0.07);
}
.smf-nav-btn:disabled { opacity: 0.28; cursor: default; }

/* ── Autor ── */
.smf-author {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: #f07800;
  font-size: clamp(1.0rem, 1.5vw, 1.2rem);
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* ── Sinopsis con scroll ── */
.smf-desc {
  color: var(--text-secondary);
  font-size: clamp(0.9rem, 1.3vw, 1.0rem);
  line-height: 1.72;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--orange) transparent;
  flex: 1;
  min-height: 60px;
  max-height: 210px;
  margin-bottom: 18px;
  padding-right: 4px;
}

/* ── Fila de acciones ── */
.smf-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-top: auto;
}
.smf-action-btn {
  padding: 9px 18px;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ── Responsive tablet ≤ 768px ── */
@media (max-width: 768px) {
  .smf-inner {
    grid-template-columns: clamp(160px, 36vw, 220px) 1fr;
  }
  .smf-desc { max-height: 160px; }
}

/* ── Responsive móvil ≤ 600px ── */
@media (max-width: 680px) {
  .smf-inner {
    grid-template-columns: 1fr;
    grid-template-rows: clamp(180px, 42vw, 250px) 1fr;
    height: auto;
  }
  .smf-cover-col {
    border-radius: 18px 18px 0 0;
    width: 100%;
    height: clamp(180px, 42vw, 250px);
  }
  .smf-right-col {
    padding: 16px 18px 20px;
    overflow-y: auto;
    max-height: calc(90vh - clamp(180px, 42vw, 250px));
  }
  .smf-title { font-size: clamp(1.15rem, 5vw, 1.35rem); }
  .smf-author { font-size: clamp(0.95rem, 3.5vw, 1.1rem); }
  .smf-desc { max-height: 110px; }
  .smf-actions-row { gap: 6px; }
  .smf-action-btn { padding: 8px 13px; font-size: 0.82rem; }
}

/* ── Responsive móvil pequeño ≤ 400px ── */
@media (max-width: 560px) {
  .smf-actions-row { flex-direction: column; }
  .smf-action-btn { width: 100%; justify-content: center; }
  .smf-saga-name { max-width: 120px; }
}

/* ══════════════════════════════════════════════════════════════
   MÓVIL PEQUEÑO ≤ 360px — escala global +10%
   Teléfonos 320-360px (iPhone SE gen1, Galaxy A01…)
   reciben tipografía y elementos ligeramente mayores.
══════════════════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════════════════════
   ≤ 360px — Ajustes adicionales para pantallas muy pequeñas
   El font-size ya está en 20-21px por los breakpoints globales.
   Aquí solo ajustamos variables de tarjetas y elementos concretos
   que no escalan bien solo con rem.
════════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  /* Tarjetas: algo más pequeñas para caber mejor en 320-360px */
  :root {
    --lib-card-w:     clamp(80px, 28vw, 105px);
    --card-w:         clamp(55px, 18vw, 75px);
    --card-fs-title:  0.70rem;
    --card-fs-author: 0.63rem;
    --card-fs-badge:  0.58rem;
    --card-icon-size: 24px;
    --card-hover-fs:  0.80rem;
  }

  /* Hero: el clamp global ya es razonable pero podemos anclar mejor */
  .hero-title    { font-size: clamp(2.0rem, 10vw, 2.6rem); }
  .hero-subtitle { font-size: 0.90rem; line-height: 1.5; }
  .hero-eyebrow  { font-size: 0.70rem; letter-spacing: 0.14em; }

  /* Header: logo más compacto para dar espacio al menú */
  .header-logo img { height: 48px; }

  /* Títulos de sección */
  .section-title { font-size: clamp(1.5rem, 9vw, 2.0rem); }

  /* Biblioteca: 2 columnas mínimo incluso en 320px */
  .bib-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
  }

  /* Modal: borde redondeado más pequeño, textos ligeramente reducidos
     (el rem ya es 20-21px, así que 0.90rem ≈ 18-19px — legible) */
  .modal          { border-radius: 12px; }
  .modal-title    { font-size: 0.95rem; }
  .modal-author   { font-size: 0.85rem !important; }
  .modal-desc     { font-size: 0.82rem; }

  /* Botones: más altos para facilitar el toque */
  .btn            { padding: 9px 14px; font-size: 0.80rem; }
}

/* ================================================================
   SECCIÓN BLOG — Cards propias y de fuentes externas
================================================================ */

#blog {
  padding: clamp(2.5rem, 6vw, 5rem) 0;
  background: var(--bg-main);
  border-top: 1px solid var(--border);
}

.blog-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin-top: clamp(1.25rem, 3vw, 2rem);
}

.blog-preview-loading,
.blog-api-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-family: 'Caveat', cursive;
  font-size: 1.25rem;
}

/* Etiqueta separadora entre artículos propios y externos */
.blog-ext-section-label {
  grid-column: 1 / -1;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* Tarjeta de artículo */
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition);
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Portada */
.blog-card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-muted);
  flex-shrink: 0;
}
.blog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-cover img { transform: scale(1.04); }

.blog-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--bg-section), var(--bg-muted));
}

/* Cuerpo */
.blog-card-body {
  padding: clamp(0.75rem, 2vw, 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.blog-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.blog-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
  background: rgba(240,120,0,0.10);
  border-radius: 50px;
  padding: 2px 10px;
}

.blog-card-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(0.92rem, 1.8vw, 1.05rem);
  line-height: 1.35;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-excerpt {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.blog-card-author { font-weight: 600; }

/* Badge de fuente externa (feed RSS) */
.blog-card-ext-source {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 50px;
  color: #fff;
  background: var(--blue);
  white-space: nowrap;
}

@media(max-width: 768px) {
  .blog-preview-grid {
    grid-template-columns: 1fr;
  }
}
