/* Reader typography — ported from the_outer_tokens/style.css */

/* ---- COVER ---- */

.cover-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: #f8f5f0;
}

.cover-image-wrapper {
  max-width: 400px;
  width: 85%;
  margin-bottom: 2.5rem;
}

.cover-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.cover-enter {
  display: inline-block;
  text-decoration: none;
  color: #8a817a;
  font-size: 0.82rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 0.5rem 1.5rem;
  border: 1px solid #d6d0c8;
  transition: color 0.2s, border-color 0.2s;
}

.cover-enter:hover {
  color: #1c1917;
  border-color: #1c1917;
}

/* ---- TABLE OF CONTENTS ---- */

.contents-page {
  max-width: 680px;
  padding-top: 4rem;
}

/* TOC Hero: cover + info side by side */
.toc-hero {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.toc-hero-cover {
  width: 180px;
  flex-shrink: 0;
}

.toc-hero-cover img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border-radius: 2px;
}

.toc-hero-info {
  flex: 1;
  min-width: 0;
  padding-top: 0.5rem;
}

.toc-hero-info .book-title {
  text-align: left;
}

.toc-hero-info .book-subtitle {
  text-align: left;
  margin-bottom: 1rem;
}

.toc-hero-description {
  font-size: 0.9rem;
  font-style: italic;
  color: #8a817a;
  line-height: 1.65;
  margin-bottom: 0;
}

.toc-hero-description-solo {
  text-align: center;
  margin-bottom: 2rem;
}

.book-title {
  font-size: 2.2rem;
  font-weight: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1c1917;
  text-align: center;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.book-subtitle {
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8a817a;
  text-align: center;
  margin-bottom: 3rem;
}

.toc-heading {
  font-size: 0.72rem;
  font-weight: normal;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a817a;
  margin-bottom: 1rem;
}

.toc {
  border-top: 1px solid #d6d0c8;
  padding-top: 0;
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 0;
  border-bottom: 1px solid #eae6e0;
}

.toc-list li:first-child {
  border-top: none;
}

.toc-list a {
  text-decoration: none;
  color: #1c1917;
  display: flex;
  align-items: baseline;
  padding: 1rem 0.75rem;
  border-radius: 4px;
  transition: color 0.15s, background-color 0.15s, padding-left 0.2s ease;
}

.toc-list a:hover {
  color: #6b5c4d;
  background-color: rgba(0, 0, 0, 0.03);
  padding-left: 1.1rem;
}

.toc-chapter-number {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8a817a;
  min-width: 7rem;
  flex-shrink: 0;
}

.toc-chapter-title {
  font-style: italic;
  font-size: 1.1rem;
  flex: 1;
}

/* ---- TOC PROGRESS ---- */

.continue-reading {
  text-align: center;
  margin-bottom: 1.5rem;
}

.continue-reading a {
  display: inline-block;
  text-decoration: none;
  color: #8a817a;
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.6rem 1.5rem;
  border: 1px solid #d6d0c8;
  transition: color 0.2s, border-color 0.2s;
}

.continue-reading a:hover {
  color: #1c1917;
  border-color: #1c1917;
}

.toc-progress {
  height: 2px;
  background: #eae6e0;
  overflow: hidden;
}

.toc-progress:empty {
  background: transparent;
}

.toc-progress-fill {
  height: 100%;
  background: var(--book-accent, #a39890);
}

.toc-progress.complete .toc-progress-fill {
  background: var(--book-accent, #8a817a);
}

.toc-home {
  text-align: center;
  margin-top: 2.5rem;
}

.toc-home a {
  text-decoration: none;
  color: #8a817a;
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.toc-home a:hover {
  color: #1c1917;
}

html.theme-sepia .toc-home a {
  color: var(--fg-muted);
}

html.theme-sepia .toc-home a:hover {
  color: var(--fg);
}

html.theme-dark .toc-home a {
  color: var(--fg-muted);
}

html.theme-dark .toc-home a:hover {
  color: var(--fg);
}

/* ---- CHAPTER PAGES ---- */

.chapter-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #d6d0c8;
}

.chapter-number {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #8a817a;
  margin-bottom: 0.75rem;
}

.chapter-title {
  font-size: 1.8rem;
  font-weight: normal;
  font-style: italic;
  color: #1c1917;
  line-height: 1.3;
}

/* ---- CHAPTER BODY ---- */

.chapter-body p {
  margin-bottom: 1.35rem;
  text-indent: 0;
}

.chapter-body p + p {
  text-indent: 1.5em;
}

/* Drop cap on first real paragraph (skips epigraph) */
.chapter-body > p:first-of-type::first-letter {
  font-size: 3.2em;
  float: left;
  line-height: 0.82;
  margin-right: 0.06em;
  margin-top: 0.06em;
  color: #1c1917;
}

/* Epigraph / chapter-opening blockquote */
.epigraph {
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #5a524a;
  margin: 0 0 3rem 0;
  padding: 0 1rem;
  border-left: 2px solid #d6d0c8;
}

.epigraph p {
  margin-bottom: 0.3rem;
  text-indent: 0 !important;
}

.epigraph-source {
  margin-top: 0.4rem;
  font-size: 0.82em;
  color: #8a817a;
}

/* No indent after section break, scripture, or epigraph */
.chapter-body .section-break + p,
.chapter-body .scripture + p,
.chapter-body .epigraph + p {
  text-indent: 0;
}

.chapter-body em {
  font-style: italic;
}

/* Section breaks — middle dots */
.section-break {
  text-align: center;
  margin: 2.4rem 0;
  color: #b5ada5;
  font-size: 1rem;
  letter-spacing: 0.5em;
  user-select: none;
}

/* Scripture / block fragments */
.scripture {
  font-style: italic;
  text-indent: 0 !important;
  margin: 1.8rem 0 1.8rem 2.5rem;
  line-height: 1.7;
  color: #3d3630;
}

/* ---- CHAPTER NAVIGATION ---- */

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #d6d0c8;
}

.chapter-nav a {
  text-decoration: none;
  color: #8a817a;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.chapter-nav a:hover {
  color: #1c1917;
}

.chapter-nav .nav-hidden {
  visibility: hidden;
}

/* ---- PAGED READER ---- */

.pager-viewport {
  overflow: hidden;
  flex: 1;
  position: relative;
}

.pager-viewport .chapter-body {
  column-fill: auto;
  column-gap: 80px;
  height: 100%;
  transition: transform 0.3s ease-out;
  will-change: transform;
}

/* Break-avoidance rules */
.pager-viewport .chapter-header,
.pager-viewport .epigraph,
.pager-viewport .section-break,
.pager-viewport .scripture {
  break-inside: avoid;
}

.pager-viewport .section-break {
  break-after: avoid;
}

.pager-viewport p {
  orphans: 2;
  widows: 2;
}

/* Page indicator — fixed to bottom of viewport so font-size changes can't shift it */
.page-indicator {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 640px;
  padding: 8px 24px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a817a;
  user-select: none;
  background: #f8f5f0;
  z-index: 10;
}

.indicator-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.indicator-row-nav {
  margin-bottom: 4px;
  gap: 4px;
  font-size: 11px;
}

.indicator-row-pages {
  position: relative;
  justify-content: center;
}

.indicator-link {
  text-decoration: none;
  color: #8a817a;
  transition: color 0.15s;
}

.indicator-link:hover {
  color: #1c1917;
}

.indicator-sep {
  color: #d6d0c8;
  font-size: 10px;
}

html.theme-sepia .indicator-link {
  color: var(--fg-muted);
}

html.theme-sepia .indicator-link:hover {
  color: var(--fg);
}

html.theme-sepia .indicator-sep {
  color: var(--border);
}

html.theme-dark .indicator-link {
  color: var(--fg-muted);
}

html.theme-dark .indicator-link:hover {
  color: var(--fg);
}

html.theme-dark .indicator-sep {
  color: var(--border);
}

.page-indicator::before {
  content: none;
}

/* Page turn buttons */
.page-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.page-nav-btn {
  background: none;
  border: none;
  color: #8a817a;
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  transition: color 0.15s;
  font-family: Georgia, 'Times New Roman', serif;
}

.page-nav-btn:hover {
  color: #1c1917;
}

html.theme-sepia .page-nav-btn {
  color: var(--fg-muted);
}

html.theme-sepia .page-nav-btn:hover {
  color: var(--fg);
}

html.theme-dark .page-nav-btn {
  color: var(--fg-muted);
}

html.theme-dark .page-nav-btn:hover {
  color: var(--fg);
}

@media (max-width: 680px) {
  .page-indicator {
    padding: 10px 20px;
  }
}

@media (max-width: 420px) {
  .page-indicator {
    padding: 10px 16px;
  }
}

/* Running header — shows chapter/title on pages 2+ */
.running-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #b5ada5;
  padding: 0 0 8px 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.running-header.visible {
  opacity: 1;
}

html.theme-sepia .running-header {
  color: var(--fg-muted);
}

html.theme-dark .running-header {
  color: var(--fg-muted);
}

/* Click zone cursor hints */
html.paged-mode .pager-viewport {
  cursor: e-resize;
}

/* ---- SETTINGS PANEL ---- */

.settings-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid #d6d0c8;
  color: #8a817a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  padding: 2px 7px;
  cursor: pointer;
  letter-spacing: 0.04em;
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}

.settings-toggle:hover,
.settings-toggle[aria-expanded="true"] {
  color: #1c1917;
  border-color: #1c1917;
}

html.theme-sepia .settings-toggle {
  border-color: var(--border);
  color: var(--fg-muted);
}

html.theme-sepia .settings-toggle:hover,
html.theme-sepia .settings-toggle[aria-expanded="true"] {
  color: var(--fg);
  border-color: var(--fg);
}

html.theme-dark .settings-toggle {
  border-color: var(--border);
  color: var(--fg-muted);
}

html.theme-dark .settings-toggle:hover,
html.theme-dark .settings-toggle[aria-expanded="true"] {
  color: var(--fg);
  border-color: var(--fg);
}

.settings-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: #f8f5f0;
  border: 1px solid #d6d0c8;
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  z-index: 50;
  min-width: 180px;
}

html.theme-sepia .settings-panel {
  background: #ede3d0;
  border-color: var(--border);
}

html.theme-dark .settings-panel {
  background: #252525;
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.settings-row + .settings-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eae6e0;
}

html.theme-dark .settings-row + .settings-row {
  border-top-color: var(--border);
}

html.theme-sepia .settings-row + .settings-row {
  border-top-color: var(--border);
}

.font-btn {
  background: none;
  border: 1px solid #d6d0c8;
  color: #1c1917;
  font-family: Georgia, 'Times New Roman', serif;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 14px;
  transition: color 0.15s, border-color 0.15s;
}

.font-btn:hover {
  border-color: #1c1917;
}

html.theme-dark .font-btn {
  border-color: var(--border);
  color: var(--fg);
}

html.theme-dark .font-btn:hover {
  border-color: var(--fg);
}

html.theme-sepia .font-btn {
  border-color: var(--border);
  color: var(--fg);
}

html.theme-sepia .font-btn:hover {
  border-color: var(--fg);
}

.font-label {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #8a817a;
  min-width: 40px;
  text-align: center;
}

html.theme-dark .font-label,
html.theme-sepia .font-label {
  color: var(--fg-muted);
}

.theme-row {
  gap: 5px;
}

.theme-btn {
  background: none;
  border: 1px solid #d6d0c8;
  color: #8a817a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 7px;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.theme-btn:hover {
  color: #1c1917;
  border-color: #1c1917;
}

.theme-btn.active {
  background-color: #1c1917;
  border-color: #1c1917;
  color: #f8f5f0;
}

html.theme-dark .theme-btn {
  border-color: var(--border);
  color: var(--fg-muted);
}

html.theme-dark .theme-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}

html.theme-dark .theme-btn.active {
  background-color: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

/* ---- PREVIEW ---- */

.preview-banner {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 3px;
  padding: 4px 12px;
  margin-bottom: 16px;
}

html.theme-dark .preview-banner {
  color: #fbbf24;
  background: #3a2a0a;
  border-color: #92400e;
}

.toc-version-badge {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  color: #4a6fa5;
  background: #e8f0fe;
  border: 1px solid #93b4e0;
  border-radius: 2px;
  padding: 1px 4px;
  margin-left: 6px;
  vertical-align: middle;
}

html.theme-dark .toc-version-badge {
  color: #7cacf0;
  background: #1a2a40;
  border-color: #2e4a6e;
}

.toc-draft-badge {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 2px;
  padding: 1px 4px;
  margin-left: 6px;
  vertical-align: middle;
}

html.theme-dark .toc-draft-badge {
  color: #fbbf24;
  background: #3a2a0a;
  border-color: #92400e;
}

/* ---- PREVIEW NOTIFICATIONS ---- */

.notify-list {
  list-style: none;
  padding: 0;
  border-top: 1px solid #d6d0c8;
}

.notify-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eae6e0;
}

.notify-chapter {
  font-size: 0.9rem;
  color: #1c1917;
}

.notify-sent {
  font-size: 0.78rem;
  color: #8a817a;
  white-space: nowrap;
}

.notify-send-btn {
  background: none;
  border: 1px solid #d6d0c8;
  color: #8a817a;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 14px;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.notify-send-btn:hover {
  color: #1c1917;
  border-color: #1c1917;
}

.notify-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

html.theme-dark .notify-list {
  border-top-color: var(--border);
}

html.theme-dark .notify-item {
  border-bottom-color: var(--border);
}

html.theme-dark .notify-chapter {
  color: var(--fg);
}

html.theme-dark .notify-sent {
  color: var(--fg-muted);
}

html.theme-dark .notify-send-btn {
  border-color: var(--border);
  color: var(--fg-muted);
}

html.theme-dark .notify-send-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}

/* ---- RESPONSIVE ---- */

@media (max-width: 680px) {
  .cover-image-wrapper {
    max-width: 300px;
  }

  .book-title {
    font-size: 1.7rem;
  }

  .chapter-title {
    font-size: 1.5rem;
  }

  .chapter-body > p:first-of-type::first-letter {
    font-size: 2.8em;
  }

  .scripture {
    margin-left: 1.5rem;
  }

  .toc-chapter-number {
    min-width: 5.5rem;
  }

  .toc-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .toc-hero-cover {
    width: 150px;
  }

  .toc-hero-info .book-title,
  .toc-hero-info .book-subtitle {
    text-align: center;
  }
}

@media (max-width: 420px) {
  .chapter-nav {
    font-size: 0.72rem;
  }

  .toc-list a {
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 1rem 0.5rem;
  }

  .toc-hero-cover {
    width: 120px;
  }
}
