/* ==========================================================================
   lectura-editorial.css  —  Estudio Vivo · Panel de Lectura
   Sistema de diseño premium para el panel de lectura bíblica
   Usa tokens --studio-* definidos en el tema raíz
   ========================================================================== */

/* ─────────────────────────────────────────────────────────────────────────────
   1. CABECERA EDITORIAL DEL CAPÍTULO  .chapter-editorial-header
   ───────────────────────────────────────────────────────────────────────────── */

.chapter-editorial-header {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--studio-line);
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 0;
}

/* Número decorativo gigante detrás del texto */
.chap-deco-number {
  position: absolute;
  right: 16px;
  top: -20px;
  font-size: 9rem;
  font-family: var(--font-title);
  font-weight: 900;
  line-height: 1;
  color: var(--studio-accent);
  opacity: 0.055;
  user-select: none;
  pointer-events: none;
  z-index: 0;
  letter-spacing: -0.04em;
  transition: opacity 0.4s ease;
}

/* Breadcrumb del libro en small-caps */
.chap-book-crumb {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--studio-muted);
  opacity: 0.8;
  font-variant: small-caps;
  font-family: var(--font-ui);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  line-height: 1.4;
}

/* Título "Capítulo N" */
.chap-title {
  font-size: 1.05rem;
  font-family: var(--font-title);
  color: var(--studio-ink);
  line-height: 1.2;
  font-weight: 600;
  position: relative;
  z-index: 1;
  margin: 0;
}

/* Separador sutil opcional */
.chap-divider-accent {
  width: 32px;
  height: 2px;
  background: var(--studio-accent);
  border-radius: 999px;
  opacity: 0.5;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. FILTROS COLAPSABLES  .filters-toggle / .filters-collapsible
   ───────────────────────────────────────────────────────────────────────────── */

.filters-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* Botón chip elegante */
.filters-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--studio-panel-muted);
  border: 1px solid var(--studio-line);
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  cursor: pointer;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  font-family: var(--font-ui);
  text-align: left;
}



.filters-toggle:hover {
  background: var(--studio-hover);
  box-shadow: 0 2px 8px var(--studio-shadow);
}

.filters-toggle:focus-visible {
  outline: 2px solid var(--studio-accent);
  outline-offset: 2px;
}

/* Estado colapsado: borde con tinte accent */
.filters-toggle.is-collapsed {
  border-color: color-mix(in srgb, var(--studio-accent) 30%, var(--studio-line));
}

/* Icono rotante */
.filters-toggle-icon {
  font-size: 0.75rem;
  color: var(--studio-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(0deg);
  line-height: 1;
  flex-shrink: 0;
  display: inline-block;
}

.filters-toggle.is-collapsed .filters-toggle-icon {
  transform: rotate(180deg);
}

/* Referencia actual en el toggle */
.filters-toggle-ref {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--studio-ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hint sutil */
.filters-toggle-hint {
  font-size: 0.75rem;
  color: var(--studio-muted);
  opacity: 0.7;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Panel colapsable */
.filters-collapsible {
  max-height: 320px;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filters-collapsible.collapsed {
  max-height: 0;
}

/* En desktop: chip inline en vez de full-width */
@media (min-width: 1180px) {
  .filters-toggle {
    width: auto;
    display: inline-flex;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   3. VERSÍCULO ACTIVO / SELECCIONADO
   ───────────────────────────────────────────────────────────────────────────── */

/* Versículo base: transición suave */
.verse {
  transition:
    background 0.15s ease,
    border-left-color 0.15s ease,
    padding-left 0.15s ease,
    margin-left 0.15s ease;
  border-left: 2px solid transparent;
  margin-left: 0;
  position: relative;
}

/* Hover en versículo no seleccionado */
.verse:hover:not(.selected) {
  background: color-mix(in srgb, var(--studio-ink) 4%, transparent);
  border-left: 2px solid var(--studio-line);
  margin-left: -2px;
  padding-left: calc(var(--verse-pl, 0px) + 2px);
  transition:
    background 0.15s ease,
    border-left-color 0.15s ease;
}

/* Versículo seleccionado */
.verse.selected {
  background: color-mix(in srgb, var(--studio-accent) 8%, transparent);
  border-left: 3px solid var(--studio-accent);
  margin-left: -3px;
  padding-left: calc(var(--verse-pl, 0px) + 3px);
  transition: all 0.2s ease;
}

.verse.selected .verse-number {
  color: var(--studio-accent);
  font-weight: 800;
}

/* Cuando hay selección activa: marcar levemente los no-seleccionados */
body.has-verse-selection .verse:not(.selected) {
  opacity: 0.65;
  transition: opacity 0.2s ease;
}

body.has-verse-selection .verse.selected {
  opacity: 1;
}

/* Versículo más cercano al centro de pantalla (lectura continua) */
.verse.active-reading-verse {
  background: color-mix(in srgb, var(--studio-accent) 5%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--studio-accent) 50%, transparent);
  margin-left: -2px;
  padding-left: calc(var(--verse-pl, 0px) + 2px);
}

.verse.active-reading-verse .verse-number {
  color: color-mix(in srgb, var(--studio-accent) 80%, var(--studio-muted));
}

/* Número de versículo base */
.verse-number {
  color: var(--studio-muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-ui);
  transition: color 0.2s ease;
  user-select: none;
  vertical-align: super;
  margin-right: 3px;
  opacity: 0.8;
}

/* ─────────────────────────────────────────────────────────────────────────────
   4. BARRA DE PROGRESO DEL CAPÍTULO  #chapterProgress
   ───────────────────────────────────────────────────────────────────────────── */

#chapterProgress {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  z-index: 200;
  pointer-events: none;
}

.chapter-progress-track {
  background: var(--studio-line);
  opacity: 0.3;
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.chapter-progress-fill {
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--studio-accent) 90%, transparent),
    var(--studio-accent)
  );
  width: 100%;
  height: var(--progress, 0%);
  position: absolute;
  top: 0;
  left: 0;
  transition: height 0.1s ease;
  border-radius: 0 0 2px 2px;
}

/* Glow sutil en el extremo inferior del fill */
.chapter-progress-fill::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--studio-accent);
  box-shadow: 0 0 6px 2px color-mix(in srgb, var(--studio-accent) 60%, transparent);
  opacity: 0.9;
}

/* Ocultar en mobile */
@media (max-width: 600px) {
  #chapterProgress {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   5. MODO LECTURA CONTINUA  body.reading-mode
   ───────────────────────────────────────────────────────────────────────────── */

body.reading-mode {
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh !important;
  width: 100vw !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

/* Ocultar header de la app y sacarlo por completo del flujo */
body.reading-mode header {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Ocultar pestañas de modo */
body.reading-mode .mode-tabs {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Ocultar filtros, paneles de filtro y cabeceras en modo lectura */
body.reading-mode #panelLectura,
body.reading-mode #panelComparacion,
body.reading-mode #panelConcordancia,
body.reading-mode #panelStrong,
body.reading-mode #referenceHeaderRow,
body.reading-mode .chapter-editorial-header {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.reading-mode .container,
body.reading-mode .app-layout,
body.reading-mode .main-content {
  max-width: 100% !important;
  width: 100% !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 100% !important;
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}

/* En modo desktop / tablet con ventanas: la ventana principal toma la pantalla completa */
body.reading-mode #desktopWinMain,
body.reading-mode [id^="desktopWin_"],
body.reading-mode .desktop-window {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  z-index: 9990 !important;
}

body.reading-mode .win-header {
  display: none !important;
}

body.reading-mode .win-body {
  height: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Contenido ocupando toda la longitud y ancho de la ventana desde el extremo superior */
body.reading-mode #content,
body.reading-mode .content {
  max-width: 100% !important;
  width: 100% !important;
  flex: 1 1 auto !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 16px 24px 100px !important;
  font-size: 1.08rem;
  line-height: 1.85;
  overflow-y: auto !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transition:
    padding 0.3s ease,
    font-size 0.3s ease;
}

/* Botón para salir del modo lectura en la parte central inferior */
.reading-mode-exit,
body.reading-mode .reading-mode-exit {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: fixed !important;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  right: auto !important;
  top: auto !important;
  z-index: 999999 !important;
  pointer-events: auto !important;

  background: var(--studio-panel, rgba(255, 255, 255, 0.95)) !important;
  border: 1px solid var(--studio-line, rgba(0, 0, 0, 0.15)) !important;
  border-radius: 999px !important;
  padding: 10px 22px !important;
  color: var(--studio-ink, #222) !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25) !important;
  font-family: var(--font-ui, system-ui, -apple-system, sans-serif) !important;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

body.reading-mode .reading-mode-exit:hover {
  background: var(--studio-hover, rgba(255, 255, 255, 1)) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.32) !important;
  transform: translateX(-50%) translateY(-2px) !important;
}

body.reading-mode .reading-mode-exit:active {
  transform: translateX(-50%) translateY(0) !important;
}

.reading-mode-exit-icon {
  font-size: 1rem;
  opacity: 0.85;
}

/* Barra de progreso horizontal en reading mode */
body.reading-mode .chapter-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--studio-accent) var(--progress, 0%),
    transparent var(--progress, 0%)
  );
  z-index: 9001;
  pointer-events: none;
}

/* Ocultar barra vertical en reading mode */
body.reading-mode #chapterProgress {
  display: none;
}

/* En reading mode: mejorar tipografía del verso */
body.reading-mode .verse {
  padding: 4px 0;
  margin-bottom: 2px;
  border-left: none;
  margin-left: 0;
}

body.reading-mode .verse.selected {
  background: color-mix(in srgb, var(--studio-accent) 6%, transparent);
  border-left: 3px solid var(--studio-accent);
  margin-left: -3px;
  padding-left: 3px;
  border-radius: 0 4px 4px 0;
}

body.reading-mode .verse:hover:not(.selected) {
  border-left: 2px solid var(--studio-line);
  margin-left: -2px;
  padding-left: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   6. STRONG INLINE  [data-strong-word]  /  .strong-inline-pill
   ───────────────────────────────────────────────────────────────────────────── */

/* Palabra con Strong: subrayado punteado */
[data-strong-word] {
  cursor: help;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--studio-accent) 45%, transparent);
  text-decoration: none;
  transition:
    border-bottom-color 0.15s ease,
    border-bottom-style 0.15s ease;
}

[data-strong-word]:hover {
  border-bottom-color: var(--studio-accent);
  border-bottom-style: solid;
}

/* Pill flotante de definición */
.strong-inline-pill {
  position: fixed;
  z-index: 800;
  background: var(--studio-panel);
  border: 1px solid var(--studio-line);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: var(--font-ui);
  box-shadow: var(--studio-shadow), 0 4px 16px color-mix(in srgb, var(--studio-accent) 10%, transparent);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  max-width: 260px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.strong-inline-pill.visible {
  opacity: 1;
  transform: translateY(-8px);
}

/* Número Strong */
.strong-pill-num {
  color: var(--studio-accent);
  font-weight: 800;
  font-size: 0.72rem;
  margin-right: 6px;
  font-family: var(--font-ui);
}

/* Definición breve en el pill */
.strong-pill-def {
  color: var(--studio-ink);
  font-size: 0.78rem;
  opacity: 0.9;
}

/* Separador dentro del pill */
.strong-pill-separator {
  display: inline-block;
  margin: 0 4px;
  color: var(--studio-line);
}

/* ─────────────────────────────────────────────────────────────────────────────
   7. UTILIDADES DE TIPOGRAFÍA PARA EL PANEL DE LECTURA
   ───────────────────────────────────────────────────────────────────────────── */

/* Contenedor de versículos */
#content,
.content {
  padding: 16px 20px;
  box-sizing: border-box;
}

/* Párrafo de versículo */
.verse {
  padding: 5px 8px;
  border-radius: 6px;
  cursor: text;
  word-break: break-word;
  hyphens: auto;
}

/* Anotaciones inline */
.verse-note {
  font-size: 0.75rem;
  color: var(--studio-muted);
  vertical-align: super;
  cursor: pointer;
  margin-left: 1px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.verse-note:hover {
  opacity: 1;
  color: var(--studio-accent);
}

/* Título de sección bíblica dentro del contenido */
.section-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--studio-ink);
  margin: 20px 0 8px;
  opacity: 0.85;
  letter-spacing: 0.01em;
}

.section-title-minor {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--studio-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 14px 0 6px;
}

/* Párrafo poético */
.verse.poetic {
  padding-left: 32px;
  font-style: italic;
  opacity: 0.92;
}

.verse.poetic-b {
  padding-left: 48px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   8. BOTÓN DE MODO LECTURA TOGGLE (puede estar en la toolbar)
   ───────────────────────────────────────────────────────────────────────────── */

#readingModeToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
  color: var(--studio-header-text);
  box-shadow: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#readingModeToggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
  border-color: color-mix(in srgb, var(--studio-accent) 55%, rgba(255, 255, 255, 0.2));
  color: var(--studio-header-text);
}

body.reading-mode #readingModeToggle {
  background: color-mix(in srgb, var(--studio-accent) 12%, transparent);
  border-color: var(--studio-accent);
  color: var(--studio-accent);
}

/* ─────────────────────────────────────────────────────────────────────────────
   9. SELECCIÓN DE VERSÍCULO: BARRA DE ACCIONES FLOTANTE
   ───────────────────────────────────────────────────────────────────────────── */

.verse-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 900;
  background: var(--studio-panel);
  border: 1px solid var(--studio-line);
  border-radius: var(--studio-radius-lg);
  padding: 8px 12px;
  display: none;
  gap: 6px;
  align-items: center;
  box-shadow: var(--studio-shadow), 0 8px 32px color-mix(in srgb, #000 20%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transition:
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.2s ease;
}

body.has-verse-selection .verse-action-bar {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.verse-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--studio-radius-md);
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--studio-ink);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
  white-space: nowrap;
}

.verse-action-btn:hover {
  background: var(--studio-hover);
  border-color: var(--studio-line);
}

.verse-action-btn.primary {
  background: var(--studio-accent);
  color: #111827;
  font-weight: 700;
  border-color: var(--studio-accent);
}

.verse-action-btn.primary:hover {
  filter: brightness(1.08);
}

.verse-action-separator {
  width: 1px;
  height: 20px;
  background: var(--studio-line);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   10. RESPONSIVIDAD GENERAL DEL PANEL
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .chapter-editorial-header {
    padding: 14px 16px 10px;
  }

  .chap-deco-number {
    font-size: 6rem;
    right: 8px;
    top: -10px;
  }

  .chap-title {
    font-size: 0.96rem;
  }

  #content,
  .content {
    padding: 12px 14px;
  }

  .filters-toggle {
    padding: 7px 12px 7px 10px;
    border-radius: 12px;
  }

  .verse-action-bar {
    bottom: 16px;
    padding: 6px 8px;
    border-radius: var(--studio-radius-md);
    left: 16px;
    right: 16px;
    transform: translateX(0) translateY(12px);
    width: calc(100% - 32px);
    box-sizing: border-box;
  }

  body.has-verse-selection .verse-action-bar {
    transform: translateX(0) translateY(0);
  }

  .reading-mode-exit {
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    padding: 8px 18px !important;
    font-size: 0.82rem !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22) !important;
  }

  .reading-mode-exit:hover {
    transform: translateX(-50%) translateY(-2px) !important;
  }

  .reading-mode-exit:active {
    transform: translateX(-50%) translateY(0) !important;
  }

  body.reading-mode #content,
  body.reading-mode .content {
    padding: 12px 14px 90px !important;
  }
}

@media (min-width: 601px) and (max-width: 1179px) {
  .chapter-editorial-header {
    padding: 16px 20px 12px;
  }

  .reading-mode-exit {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    top: auto !important;
    padding: 9px 20px !important;
    font-size: 0.86rem !important;
  }

  body.reading-mode #content,
  body.reading-mode .content {
    padding: 16px 20px 90px !important;
  }
}

@media (min-width: 1180px) {
  body.reading-mode #content,
  body.reading-mode .content {
    padding: 16px 24px 90px !important;
    font-size: 1.12rem;
  }

  .chapter-editorial-header {
    padding: 20px 24px 14px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   11. ANIMACIÓN DE ENTRADA PARA VERSÍCULOS (scroll-driven)
   ───────────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .verse[data-animate-in] {
    animation: verseEnter 0.35s ease forwards;
    opacity: 0;
  }

  @keyframes verseEnter {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .chapter-editorial-header {
    animation: headerSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes headerSlideIn {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ═══════════════════════════════════════════════════════════════════
   ESTILO EDITORIAL PARA SELECTORES DE FILTROS (.filters / select)
   ═══════════════════════════════════════════════════════════════════ */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  padding: 12px 14px;
  background: var(--studio-panel, #faf6f0);
  border: 1px solid var(--studio-line, #e2d5c3);
  border-radius: 16px;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(44, 31, 20, 0.05);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-family: var(--font-ui, sans-serif);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--studio-muted, #8a7054);
}

.filter-group select {
  font-family: var(--font-ui, sans-serif);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--studio-ink, #1a0f07);
  background: var(--studio-panel-muted, #f3ede2);
  border: 1px solid var(--studio-line, #dcd0bf);
  border-radius: 12px;
  padding: 8px 30px 8px 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c6248' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-group select:hover:not(:disabled) {
  border-color: var(--studio-accent, #c9a46e);
  background-color: var(--studio-hover, #ede4d3);
  box-shadow: 0 2px 8px rgba(44, 31, 20, 0.08);
}

.filter-group select:focus {
  outline: none;
  border-color: #3a9e8a;
  box-shadow: 0 0 0 3px rgba(58, 158, 138, 0.2);
}

.filter-group select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Respeta preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .filters-collapsible {
    transition: none;
  }

  .filters-toggle-icon {
    transition: none;
  }

  .verse,
  .verse.selected,
  body.reading-mode header,
  body.reading-mode .mode-tabs {
    transition: none;
  }

  .strong-inline-pill {
    transition: opacity 0.05s ease;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   12. TARJETA EDITORIAL DE PREFACIO / INTRODUCCIÓN DEL LIBRO
   ───────────────────────────────────────────────────────────────────────────── */
#content:has(.book-preface-container),
#content.has-preface {
  max-width: 100%;
  box-sizing: border-box;
}

.book-preface-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  animation: fadeInPreface 0.25s ease-out;
  box-sizing: border-box;
  width: 100%;
}

@keyframes fadeInPreface {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.preface-hero {
  position: relative;
  padding: 24px 24px 20px;
  background: var(--studio-surface, var(--studio-panel, rgba(255, 255, 255, 0.6)));
  border: 1px solid var(--studio-line, rgba(0, 0, 0, 0.08));
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.preface-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--studio-hover, rgba(201, 164, 110, 0.15));
  color: var(--studio-accent, #9e783d);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.preface-title {
  font-family: var(--font-title, serif);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--studio-ink, #2c1f14);
  margin: 0 0 16px 0;
  line-height: 1.25;
}

.preface-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--studio-line, rgba(0, 0, 0, 0.1));
}

.preface-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preface-meta-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--studio-muted, #7c6f64);
}

.preface-meta-icon {
  color: var(--studio-accent, #c9a46e);
  flex-shrink: 0;
}

.preface-meta-value {
  font-size: 0.95rem;
  font-weight: 450;
  color: var(--studio-ink, #2c1f14);
  line-height: 1.58;
}

.preface-section-card {
  background: var(--studio-surface, var(--studio-panel, rgba(255, 255, 255, 0.6)));
  border: 1px solid var(--studio-line, rgba(0, 0, 0, 0.08));
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  box-sizing: border-box;
}

.preface-section-card h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title, serif);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--studio-ink, #2c1f14);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--studio-line, rgba(0, 0, 0, 0.06));
}

.preface-card-icon {
  color: var(--studio-accent, #c9a46e);
  flex-shrink: 0;
}

.preface-section-card p {
  font-size: 0.95rem;
  line-height: 1.68;
  color: var(--studio-ink, #2c1f14);
  margin: 0 0 10px 0;
}

.preface-section-card p:last-child {
  margin-bottom: 0;
}

.preface-list {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preface-list li {
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--studio-ink, #2c1f14);
}

.preface-outline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.preface-outline-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  background: var(--studio-hover, rgba(0, 0, 0, 0.02));
  border-radius: 8px;
  border-left: 3px solid var(--studio-accent, #c9a46e);
}

.preface-outline-range {
  font-family: var(--font-ui, monospace);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--studio-accent, #9e783d);
  background: var(--studio-surface, var(--studio-panel, #fff));
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.preface-outline-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--studio-ink, #2c1f14);
  flex: 1;
}

.preface-cta-wrapper {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.preface-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--studio-accent, #c9a46e);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(201, 164, 110, 0.4);
  transition: all 0.2s ease;
}

.preface-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(201, 164, 110, 0.55);
}

.preface-start-btn:active {
  transform: translateY(0);
}

.preface-commentary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 30px;
  border: 1px solid var(--studio-line, rgba(0, 0, 0, 0.12));
  background: var(--studio-surface, var(--studio-panel, rgba(255, 255, 255, 0.6)));
  color: var(--studio-ink, inherit);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.preface-commentary-btn:hover {
  background: var(--studio-hover, rgba(0, 0, 0, 0.05));
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   PREFACIO RESPONSIVE (TABLET & TELÉFONOS MÓVILES)
   Aprovechamiento máximo del ancho de pantalla para facilitar lectura fluida
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #content:has(.book-preface-container),
  #content.has-preface,
  body.reading-mode #content:has(.book-preface-container),
  body.reading-mode #content.has-preface {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .book-preface-container {
    padding: 12px 0 36px;
    width: 100%;
  }

  .preface-hero {
    padding: 20px 18px 16px;
    margin-bottom: 14px;
    border-radius: 12px;
  }

  .preface-section-card {
    padding: 18px 18px;
    margin-bottom: 14px;
    border-radius: 12px;
  }
}

@media (max-width: 600px) {
  #content:has(.book-preface-container),
  #content.has-preface,
  body.reading-mode #content:has(.book-preface-container),
  body.reading-mode #content.has-preface {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  .book-preface-container {
    padding: 4px 0 32px;
    width: 100%;
  }

  .preface-hero {
    padding: 16px 14px 14px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .preface-section-card {
    padding: 15px 14px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .preface-badge {
    padding: 3px 8px;
    font-size: 0.72rem;
    margin-bottom: 10px;
  }

  .preface-title {
    font-size: 1.6rem;
    margin-bottom: 10px;
  }

  .preface-meta-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
  }

  .preface-meta-label {
    font-size: 0.72rem;
  }

  .preface-meta-value {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .preface-section-card h4 {
    font-size: 1.02rem;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  .preface-section-card p {
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 8px;
  }

  .preface-list {
    padding-left: 16px;
    gap: 6px;
  }

  .preface-list li {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .preface-outline-list {
    gap: 6px;
    margin-top: 8px;
  }

  .preface-outline-row {
    padding: 7px 10px;
    gap: 8px;
  }

  .preface-outline-range {
    font-size: 0.76rem;
    padding: 2px 6px;
  }

  .preface-outline-text {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .preface-cta-wrapper {
    margin-top: 20px;
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .preface-start-btn,
  .preface-commentary-btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    font-size: 0.94rem;
    padding: 12px 18px;
  }
}

@media (max-width: 380px) {
  #content:has(.book-preface-container),
  #content.has-preface,
  body.reading-mode #content:has(.book-preface-container),
  body.reading-mode #content.has-preface {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  .preface-hero,
  .preface-section-card {
    padding: 13px 10px;
  }

  .preface-title {
    font-size: 1.42rem;
  }
}

