:root {
  --primary-color: #4b2e83;
  --primary-light: #6d4bb3;
  --primary-dark: #2f1a4f;
  --accent-color: #8b5cf6;
  --background-color: #0f0f0f;
  --surface-color: #1a1a1a;
  --text-primary: #f5f5f5;
  --text-secondary: #c4c4c4;
  --text-muted: #737373;
  --border-color: #2a2a2a;
  --border-light: #262626;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --font-serif: 'Crimson Text', 'Times New Roman', 'Times', serif;
  --font-sans: 'Crimson Text', 'Times New Roman', 'Times', serif;
  --font-display: 'Crimson Text', 'Times New Roman', 'Times', serif;
  
  /* Bible Book Category Colors */
  --torah-color: #8B4513;
  --historical-color: #CD853F;
  --wisdom-color: #DAA520;
  --major-prophets-color: #A0522D;
  --minor-prophets-color: #A52A2A;
  --gospels-color: #4169E1;
  --acts-color: #6495ED;
  --pauline-color: #1E90FF;
  --general-epistles-color: #4682B4;
  --apocalyptic-color: #191970;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
font-family: 'Crimson Text', 'Times New Roman', serif;
margin: 0;
padding: 0;
background-color: var(--background-color);
color: var(--text-primary);
line-height: 1.7;
font-size: 16px;
overflow-x: hidden;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

* {
  font-family: 'Crimson Text', 'Times New Roman', serif !important;
}

/* Global text selection styling */
::selection {
    background: rgba(139, 92, 246, 0.4);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(139, 92, 246, 0.4);
    color: var(--text-primary);
}

/* Prevent unwanted text selection on UI elements */
.sidebar-nav,
.chapter-link,
.nav-button,
.book-card,
.verse-number {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection on content */
.verse-text,
.commentary-section,
.outline-item,
p,
li,
div {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Layout */
.layout {
    min-height: 100vh;
    display: flex;
}



/* Custom scrollbar for sidebar */


/* Firefox scrollbar styling */


/* Theme-aware scrollbar styling */


/* High contrast mode support */


/* Reduced motion support */


/* Mobile and touch device enhancements */


/* Touch scrolling improvements */


/* iPad-specific scrollbar styling */


/* Auto-hide scrollbar when not scrolling */
.sidebar {
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar:not(:hover):not(:focus-within) {
    scrollbar-width: none;
}

.sidebar:not(:hover):not(:focus-within)::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* Show scrollbar on hover/focus */
.sidebar:hover::-webkit-scrollbar,
.sidebar:focus-within::-webkit-scrollbar {
    width: 8px;
    transition: width 0.2s ease;
}

@media (min-width: 768px) and (max-width: 1366px) {
    .sidebar:hover::-webkit-scrollbar,
    .sidebar:focus-within::-webkit-scrollbar {
        width: 10px;
    }
}

/* Active scrolling visual feedback */
.sidebar::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
    transition: all 0.1s ease;
}

/* Smooth scroll enhancements */
.sidebar {
    scroll-padding-top: 1rem;
    scroll-padding-bottom: 1rem;
}

/* Focus-visible scrollbar enhancement */
.sidebar:focus-visible::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Scrollbar animation on keyboard navigation */
.keyboard-navigation .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better scrollbar visibility during navigation */
.sidebar-nav a:focus {
    scroll-margin-top: 2rem;
    scroll-margin-bottom: 2rem;
}

/* Initial scrollbar reveal animation */
@keyframes scrollbarReveal {
    0% {
        opacity: 0;
        transform: translateX(10px);
    }
    50% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0.6;
        transform: translateX(0);
    }
}







.main-content {
    flex: 1;
    margin-left: 0 !important;
    min-height: 100vh;
    position: relative;
    z-index: 10;
    background-color: var(--background-color);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    padding: 1rem;
    width: 100% !important;
    max-width: 1200px;
    margin: 0 auto !important;
    padding-bottom: 120px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
    background-color: var(--background-color);
    position: relative;
    z-index: 1;
}

.narrow-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    background-color: var(--background-color);
}

/* Typography */
.page-title {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 2rem;
  font-weight: normal;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 2rem;
  line-height: 1.3;
}

.section-title {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: normal;
  color: var(--text-primary);
  margin: 0 0 1rem;
  line-height: 1.3;
}

.chapter-title {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.75rem;
  font-weight: normal;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 1rem;
  line-height: 1.3;
}

/* Cards and Components */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.5rem;
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.book-card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.book-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.book-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.book-card:hover::before {
  transform: scaleX(1);
}

/* Testament Divider */
.testament-divider {
    border: none;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--torah-color) 0%,
        var(--gospels-color) 100%
    );
    margin: 2rem 0;
    opacity: 0.7;
    border-radius: 1px;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.book-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--accent-color)
    );
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.book-card:hover::before {
    transform: scaleX(1);
}

.book-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.book-title {
    font-family: 'Crimson Text', 'Times New Roman', serif;
    font-size: 1.1rem;
    font-weight: normal;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.book-meta {
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Crimson Text', 'Times New Roman', serif;
}

/* Chapter Grid */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.chapter-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  background: var(--surface-color);
  color: var(--primary-light);
  text-decoration: none;
  font-weight: normal;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  transition: all 0.15s ease;
  min-height: 44px;
}

.chapter-link:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-light);
}

/* Verses */
.verses-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: var(--background-color);
  text-align: center;
}

.chapter-text {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.2rem;
  line-height: 1.9;
  color: var(--text-primary);
  text-align: left;
  margin: 0 auto;
  padding: 2rem;
  background: var(--surface-color);
  max-width: 600px;
  font-weight: 400;
  letter-spacing: 0.01em;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chapter-text .verse {
    display: inline;
    position: relative;
    margin: 0;
    padding: 0.1rem 0.2rem;
    background: transparent;
    border: none;
    border-radius: 3px;
    transition: background-color 0.15s ease;
}

.chapter-text .verse:hover {
    background: rgba(139, 92, 246, 0.08);
}

.verse {
    margin-bottom: 0.5rem;
    line-height: 1.8;
    font-size: 1.125rem;
    position: relative;
    padding: 0.25rem 0;
    background: transparent;
    border: none;
}

.verse:hover {
    background: rgba(255, 255, 255, 0.02);
}

.verse-number {
  font-size: 0.8rem !important;
  color: var(--primary-light) !important;
  font-weight: 500 !important;
  font-family: 'Crimson Text', 'Times New Roman', serif !important;
  vertical-align: super !important;
  margin-right: 0.25rem !important;
  position: static !important;
  display: inline !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

.verse-text {
  color: var(--text-primary);
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.2rem;
  line-height: 1.9;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.verse-text::selection {
    background: rgba(139, 92, 246, 0.4);
    color: var(--text-primary);
}

.verse-text::-moz-selection {
    background: rgba(139, 92, 246, 0.4);
    color: var(--text-primary);
}

/* Navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.breadcrumb a {
  color: var(--primary-light);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface-color);
  color: var(--text-primary);
  text-decoration: none;
  border: 1px solid var(--border-light);
  font-weight: normal;
  transition: all 0.15s ease;
  font-size: 0.9rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.nav-button:hover {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

.nav-button-primary {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

.nav-button-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Search */
.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  font-size: 1rem;
  border: 1px solid var(--border-light);
  background: var(--surface-color);
  color: var(--text-primary);
  transition: border-color 0.15s ease;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Mobile landscape and tablet styles */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .main-content {
        width: 100%;
        margin: 0 auto;
        padding: 1rem;
        padding-bottom: 120px;
    }

    .container,
    .narrow-container {
        padding: 1.5rem 1rem;
        max-width: 100%;
    }
}

/* Tablet-specific styles */
/* iPad and large tablets - enhanced keyboard support */
@media (min-width: 769px) and (max-width: 1024px) {
    body {
        font-size: 17px;
    }

    .sidebar {
        width: 280px !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        z-index: 50;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        display: block !important;
        visibility: visible !important;
    }

    .main-content {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
        min-width: 0;
        position: relative;
        z-index: 10;
        background-color: var(--background-color);
        padding-left: 1rem;
    }

    .container,
    .narrow-container {
        padding: 2rem 1.5rem;
        max-width: 100%;
    }

    .page-title {
        font-size: 2.5rem;
    }

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

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 1rem;
    }

    .chapter-link {
        min-height: 60px;
        font-size: 1.2rem;
        /* Enhanced touch targets for hybrid touch/keyboard use */
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .sidebar-nav a {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 52px;
        /* Better keyboard focus indicators */
        border-radius: var(--radius-sm);
        transition: all 0.2s ease;
    }

    .sidebar-nav a:focus {
        outline: 2px solid rgba(255, 255, 255, 0.8);
        outline-offset: 2px;
        background-color: rgba(255, 255, 255, 0.15);
    }

    /* Enhanced iPad handling - always keep sidebar visible */
        @supports (-webkit-touch-callout: none) {
            .sidebar {
                -webkit-transform: translate3d(0, 0, 0) !important;
                transform: translate3d(0, 0, 0) !important;
                -webkit-backface-visibility: hidden;
                backface-visibility: hidden;
                position: fixed !important;
                left: 0 !important;
            }

            .main-content {
                -webkit-backface-visibility: hidden;
                backface-visibility: hidden;
                margin-left: 280px !important;
            }

            /* Prevent sidebar from being hidden on iPad */
            .sidebar:not(.force-hide) {
                display: block !important;
                visibility: visible !important;
            }
        }
}

/* iPad Pro 11" and 12.9" specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
    .sidebar {
        width: 300px !important;
        display: block !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }

    .main-content {
        margin-left: 300px !important;
        width: calc(100% - 300px) !important;
    }

    .sidebar-nav a {
        padding: 0.875rem 1.125rem;
        font-size: 1.05rem;
        min-height: 56px;
    }

    .sidebar-header {
        padding: 1.25rem;
    }

    .sidebar-title {
        font-size: 1.3rem;
    }
}

/* Landscape iPad optimization for keyboard usage */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .sidebar {
        width: 320px !important;
        display: block !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }

    .main-content {
        margin-left: 320px !important;
        width: calc(100% - 320px) !important;
    }

    .sidebar-nav a {
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
        min-height: 60px;
    }
}

/* iPad Portrait - optimized for keyboard and touch */
@media (min-width: 768px) and (max-width: 834px) and (orientation: portrait) {
    .sidebar {
        width: 260px !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        z-index: 50;
        display: block !important;
        visibility: visible !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
        min-width: 0;
        padding-left: 1rem;
    }

    .sidebar-nav a {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 48px;
        /* Larger touch targets while maintaining keyboard usability */
        margin-bottom: 0.15rem;
    }

    .sidebar-nav a:focus {
        outline: 2px solid rgba(255, 255, 255, 0.9);
        outline-offset: 2px;
    }

    /* Ensure sidebar stays visible even when toggled */
    .sidebar.open {
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }
}

/* iPad mini specific adjustments */
@media (min-width: 768px) and (max-width: 820px) and (orientation: portrait) {
    .sidebar {
        width: 240px !important;
        display: block !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }

    .main-content {
        margin-left: 240px !important;
        width: calc(100% - 240px) !important;
    }
}

/* Desktop - ensure sidebar is always visible */
@media (min-width: 1367px) {
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 1400px;
        margin: 0 auto !important;
        padding-bottom: 120px;
    }
}

/* Mobile styles - only hide sidebar on very small screens */
@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .main-content {
        width: 100%;
        margin: 0 auto;
        padding: 1rem 0.5rem;
        padding-bottom: 100px;
    }
}

/* Extremely narrow screens */
@media (max-width: 360px) {
    .main-content {
        padding: 1rem 0.5rem;
        padding-bottom: 100px;
    }

    .container,
    .narrow-container {
        padding: 0.75rem 0.5rem;
        max-width: 100%;
    }

    .page-title,
    .chapter-title {
        font-size: 1.5rem;
        padding: 0 0.25rem;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
        padding: 0;
    }

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.25rem;
        padding: 0;
    }
}

/* Ultra-narrow screens */
@media (max-width: 320px) {
    .main-content {
        padding: 1rem 0.25rem;
        padding-bottom: 100px;
    }

    .container,
    .narrow-container {
        padding: 0.5rem 0.25rem;
        max-width: 100%;
    }

    .verse-text {
        font-size: 1rem;
        line-height: 1.6;
        padding: 0.25rem 0;
    }

    .chapter-text {
        font-size: 1rem;
        line-height: 1.6;
        padding: 0.75rem 0.25rem;
    }

    .nav-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .breadcrumb {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .search-input {
        font-size: 16px;
        padding: 1rem 0.75rem;
    }
}

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

    .main-content {
        width: 100%;
        margin: 0 auto;
        padding: 1rem 0.75rem;
    }

    .page-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
        line-height: 1.25;
        padding: 0 0.5rem;
        font-weight: 600;
        color: var(--primary-color);
        text-rendering: optimizeLegibility;
    }

    .chapter-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
        line-height: 1.25;
        padding: 0 0.5rem;
        font-weight: 600;
        color: var(--primary-color);
        text-rendering: optimizeLegibility;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
        padding: 0 0.25rem;
    }

    .book-card {
        padding: 1rem 0.75rem;
        min-height: 80px;
        touch-action: manipulation;
    }

    .book-card:active {
        transform: scale(0.98);
        background: var(--border-light);
    }

    .book-title {
        font-size: 1.1rem;
        line-height: 1.2;
    }

    .book-meta {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.5rem;
        padding: 0 0.25rem;
    }

    .chapter-link {
        padding: 1rem 0.5rem;
        font-size: 1rem;
        min-height: 56px;
        touch-action: manipulation;
    }

    .chapter-link:active {
        transform: scale(0.95);
        background: var(--primary-light);
        color: white;
    }

    .verse {
        font-size: 1rem;
        padding: 0.25rem 0;
        margin-bottom: 0.5rem;
        line-height: 1.7;
    }

    .verse-number {
        font-size: 0.75rem !important;
        color: var(--primary-light) !important;
        vertical-align: super !important;
        display: inline !important;
    }

    .verse-text {
        font-size: 1.2rem;
        line-height: 1.9;
        font-family: 'Crimson Text', 'Times New Roman', serif;
        font-weight: 400;
        letter-spacing: 0.015em;
        word-spacing: 0.05em;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .chapter-text {
        font-size: 1.2rem;
        line-height: 1.9;
        padding: 1.5rem 1rem;
        font-family: 'Crimson Text', 'Times New Roman', serif;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        max-width: 100%;
        word-wrap: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
    }

    .navigation {
        flex-direction: column;
        gap: 1rem;
        margin-top: 3rem;
    }

    .nav-button {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
        touch-action: manipulation;
        text-align: center;
        justify-content: center;
    }

    .nav-button:active {
        transform: scale(0.98);
        background: var(--primary-dark);
    }

    .sidebar-nav {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 0.5rem;
    }

    .sidebar-nav a {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        touch-action: manipulation;
    }

    .sidebar-nav a:active {
        background-color: rgba(255, 255, 255, 0.2);
        transform: scale(0.98);
    }

    .breadcrumb {
        position: static !important;
        font-size: 0.9rem;
        margin: 0.5rem 0 1rem 0;
        padding-bottom: 0.5rem;
        flex-wrap: wrap;
        gap: 0.25rem 0.4rem;
        background: transparent !important;
        box-shadow: none !important;
    }

    .breadcrumb.stuck {
        box-shadow: none !important;
        padding-top: 0;
        margin-top: 0.5rem;
    }

    .breadcrumb-actions {
        display: none !important;
    }

    .breadcrumb a {
        font-size: 0.9rem;
        border-bottom: none;
    }

    .breadcrumb-separator {
        margin: 0 0.3rem;
    }

    .search-input {
        font-size: 16px;
        padding: 1.25rem 1rem;
        border-radius: var(--radius-lg);
        border: 2px solid var(--border-light);
        background: var(--background-color);
        color: var(--text-color);
        font-family: 'Crimson Text', 'Times New Roman', serif;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    /* Better spacing for mobile content */
    .verses-container {
        padding: 1.5rem 1rem;
        margin: 0 auto;
        max-width: 100%;
        background: var(--background-color);
        border-radius: var(--radius-md);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .chapter-text {
        font-size: 1.2rem;
        line-height: 1.9;
        padding: 1.5rem 1rem;
        text-align: left;
        margin: 1rem 0;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        word-spacing: 0.05em;
        letter-spacing: 0.015em;
    }

    /* Improve touch targets for all interactive elements */
    a,
    button,
    input,
    select,
    textarea {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Allow text selection for verse content */
    .verse-text,
    .chapter-text,
    p {
        -webkit-user-select: text;
        -khtml-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
    }

    /* Enhanced touch feedback */
    .book-card,
    .chapter-link,
    .nav-button,
    .sidebar-nav a {
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    .book-card:active {
        transform: scale(0.98);
        background: var(--border-light);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .chapter-link:active {
        transform: scale(0.96);
        background: var(--primary-light);
        color: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    .nav-button:active {
        transform: scale(0.96);
        background: var(--primary-dark);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    .sidebar-nav a:active {
        background-color: rgba(255, 255, 255, 0.2);
        transform: scale(0.98);
    }

    /* Swipe gesture indicators */
    .chapter-text::before {
        content: '';
        position: absolute;
        top: 50%;
        left: -20px;
        width: 4px;
        height: 60px;
        background: linear-gradient(to bottom, transparent, var(--primary-color), transparent);
        border-radius: 2px;
        transform: translateY(-50%);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .chapter-text::after {
        content: '';
        position: absolute;
        top: 50%;
        right: -20px;
        width: 4px;
        height: 60px;
        background: linear-gradient(to bottom, transparent, var(--primary-color), transparent);
        border-radius: 2px;
        transform: translateY(-50%);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .chapter-text:hover::before,
    .chapter-text:hover::after {
        opacity: 0.6;
    }

    /* Mobile scroll enhancements */
    .sidebar,
    .main-content,
    .verses-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Improve button accessibility on mobile */
    button,
    .nav-button,
    .book-card,
    .chapter-link {
        min-height: 44px;
        min-width: 44px;
        cursor: pointer;
    }

    /* Enhanced ripple effect for touch */
    @keyframes ripple {
        0% {
            transform: scale(0);
            opacity: 1;
        }
        100% {
            transform: scale(4);
            opacity: 0;
        }
    }

    .ripple-effect {
        position: relative;
        overflow: hidden;
    }

    .ripple-effect::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.6);
        transform: translate(-50%, -50%) scale(0);
        animation: ripple 0.6s linear;
        pointer-events: none;
    }

    /* Prevent zoom on form inputs */
    input[type="text"], 
    input[type="search"], 
    textarea {
      font-size: 16px;
      -webkit-appearance: none;
      border-radius: var(--radius-md);
      font-family: 'Crimson Text', 'Times New Roman', serif !important;
    }

    /* Improve readability on mobile */
    p,
    li {
        font-size: 1.1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        line-height: 1.25;
        font-weight: 600;
        margin-bottom: 1rem;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        color: var(--primary-color);
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-4 {
    margin-top: 2rem;
}

.hidden {
    display: none;
}

/* Loading and States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Fix for background issues in all browsers */
body,
html,
.layout,
.main-content {
    min-height: 100vh;
    background-color: var(--background-color) !important;
    position: relative;
}

/* Ensure background color extends to the end of the page */
.layout::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background-color: var(--background-color) !important;
    z-index: -1;
}

.commentary-container,
.commentary-section,
.commentary-content,
.container,
.narrow-container {
    background-color: var(--background-color) !important;
    position: relative;
    z-index: 1;
    font-size: 1.2rem;
}

/* Add additional background fixes */
.verse-card,
.verse-text,
.chapter-overview,
.commentary-header,
.commentary-meta {
    position: relative;
    z-index: 2;
    background-color: var(--surface-color);
}

.commentary-section {
    background-color: var(--surface-color);
}

.tab-content {
    background-color: var(--surface-color);
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

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

    .container,
    .narrow-container {
        padding: 1rem 0.75rem;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .book-card {
        padding: 0.75rem 0.5rem;
        min-height: 70px;
    }

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

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }

    .chapter-link {
        padding: 0.75rem 0.25rem;
        font-size: 0.9rem;
        min-height: 48px;
    }

    .chapter-link:active {
        background: var(--primary-color);
        color: white;
    }

@media (max-width: 480px) {
  .page-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

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

  .container,
  .narrow-container {
    padding: 1rem 0.75rem;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .book-card {
    padding: 0.75rem 0.5rem;
    min-height: 70px;
  }

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

  .chapter-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
  }

  .chapter-link {
    padding: 0.75rem 0.25rem;
    font-size: 0.9rem;
    min-height: 48px;
  }

  .chapter-link:active {
    background: var(--primary-color);
    color: white;
  }

  .verse {
    padding: 0.25rem 0;
    font-size: 0.95rem;
  }

  .verse-number {
    font-size: 0.7rem !important;
    color: var(--primary-light) !important;
    vertical-align: super !important;
    display: inline !important;
  }

  .verse-text {
    font-size: 1rem;
    line-height: 1.7;
    font-family: 'Crimson Text', 'Times New Roman', serif;
    font-weight: 400;
    letter-spacing: 0.01em;
  }

  .chapter-text {
    font-size: 1rem;
    line-height: 1.7;
    padding: 0.75rem;
    font-family: 'Crimson Text', 'Times New Roman', serif;
  }

    .sidebar-nav {
        padding: 0 0.25rem;
    }

    .sidebar-nav a {
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .nav-button {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .nav-button:active {
        background: var(--primary-dark);
        transform: scale(0.97);
    }
}

/* Force dark theme always - no media query */

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Commentary and Outline Styles */
.commentary-container {
  background-color: var(--background-color);
  min-height: 100vh;
  margin: 0 auto;
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  box-sizing: border-box;
  font-family: 'Crimson Text', 'Times New Roman', serif;
  padding-bottom: 120px;
}

/* Commentary-specific container overrides */
.commentary-container .container {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.commentary-breadcrumb {
  margin: 0 auto;
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.commentary-navigation {
  margin: 0 auto;
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.commentary-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 1rem;
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.commentary-header h1 {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 2.5rem;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

.commentary-header p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.book-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.book-meta-item {
  background: var(--primary-light);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--primary-light);
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.commentary-section {
  background: var(--surface-color);
  margin-bottom: 2rem;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.commentary-section h2 {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.8rem;
  color: var(--text-primary);
  margin: 0 0 1.5rem;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.outline-section {
  margin-bottom: 2rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.outline-title {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--border-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.outline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.outline-item {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--background-color);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent-color);
  line-height: 1.6;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.outline-nested {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 1rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.outline-nested .outline-item {
  border-left-color: var(--text-muted);
  font-size: 0.95rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.verse-reference {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.verse-reference:hover {
  text-decoration: underline;
}

/* Inline verse tooltip (inside .verse-reference elements) */
.verse-reference .verse-tooltip {
  display: none;
  position: absolute;
  background: var(--text-primary);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  max-width: 400px;
  min-width: 300px;
  z-index: 100;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  line-height: 1.5;
  white-space: normal;
  word-wrap: break-word;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.verse-reference:hover .verse-tooltip {
  display: block;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.tag {
  background: var(--accent-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.main-content {
  min-width: 0;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.toc-sidebar {
  position: sticky;
  top: 2rem;
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.toc-title {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.2rem;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.toc-item {
  margin-bottom: 0.5rem;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.toc-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-family: 'Crimson Text', 'Times New Roman', serif;
}

.toc-link:hover {
  background: var(--border-light);
  color: var(--primary-light);
  transform: translateX(4px);
}

/* Mobile styles for commentary */
@media (max-width: 768px) {
  .commentary-container {
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.5rem;
  }

    .commentary-breadcrumb,
    .commentary-navigation {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .commentary-header {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
    }

    .commentary-header h1 {
        font-size: 2rem;
    }

    .commentary-header p {
        font-size: 1rem;
    }

    .book-meta {
        gap: 0.5rem;
    }

    .book-meta-item {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .commentary-section {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }

    .commentary-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .outline-title {
        font-size: 1.2rem;
        padding: 0.6rem 1rem;
    }

    .outline-item {
        padding: 0.6rem 0.8rem;
        margin-bottom: 0.4rem;
        font-size: 0.95rem;
    }

    .outline-nested {
        margin-left: 0.5rem;
    }

    .outline-nested .outline-item {
        font-size: 0.9rem;
        padding: 0.5rem 0.7rem;
    }

    .two-column {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .toc-sidebar {
        order: -1;
        position: static;
        padding: 1rem;
    }

    .toc-title {
        font-size: 1.1rem;
    }

    .toc-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
    }

    .verse-reference .verse-tooltip {
        position: fixed;
        bottom: 2rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        max-width: none;
        min-width: auto;
        padding: 1rem;
        font-size: 1rem;
        z-index: 1001;
    }
}

/* Tablet responsive tooltips */
@media (min-width: 769px) and (max-width: 1024px) {
  .commentary-container {
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 1rem;
  }

    .commentary-breadcrumb,
    .commentary-navigation {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .verse-reference .verse-tooltip {
        max-width: 380px;
        min-width: 280px;
        font-size: 0.875rem;
    }
}

/* Large screen tooltips */
@media (min-width: 1200px) {
    .verse-reference .verse-tooltip {
        max-width: 500px;
        min-width: 400px;
        font-size: 0.95rem;
        padding: 1rem 1.25rem;
    }

    .commentary-container {
        margin-left: 240px;
        width: calc(100% - 260px);
        padding: 3rem;
        max-width: 1400px;
    }

    .commentary-breadcrumb,
    .commentary-navigation {
        margin-left: 240px;
        width: calc(100% - 260px);
        max-width: 1400px;
    }
}

@media (max-width: 480px) {
    .commentary-header {
        padding: 1rem 0.75rem;
    }

    .commentary-header h1 {
        font-size: 1.75rem;
    }

    .commentary-section {
        padding: 1rem 0.75rem;
    }

    .commentary-section h2 {
        font-size: 1.3rem;
    }

    .outline-title {
        font-size: 1.1rem;
        padding: 0.5rem 0.75rem;
    }

    .outline-item {
        padding: 0.5rem 0.6rem;
        font-size: 0.9rem;
    }

    .outline-nested .outline-item {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    .book-meta-item {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .tag {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --border-light: #333;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
  }
  
  * {
    font-family: 'Crimson Text', 'Times New Roman', serif !important;
  }
}

/* Apply Crimson Text to all remaining elements */
h1, h2, h3, h4, h5, h6,
p, li, span, div, a, button, 
input, textarea, select,
label, table, th, td,
blockquote, pre, code {
  font-family: 'Crimson Text', 'Times New Roman', serif !important;
}

/* Bible Book Categories Legend */
.bible-legend {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 3rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.legend-title {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: normal;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 1.5rem;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.legend-section h4 {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem;
  text-align: center;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .legend-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .bible-legend {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }
}

/* Category Headings */
.category-heading {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-align: center;
  grid-column: 1 / -1;
}

/* Bible Book Category Styles */
.bible-book {
    border-left: 4px solid var(--border-color);
    transition: border-left-color 0.2s ease;
}

.bible-book.torah {
    border-left-color: var(--torah-color);
}
.bible-book.torah:hover {
    border-left-color: var(--torah-color);
    box-shadow: 0 4px 8px rgba(139, 69, 19, 0.2);
}
.bible-book.active.torah {
    border-left-color: var(--torah-color);
    background: rgba(139, 69, 19, 0.1);
}

.bible-book.historical {
    border-left-color: var(--historical-color);
}
.bible-book.historical:hover {
    border-left-color: var(--historical-color);
    box-shadow: 0 4px 8px rgba(205, 133, 63, 0.2);
}
.bible-book.active.historical {
    border-left-color: var(--historical-color);
    background: rgba(205, 133, 63, 0.1);
}

.bible-book.wisdom {
    border-left-color: var(--wisdom-color);
}
.bible-book.wisdom:hover {
    border-left-color: var(--wisdom-color);
    box-shadow: 0 4px 8px rgba(218, 165, 32, 0.2);
}
.bible-book.active.wisdom {
    border-left-color: var(--wisdom-color);
    background: rgba(218, 165, 32, 0.1);
}

.bible-book.major-prophets {
    border-left-color: var(--major-prophets-color);
}
.bible-book.major-prophets:hover {
    border-left-color: var(--major-prophets-color);
    box-shadow: 0 4px 8px rgba(160, 82, 45, 0.2);
}
.bible-book.active.major-prophets {
    border-left-color: var(--major-prophets-color);
    background: rgba(160, 82, 45, 0.1);
}

.bible-book.minor-prophets {
    border-left-color: var(--minor-prophets-color);
}
.bible-book.minor-prophets:hover {
    border-left-color: var(--minor-prophets-color);
    box-shadow: 0 4px 8px rgba(165, 42, 42, 0.2);
}
.bible-book.active.minor-prophets {
    border-left-color: var(--minor-prophets-color);
    background: rgba(165, 42, 42, 0.1);
}

.bible-book.gospels {
    border-left-color: var(--gospels-color);
}
.bible-book.gospels:hover {
    border-left-color: var(--gospels-color);
    box-shadow: 0 4px 8px rgba(65, 105, 225, 0.2);
}
.bible-book.active.gospels {
    border-left-color: var(--gospels-color);
    background: rgba(65, 105, 225, 0.1);
}

.bible-book.acts {
    border-left-color: var(--acts-color);
}
.bible-book.acts:hover {
    border-left-color: var(--acts-color);
    box-shadow: 0 4px 8px rgba(100, 149, 237, 0.2);
}
.bible-book.active.acts {
    border-left-color: var(--acts-color);
    background: rgba(100, 149, 237, 0.1);
}

.bible-book.pauline {
    border-left-color: var(--pauline-color);
}
.bible-book.pauline:hover {
    border-left-color: var(--pauline-color);
    box-shadow: 0 4px 8px rgba(30, 144, 255, 0.2);
}
.bible-book.active.pauline {
    border-left-color: var(--pauline-color);
    background: rgba(30, 144, 255, 0.1);
}

.bible-book.general-epistles {
    border-left-color: var(--general-epistles-color);
}
.bible-book.general-epistles:hover {
    border-left-color: var(--general-epistles-color);
    box-shadow: 0 4px 8px rgba(70, 130, 180, 0.2);
}
.bible-book.active.general-epistles {
    border-left-color: var(--general-epistles-color);
    background: rgba(70, 130, 180, 0.1);
}

.bible-book.apocalyptic {
    border-left-color: var(--apocalyptic-color);
}
.bible-book.apocalyptic:hover {
    border-left-color: var(--apocalyptic-color);
    box-shadow: 0 4px 8px rgba(25, 25, 112, 0.2);
}
.bible-book.active.apocalyptic {
    border-left-color: var(--apocalyptic-color);
    background: rgba(25, 25, 112, 0.1);
}



/* Force sidebar to always be visible on non-mobile devices */
@media (min-width: 768px) {
    .sidebar {
        display: block !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 50 !important;
    }
    
    .sidebar.hidden,
    .sidebar.closed,
    .sidebar[style*="display: none"],
    .sidebar[style*="visibility: hidden"],
    .sidebar[style*="translateX(-"] {
        display: block !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }
}

/* Enhanced iPad and keyboard navigation styles */
.keyboard-navigation *:focus {
    outline: 2px solid var(--accent-color) !important;
    outline-offset: 2px !important;
}

.keyboard-navigation .sidebar-nav a:focus {
    outline: 2px solid rgba(255, 255, 255, 0.9) !important;
    outline-offset: 2px !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateX(6px);
}

/* iPad-specific optimizations */
.ipad-optimized {
    -webkit-text-size-adjust: 100%;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.ipad-optimized input,
.ipad-optimized textarea {
    -webkit-user-select: text;
    user-select: text;
}

.keyboard-available .sidebar-nav a {
    transition: all 0.2s ease, transform 0.2s ease;
}

.keyboard-available .sidebar-nav a:hover {
    transform: translateX(6px);
}

.keyboard-available .sidebar-nav a:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Enhanced touch targets for iPad */
@media (min-width: 768px) and (max-width: 1366px) {
    .sidebar-nav a {
        min-height: 48px;
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .chapter-link {
        min-height: 56px;
        padding: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .book-card {
        min-height: 120px;
        padding: 1.25rem;
    }
    
    /* Improved scroll behavior for sidebar */
    .sidebar {
        scroll-behavior: smooth;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Focus within sidebar improvements */
    .sidebar-nav a:focus-visible {
        outline: 2px solid rgba(255, 255, 255, 0.9);
        outline-offset: 3px;
        background-color: rgba(255, 255, 255, 0.25);
        border-radius: var(--radius-md);
    }
}

/* iPad Pro landscape optimizations */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .sidebar-nav a {
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
        min-height: 56px;
    }
    
    .sidebar-header {
        padding: 1.5rem 1.25rem;
    }
    
    .sidebar-title {
        font-size: 1.4rem;
    }
}

/* Accessibility improvements for keyboard users */
@media (prefers-reduced-motion: no-preference) {
    .keyboard-navigation .sidebar-nav a:focus {
        transition: all 0.3s ease;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .keyboard-navigation *:focus {
        outline: 3px solid #000 !important;
        outline-offset: 2px !important;
        background-color: #fff !important;
        color: #000 !important;
    }

    .sidebar .keyboard-navigation *:focus {
        outline: 3px solid #fff !important;
        background-color: #000 !important;
        color: #fff !important;
    }
}

/* Sidenote spacing override */
.sidenote,
.marginnote {
    margin-bottom: 0.6rem;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.sidenote::selection,
.marginnote::selection,
.sidenote *::selection,
.marginnote *::selection {
    background: transparent;
}

label.sidenote-number {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ==========================================================================
   Shared Large Font Mode Rules
   ========================================================================== */

[data-font-size="large"] .intro-text,
[data-font-size="large"] .topic-overview,
[data-font-size="large"] .plan-overview,
[data-font-size="large"] .parable-description,
[data-font-size="large"] .resource-description {
    font-size: 1.5rem;
}

[data-font-size="large"] .verse-ref {
    font-size: 1.3rem;
}

[data-font-size="large"] .verse-text {
    font-size: 1.3rem;
}

[data-font-size="large"] .verse-note {
    font-size: 1.1rem;
}

[data-font-size="large"] .print-btn,
[data-font-size="large"] .action-btn,
[data-font-size="large"] .guide-download-btn {
    font-size: 1.1rem;
    padding: 0.55rem 1.1rem;
}

[data-font-size="large"] .category-description {
    font-size: 1.2rem;
}

/* ==========================================================================
   Shared Dark Mode Rules
   ========================================================================== */

[data-theme="dark"] .words-of-christ {
    color: #ff6b6b;
}

[data-theme="dark"] .nav-paragraph.selected {
    outline-color: #6b9b7a;
    background: rgba(107, 155, 122, 0.1);
}

/* Note: .section-card, .person-card-name, .person-card-verse dark mode rules
   must stay in individual templates due to CSS cascade order (template <style>
   blocks load after style.css) */
