/* ============================================
   BIBLE-CONTENT.CSS - Bible Text & Chapter Styling
   ============================================
   
   Contains:
   - Chapter content styling
   - Verse selection and highlighting
   - Poetic text formatting
   - Bible-specific typography
   - Light/Dark theme support
*/

/* ============================================
   CSS CUSTOM PROPERTIES - BIBLE THEME VARIABLES
   ============================================ */

:root {
  /* User Font Preferences - can be overridden via profile settings */
  --bible-font-family: 'Crimson Text', 'Georgia', 'EB Garamond', serif;
  --bible-font-size: 1.2rem;
  --bible-line-height: 1.9;
  --bible-letter-spacing: 0.02em;
  --bible-layout: 'auto'; /* 'single', 'two-column', 'auto' */
  
  /* Light Theme Colors - Shalom Bible Style */
  --bible-light-bg-primary: #ffffff;
  --bible-light-bg-secondary: #f9fafb;
  --bible-light-bg-poetic: #f9fafb;
  --bible-light-bg-chapter-select: #f3f4f6;
  
  --bible-light-text-primary: #1f2937;
  --bible-light-text-secondary: #4b5563;
  --bible-light-text-verse-num: #7c3aed;
  --bible-light-text-verse-hover: #6b46c1;
  --bible-light-text-chapter-info: #4b5563;
  
  --bible-light-verse-hover-bg: rgba(124, 58, 237, 0.1);
  --bible-light-verse-selected-bg: linear-gradient(135deg, #e9e5ff 0%, #ddd6fe 100%);
  --bible-light-verse-text-hover: rgba(124, 58, 237, 0.08);
  --bible-light-verse-text-selected: rgba(124, 58, 237, 0.15);
  
  --bible-light-border-verse-hover: #7c3aed;
  --bible-light-border-verse-selected: #6b46c1;
  --bible-light-border-verse-text-selected: #a78bfa;
  
  --bible-light-shadow-light: 0 3px 10px rgba(124, 58, 237, 0.08);
  --bible-light-shadow-verse-hover: 0 2px 4px rgba(124, 58, 237, 0.2);
  --bible-light-shadow-verse-selected: 0 3px 6px rgba(107, 70, 193, 0.3);
  --bible-light-shadow-verse-text: 0 1px 3px rgba(167, 139, 250, 0.15);
  --bible-light-shadow-verse-text-selected: 0 2px 6px rgba(167, 139, 250, 0.25);
  
  --bible-light-scrollbar-track: #f3f4f6;
  --bible-light-scrollbar-thumb: #d1d5db;
  --bible-light-scrollbar-thumb-hover: #9ca3af;
  
  /* Dark Theme Colors - Bible Style */
  --bible-dark-bg-primary: #121212;
  --bible-dark-bg-secondary: #1e1e1e;
  --bible-dark-bg-poetic: #1a1a1a;
  --bible-dark-bg-chapter-select: #2a2a2a;
  
  --bible-dark-text-primary: #e2e8f0;
  --bible-dark-text-secondary: #cbd5e1;
  --bible-dark-text-verse-num: #f87171;
  --bible-dark-text-verse-hover: #f3f4f6;
  --bible-dark-text-chapter-info: #93c5fd;
  
  --bible-dark-verse-hover-bg: rgba(255, 255, 255, 0.08);
  --bible-dark-verse-selected-bg: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  --bible-dark-verse-text-hover: rgba(255, 255, 255, 0.06);
  --bible-dark-verse-text-selected: rgba(212, 175, 55, 0.2);
  
  --bible-dark-border-verse-hover: rgba(255, 255, 255, 0.15);
  --bible-dark-border-verse-selected: #60a5fa;
  --bible-dark-border-verse-text-selected: rgba(255, 255, 255, 0.2);
  
  --bible-dark-shadow-light: 0 4px 15px rgba(0,0,0,0.3);
  --bible-dark-shadow-verse-hover: 0 2px 8px rgba(255, 255, 255, 0.1);
  --bible-dark-shadow-verse-selected: 0 3px 10px rgba(96, 165, 250, 0.4);
  --bible-dark-shadow-verse-text: 0 2px 6px rgba(255, 255, 255, 0.08);
  --bible-dark-shadow-verse-text-selected: 0 3px 8px rgba(255, 255, 255, 0.1);
  
  --bible-dark-scrollbar-track: #374151;
  --bible-dark-scrollbar-thumb: #6b7280;
  --bible-dark-scrollbar-thumb-hover: #9ca3af;
  
  /* Default to light theme for Bible content */
  --bible-bg-primary: var(--bible-light-bg-primary);
  --bible-bg-secondary: var(--bible-light-bg-secondary);
  --bible-bg-poetic: var(--bible-light-bg-poetic);
  --bible-bg-chapter-select: var(--bible-light-bg-chapter-select);
  
  --bible-text-primary: var(--bible-light-text-primary);
  --bible-text-secondary: var(--bible-light-text-secondary);
  --bible-text-verse-num: var(--bible-light-text-verse-num);
  --bible-text-verse-hover: var(--bible-light-text-verse-hover);
  --bible-text-chapter-info: var(--bible-light-text-chapter-info);
  
  --bible-verse-hover-bg: var(--bible-light-verse-hover-bg);
  --bible-verse-selected-bg: var(--bible-light-verse-selected-bg);
  --bible-verse-text-hover: var(--bible-light-verse-text-hover);
  --bible-verse-text-selected: var(--bible-light-verse-text-selected);
  
  --bible-border-verse-hover: var(--bible-light-border-verse-hover);
  --bible-border-verse-selected: var(--bible-light-border-verse-selected);
  --bible-border-verse-text-selected: var(--bible-light-border-verse-text-selected);
  
  --bible-shadow-light: var(--bible-light-shadow-light);
  --bible-shadow-verse-hover: var(--bible-light-shadow-verse-hover);
  --bible-shadow-verse-selected: var(--bible-light-shadow-verse-selected);
  --bible-shadow-verse-text: var(--bible-light-shadow-verse-text);
  --bible-shadow-verse-text-selected: var(--bible-light-shadow-verse-text-selected);
  
  --bible-scrollbar-track: var(--bible-light-scrollbar-track);
  --bible-scrollbar-thumb: var(--bible-light-scrollbar-thumb);
  --bible-scrollbar-thumb-hover: var(--bible-light-scrollbar-thumb-hover);


}

/* Light theme override */
[data-theme="light"] {
  --bible-bg-primary: #ffffff;
  --bible-bg-secondary: var(--bible-light-bg-secondary);
  --bible-bg-poetic: #ffffff;
  --bible-bg-chapter-select: var(--bible-light-bg-chapter-select);
  
  --bible-text-primary: var(--bible-light-text-primary);
  --bible-text-secondary: var(--bible-light-text-secondary);
  --bible-text-verse-num: var(--bible-light-text-verse-num);
  --bible-text-verse-hover: var(--bible-light-text-verse-hover);
  --bible-text-chapter-info: var(--bible-light-text-chapter-info);
  
  --bible-verse-hover-bg: var(--bible-light-verse-hover-bg);
  --bible-verse-selected-bg: var(--bible-light-verse-selected-bg);
  --bible-verse-text-hover: var(--bible-light-verse-text-hover);
  --bible-verse-text-selected: var(--bible-light-verse-text-selected);
  
  --bible-border-verse-hover: var(--bible-light-border-verse-hover);
  --bible-border-verse-selected: var(--bible-light-border-verse-selected);
  --bible-border-verse-text-selected: var(--bible-light-border-verse-text-selected);
  
  --bible-shadow-light: var(--bible-light-shadow-light);
  --bible-shadow-verse-hover: var(--bible-light-shadow-verse-hover);
  --bible-shadow-verse-selected: var(--bible-light-shadow-verse-selected);
  --bible-shadow-verse-text: var(--bible-light-shadow-verse-text);
  --bible-shadow-verse-text-selected: var(--bible-light-shadow-verse-text-selected);
  
  --bible-scrollbar-track: var(--bible-light-scrollbar-track);
  --bible-scrollbar-thumb: var(--bible-light-scrollbar-thumb);
  --bible-scrollbar-thumb-hover: var(--bible-light-scrollbar-thumb-hover);

  --bible-clear-button-background: linear-gradient(135deg, #f3f4f6 0%, #f9fafb 55%, #e5e7eb 100%);
  --bible-clear-button-text: #374151;
  --bible-clear-button-border: #d1d5db;

  --default-dual-colour: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);

}

/* Dark theme explicit override */
[data-theme="dark"] {
  --bible-bg-primary: var(--bible-dark-bg-primary);
  --bible-bg-secondary: var(--bible-dark-bg-secondary);
  --bible-bg-poetic: var(--bible-dark-bg-poetic);
  --bible-bg-chapter-select: var(--bible-dark-bg-chapter-select);
  
  --bible-text-primary: var(--bible-dark-text-primary);
  --bible-text-secondary: var(--bible-dark-text-secondary);
  --bible-text-verse-num: var(--bible-dark-text-verse-num);
  --bible-text-verse-hover: var(--bible-dark-text-verse-hover);
  --bible-text-chapter-info: var(--bible-dark-text-chapter-info);
  
  --bible-verse-hover-bg: var(--bible-dark-verse-hover-bg);
  --bible-verse-selected-bg: var(--bible-dark-verse-selected-bg);
  --bible-verse-text-hover: var(--bible-dark-verse-text-hover);
  --bible-verse-text-selected: var(--bible-dark-verse-text-selected);
  
  --bible-border-verse-hover: var(--bible-dark-border-verse-hover);
  --bible-border-verse-selected: var(--bible-dark-border-verse-selected);
  --bible-border-verse-text-selected: var(--bible-dark-border-verse-text-selected);
  
  --bible-shadow-light: var(--bible-dark-shadow-light);
  --bible-shadow-verse-hover: var(--bible-dark-shadow-verse-hover);
  --bible-shadow-verse-selected: var(--bible-dark-shadow-verse-selected);
  --bible-shadow-verse-text: var(--bible-dark-shadow-verse-text);
  --bible-shadow-verse-text-selected: var(--bible-dark-shadow-verse-text-selected);
  
  --bible-scrollbar-track: var(--bible-dark-scrollbar-track);
  --bible-scrollbar-thumb: var(--bible-dark-scrollbar-thumb);
  --bible-scrollbar-thumb-hover: var(--bible-dark-scrollbar-thumb-hover);

  --bible-clear-button-background: linear-gradient(45deg, #2a2a2a 0%, #333333 50%, #3a3a3a 100%);
  --bible-clear-button-text: #DDDDDD;
  --bible-clear-button-border: #444;

  --default-dual-colour: linear-gradient(45deg, #2a2a2a 0%, #333333 50%, #3a3a3a 100%);
}

/* Main chapter content container */
.chapter-content {
  margin-left: 0;
  margin-right: 0;
  max-width: 900px;
  width: 100%;
  background: var(--bible-bg-primary) !important;
  padding: 2.5rem 3.5rem;
  border-radius: 12px;
  color: var(--bible-text-primary) !important;
  font-family: var(--bible-font-family) !important;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 1.5rem auto;
  min-height: auto;
  max-height: none;
  box-sizing: border-box;
  font-size: var(--bible-font-size) !important;
  line-height: var(--bible-line-height) !important;
  letter-spacing: var(--bible-letter-spacing);
  text-align: justify;
  text-justify: inter-word;
  box-shadow: var(--bible-shadow-light);
  word-spacing: 0.03em;
}

/* Scrollbar styling for chapter content */
.chapter-content::-webkit-scrollbar {
  width: 10px;
}

.chapter-content::-webkit-scrollbar-track {
  background: var(--bible-scrollbar-track);
  border-radius: 5px;
}

.chapter-content::-webkit-scrollbar-thumb {
  background: var(--bible-scrollbar-thumb);
  border-radius: 5px;
}

.chapter-content::-webkit-scrollbar-thumb:hover {
  background: var(--bible-scrollbar-thumb-hover);
}

/* Two-column layout class (user preference) - only on large monitors (>1400px) */
.chapter-content.layout-two-column {
  max-width: 750px;
  columns: 1;
}

@media (min-width: 1400px) {
  .chapter-content.layout-two-column {
    max-width: 1100px;
    columns: 2;
    column-gap: 3.5rem;
    column-rule: 1px solid rgba(124, 58, 237, 0.12);
    column-fill: balance; /* Balance content across columns */
  }
}

/* Only justify text when there's enough content for two columns */
.chapter-content.layout-two-column.has-sufficient-content {
  text-align: justify;
}

/* When layout-two-column doesn't have enough content, use single column styling */
.chapter-content.layout-two-column.insufficient-content {
  columns: 1;
  max-width: 750px;
  text-align: left;
}

.chapter-content.layout-two-column p {
  break-inside: auto; /* Allow paragraphs to break across columns for better distribution */
  margin-bottom: 0.8em;
}

/* Single column layout (user preference) */
.chapter-content.layout-single {
  max-width: 750px;
  columns: 1;
}

/* Force single column on mobile devices regardless of user preference */
@media (max-width: 1023px) {
  .chapter-content,
  .chapter-content.layout-two-column,
  .chapter-content.layout-auto,
  .chapter-content.layout-auto.auto-two-column {
    columns: 1 !important;
    max-width: 100% !important;
    column-gap: 0 !important;
  }
}

/* Non-authenticated users: double-column Bible content on tablet + desktop */
@media (min-width: 1025px) {
  body.not-authenticated .chapter-content {
    max-width: 1100px;
    columns: 2 !important;
    column-gap: 3.5rem !important;
    column-rule: 1px solid rgba(124, 58, 237, 0.12);
    column-fill: balance;
  }

  body.not-authenticated .chapter-content p {
    break-inside: auto;
    margin-bottom: 0.8em;
  }

  /* Keep poetic content single column even for non-authenticated users */
  body.not-authenticated .chapter-content.poetic {
    columns: 1 !important;
    max-width: 800px;
  }
}

/* Auto layout - responsive based on screen size AND content length */
/* Auto layout requires both: wide screen AND sufficient content height */
@media (min-width: 1400px) {
  .chapter-content.layout-auto {
    max-width: 1100px;
    /* Start with single column - JavaScript will add two-column if content is sufficient */
    columns: 1;
    column-gap: 3.5rem;
    column-rule: 1px solid rgba(124, 58, 237, 0.12);
    transition: columns 0.3s ease;
  }
  
  /* Apply two columns only when content is flagged as sufficient */
  .chapter-content.layout-auto.auto-two-column {
    columns: 2;
  }
  
  .chapter-content.layout-auto p {
    break-inside: auto; /* Allow paragraphs to break across columns */
  }
}

/* Large desktop single column with centered text */
@media (min-width: 1200px) and (max-width: 1399px) {
  .chapter-content.layout-auto {
    max-width: 800px;
    font-size: calc(var(--bible-font-size) * 1.02);
  }
}

/* Dark mode - Copilot inspired glowing white border */
[data-theme="dark"] .chapter-content {
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    var(--bible-shadow-light),
    0 0 20px rgba(255, 255, 255, 0.1),
    0 0 40px rgba(255, 255, 255, 0.05),
    inset 0 0 20px rgba(255, 255, 255, 0.02);
  position: relative;
}


/* ============================================
   POETIC BOOKS SPECIAL FORMATTING
   ============================================
   Books like Psalms, Proverbs, Isaiah, Job, Ecclesiastes,
   Lamentations, Song of Solomon have special verse-by-verse
   formatting that mimics traditional Bible poetry layout.
*/

.chapter-content.poetic {
  font-family: var(--bible-font-family);
  font-size: calc(var(--bible-font-size) * 1.02);
  background: var(--bible-bg-primary) !important;
  padding-left: 2.5em;
  padding-right: 2.5em;
  line-height: calc(var(--bible-line-height) * 1.15);
  letter-spacing: 0.015em;
  columns: 1 !important; /* Keep poetic content in single column */
  max-width: 800px;
}

/* Override two-column layout for poetic content */
.chapter-content.poetic.layout-two-column,
.chapter-content.poetic.layout-auto,
.chapter-content.poetic.auto-two-column {
  columns: 1 !important;
  max-width: 800px;
}

.chapter-content.poetic p {
  text-indent: 0;
  margin-bottom: 1.2em;
  padding-left: 0;
}

/* Verse-by-verse poetic styling */
.chapter-content.poetic .verse-text {
  display: block;
  padding-left: 2em;
  margin-bottom: 0.4em;
  text-indent: -0.5em;
  line-height: 1.6;
}

/* First verse in a section - no indent */
.chapter-content.poetic .v:first-child + .verse-text,
.chapter-content.poetic h3 + .v + .verse-text,
.chapter-content.poetic h4 + .v + .verse-text {
  padding-left: 1.5em;
}

/* Verse number styling for poetic content */
.chapter-content.poetic .v {
  display: inline-block;
  width: 2em;
  text-align: right;
  margin-right: 0.5em;
  vertical-align: top;
  font-size: 0.8em;
  color: var(--bible-text-verse-num);
  font-weight: 500;
}

/* Section headings in poetic books */
.chapter-content.poetic h3,
.chapter-content.poetic h4 {
  font-family: var(--bible-font-family);
  font-size: 1em;
  font-weight: 600;
  font-style: italic;
  color: var(--bible-text-chapter-info);
  margin: 1.5em 0 0.8em 0;
  padding: 0;
  text-align: center;
  border: none;
  letter-spacing: 0.05em;
}

/* Hebrew subtitles (Psalms superscriptions) */
.chapter-content.poetic .d,
.chapter-content.poetic [class*="subtitle"] {
  font-style: italic;
  font-size: 0.95em;
  color: var(--bible-text-secondary);
  margin-bottom: 1.2em;
  padding-left: 1.5em;
  display: block;
}

/* Selah and other poetic markers */
.chapter-content.poetic .selah,
.chapter-content.poetic em:contains("Selah") {
  font-style: italic;
  font-weight: 600;
  color: var(--bible-text-verse-num);
  display: inline-block;
  margin-left: 2em;
  font-size: 0.9em;
}

/* Line breaks in poetry */
.chapter-content.poetic br {
  display: block;
  margin-bottom: 0.3em;
  content: "";
}

/* Indented poetry lines (second and subsequent lines of a verse) */
.chapter-content.poetic .q1,
.chapter-content.poetic .q {
  display: block;
  padding-left: 2em;
  margin-bottom: 0.25em;
}

.chapter-content.poetic .q2 {
  display: block;
  padding-left: 3.5em;
  margin-bottom: 0.25em;
}

.chapter-content.poetic .q3 {
  display: block;
  padding-left: 5em;
  margin-bottom: 0.25em;
}

/* Right-aligned poetry (rare, used in some translations) */
.chapter-content.poetic .qr {
  display: block;
  text-align: right;
  padding-right: 2em;
  margin-bottom: 0.25em;
  font-style: italic;
}

/* Stanza breaks */
.chapter-content.poetic .b,
.chapter-content.poetic .stanza-break {
  display: block;
  height: 1em;
  margin: 0.5em 0;
}

/* Mobile adjustments for poetic content */
@media (max-width: 768px) {
  .chapter-content.poetic {
    padding-left: 1em;
    padding-right: 1em;
    font-size: calc(var(--bible-font-size) * 1);
  }
  
  .chapter-content.poetic .verse-text {
    padding-left: 1.5em;
    text-indent: -0.3em;
  }
  
  .chapter-content.poetic .v {
    width: 1.5em;
    font-size: 0.75em;
  }
  
  .chapter-content.poetic .q2 {
    padding-left: 2.5em;
  }
  
  .chapter-content.poetic .q3 {
    padding-left: 3.5em;
  }
}

/* Verse number styling - Enhanced hierarchy */
.chapter-content .v {
  font-size: 0.75em;
  vertical-align: super;
  color: var(--bible-text-verse-num) !important;
  font-weight: 600;
  margin-right: .4rem;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: 'Georgia', serif;
  min-width: 20px;
  text-align: center;
  display: inline-block;
  line-height: 1;
  border: 2px solid transparent; /* Prevent jitter on hover by reserving border space */
  box-sizing: border-box;
}

/* Enhanced verse selection styling with subtle faded highlight */
.chapter-content .v:hover {
  background: var(--bible-verse-hover-bg);
  border-color: var(--bible-border-verse-hover);
  color: var(--bible-text-verse-hover) !important;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.chapter-content .v.selected {
  background: var(--bible-verse-selected-bg);
  border-color: var(--bible-border-verse-selected); /* Only change color - width matches base state */
  color: var(--bible-border-verse-selected) !important;
  font-weight: inherit;
  box-shadow: var(--bible-shadow-verse-selected);
}

/* Highlight verse text and other content when selected - matches normal verse highlighting */
/* Keep same padding/margin as base state to prevent jitter */
.chapter-content .selected {
  background: var(--bible-verse-text-selected) !important;
  border-color: var(--bible-border-verse-text-selected) !important;
  box-shadow: var(--bible-shadow-verse-text-selected);
  color: var(--bible-text-primary) !important;
  text-decoration: none;
}

/* Keep verse number styling stronger */
.chapter-content .v.selected {
  background: var(--bible-verse-selected-bg);
  border-color: var(--bible-border-verse-selected); /* Only change color - width matches base state */
  color: var(--bible-border-verse-selected) !important;
  font-weight: inherit;
  box-shadow: var(--bible-shadow-verse-selected);
  padding: 3px 6px;
  margin-right: .4rem;
}

/* Verse text styling - Enhanced readability */
.verse-text, .verse-text-wrapper {
  cursor: pointer;
  font-weight: 400;
  color: var(--bible-text-primary) !important;
  line-height: var(--bible-line-height) !important;
  display: inline;
  margin-left: 4px;
  font-size: var(--bible-font-size) !important;
  width: 85%;
  font-family: var(--bible-font-family) !important;
  overflow-wrap: break-word; /* wraps long words */
  white-space: normal;
  transition: background-color 0.2s ease;
  letter-spacing: var(--bible-letter-spacing);
  /* Transparent border/padding for consistent sizing - prevents jitter */
  border: 2px solid transparent !important;
  border-radius: 4px;
  padding: 2px 0px !important;
  margin: -2px -4px;
  position: relative;
  /* box-sizing: border-box; */
}

/* Invisible expanded hitbox for easier clicking between lines */
.verse-text::before, .verse-text-wrapper::before {
  content: '';
  position: absolute;
  top: -0.6em;
  bottom: -0.6em;
  left: -2px;
  right: -2px;
  z-index: 1;
  pointer-events: auto;
  /* Invisible but clickable */
}

/* Subtle faded highlight on hover - ONLY background color changes */
.verse-text:hover, .verse-text-wrapper:hover {
  background: var(--bible-verse-text-hover);
  /* Border stays transparent - no visual box */
}

/* Strong highlight when selected - background only, no visible border */
.verse-text.underline, .verse-text-wrapper.underline {
  background: var(--bible-verse-text-selected) !important;
  /* Keep transparent border - no visible box outline */
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--bible-text-primary) !important;
  text-decoration: none;
}

/* Superscript verse numbers hover effects removed */

.chapter-content sup.selected {
  text-decoration: underline;
  color: #d2691e;
}

/* Chapter selection dropdown */
#chapter-select {
  font-size: 1.1em;
  background: var(--bible-clear-button-background);
  border-radius: 1rem;
  padding: 0.5rem 1.2rem;
  font-weight: 200;
  margin-left: 0.5em;
  transition: all 0.3s ease;
  box-shadow: var(--bible-shadow-verse-text);
  color: var(--bible-text-secondary);
  font-family: "cursive";
  border: none;
}

#chapter-select:focus {
  border-color: var(--bible-border-verse-text-selected);
  outline: none;
  box-shadow: 0 0 0 3px rgba(210, 105, 30, 0.1);
}

[data-theme="dark"] #chapter-select:focus {
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

#chapter-select option {
  background: var(--bible-bg-chapter-select);
  color: var(--bible-text-secondary);
  border: var(--spi)
}

/* Clear verses button */
#clear-verses-btn {
  background: var(--bible-clear-button-background);
  color: var(--bible-clear-button-text);
  border: var(--bible-clear-button-border);
  border-radius: 6px;
  padding: 0.5em 1em;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 1em;
}

#clear-verses-btn:hover {
  background: #3C3C3C;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
  color: white;
}

/* Chapter Navigation Buttons */
.chapter-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.5em 0;
  padding: 0 1em;
  gap: 1em;
}

.nav-btn {
  background: var(--bible-verse-text-selected);
  color: var(--bible-text-primary);
  border: 2px solid var(--bible-border-verse-text-selected);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Georgia', serif;
  min-width: 140px;
  text-decoration: none;
}

.nav-btn:hover {
  background: var(--bible-verse-hover-bg);
  border-color: var(--bible-border-verse-hover);
  color: var(--bible-text-primary);
  transform: translateY(-2px);
  box-shadow: var(--bible-shadow-verse-text-selected);
  text-decoration: none;
}

[data-theme="dark"] .nav-btn {
  background: var(--bible-verse-text-selected);
  color: var(--bible-text-primary);
  border-color: var(--bible-border-verse-text-selected);
}

[data-theme="dark"] .nav-btn:hover {
  background: var(--bible-verse-hover-bg);
  border-color: var(--bible-border-verse-hover);
  color: var(--bible-text-primary);
}

.nav-btn:disabled {
  background: var(--bible-scrollbar-thumb);
  color: var(--bible-text-secondary);
  border-color: var(--bible-scrollbar-thumb);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

.nav-btn .arrow {
  font-size: 1.2em;
  font-weight: bold;
}

.chapter-info {
  text-align: center;
  color: var(--bible-text-chapter-info);
  font-family: 'Georgia', serif;
  font-weight: 600;
  font-size: 1.1em;
}

/* Navbar Chapter Navigation */
.navbar-chapter-nav {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
}

.navbar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bible-border-verse-text-selected);
  border: none;
  border-radius: 50%;
  color: var(--bible-text-primary);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.navbar-nav-btn:hover:not(:disabled) {
  background: var(--bible-border-verse-hover);
  color: var(--bible-text-primary);
  transform: scale(1.1);
}

.navbar-nav-btn:disabled {
  background: var(--bible-scrollbar-thumb);
  color: var(--bible-text-secondary);
  cursor: not-allowed;
  transform: none;
}

.navbar-nav-btn .arrow {
  font-size: 16px;
  line-height: 1;
}

.navbar-chapter-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--bible-text-chapter-info);
  white-space: nowrap;
  margin: 0 8px;
}

/* Enhanced Responsive navbar chapter navigation */
@media (max-width: 1023px) and (orientation: portrait) {
  .navbar-chapter-info {
    display: none;
  }
  
  .navbar-chapter-nav {
    gap: 6px;
    padding: 0 12px;
  }
  
  .navbar-nav-btn {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 767px) and (orientation: landscape) {
  .navbar-chapter-info {
    display: none;
  }
  
  .navbar-chapter-nav {
    gap: 4px;
    padding: 0 8px;
  }
  
  .navbar-nav-btn {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 480px) {
  .navbar-nav-btn {
    width: 26px;
    height: 26px;
  }
  
  .navbar-chapter-nav {
    gap: 2px;
    padding: 0 6px;
  }
}

/* Typography improvements - Enhanced hierarchy */
.chapter-content p {
  margin-bottom: 1.2em;
  text-align: justify;
  text-indent: 0;
  font-size: var(--bible-font-size) !important;
  line-height: var(--bible-line-height) !important;
  color: var(--bible-text-primary) !important;
}

.chapter-content p:first-of-type {
  margin-top: 0.5em;
}

.chapter-content strong {
  color: var(--bible-border-verse-text-selected);
  font-weight: 700;
  background: var(--bible-verse-hover-bg);
  padding: 1px 3px;
  border-radius: 3px;
}

.chapter-content em {
  font-style: normal !important;
  color: var(--bible-text-primary) !important;
  font-weight: 400 !important;
  font-family: var(--bible-font-family) !important;
}

/* Enhanced Mobile & Tablet Responsiveness for Bible Content */

/* Large Tablet Landscape */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
  .chapter-content {
    padding: 2.5em 3em;
    font-size: var(--bible-font-size);
    line-height: var(--bible-line-height);
    max-width: 100%;
  }
  
  .chapter-content.poetic {
    padding-left: 4em;
    padding-right: 4em;
    font-size: var(--bible-font-size);
    line-height: calc(var(--bible-line-height) * 1.1);
  }
}

/* Tablet Landscape - Optimized for reading */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: landscape) {
  .chapter-content {
    padding: 2em 2.5em;
    font-size: var(--bible-font-size);
    line-height: var(--bible-line-height);
    max-width: 100%;
  }
  
  .chapter-content.poetic {
    padding-left: 3em;
    padding-right: 3em;
    font-size: var(--bible-font-size);
    line-height: calc(var(--bible-line-height) * 1.1);
  }
  
  .chapter-content .v {
    padding: 3px 6px;
    margin: 1px;
    border-radius: 3px;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
  }
  
  .verse-text, .verse-text-wrapper {
    /* NO padding/margin - prevents jitter on desktop */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    transition: background-color 0.15s ease;
  }
}

/* Tablet Portrait */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
  .chapter-content {
    padding: 2em;
    font-size: var(--bible-font-size);
    line-height: var(--bible-line-height);
    max-width: 100%;
  }
  
  .chapter-content.poetic {
    padding-left: 3em;
    padding-right: 3em;
    font-size: var(--bible-font-size);
    line-height: calc(var(--bible-line-height) * 1.1);
  }
  
  .chapter-content .v {
    padding: 4px 8px;
    margin: 2px;
    border-radius: 4px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
  }
  
  .verse-text, .verse-text-wrapper {
    /* NO padding/margin - prevents jitter on desktop */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    transition: background-color 0.15s ease;
  }
}

/* Mobile Landscape - Compact but readable */
@media (max-width: 767px) and (orientation: landscape) {
  .chapter-content {
    padding: 1.2em 1.5em;
    font-size: var(--bible-font-size);
    line-height: var(--bible-line-height);
    max-width: 100%;
  }
  
  .chapter-content.poetic {
    padding-left: 2em;
    padding-right: 2em;
    font-size: var(--bible-font-size);
    line-height: calc(var(--bible-line-height) * 1.1);
  }
  
  .chapter-title-top {
    font-size: 1.3em;
    top: 15px;
    left: 8px;
  }
  
  .bible-main-content h2 {
    font-size: 1.3em;
    padding-left: 0.4em;
  }
  
  .chapter-content .v {
    padding: 2px 5px;
    margin: 1px;
    border-radius: 3px;
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    font-size: 0.7em;
  }
  
  .verse-text, .verse-text-wrapper {
    /* NO padding/margin - prevents jitter */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    transition: background-color 0.15s ease;
  }
  
  /* Subtle visual hint for tappable verses on touch devices */
  .verse-text:active, .verse-text-wrapper:active {
    background: var(--bible-verse-hover-bg);
    /* NO transform - causes text shift */
  }
  
  .chapter-content .v:active {
    background: var(--bible-verse-hover-bg);
    /* NO transform - causes text shift */
  }
}

/* Mobile Portrait */
@media (max-width: 767px) and (orientation: portrait) {
  .chapter-content {
    padding: 1.5em;
    font-size: var(--bible-font-size);
    line-height: var(--bible-line-height);
    max-width: 100%;
  }
  
  .chapter-content.poetic {
    padding-left: 2em;
    padding-right: 2em;
    font-size: var(--bible-font-size);
    line-height: calc(var(--bible-line-height) * 1.05);
  }
  
  .chapter-title-top {
    font-size: 1.5em;
    top: 20px;
    left: 10px;
  }
  
  .bible-main-content h2 {
    font-size: 1.5em;
    padding-left: 0.5em;
  }
  
  /* Enhanced tap targets for mobile verse selection */
  .chapter-content .v {
    padding: 4px 8px;
    margin: 2px;
    border-radius: 4px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
  }
  
  .verse-text, .verse-text-wrapper {
    /* NO padding/margin - prevents jitter */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    transition: background-color 0.15s ease;
  }
  
  /* Subtle visual hint for tappable verses on touch devices */
  .verse-text:active, .verse-text-wrapper:active {
    background: var(--bible-verse-hover-bg);
    /* NO transform - causes text shift */
  }
  
  .chapter-content .v:active {
    background: var(--bible-verse-hover-bg);
    /* NO transform - causes text shift */
  }
}

/* Enhanced tablet-specific optimizations with touch support */
@media (min-width: 768px) and (max-width: 1024px) and (pointer: coarse) {
  /* Enhanced tap targets for tablet verse selection */
  .chapter-content .v {
    padding: 6px 10px;
    margin: 3px;
    border-radius: 6px;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
  }
  
  .verse-text, .verse-text-wrapper {
    /* NO padding/margin - prevents jitter */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    transition: background-color 0.15s ease;
  }
  
  /* Subtle visual hint for tappable verses on touch devices */
  .verse-text:active, .verse-text-wrapper:active {
    background: var(--bible-verse-hover-bg);
    /* NO transform - causes text shift */
  }
  
  .chapter-content .v:active {
    background: var(--bible-verse-hover-bg);
    /* NO transform - causes text shift */
  }
}

/* Very small mobile devices */
@media (max-width: 480px) {
  .chapter-content {
    padding: 1em;
    font-size: var(--bible-font-size);
    line-height: var(--bible-line-height);
  }
  
  .chapter-content.poetic {
    padding-left: 1.5em;
    padding-right: 1.5em;
    font-size: var(--bible-font-size);
    line-height: calc(var(--bible-line-height) * 1.05);
  }
  
  .chapter-content .v {
    font-size: 0.65em;
    margin-right: 6px;
    min-width: 28px;
    min-height: 28px;
    padding: 3px 6px;
  }
  
  .verse-text:hover,
  .verse-text.underline {
    /* Do NOT change padding on hover - causes jitter */
    background: var(--bible-verse-hover-bg);
  }
  
  .chapter-title-top {
    font-size: 1.2em;
    top: 15px;
    left: 8px;
  }
  
  .bible-main-content h2 {
    font-size: 1.2em;
    padding-left: 0.3em;
  }
}

/* Theme-aware content styling with appropriate contrasts */
.chapter-content,
.chapter-content *,
.chapter-content p,
.chapter-content span,
.chapter-content .verse-text {
  color: var(--bible-text-primary) !important;
  font-style: normal !important;
  font-family: var(--bible-font-family) !important;
  font-size: var(--bible-font-size) !important;
}

/* Ensure verse numbers maintain theme colors - keep smaller relative size */
.chapter-content .v {
  color: var(--bible-text-verse-num) !important;
  font-style: normal !important;
  font-size: 0.75em !important;
}

/* Superscript verse numbers hover effects removed */

.chapter-content sup.selected {
  text-decoration: underline;
  color: var(--bible-border-verse-text-selected);
}

/* ==========================================
   BIG CHAPTER NUMBER (Drop Cap Style)
   ==========================================
   A large decorative chapter number at the start
   of each chapter, like printed Bibles.
*/

.big-chapter-number {
  float: left;
  font-family: 'Crimson Text', 'Georgia', 'Times New Roman', serif;
  font-size: 10rem;
  font-weight: 700;
  line-height: 0.75;
  color: #1a1a1a;
  margin-right: 0.08em;
  margin-top: 0;
  margin-bottom: -0.1em;
  padding: 0;
  text-shadow: none;
  letter-spacing: -0.03em;
  
  /* Clean solid color - no gradient */
  -webkit-background-clip: unset;
  -webkit-text-fill-color: inherit;
  background-clip: unset;
  background: none;
}

/* Tablet */
@media (max-width: 768px) {
  .big-chapter-number {
    font-size: 7rem;
    line-height: 0.75;
    margin-top: 0;
    margin-right: 0.08em;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .big-chapter-number {
    font-size: 5.5rem;
    line-height: 0.75;
    margin-top: 0;
    margin-right: 0.06em;
  }
}

/* Dark theme styling - white text */
[data-theme="dark"] .big-chapter-number {
  color: #e5e5e5;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: inherit;
  background-clip: unset;
}

/* Poetic books - adjust for different layout */
.chapter-content.poetic .big-chapter-number {
  font-size: 8rem;
  margin-right: 0.1em;
  margin-top: 0;
}

@media (max-width: 768px) {
  .chapter-content.poetic .big-chapter-number {
    font-size: 6rem;
  }
}

/* Clear float after first paragraph to prevent layout issues */
.chapter-content p:first-of-type::after {
  content: "";
  display: table;
  clear: both;
}

/* Two-column layout adjustment */
.chapter-content.layout-two-column .big-chapter-number {
  font-size: 7rem;
}

@media (max-width: 1200px) {
  .chapter-content.layout-two-column .big-chapter-number {
    font-size: 5.5rem;
  }
}

/* ============================================
   RED LETTER BIBLE STYLING
   ============================================
   Shows words of Jesus in red when enabled.
   Only visible when body has 'red-letter-enabled' class.
*/

/* Red Letter - Words of Jesus in red */
body.red-letter-enabled .woj,
body.red-letter-enabled .woc,
body.red-letter-enabled .words-of-jesus,
body.red-letter-enabled .words-of-christ,
body.red-letter-enabled [class*="woj"],
body.red-letter-enabled [class*="woc"],
body.red-letter-enabled .chapter-content .esv-text .woj,
body.red-letter-enabled .chapter-content .esv-text .woc,
body.red-letter-enabled .esv-text .woc {
  color: #c41e3a !important; /* Traditional Bible red */
}

/* Dark theme - brighter red for visibility */
[data-theme="dark"] body.red-letter-enabled .woj,
[data-theme="dark"] body.red-letter-enabled .woc,
[data-theme="dark"] body.red-letter-enabled .words-of-jesus,
[data-theme="dark"] body.red-letter-enabled .words-of-christ,
[data-theme="dark"] body.red-letter-enabled [class*="woj"],
[data-theme="dark"] body.red-letter-enabled [class*="woc"],
[data-theme="dark"] body.red-letter-enabled .chapter-content .esv-text .woj,
[data-theme="dark"] body.red-letter-enabled .chapter-content .esv-text .woc,
[data-theme="dark"] body.red-letter-enabled .esv-text .woc {
  color: #ef4444 !important; /* Brighter red for dark mode */
}

/* Ensure verse numbers inside woc keep their styling but also red */
body.red-letter-enabled .woc .verse-num,
body.red-letter-enabled b.verse-num.woc {
  color: #c41e3a !important;
}

[data-theme="dark"] body.red-letter-enabled .woc .verse-num,
[data-theme="dark"] body.red-letter-enabled b.verse-num.woc {
  color: #ef4444 !important;
}
