/* The book title leads every guide, retaining the original display typography. */
.hero h1.book-title {
  display: block;
  max-width: 1100px;
  margin-inline: auto;
  line-height: 1.08;
  text-wrap: balance;
}
.hero h1.book-title + .sub {
  text-wrap: balance;
  line-height: 1.5;
}

/* Let the footer wrap as whole items instead of splitting the completion pill. */
.card .more {
  flex-wrap: wrap;
  gap: 8px 12px;
}
.card .more .done-badge {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.4;
  margin-left: auto;
}

/* Keep the reading controls visible while only the explanation scrolls. */
#dlg[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
#dlg .dlg-head,
#dlg .dlg-foot {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}
#dlg .dlg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
#dlg .dlg-foot {
  flex-wrap: nowrap;
  gap: 12px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 14px 26px max(14px, env(safe-area-inset-bottom));
}
#dlg .dlg-foot .btn { min-height: 44px; }
#dlg .x { min-width: 44px; min-height: 44px; }
#dlg .reading-point { min-width: 0; }
#dlg .reading-point > b { display: block; margin-bottom: 5px; }
.reading-card-hint { color: var(--muted); line-height: 1.6; margin: -4px 0 22px; }
@media (max-width: 600px) {
  #dlg .dlg-head { padding: 18px 16px 14px; gap: 12px; }
  #dlg .dlg-head .ico { width: 40px; height: 40px; }
  #dlg .dlg-head h3 { font-size: 1.45rem; line-height: 1.2; }
  #dlg .dlg-body { padding: 16px; }
  #dlg .dlg-foot { padding-inline: 16px; gap: 10px; }
  #dlg .dlg-foot .btn { padding: 11px 12px; font-size: .8rem; white-space: nowrap; }
}

/* Tarjetas de capítulo: <article> con un botón real ("Explorar"). Toda la tarjeta sigue abriendo el diálogo. */
.map .card { cursor: pointer; }
.card .card-lead {
  font-weight: 400;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.card .card-open {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}
.card .card-open:focus-visible { outline: 2px solid var(--edge, var(--accent)); outline-offset: 4px; }
.card:has(.card-open:focus-visible) { box-shadow: var(--shadow); }
