/* ==========================================================================
   HOOKED THEORY BOOK - READER STYLES
   Optimized for immersive reading, long-form typography, and interactive exploration
   ========================================================================== */

:root {
  --reading-font-size: 1.05rem;
  --reading-line-height: 1.8;
  --reading-max-width: 820px;
}

/* Sepia Theme for Eye Care */
[data-theme="sepia"] {
  --bg-primary: #fbf0d9;
  --bg-surface: #f4ecd8;
  --bg-surface-elevated: #efe5ce;
  --bg-surface-hover: #e8ddc4;
  --bg-sidebar: #2c251e;
  --bg-sidebar-hover: #3d342b;
  --bg-sidebar-active: #4e4337;
  
  --text-primary: #2d241e;
  --text-secondary: #5c4d41;
  --text-muted: #8c7b6d;
  --text-inverse: #f4ecd8;
  
  --primary: #9a4d1a;
  --primary-hover: #7c3e15;
  --primary-light: rgba(154, 77, 26, 0.12);
  --primary-border: #d4a373;
  
  --accent: #b45309;
  --accent-light: rgba(180, 83, 9, 0.12);
  --border-light: #e2d5bd;
}

/* Global Reading Progress Bar at very top of screen */
.reading-progress-top {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #0ea5e9, #10b981);
  z-index: 1000;
  width: 0%;
  transition: width 0.1s ease-out;
}

/* Reader Toolbar Controls */
.reader-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-font-size {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-font-size:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
}

/* Search Box in Header */
.book-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.book-search-input {
  padding: 0.4rem 0.8rem 0.4rem 2rem;
  font-size: 0.82rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-primary);
  width: 170px;
  transition: width 0.25s ease, border-color 0.25s ease;
}

.book-search-input:focus {
  outline: none;
  width: 240px;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon-hint {
  position: absolute;
  left: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Book Content Typography */
.book-chapter {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 3.5rem;
  padding: 3rem 2.75rem;
  font-size: var(--reading-font-size);
  line-height: var(--reading-line-height);
  transition: box-shadow var(--transition-normal);
  scroll-margin-top: 5rem;
}

.book-chapter:hover {
  box-shadow: var(--shadow-md);
}

.chapter-number-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.chapter-heading {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.chapter-subheading-en {
  font-size: 1.15rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  font-style: italic;
}

.book-chapter h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.01em;
}

.book-chapter h4 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.book-chapter p {
  margin-bottom: 1.35rem;
  color: var(--text-primary);
  text-align: justify;
}

/* Lead paragraph styling */
.lead-paragraph {
  font-size: 1.15em;
  line-height: 1.75;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 1.75rem;
}

/* Blockquotes & Science Callouts */
.book-quote {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
}

.book-quote cite {
  display: block;
  font-style: normal;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 0.65rem;
}

.case-study-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.case-study-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.case-study-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* Figure inside Book */
.book-figure {
  margin: 2.25rem 0;
  text-align: center;
  background: var(--bg-surface-hover);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.book-figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.book-figure-caption {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
  font-weight: 500;
}

/* End of Chapter Action & Summary Cards */
.chapter-summary-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(14, 165, 233, 0.08));
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.summary-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.summary-list {
  padding-left: 1.25rem;
}

.summary-list li {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.do-this-now-card {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-md);
}

.do-this-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  width: fit-content;
}

.do-this-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
}

.do-this-tasks {
  padding-left: 1.25rem;
  color: #cbd5e1;
  font-size: 0.92rem;
}

.do-this-tasks li {
  margin-bottom: 0.5rem;
}

.btn-open-workbook {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  color: white;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  width: fit-content;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: all var(--transition-fast);
}

.btn-open-workbook:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
  color: white;
}

/* Quick Jump Header Links */
.nav-link-badge {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.nav-link-badge:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Search Highlights */
mark.search-highlight {
  background-color: #fde047;
  color: #0f172a;
  padding: 0 3px;
  border-radius: 2px;
  font-weight: 700;
}

/* ==========================================================================
   CHAPTER COMPREHENSION QUIZ STYLES
   ========================================================================== */
.chapter-quiz-card {
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.quiz-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.quiz-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.quiz-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--primary-border);
}

.quiz-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.quiz-item[open] {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.quiz-question-summary {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  user-select: none;
}

.quiz-question-summary:hover {
  color: var(--primary);
  background: var(--bg-surface-hover);
}

.quiz-q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
}

.quiz-answer-body {
  padding: 1rem 1.15rem;
  background: var(--bg-surface-hover);
  border-top: 1px solid var(--border-light);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.quiz-answer-body strong.ans-title {
  color: var(--success);
  display: inline-block;
  margin-bottom: 0.35rem;
}

