/**
 * YERENWG VENTURES - Magazine Reader CSS (CLEAN VERSION)
 * Simple two-column layout: content fills left column first, then right
 */

/* ==================== VARIABLES ==================== */
:root {
  --bg: #fafafa;
  --page-bg: #ffffff;
  --text: #1a1a1a;
  --text-light: #4a4a4a;
  --muted: #888888;
  --accent: #008751;  /* Nigeria Green */
  --accent-hover: #a04a1e;
  --success: #2e7d32;
  --border: #e0e0e0;
  --shadow: rgba(0,0,0,0.08);
  --shadow-heavy: rgba(0,0,0,0.15);
  
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  
  --page-padding: 50px;
}

/* Dark mode */
body.night-mode {
  --bg: #1a1a1a;
  --page-bg: #2a2a2a;
  --text: #e0e0e0;
  --text-light: #b0b0b0;
  --border: #404040;
}

/* ==================== RESET & BASE ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  font-size: 16px;  /* Increased from 15px for better web readability */
  line-height: 1.7;  /* Slightly more line spacing */
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
}

/* ==================== COVER PAGE ==================== */
.cover-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2c5530 0%, #1a3d1f 100%);
  color: white;
  text-align: center;
  padding: 60px 20px;
}

.cover-content {
  max-width: 1000px;
  display: flex;
  align-items: center;
  gap: 60px;
  animation: fadeInUp 1s ease-out;
}

.cover-image-container {
  flex: 0 0 auto;
  min-width: 350px;
}

.cover-image {
  max-width: 400px;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  border: 3px solid rgba(255,255,255,0.2);
}

.book-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  margin: 20px 0;
  text-shadow: 2px 4px 8px rgba(0,0,0,0.3);
}

.author {
  font-size: 24px;
  font-style: italic;
  margin: 20px 0 30px;
  opacity: 0.95;
}

.tagline {
  font-size: 20px;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto 40px;
  opacity: 0.9;
}

.cover-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.start-reading-btn, .toc-btn {
  padding: 15px 35px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: var(--font-sans);
}

.start-reading-btn {
  background: #ffd700;
  color: #1a3d1f;
}

.start-reading-btn:hover {
  background: #ffed4e;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,215,0,0.4);
}

.toc-btn {
  background: transparent;
  border: 2px solid white;
  color: white;
}

.toc-btn:hover {
  background: rgba(255,255,255,0.1);
}

.series-badge {
  display: inline-block;
  padding: 8px 20px;
  background: rgba(255,215,0,0.2);
  border: 2px solid #ffd700;
  border-radius: 25px;
  font-size: 12px;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffd700;
  margin-bottom: 30px;
}

.title-formatted {
  text-align: left;
}

.title-main {
  font-size: 96px;  /* Large, prominent title size */
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;  /* Arial/sans-serif font */
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 15px;
  color: white;
  text-transform: uppercase;
}

.title-main-only {
  font-size: 96px;  /* Large, prominent title size (matches .title-main) */
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;  /* Arial/sans-serif font */
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 15px;
  color: white;
  text-transform: uppercase;
}

.title-subtitle {
  font-size: 24px;
  font-weight: 300;
  line-height: 1.4;
  color: #ffd700;
  font-family: var(--font-serif);
}

@media (max-width: 900px) {
  .cover-content {
    flex-direction: column;
    text-align: center;
  }
  
  .cover-image-container {
    min-width: 0;
  }
  
  .cover-image {
    max-width: 300px;
  }
  
  .title-main {
    font-size: 48px;  /* Responsive: scaled down for mobile (50% of desktop 96px) */
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;  /* Maintain Arial on mobile */
  }
  
  .title-main-only {
    font-size: 48px;  /* Responsive: scaled down for mobile (50% of desktop 96px) */
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;  /* Maintain Arial on mobile */
  }
  
  .title-subtitle {
    font-size: 18px;
  }
}

/* ==================== NAVIGATION ==================== */
.book-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--page-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px var(--shadow);
  padding: 15px 20px;
  display: none;
}

.book-nav.visible {
  display: block;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-controls {
  display: flex;
  gap: 10px;
}

.nav-btn, .nav-icon {
  background: var(--page-bg);
  border: 1px solid var(--border);
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.nav-btn:hover, .nav-icon:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ==================== TWO-COLUMN MAGAZINE LAYOUT ==================== */
.reader-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 20px;
}

.magazine-pages {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Loader and single-chapter spacing for paginated mode */
.magazine-pages.loading::before {
  content: 'Loading…';
  display: block;
  padding: 20px;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
}

.magazine-pages > article.page.chapter:first-child {
  margin-top: 10px;
}

.page {
  background: var(--page-bg);
  padding: var(--page-padding);
  box-shadow: 0 8px 30px var(--shadow);
  border-radius: 8px;
  margin-bottom: 60px;
  
  /* CLEAN TWO-COLUMN SETUP */
  column-count: 2;
  column-gap: 40px;
  column-rule: 1px solid var(--border);
  
  /* Typography */
  font-size: 16px;  /* Increased from 15px for better web readability */
  line-height: 1.7;  /* Slightly more spacing */
  text-align: left;
}

.chapter {
  scroll-margin-top: 100px;
}

/* Mobile: single column */
@media (max-width: 768px) {
  .page {
    column-count: 1;
    padding: 30px 20px;
  }
}

/* ==================== TYPOGRAPHY ==================== */

/* Hide duplicate chapter-title (the one that just says "Chapter 1") */
.chapter-title {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Chapter Titles: Styled in two parts (JavaScript splits them) */
.page.chapter h1 {
  margin: 40px 0 30px;
  text-align: left !important;  /* Force left alignment */
  border: none;
  line-height: 1;
  display: block !important;  /* Block instead of flex */
  width: auto !important;  /* Don't stretch full width */
  max-width: fit-content;  /* Only as wide as content */
}

/* "CHAPTER X:" - Gold, small, uppercase (like front matter titles) */
.page.chapter h1 .chapter-number {
  font-size: 18px;
  font-weight: 600;
  color: #d4af37 !important;  /* Gold color from front matter */
  text-transform: uppercase;
  letter-spacing: 3px;
  font-family: var(--font-sans);
  display: block;
  margin-bottom: 40px;  /* DOUBLE line spaces below */
  text-align: left;
}

/* "THE BEAUTIFUL DAMSEL" - Solid, bold, larger */
.page.chapter h1 .chapter-name {
  font-size: 36px;
  font-weight: 900 !important;  /* Ultra-bold - force it! */
  color: var(--text) !important;
  display: block;
  line-height: 1.3;
  font-family: var(--font-serif);
  text-align: left;
  font-style: normal !important;  /* Ensure not italic */
}

/* CHAPTER HERO IMAGES - Positioned after title, before content */
.chapter-hero-image {
  width: 100%;
  margin: 30px 0 40px;
  padding: 0;
  display: block;
  break-inside: avoid-column;
  page-break-inside: avoid;
  column-span: all;  /* Hero image spans both columns for impact */
}

.chapter-hero-image img.hero-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  object-fit: cover;
  max-height: 400px;  /* Limit height for magazine layout */
}

.chapter-hero-image figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  font-family: var(--font-sans);
}

/* Mobile responsive for hero images */
@media (max-width: 768px) {
  .chapter-hero-image {
    margin: 20px 0 30px;
  }
  
  .chapter-hero-image img.hero-image {
    max-height: 250px;
    border-radius: 6px;
  }
}

/* For non-chapter h1 (front matter, etc.) */
.page h1 {
  font-size: 32px;
  line-height: 1.2;
  margin: 30px 0 25px;
  color: var(--text);
  font-weight: 800;
}

.page h2 {
  font-size: 24px;
  line-height: 1.3;
  margin: 30px 0 15px;
  color: #b75a2e;
  border-left: 4px solid #b75a2e;
  padding-left: 15px;
}

.page h3 {
  font-size: 18px;
  margin: 20px 0 10px;
  color: #1a3d1f;
  font-weight: 600;
}

.page p {
  margin: 0 0 15px;
}

/* Drop cap for first paragraph */
.page p:first-of-type::first-letter {
  font-size: 56px;
  line-height: 1;
  float: left;
  margin: 0 8px 0 0;
  font-weight: bold;
  color: var(--accent);
}

/* ==================== IMAGES ==================== */
.page img {
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  border-radius: 8px;
  display: block;
}

.featured-image {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: 10px;
  margin: 25px 0;
  cursor: pointer;
  transition: transform 0.4s, box-shadow 0.4s;
}

.featured-image:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 40px var(--shadow-heavy);
}

.section-image {
  width: 100%;
  height: auto;
  max-height: 350px;
  object-fit: cover;
  border-radius: 8px;
  margin: 20px 0;
  cursor: pointer;
}

.image-caption {
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  margin: 5px 0 15px;
}

/* ==================== BLOCKQUOTES ==================== */
blockquote {
  border-left: 4px solid var(--accent);
  background: rgba(183, 90, 46, 0.05);
  margin: 25px 0;
  padding: 20px 25px;
  font-style: italic;
  font-size: 16px;
}

/* ==================== INTERACTIVE ELEMENTS ==================== */
.quote-highlight {
  background: rgba(255, 215, 0, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s;
}

.quote-highlight:hover {
  background: rgba(255, 215, 0, 0.4);
}

.footnote-ref {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85em;
  vertical-align: super;
  padding: 0 3px;
  cursor: pointer;
}

.footnote-ref:hover {
  text-decoration: underline;
}

/* ==================== DATA VISUALIZATIONS ==================== */
.chart-container, .visualization-container {
  margin: 30px 0;
  padding: 25px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-width: 100%; /* Fit within column */
  overflow: hidden; /* Prevent overflow */
}

/* Ensure charts fit within columns (responsive) */
.content .chart-container,
.content .visualization-container {
  max-width: 100%;
  box-sizing: border-box;
}

.chart-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text);
}

/* Make canvas and charts responsive */
.chart-container canvas,
.visualization-container canvas,
.chart-container img,
.visualization-container img {
  max-width: 100%;
  height: auto !important;
  display: block;
}

/* Chart responsiveness in two-column layout */
@media (min-width: 1024px) {
  .content-columns .chart-container,
  .content-columns .visualization-container {
    max-width: 100%;
    /* Fit within single column, don't span both */
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .chart-container, .visualization-container {
    padding: 15px;
    margin: 20px 0;
  }
}

/* ==================== COMPONENT BOXES ==================== */
.component-box {
  margin: 25px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 135, 81, 0.03);
}

.component-box h3 {
  color: var(--accent);
  margin-top: 0;
}

/* ==================== POETRY FORMATTING ==================== */
.poetry-stanza {
  margin: 20px 0;
  padding: 0;
  line-height: 1.7;
}

.poetry-line {
  display: block;
  margin: 5px 0;
  line-height: 1.7;
}

.poetry-stanza + .poetry-stanza {
  margin-top: 25px;
}

/* ==================== TABLE OF CONTENTS SIDEBAR ==================== */
.toc-sidebar {
  position: fixed;
  top: 0;
  left: -350px;
  width: 350px;
  height: 100vh;
  background: var(--page-bg);
  box-shadow: 4px 0 20px var(--shadow-heavy);
  z-index: 1500;
  transition: left 0.4s ease-out;
  overflow-y: auto;
  padding: 30px;
}

.toc-sidebar.active {
  left: 0;
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border);
}

.close-toc {
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

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

.toc-item {
  margin: 0 0 8px;
}

.toc-item a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 15px;
}

.toc-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-sans);
}

.toc-title {
  flex: 1;
  font-family: var(--font-serif);
  line-height: 1.4;
}

.toc-item a:hover {
  background: var(--bg);
  transform: translateX(5px);
}

.toc-item a:hover .toc-number {
  background: var(--accent-hover);
  transform: scale(1.1);
}

.toc-item a.active {
  background: rgba(183, 90, 46, 0.1);
  border-left: 4px solid var(--accent);
}

.toc-item a.active .toc-number {
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px rgba(183, 90, 46, 0.2);
}

/* ==================== READING CONTROLS ==================== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(to right, var(--accent), #ffd700);
  z-index: 2001;
  transition: width 0.1s linear;
}

.reading-controls {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--page-bg);
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 6px 20px var(--shadow-heavy);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--font-sans);
}

.progress-indicator {
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-buttons {
  display: flex;
  gap: 8px;
}

.control-buttons button {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.control-buttons button:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ==================== MODALS ==================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--page-bg);
  border-radius: 12px;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 35px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease-out;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--bg);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

/* Lightbox specific */
.lightbox .lightbox-content {
  background: transparent;
  padding: 0;
  max-width: 95vw;
  max-height: 95vh;
}

.lightbox img {
  width: 100%;
  height: auto;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-caption {
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 15px 20px;
  border-radius: 0 0 8px 8px;
  text-align: center;
    font-size: 16px;
  }
  
.lightbox-controls {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ==================== FRONT/BACK MATTER ==================== */
.front-matter, .back-matter {
  min-height: 80vh;
  display: flex;
  align-items: center;
  
  /* Override column layout for front/back matter - single column only */
  column-count: 1 !important;
  column-span: none !important;
  justify-content: center;
  text-align: center;
  padding: 60px var(--page-padding);
  background: var(--page-bg);
}

/* LEFT-ALIGNED FRONT MATTER SECTIONS */
.front-matter.acknowledgments-page,
.front-matter.foreword-page,
.front-matter.preface-page {
  display: block !important;
  text-align: left !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 60px var(--page-padding);
}

.front-matter.acknowledgments-page .fm-content,
.front-matter.foreword-page .fm-content,
.front-matter.preface-page .fm-content {
  text-align: left !important;
  max-width: 800px;
  margin: 0 auto;
}

/* LEFT-ALIGNED BACK MATTER SECTIONS */
.back-matter.support-page,
.back-matter.project-summary-page,
.back-matter.final-acknowledgments-page,
.back-matter.final-reflection-page {
  display: block !important;
  text-align: left !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 60px var(--page-padding);
}

.back-matter.project-summary-page .bm-content,
.back-matter.final-acknowledgments-page .bm-content,
.back-matter.final-reflection-page .bm-content {
  text-align: left !important;
  max-width: 800px;
  margin: 0 auto;
}

/* ABOUT AUTHOR PAGE - IMAGE FLOAT STYLING */
.back-matter.about-author-page {
  display: block !important;
  text-align: left !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 60px var(--page-padding);
}

.back-matter.about-author-page .bm-content {
  text-align: left !important;
  max-width: 800px;
  margin: 0 auto;
}

.back-matter.about-author-page img {
  float: left;
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0 30px 20px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 3px solid var(--accent);
}

.back-matter.about-author-page h1 {
  clear: none;
  margin-bottom: 20px;
}

.back-matter.about-author-page h2 {
  clear: both;
  margin-top: 30px;
}

.title-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #005528 0%, #008751 100%);
  color: #fff;
}

.fm-title-main {
  font-size: 56px;
  font-weight: bold;
  line-height: 1.1;
  margin-bottom: 20px;
}

.fm-title-sub {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.4;
  color: #d4af37;
  margin-bottom: 60px;
}

.fm-author {
  font-size: 24px;
  font-style: italic;
  margin-bottom: 60px;
  color: #e0e0e0;
}

.fm-publisher {
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #d4af37;
  border-top: 2px solid #d4af37;
  padding-top: 20px;
  display: inline-block;
}

.title-page .fm-series {
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 40px;
}

/* Other Front/Back Matter Pages */
.copyright-page, .dedication-page, .preface-page, .author-page, .bibliography-page, .other-books-page {
  text-align: left;
  min-height: 60vh;
}

.fm-content h2, .bm-content h2 {
  font-family: var(--font-serif);
  font-size: 32px;
  margin-bottom: 40px;
  text-align: center;
}

.copyright-notice, .dedication-text, .preface-text, .author-bio, .bibliography-text {
  font-size: 16px;
  line-height: 1.8;
  text-align: left;
}

.copyright-notice p, .dedication-text p, .preface-text p, .author-bio p, .bibliography-text p {
  margin-bottom: 20px;
}

.isbn-info {
  font-size: 14px;
  line-height: 1.8;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}

.isbn-info strong {
  font-weight: 600;
  color: var(--text);
}

.isbn-info a, .author-contact a {
  color: var(--accent);
  text-decoration: none;
}

.isbn-info a:hover, .author-contact a:hover {
  text-decoration: underline;
}

.signature {
  margin-top: 40px;
  font-style: italic;
  text-align: right;
  color: var(--text-light);
}

.author-contact {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
}

.bibliography-themes {
  list-style: none;
  padding: 0;
  margin: 30px 0;
}

.bibliography-themes li {
  margin-bottom: 15px;
  padding-left: 25px;
  position: relative;
}

.bibliography-themes li:before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.bibliography-note {
  font-style: italic;
  font-size: 14px;
  color: var(--text-light);
  margin-top: 30px;
  text-align: center;
}

/* Dynamic Bibliography (collected endnotes) */
.back-matter.bibliography-page {
  display: block !important;
  text-align: left !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  column-count: 1 !important; /* keep single column for readability */
}

.back-matter.bibliography-page .bm-content {
  max-width: 900px;
  margin: 0 auto;
}

.back-matter.bibliography-page h2 {
  text-align: center;
  font-size: 34px;
  margin: 10px 0 30px;
  color: var(--accent);
  border: none;
  padding: 0;
}

.back-matter.bibliography-page h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 12px;
  color: #1f2937;
}

.back-matter.bibliography-page .footnote-definition {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(0, 135, 81, 0.03);
  border-radius: 4px;
}

.back-matter.bibliography-page .footnote-definition .footnote-number {
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}

.back-matter.bibliography-page .footnote-backref {
  color: var(--accent);
  text-decoration: none;
  margin-right: 8px;
}

.other-books-list .book-item {
  margin-bottom: 30px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

/* SUPPORT THE AUTHOR PAGE (Back Matter) */
.support-page {
  min-height: 80vh;
  text-align: left !important;  /* Override center alignment from .back-matter */
  display: block !important;  /* Override flex */
  align-items: flex-start !important;
}

.support-page .bm-content {
  max-width: 100%;
  width: 100%;
  text-align: left !important;
}

.support-page h2,
.support-page h3 {
  text-align: left !important;
}

.support-page h2[style*="text-align: center"] {
  text-align: center !important;  /* Only for h2 with inline center */
}

.support-hero {
  margin: 30px 0;
  padding: 40px;
  text-align: left !important;
}

.support-hero h3 {
  text-align: center !important;  /* Keep hero title centered */
}

.donation-methods {
  margin: 30px 0;
  text-align: left !important;
}

.donation-method {
  margin-bottom: 20px;
  page-break-inside: avoid;
  break-inside: avoid-column;
  text-align: left !important;
}

.donation-method h4 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: left !important;
}

.donation-method p {
  margin: 8px 0;
  line-height: 1.6;
  text-align: left !important;
}

.donation-method p strong {
  display: inline;  /* Keep strong inline with text */
}

.donation-method ul {
  margin: 10px 0 10px 20px;
  text-align: left !important;
  list-style-position: inside;
}

.donation-method ul li {
  margin: 6px 0;
  text-align: left !important;
}

.bm-support a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.bm-support a:hover {
  text-decoration: underline;
}

.bm-support ul {
  text-align: left !important;
  list-style-position: inside;
}

.bm-support p {
  text-align: left !important;
}

.book-item h3 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--accent);
}

.book-item p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-light);
}

.series-cta {
  margin-top: 40px;
  padding: 25px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-align: center;
}

.series-cta p {
  font-size: 16px;
  margin: 0;
}

.series-cta a {
  color: #fff;
  text-decoration: underline;
  font-weight: bold;
}

.series-cta a:hover {
  text-decoration: none;
}

/* TOC Page */
.toc-page {
  min-height: 80vh;
  text-align: left;
}

.toc-full ul {
  list-style: none;
  padding: 0;
}

.toc-full-item {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.toc-full-item a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  transition: color 0.2s;
}

.toc-full-item a:hover {
  color: var(--accent);
}

.toc-full-number {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-right: 20px;
  min-width: 100px;
}

.toc-full-title {
  font-family: var(--font-serif);
  font-size: 16px;
  flex: 1;
}

/* ==================== BUTTONS ==================== */
.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.3s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(183, 90, 46, 0.3);
}

.btn-secondary {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
  position: fixed;
  bottom: 100px;
  right: 30px;
  background: var(--success);
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  z-index: 3000;
  transform: translateX(400px);
  transition: transform 0.4s;
  font-family: var(--font-sans);
}

.toast.show {
  transform: translateX(0);
}

/* ==================== COMPONENT BOXES (Info, Data, Timeline, Map, Photo) ==================== */

.component-box {
  margin: 30px 0;
  padding: 24px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #e1e4e8;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  column-span: all; /* Span both columns */
  break-inside: avoid;
  page-break-inside: avoid;
}

.component-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e1e4e8;
}

.component-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-sans);
}

.component-body {
  color: var(--text);
  line-height: 1.7;
}

.component-body p {
  margin: 12px 0;
}

/* Info Box Specific */
.info-box {
  background: linear-gradient(135deg, #fff8f0 0%, #ffffff 100%);
  border-left-color: #ffd700;
}

.info-box .component-header h3 {
  color: #c17a28;
}

/* Data Visual Specific */
.data-visual {
  background: linear-gradient(135deg, #f0f8ff 0%, #ffffff 100%);
  border-left-color: #2196F3;
}

.data-visual .component-header h3 {
  color: #1976D2;
}

/* Timeline Box */
.timeline-box {
  background: linear-gradient(135deg, #fff5f0 0%, #ffffff 100%);
  border-left-color: var(--accent);
}

/* Map Graphic */
.map-graphic {
  background: linear-gradient(135deg, #f0fff0 0%, #ffffff 100%);
  border-left-color: #4CAF50;
}

.map-graphic .component-header h3 {
  color: #388E3C;
}

/* Photo Spread/Montage */
.photo-spread,
.photo-montage {
  padding: 20px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
}

.photo-spread .component-body,
.photo-montage .component-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.photo-placeholder {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #f0f0f0 25%, #e0e0e0 25%, #e0e0e0 50%, #f0f0f0 50%, #f0f0f0 75%, #e0e0e0 75%, #e0e0e0);
  background-size: 20px 20px;
  border: 2px dashed #ccc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
  font-style: italic;
  padding: 12px;
  text-align: center;
}

/* Quote Callout Large (Pull Quotes) */
.quote-callout-large {
  margin: 30px 0;
  padding: 0;
  column-span: all;
  break-inside: avoid;
}

.pullquote {
  position: relative;
  margin: 24px auto;
  padding: 32px 24px 24px 60px;
  background: linear-gradient(135deg, #fff8f0 0%, #fffaf5 100%);
  border-left: 5px solid var(--accent);
  border-radius: 0 12px 12px 0;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.6;
  font-style: italic;
  color: #2c3e50;
  box-shadow: 0 4px 12px rgba(183, 90, 46, 0.1);
  max-width: 90%;
}

.pullquote .quote-icon {
  position: absolute;
  top: 20px;
  left: 16px;
  width: 32px;
  height: 32px;
  color: var(--accent);
  opacity: 0.4;
}

.pullquote p {
  margin: 0;
  font-weight: 500;
}

/* Mobile Responsive for Components */
@media (max-width: 768px) {
  .component-box {
    padding: 16px;
    margin: 20px 0;
  }
  
  .component-header h3 {
    font-size: 16px;
  }
  
  .pullquote {
    font-size: 18px;
    padding: 24px 20px 20px 50px;
  }
  
  .photo-spread .component-body,
  .photo-montage .component-body {
    grid-template-columns: 1fr;
  }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .book-nav, .reading-controls, .toc-sidebar, .modal-overlay, .toast {
    display: none !important;
  }
  
  .page {
    box-shadow: none;
    page-break-inside: avoid;
  }
  
  .spread {
    page-break-inside: avoid;
  }
}

/* ==================== ACCESSIBILITY ==================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

button:focus, a:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  :root {
    --page-padding: 25px;
  }
  
  body {
    font-size: 16px;
  }
  
  .page h1 {
    font-size: 28px;
  }
  
  .page h2 {
    font-size: 22px;
  }
  
  .reading-controls {
    bottom: 15px;
    right: 15px;
    padding: 12px 15px;
  }
  
  .fm-title-main {
    font-size: 36px;
  }
  
  .fm-title-sub {
    font-size: 18px;
  }
  
  .front-matter, .back-matter {
    padding: 40px 20px;
  }
  
  .toc-full-number {
    min-width: 80px;
    font-size: 12px;
  }
  
  .toc-full-title {
    font-size: 14px;
  }
}

/* ==================== PREVENT ALL COLUMN SPANNING ==================== */
/* Force ALL elements to stay within columns */
.page * {
  column-span: none !important;
}

/* Specific overrides for common elements */
.page blockquote,
.page .component-box,
.page .timeline-box,
.page .data-visual,
.page .photo-spread,
.page .map-graphic,
.page .quote-callout-large,
.page img {
  column-span: none !important;
  max-width: 100%;
}

/* ==================== PREVENT ALL COLUMN SPANNING ==================== */
.page * {
  column-span: none !important;
}

.page blockquote,
.page .component-box,
.page img {
  column-span: none !important;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   CHAPTER TOC PAGE STYLING (Added Oct 26, 2025)
   Conditional detailed TOCs for complex chapters
   ═══════════════════════════════════════════════════════════════ */

.chapter-toc {
    background: linear-gradient(to bottom, #ffffff 0%, #f7fafc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 40px;
}

.chapter-toc-header {
    text-align: center;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 3px solid #667eea;
}

.chapter-toc-label {
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.chapter-toc-title {
    font-size: 42px;
    font-weight: 800;
    color: #1a202c;
    margin: 15px 0;
    line-height: 1.2;
}

.chapter-toc-subtitle {
    font-size: 18px;
    color: #718096;
    font-style: italic;
    margin-top: 15px;
}

.chapter-toc-content {
    max-width: 750px;
    margin: 0 auto;
    padding: 20px;
}

/* Style section lists in chapter TOC */
.chapter-toc-content h2,
.chapter-toc-content h3 {
    color: #2d3748;
    margin: 35px 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    font-size: 20px;
    font-weight: 700;
}

.chapter-toc-content h4 {
    color: #4a5568;
    margin: 25px 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.chapter-toc-content ul,
.chapter-toc-content ol {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.chapter-toc-content li {
    padding: 14px 24px;
    margin: 8px 0;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    border-radius: 0 8px 8px 0;
    font-size: 16px;
    line-height: 1.6;
    background: white;
}

.chapter-toc-content li:hover {
    border-left-color: #667eea;
    background: rgba(102, 126, 234, 0.08);
    padding-left: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Emphasize bolded items in TOC (toolkits, key concepts) */
.chapter-toc-content strong {
    color: #667eea;
    font-weight: 700;
}

/* Style for italic descriptions */
.chapter-toc-content em {
    color: #718096;
    font-size: 14px;
}

.chapter-toc-nav {
    text-align: center;
    margin-top: 60px;
    padding-top: 50px;
}

.btn-start-chapter {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 20px 50px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    cursor: pointer;
}

.btn-start-chapter:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
    text-decoration: none;
}

.toc-nav-hint {
    margin-top: 20px;
    font-size: 14px;
    color: #a0aec0;
    font-style: italic;
}

/* Badge for chapters with detailed TOC in main TOC */
.toc-item.has-detailed-toc {
    background: linear-gradient(to right, transparent, rgba(102, 126, 234, 0.05));
}

.toc-item.has-detailed-toc:hover {
    background: linear-gradient(to right, rgba(102, 126, 234, 0.08), rgba(102, 126, 234, 0.12));
}

.toc-badge {
    font-size: 11px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
    font-weight: 600;
    display: inline-block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chapter-toc {
        padding: 40px 20px;
    }
    
    .chapter-toc-title {
        font-size: 32px;
    }
    
    .chapter-toc-content {
        padding: 10px;
        max-width: 100%;
    }
    
    .chapter-toc-content li {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .btn-start-chapter {
        padding: 16px 40px;
        font-size: 18px;
        width: 100%;
    }
}

@media print {
    .chapter-toc {
        page-break-after: always;
    }
    
    .btn-start-chapter,
    .toc-nav-hint {
        display: none;
    }
}
