/* ═══════════════════════════════════════════════════════
   reader.css — Plataforma Lectora "Funcionó. Y era hora."
   Diseño editorial: papel/tinta, sin estética de AulaGenIA
   ═══════════════════════════════════════════════════════ */

/* ─── TOKENS ──────────────────────────────────────────── */
:root {
  --paper:      #FAF8F4;
  --paper-2:    #F0EBE3;
  --paper-3:    #E8E0D4;
  --ink:        #1C1917;
  --ink-soft:   #57534E;
  --ink-muted:  #A8A29E;
  --accent:     #8B5E3C;
  --accent-lt:  #C49A6C;
  --teal:       #0f766e;
  --teal-lt:    #14b8a6;
  --rule:       #DDD7CF;
  --white:      #ffffff;
  --sidebar-w:  260px;
  --player-h:   72px;
  --reading-max: 680px;
  --font-serif: 'Libre Baskerville', Georgia, serif;
  --font-sans:  'Plus Jakarta Sans', system-ui, sans-serif;
}

[data-theme="dark"] {
  --paper:     #0f172a;
  --paper-2:   #1e293b;
  --paper-3:   #334155;
  --ink:       #e2e8f0;
  --ink-soft:  #94a3b8;
  --ink-muted: #64748b;
  --rule:      #334155;
  --white:     #1e293b;
}

/* ─── RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  background: var(--paper);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* ─── LAYOUT SHELL ────────────────────────────────────── */
.reader-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.sidebar-book-title {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 2px;
}

.sidebar-book-author {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}

.sidebar-progress-wrap {
  padding: 10px 20px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.sidebar-progress-label {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.sidebar-progress-bar {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.sidebar-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-lt));
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }

.sidebar-cap-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.35;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-cap-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.sidebar-cap-btn.active {
  border-left-color: var(--teal);
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
}

.sidebar-cap-btn.done .cap-check {
  color: var(--teal);
}

.cap-check {
  font-size: 0.65rem;
  flex-shrink: 0;
  color: var(--rule);
  transition: color 0.2s;
}

.cap-num-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: block;
}

.cap-progress-track {
  width: 100%;
  height: 2px;
  background: var(--rule);
  border-radius: 1px;
  margin-top: 6px;
  overflow: hidden;
}

.cap-progress-fill {
  height: 100%;
  background: var(--teal);
  transition: width 0.3s ease;
}

/* ─── TOGGLE SIDEBAR (mobile) ─────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 90;
}

/* ─── MAIN CONTENT ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + 48px);
  display: flex;
  flex-direction: column;
}

/* ─── TOP BAR ─────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 32px;
  gap: 16px;
}

.top-bar-progress {
  flex: 1;
  max-width: 400px;
}

.top-progress-bar {
  height: 2px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.top-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-lt));
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.top-progress-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--ink-muted);
}

/* ─── CHAPTER DISPLAY ─────────────────────────────────── */
.chapter-display {
  max-width: calc(var(--reading-max) + 96px);
  margin: 0 auto;
  padding: 56px 48px;
  width: 100%;
  animation: fadeIn 0.4s ease;
}

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

/* ─── CHAPTER HEADER ──────────────────────────────────── */
.cap-header {
  max-width: var(--reading-max);
  margin: 0 auto 4rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.cap-label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  display: block;
}

.cap-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
  display: block;
}

.cap-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.cap-header h1 .subtitle {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.78em;
  margin-top: 0.25em;
}

.cap-intro {
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.75;
  font-style: italic;
  max-width: var(--reading-max);
}

/* ─── CHAPTER BODY ────────────────────────────────────── */
.cap-body,
.credits-body,
.cta-container,
.author-body {
  max-width: var(--reading-max);
  margin: 0 auto;
}

.cap-section {
  margin-bottom: 0;
}

.cap-num {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.75rem;
  display: block;
}

.cap-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 2.5rem;
}

/* ─── PARAGRAPHS ──────────────────────────────────────── */
.cap-body p,
.credits-body p,
.cta-container p,
.author-body p,
.credits-body div,
.author-body div {
  max-width: var(--reading-max);
  margin: 0 0 1.5rem;
  color: var(--ink);
}

.cap-body p:last-child,
.credits-body p:last-child,
.cta-container p:last-child,
.author-body p:last-child { margin-bottom: 0; }

/* Drop cap */
.drop-cap::first-letter {
  font-size: 3.6rem;
  font-weight: 700;
  float: left;
  line-height: 0.8;
  margin-right: 0.08em;
  margin-top: 0.12em;
  color: var(--accent);
}

/* ─── READING HIGHLIGHT (Word-by-word) ──────── */
.word-wrap {
  display: inline-block;
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 2px;
  padding: 0 1px;
  margin: 0 -1px;
}

.word-highlight {
  background: var(--accent-lt);
  color: var(--white) !important;
}

[data-theme="dark"] .word-highlight {
  background: var(--accent);
  color: var(--white) !important;
}

/* Opcional: atenuar palabras ya leídas o dejarlas normales */
.word-read {
  /* color: var(--ink-soft); */
}


/* ─── BLOCKQUOTE / PULL QUOTE ─────────────────────────── */
.cap-body .blockquote,
.cap-body blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding: 1rem 0 1rem 1.75rem;
  margin: 2.5rem 0;
  max-width: var(--reading-max);
}

/* ─── HR / RULE ───────────────────────────────────────── */
.cap-body hr,
.cap-body hr.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem auto;
  max-width: var(--reading-max);
}

/* ─── END MARK ────────────────────────────────────────── */
.end-mark {
  text-align: center;
  color: var(--rule);
  font-size: 1.25rem;
  margin-top: 4rem;
  letter-spacing: 0.5em;
}

/* ─── PROMPT BOX (cap-01 y guia) ─────────────────────── */
.prompt-box {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--teal);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

.prompt-box .label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.75rem;
}

/* ─── INLINE ──────────────────────────────────────────── */
.cap-body em { font-style: italic; }
.cap-body strong { font-weight: 700; color: var(--ink); }

/* ═══════════════════════════════════════════════════════════
   UNNUMBERED CHAPTERS (Créditos, Próximos Pasos, Autora)
   Matches the editorial standard of numbered chapters.
   ═══════════════════════════════════════════════════════════ */

/* Page wrapper (used by Créditos) */
.page {
  max-width: var(--reading-max);
  margin: 0 auto;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--ink);
}

/* Page top header block */
.page-top {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.book-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.book-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.page-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

/* Credits body */
.credits-body {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--ink);
}

.copyright-main {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.copyright-secondary {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.copyright-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

/* Meta info block (ISBN, Editorial, etc.) */
.meta-block {
  margin: 1.5rem 0;
}

.meta-row {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.meta-row .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

/* Inner rule divider */
.rule-inner,
hr.rule-inner {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

hr.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

/* Disclaimer */
.disclaimer-title {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 1rem;
}

.disclaimer-text {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.75;
}

.disclaimer-text p {
  margin-bottom: 1rem;
}

/* Page footer */
.page-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.footer-author {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* CTA section (Próximos Pasos) */
.cta-container {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--ink);
  text-align: center;
  max-width: var(--reading-max);
  margin: 0 auto;
}

.cta-container p {
  margin-bottom: 1.5rem;
}

.cta-link-wrapper {
  margin: 2rem 0;
}

.cta-link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.cta-link:hover {
  border-bottom-color: var(--teal);
}

/* Author bio section (Sobre la Autora) */
.photo-container {
  text-align: center;
  margin: 2rem 0;
}

.author-photo {
  max-width: 200px;
  width: 100%;
  border-radius: 50%;
  border: 3px solid var(--rule);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.bio-text {
  max-width: var(--reading-max);
  margin: 0 auto;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--ink);
}

.bio-text p {
  margin-bottom: 1.5rem;
}

/* ─── CHAPTER NAV (prev/next) ─────────────────────────── */
.chapter-nav {
  max-width: calc(var(--reading-max) + 96px);
  margin: 0 auto;
  padding: 0 48px 48px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 12px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  max-width: 48%;
}

.nav-btn:hover {
  background: var(--paper-2);
  border-color: var(--ink-muted);
  color: var(--ink);
  transform: translateX(-2px);
}

.nav-btn.next:hover { transform: translateX(2px); }

.nav-btn-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: block;
}

.nav-btn-title {
  color: var(--ink);
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── CTA AULAGENIA (último capítulo) ─────────────────── */
.cta-aula {
  max-width: calc(var(--reading-max) + 96px);
  margin: 0 auto 64px;
  padding: 0 48px;
}

.cta-aula-inner {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--teal);
  border-radius: 6px;
  padding: 40px;
  text-align: center;
}

.cta-aula-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 16px;
}

.cta-aula-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.3;
}

.cta-aula-body {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
  line-height: 1.7;
}

.cta-aula-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--teal), var(--teal-lt));
  border: none;
  padding: 14px 32px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
  box-shadow: 0 4px 14px rgba(15,118,110,0.25);
}

.cta-aula-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15,118,110,0.35);
}

/* ─── AUDIO PLAYER (sticky bottom) ───────────────────── */
.audio-player {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--player-h);
  background: var(--white);
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 80;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

.audio-player.hidden { display: none; }

.player-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.player-btn:hover { background: var(--paper-2); color: var(--teal); }

.player-play {
  width: 40px;
  height: 40px;
  background: var(--teal);
  border-radius: 50%;
  color: white;
  flex-shrink: 0;
}

.player-play:hover { background: var(--teal-lt); }

.player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-chapter {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-time {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--ink-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.player-track {
  flex: 1;
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.player-track-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-lt));
  border-radius: 2px;
  pointer-events: none;
  width: 0%;
}

.player-track:hover .player-track-fill { background: var(--teal); }

.player-track-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 12px;
  height: 12px;
  background: var(--teal);
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.15s;
}

.player-track:hover .player-track-thumb { transform: translate(-50%, -50%) scale(1); }

.player-speed {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3px 7px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.player-speed:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* Skip buttons (-10s / +10s) */
.player-skip {
  position: relative;
  width: 34px;
  height: 34px;
}

.player-skip .skip-label {
  position: absolute;
  font-family: var(--font-sans);
  font-size: 0.5rem;
  font-weight: 800;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: inherit;
  line-height: 1;
  margin-top: 1px;
}

.player-no-audio {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-style: italic;
}

/* Auto-scroll toggle */
.player-autoscroll {
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
}

.player-autoscroll.active {
  opacity: 1;
  color: var(--teal);
}

/* Sleep timer */
.player-sleep-btn {
  position: relative;
}

.player-sleep-btn.active {
  color: var(--accent);
}

.sleep-label {
  font-family: var(--font-sans);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--accent);
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Audio icon in sidebar */
.cap-audio-icon {
  flex-shrink: 0;
  color: var(--ink-muted);
  opacity: 0.5;
  margin-left: auto;
}

/* ─── FONT SIZE BUTTONS ──────────────────────────────── */
.font-size-btn {
  font-weight: 800;
  min-width: 32px;
  justify-content: center;
  font-size: 0.72rem;
}

/* ─── READING TIME BADGE ─────────────────────────────── */
.reading-time {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0.5rem;
}

.reading-time svg {
  opacity: 0.6;
}

/* ─── RESUME TOAST ───────────────────────────────────── */
.resume-toast {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  border-radius: 10px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  animation: toastSlideUp 0.4s ease;
  max-width: calc(100vw - 40px);
}

.resume-toast.hidden { display: none; }

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.resume-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resume-btn {
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.resume-btn:hover { background: var(--teal-lt); }

.resume-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.resume-dismiss:hover { color: white; }

/* ─── SHARE QUOTE TOOLTIP ────────────────────────────── */
.share-tooltip {
  position: fixed;
  z-index: 300;
  background: var(--ink);
  color: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  padding: 4px;
  animation: fadeIn 0.15s ease;
}

.share-tooltip.hidden { display: none; }

.share-tooltip-btn {
  background: none;
  border: none;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  white-space: nowrap;
}

.share-tooltip-btn:hover { background: rgba(255,255,255,0.12); }

/* ─── LOADING / GATE ──────────────────────────────────── */
.reader-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--paper);
}

.gate-card {
  text-align: center;
  padding: 48px 32px;
  max-width: 380px;
}

.gate-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}

.gate-body {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
  line-height: 1.7;
}

.gate-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--rule);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }

  .sidebar-overlay.open { display: block; }

  .sidebar-toggle { display: flex; }

  .main-content { margin-left: 0; }

  .chapter-display { padding: 48px 24px; }

  .chapter-nav { padding: 0 24px 40px; }

  .cta-aula { padding: 0 24px; }

  .top-bar { padding: 10px 20px; }

  /* ─── MOBILE PLAYER: 2 rows ─────────────────────────── */
  .audio-player {
    left: 0;
    height: auto;
    flex-wrap: wrap;
    padding: 8px 16px 10px;
    gap: 6px;
  }

  /* Row 1: Seek bar full width */
  .player-info {
    order: -1;
    width: 100%;
    flex: none;
  }

  .player-chapter { display: none; }

  .player-timeline { gap: 10px; }

  .player-track {
    height: 12px;
    border-radius: 6px;
  }
  .player-track-fill { border-radius: 6px; }
  .player-track-thumb {
    width: 18px; height: 18px;
    transform: translate(-50%, -50%) scale(1);
  }

  .player-time { font-size: 0.72rem; }

  /* Row 2: Controls centered */
  /* Hide prev/next cap — skip ±10s are more useful */
  #player-prev-cap, #player-next-cap { display: none; }

  .player-skip { width: 38px; height: 38px; }
  .player-skip .skip-label { font-size: 0.55rem; }

  .player-play { width: 44px; height: 44px; }

  .player-speed { padding: 3px 8px; font-size: 0.7rem; }

  /* Bottom padding for content so player doesn't cover text */
  .main-content { padding-bottom: 120px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }

  .chapter-display { padding: 36px 20px; }

  .cap-header { margin-bottom: 2.5rem; }

  .nav-btn-title { display: none; }

  /* Reducimos padding del botón de velocidad para que ocupe menos */
  .player-speed { padding: 2px 5px; font-size: 0.65rem; }

  .cta-aula-inner { padding: 28px 20px; }
}

/* ─── ESTILOS SOBRE LA AUTORA ────────────────────────── */
.photo-container {
  text-align: center;
  margin-bottom: 2rem;
  margin-top: 2rem;
}
.author-photo {
  width: 120px;
  max-width: 100%;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--border-color, #E5E0D8);
  filter: grayscale(15%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.bio-text {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.8;
}
.bio-text p {
  margin-bottom: 1.5rem;
}
