/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Crimson+Text:ital,wght@0,400;0,600;1,400;1,600&family=Playfair+Display:wght@700;800&display=swap');

/* CSS Variables */
:root {
    --saffron-50: #fef9f3;
    --saffron-100: #fef3e6;
    --saffron-200: #fde7cc;
    --saffron-300: #fbd9a6;
    --saffron-400: #f9c574;
    --saffron-500: #e4b23d;
    --saffron-600: #d4a02e;
    --saffron-700: #b8891f;
    --cream-50: #fdfbf7;
    --cream-100: #faf7f0;
    --warm-50: #fef8f0;
    --warm-100: #fdf2e3;
    --warm-200: #fbe5c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --bg-primary: var(--warm-50);
    --bg-secondary: white;
    --text-primary: #2d2416;
    --text-secondary: #6b5d4f;
    --border-color: rgba(228, 178, 61, 0.2);

    --shadow-sm: 0 1px 2px 0 rgba(212, 160, 46, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(212, 160, 46, 0.15), 0 2px 4px -1px rgba(212, 160, 46, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(212, 160, 46, 0.2), 0 4px 6px -2px rgba(212, 160, 46, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(212, 160, 46, 0.25), 0 10px 10px -5px rgba(212, 160, 46, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(212, 160, 46, 0.3);

    --gradient-primary: linear-gradient(135deg, var(--saffron-400) 0%, var(--saffron-600) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--warm-100) 0%, var(--cream-50) 100%);
    --gradient-hero: linear-gradient(135deg, rgba(228, 178, 61, 0.9) 0%, rgba(212, 160, 46, 0.95) 100%);
}

/* Dark Mode Variables */
.dark-mode {
    --bg-primary: var(--gray-900);
    --bg-secondary: var(--gray-800);
    --text-primary: var(--gray-100);
    --text-secondary: var(--gray-400);
    --border-color: var(--gray-700);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

    --gradient-secondary: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--saffron-600);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-family: 'Playfair Display', serif;
}

.pali-text {
    font-family: 'Crimson Text', serif;
    font-style: italic;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 10000;
    transition: width 0.1s ease;
}

/* Navbar with Glassmorphism */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid transparent;
    padding: 1rem 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.dark-mode .navbar {
    background: rgba(31, 41, 55, 0.5);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    box-shadow: var(--shadow-lg);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.625rem;
    border-radius: 0.75rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0.75rem;
}

@media (hover: hover) {
    .btn-icon:hover::before {
        opacity: 0.1;
    }

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

.btn-icon svg {
    position: relative;
    z-index: 1;
}

/* Hero Section with Parallax */
.hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="1" fill="rgba(228,178,61,0.1)"/></svg>');
    opacity: 0.3;
    z-index: 1;
}

.hero-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .hero:hover .hero-background img {
        transform: scale(1.05);
    }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 1;
}

.dark-mode .hero-overlay {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.5) 100%);
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 5.5rem);
    color: white;
    margin-bottom: 1.5rem;
    animation: fadeInUp 1s ease-out;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hero-subtitle {
    font-size: clamp(1.125rem, 3vw, 1.5rem);
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 1s ease-out 0.2s both;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    animation: fadeInUp 1s ease-out 0.4s both;
}

@media (min-width: 640px) {
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

.btn-primary {
    padding: 1.125rem 2.5rem;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(228, 178, 61, 0.4);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    font-size: 1.0625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
    line-height: 1.2;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--saffron-500) 0%, var(--saffron-700) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

@media (hover: hover) {
    .btn-primary:hover::before {
        opacity: 1;
    }

    .btn-primary:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 25px rgba(228, 178, 61, 0.5);
    }
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

.btn-secondary {
    padding: 1.125rem 2.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 1.0625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.5);
        transform: translateY(-3px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: bounce 2s infinite;
}

.scroll-indicator svg {
    width: 2rem;
    height: 2rem;
    color: rgba(255, 255, 255, 0.8);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Chapter Grid with Enhanced Cards */
.chapters-section {
    padding: 5rem 0;
    scroll-margin-top: 5rem;
    position: relative;
}


.section-header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInUp 0.8s ease-out;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Playfair Display', serif;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1.6;
}

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

.chapter-card {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 1.25rem;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.chapter-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 1.25rem;
}

.chapter-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(228, 178, 61, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

@media (hover: hover) {
    .chapter-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: var(--shadow-2xl);
        border-color: var(--saffron-400);
    }
}

@media (hover: hover) {
    .chapter-card:hover::before {
        opacity: 0.05;
    }
}

@media (hover: hover) {
    .chapter-card:hover::after {
        opacity: 1;
    }
}

@media (hover: hover) {
    .chapter-card:hover .chapter-number {
        transform: scale(1.1) rotate(5deg);
    }
}

.chapter-number {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.375rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(228, 178, 61, 0.3);
    transition: all 0.3s ease;
}

.chapter-title {
    position: relative;
    z-index: 1;
    font-size: 1.625rem;
    margin-bottom: 0.625rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

@media (hover: hover) {
    .chapter-card:hover .chapter-title {
        color: var(--saffron-600);
    }
}

.chapter-title-pali {
    position: relative;
    z-index: 1;
    font-family: 'Crimson Text', serif;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.1875rem;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

@media (hover: hover) {
    .chapter-card:hover .chapter-title-pali {
        color: var(--saffron-500);
    }
}

.chapter-summary {
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.chapter-card .tag-list {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

.chapter-meta {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    color: var(--saffron-500);
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Chapter Detail Page */
.chapter-detail {
    padding: 3rem 0;
    animation: fadeIn 0.6s ease-out;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

@media (hover: hover) {
    .breadcrumb a:hover {
        color: var(--saffron-500);
        background: rgba(228, 178, 61, 0.1);
    }
}

.chapter-header {
    background: var(--gradient-secondary);
    border-radius: 1.5rem;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(228, 178, 61, 0.2);
    position: relative;
    overflow: hidden;
}

.chapter-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(228, 178, 61, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.dark-mode .chapter-header {
    background: var(--gradient-secondary);
    border-color: rgba(228, 178, 61, 0.3);
}

/* Two-column layout for chapter page */
.chapter-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 1024px) {
    .chapter-content-wrapper {
        flex-direction: column;
    }
}

.chapter-summary-section {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(228, 178, 61, 0.2);
}

.chapter-summary-section h2 {
    font-size: 1.875rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
}

.chapter-summary-section .summary-text {
    font-size: 1.125rem;
    line-height: 1.9;
    color: var(--text-secondary);
}

.verses-section h2 {
    font-size: 1.875rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.verse-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.verse-card {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 1.25rem;
    padding: 1.75rem;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    gap: 1.25rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.verse-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 70px;
    font-size: 6rem;
    color: rgba(228, 178, 61, 0.05);
    font-family: 'Playfair Display', serif;
    line-height: 1;
}

@media (hover: hover) {
    .verse-card:hover {
        border-color: var(--saffron-400);
        transform: translateX(8px);
        box-shadow: var(--shadow-xl);
    }
}

.verse-number-badge {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(228, 178, 61, 0.3);
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .verse-card:hover .verse-number-badge {
        transform: scale(1.1);
    }
}

.dark-mode .verse-number-badge {
    background: var(--gradient-primary);
}

.verse-preview {
    flex: 1;
}

.verse-pali {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 0.625rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.verse-translation {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 1.0625rem;
}

/* Verse Detail Page */
.verse-detail {
    padding: 3rem 0;
    animation: fadeIn 0.6s ease-out;
}

.verse-content {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    padding: 3rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(228, 178, 61, 0.1);
}

.verse-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.verse-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: var(--gradient-primary);
}

.verse-number-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 1.25rem;
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(228, 178, 61, 0.4);
}

.verse-text {
    margin-bottom: 2.5rem;
}

.verse-pali-large {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 2.25rem;
    color: var(--text-secondary);
    margin: 2.5rem 0;
    padding: 2rem 0;
    line-height: 2;
    text-align: center;
    position: relative;
}

.verse-pali-large::before,
.verse-pali-large::after {
    content: '"';
    font-size: 4rem;
    color: rgba(228, 178, 61, 0.2);
    font-family: 'Playfair Display', serif;
    position: absolute;
}

.verse-pali-large::before {
    top: -20px;
    left: 0;
}

.verse-pali-large::after {
    bottom: -20px;
    right: 0;
    content: '"';
}

.verse-translation-large {
    font-size: 1.25rem;
    line-height: 1.9;
    color: var(--text-primary);
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.verse-transliteration-inline {
    max-width: 860px;
    margin: 0 auto 1.5rem;
    padding: 1.25rem 1.4rem;
    border-radius: 1rem;
    background: rgba(228, 178, 61, 0.07);
    border: 1px solid rgba(228, 178, 61, 0.16);
}

.verse-transliteration-text {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-secondary);
    text-align: center;
}

/* Accordion with Enhanced Styling */
.accordion {
    margin-bottom: 1.25rem;
}

.accordion-button {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: rgba(228, 178, 61, 0.08);
    border: 2px solid rgba(228, 178, 61, 0.2);
    border-radius: 0.75rem;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.0625rem;
    color: var(--text-primary);
}

.dark-mode .accordion-button {
    background: rgba(228, 178, 61, 0.1);
    border-color: rgba(228, 178, 61, 0.3);
}

@media (hover: hover) {
    .accordion-button:hover {
        background: rgba(228, 178, 61, 0.15);
        border-color: var(--saffron-400);
        transform: translateX(4px);
    }
}

.accordion-button.active {
    background: rgba(228, 178, 61, 0.15);
    border-color: var(--saffron-400);
    color: var(--saffron-600);
}

.dark-mode .accordion-button.active {
    color: var(--saffron-400);
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-button.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-content.active {
    max-height: 3000px;
}

.accordion-body {
    padding: 2rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    line-height: 1.9;
    font-size: 1.0625rem;
}

/* Navigation Buttons */
.verse-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1.25rem;
    margin-top: 2.5rem;
}

.verse-detail-classic .breadcrumb {
    margin-bottom: 1.5rem;
}

.verse-tools-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.verse-tools-heading {
    margin-bottom: 1.5rem;
}

.verse-tools-title {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.action-button-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.verse-navigation-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.9rem;
}

.verse-navigation-spacer {
    min-height: 1px;
}

.verse-theme-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.study-aid-note {
    margin: -0.5rem 0 1.4rem;
}

.verse-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.verse-tool-card {
    background: rgba(228, 178, 61, 0.06);
    border: 1px solid rgba(228, 178, 61, 0.18);
    border-radius: 1rem;
    padding: 1.4rem;
}

.dark-mode .verse-tool-card {
    background: rgba(17, 24, 39, 0.65);
}

.verse-tool-card h3 {
    margin-bottom: 0.9rem;
    font-size: 1.1rem;
}

.verse-tool-script {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.audio-player {
    width: 100%;
}

.related-verse-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.related-verse-link {
    display: block;
    padding: 0.95rem 1rem;
    border-radius: 0.9rem;
    background: rgba(228, 178, 61, 0.08);
    border: 1px solid rgba(228, 178, 61, 0.14);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

@media (hover: hover) {
    .related-verse-link:hover {
        transform: translateY(-2px);
        background: rgba(228, 178, 61, 0.12);
    }
}

.related-verse-meta {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--saffron-500);
    font-size: 0.85rem;
    font-weight: 700;
}

.related-verse-link p {
    margin-top: 0.45rem;
    color: var(--text-secondary);
}

.nav-button {
    padding: 1rem 1.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    box-shadow: var(--shadow-sm);
}

@media (hover: hover) {
    .nav-button:hover {
        border-color: var(--saffron-400);
        background: rgba(228, 178, 61, 0.05);
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .dark-mode .nav-button:hover {
        background: rgba(228, 178, 61, 0.1);
    }
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Search Modal with Glassmorphism */
.search-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.search-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.search-modal-content {
    background: var(--bg-secondary);
    border-radius: 1.25rem;
    width: 90%;
    max-width: 650px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(228, 178, 61, 0.2);
    animation: slideDown 0.3s ease-out;
}

/* Search Close Button (mobile/tablet) */
.search-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(228, 178, 61, 0.12);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s ease;
}

.search-close-btn:active {
    background: rgba(228, 178, 61, 0.25);
}

@media (max-width: 1024px) {
    .search-modal-content {
        position: relative;
    }
    .search-close-btn {
        display: flex;
    }
}

.search-input-wrapper {
    padding: 1.75rem;
    border-bottom: 2px solid var(--border-color);
}

.search-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1.0625rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--saffron-400);
    box-shadow: 0 0 0 3px rgba(228, 178, 61, 0.1);
}

.search-results {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem;
}

.search-modal-content[data-mode="themes"] {
    max-width: 760px;
}

.theme-browser-header {
    padding: 0.25rem 0 1.25rem;
}

.theme-browser-copy {
    color: var(--text-secondary);
    line-height: 1.7;
}

.theme-browser-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.theme-browser-card {
    width: 100%;
    padding: 1.2rem 1.15rem;
    border-radius: 1rem;
    border: 1px solid rgba(228, 178, 61, 0.22);
    background: rgba(228, 178, 61, 0.06);
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

@media (hover: hover) {
    .theme-browser-card:hover {
        transform: translateY(-2px);
        background: rgba(228, 178, 61, 0.12);
        border-color: var(--saffron-400);
    }
}

.theme-browser-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.theme-browser-description {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.theme-browser-count {
    display: inline-flex;
    align-self: flex-start;
    margin-top: 0.25rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(228, 178, 61, 0.16);
    color: var(--saffron-700);
    font-size: 0.82rem;
    font-weight: 700;
}

.search-result-item {
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 2px solid transparent;
}

@media (hover: hover) {
    .search-result-item:hover {
        background: rgba(228, 178, 61, 0.08);
        border-color: var(--saffron-400);
        transform: translateX(4px);
    }

    .dark-mode .search-result-item:hover {
        background: rgba(228, 178, 61, 0.1);
    }
}

.search-result-chapter {
    font-size: 0.8125rem;
    color: var(--saffron-500);
    font-weight: 600;
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-result-text {
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.search-no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    font-size: 1.0625rem;
}

/* Floating Action Button - Scroll to Top */
.scroll-to-top {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(228, 178, 61, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

@media (hover: hover) {
    .scroll-to-top:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(228, 178, 61, 0.5);
    }
}

.scroll-to-top svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* RAG Chat */
.chat-widget {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1000;
}

.chat-toggle {
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(228, 178, 61, 0.4);
}

@media (hover: hover) {
    .chat-toggle:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(228, 178, 61, 0.5);
    }
}

.chat-panel {
    position: absolute;
    right: 0;
    bottom: 4.25rem;
    width: min(24rem, calc(100vw - 2rem));
    max-height: min(42rem, calc(100vh - 7rem));
    background: var(--bg-secondary);
    border: 1px solid rgba(228, 178, 61, 0.24);
    border-radius: 1rem;
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-panel[hidden] {
    display: none;
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-panel-header strong,
.chat-panel-header span {
    display: block;
}

.chat-panel-header span {
    margin-top: 0.2rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.chat-close {
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-primary);
}

.chat-message {
    width: fit-content;
    max-width: 100%;
    margin-bottom: 0.8rem;
    padding: 0.85rem 0.95rem;
    border-radius: 0.8rem;
    line-height: 1.55;
    font-size: 0.92rem;
}

.chat-message-user {
    margin-left: auto;
    background: rgba(228, 178, 61, 0.18);
    color: var(--text-primary);
}

.chat-message-assistant {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.chat-answer p {
    margin-bottom: 0.75rem;
}

.chat-answer p:last-child {
    margin-bottom: 0;
}

.chat-citations {
    margin-top: 0.9rem;
    display: grid;
    gap: 0.5rem;
}

.chat-citation {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem;
    border-radius: 0.6rem;
    text-decoration: none;
    background: rgba(228, 178, 61, 0.08);
    color: var(--text-primary);
}

.chat-citation span {
    font-weight: 700;
}

.chat-citation small {
    color: var(--text-secondary);
    white-space: nowrap;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
    padding: 0.85rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input {
    width: 100%;
    resize: none;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--saffron-400);
}

.chat-send {
    align-self: end;
    border: none;
    border-radius: 0.65rem;
    padding: 0.75rem 1rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 800;
    cursor: pointer;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 5rem;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0.3;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .section-title {
        font-size: 2rem;
    }

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

    .verse-content {
        padding: 2rem 1.5rem;
    }

    .verse-pali-large {
        font-size: 1.75rem;
    }

    .verse-translation-large {
        font-size: 1.0625rem;
    }

    .verse-transliteration-text {
        font-size: 1.1rem;
    }

    .chapter-header {
        padding: 2rem 1.5rem;
    }

    .scroll-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 3rem;
        height: 3rem;
    }

    .verse-navigation {
        grid-template-columns: 1fr;
    }

    .nav-button {
        width: 100%;
        justify-content: center;
    }

    .verse-navigation-actions {
        order: 2;
    }

    .theme-browser-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 1rem 1.75rem;
        font-size: 1rem;
    }

    .chapter-card {
        padding: 1.5rem;
    }

    .verse-card {
        padding: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Utility Classes */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

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

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

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(228, 178, 61, 0.2);
    border-top-color: var(--saffron-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Selection Styling */
::selection {
    background: rgba(228, 178, 61, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(228, 178, 61, 0.3);
    color: var(--text-primary);
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid var(--saffron-500);
    outline-offset: 2px;
}

/* Expanded Site Navigation */
.navbar-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(228, 178, 61, 0.12);
}

@media (hover: hover) {
    .nav-link:hover {
        color: var(--text-primary);
        background: rgba(228, 178, 61, 0.12);
    }
}

.hero-kicker,
.section-kicker,
.panel-kicker,
.card-kicker,
.block-label {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--saffron-500);
}

.hero-stats {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.stat-chip {
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: white;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.content-section {
    padding: 4.5rem 0;
}

.accent-section {
    background: linear-gradient(180deg, rgba(228, 178, 61, 0.08) 0%, rgba(253, 251, 247, 0.8) 100%);
}

.dark-mode .accent-section {
    background: linear-gradient(180deg, rgba(228, 178, 61, 0.08) 0%, rgba(31, 41, 55, 0.6) 100%);
}

.section-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
}

.surface-card,
.panel,
.callout-card,
.loading-card,
.error-card,
.empty-card {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    border: 1px solid rgba(228, 178, 61, 0.16);
    box-shadow: var(--shadow-lg);
}

.surface-card {
    padding: 1.75rem;
}

.feature-grid,
.link-grid,
.faq-preview-grid,
.quote-grid,
.character-grid,
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.compact-grid {
    margin-top: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.about-sections {
    grid-template-columns: 1fr;
}

.about-section-card {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.about-section-card h2 {
    margin-bottom: 0;
}

.about-section-card p {
    margin: 0;
}

.two-column-callout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.callout-card {
    padding: 2rem;
}

.verse-day-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.verse-day-tags {
    margin-bottom: 1.25rem;
}

.verse-day-actions {
    margin-top: 0.25rem;
}

.callout-card h2,
.surface-card h2,
.surface-card h3,
.panel h2 {
    margin-bottom: 0.75rem;
}

.callout-card blockquote,
.quote-card blockquote {
    font-family: 'Crimson Text', serif;
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin: 1rem 0 1.5rem;
}

.callout-label,
.muted-copy,
.section-subtitle,
.chapter-summary,
.card-copy,
.prose-card p,
.faq-preview-card p {
    color: var(--text-secondary);
}

.theme-cloud,
.tag-list,
.linked-verses,
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.theme-chip,
.mini-tag,
.filter-chip {
    border: none;
    background: rgba(228, 178, 61, 0.12);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

@media (hover: hover) {
    .theme-chip:hover,
    .mini-tag:hover,
    .filter-chip:hover {
        background: rgba(228, 178, 61, 0.2);
        transform: translateY(-1px);
    }
}

.theme-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.mini-tag {
    text-decoration: none;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.filter-chip.active {
    background: var(--gradient-primary);
    color: white;
}

.link-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .link-card:hover,
    .verse-surface-card:hover,
    .mini-verse-card:hover,
    .mini-nav-card:hover,
    .quote-card:hover,
    .character-card:hover {
        transform: translateY(-4px);
    }
}

.link-card-cta,
.text-link,
.ghost-link {
    font-weight: 700;
    color: var(--saffron-600);
    text-decoration: none;
}

.ghost-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(228, 178, 61, 0.16);
    color: var(--saffron-700);
    font-size: 0.8rem;
    font-weight: 700;
}

.page-shell {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.page-shell-centered {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 2rem;
}

.page-hero > :only-child {
    grid-column: 1 / -1;
}

.compact-hero {
    margin-bottom: 2rem;
}

.page-hero-copy,
.hero-meta-panel {
    padding: 2.25rem;
    border-radius: 1.5rem;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(228, 178, 61, 0.16);
}

.page-hero-copy h1 {
    font-size: clamp(2rem, 4vw, 3.3rem);
    margin-bottom: 0.75rem;
}

.pali-inline {
    font-family: 'Crimson Text', serif;
    font-size: 1.2rem;
    color: var(--saffron-600);
    margin-bottom: 1rem;
}

.hero-meta-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.meta-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.meta-stat strong,
.stat-surface-value {
    font-size: 2rem;
    color: var(--text-primary);
}

.stat-surface {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.chapter-layout,
.verse-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.7fr);
    gap: 1.5rem;
}

.content-stack,
.sidebar-stack,
.nav-stack,
.stack-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel {
    padding: 1.75rem;
}

.panel-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.25rem 0;
}

.mini-nav-card,
.mini-verse-card {
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: rgba(228, 178, 61, 0.08);
    border: 1px solid rgba(228, 178, 61, 0.18);
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.mini-nav-card span,
.mini-verse-card .card-kicker {
    display: block;
    margin-bottom: 0.35rem;
}

.verse-jump-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    gap: 0.65rem;
}

.verse-jump-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 3rem;
    border-radius: 0.9rem;
    text-decoration: none;
    color: var(--text-primary);
    background: rgba(228, 178, 61, 0.08);
    border: 1px solid rgba(228, 178, 61, 0.16);
    font-weight: 700;
}

.list-card {
    padding: 1.35rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(228, 178, 61, 0.14);
    background: rgba(228, 178, 61, 0.04);
}

.list-card-head,
.card-actions,
.action-row,
.navigation-bar,
.quote-meta,
.chapter-card-top,
.title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.chapter-verse-actions {
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.feature-card-actions {
    margin-top: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
}

.chapter-verse-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(228, 178, 61, 0.2);
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
    .chapter-verse-button:hover {
        transform: translateY(-1px);
    }
}

.chapter-verse-save {
    background: rgba(228, 178, 61, 0.08);
    color: var(--saffron-600);
    cursor: pointer;
}

.chapter-verse-save[aria-pressed="true"] {
    background: rgba(228, 178, 61, 0.16);
    border-color: var(--saffron-500);
}

.chapter-verse-open {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.list-card-script,
.lead-copy {
    color: var(--text-secondary);
    line-height: 1.8;
}

.verse-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.verse-header-block {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.action-button {
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(228, 178, 61, 0.18);
    background: rgba(228, 178, 61, 0.08);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
    .action-button:hover {
        background: rgba(228, 178, 61, 0.14);
        border-color: var(--saffron-400);
        transform: translateY(-1px);
    }
}

.action-button[aria-pressed="true"] {
    background: rgba(228, 178, 61, 0.18);
    border-color: var(--saffron-500);
}

.verse-block,
.study-card,
.accordion-card {
    background: rgba(228, 178, 61, 0.04);
    border: 1px solid rgba(228, 178, 61, 0.16);
    border-radius: 1.25rem;
    padding: 1.4rem;
}

.script-block,
.transliteration-block {
    font-family: 'Crimson Text', serif;
    font-size: 1.45rem;
    line-height: 1.85;
}

.translation-block {
    font-size: 1.05rem;
    line-height: 1.9;
}

.study-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.word-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.word-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.accordion-card .accordion-button,
.faq-question {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
}

.accordion-card .accordion-body,
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.accordion-card .accordion-body.open,
.faq-answer.open {
    max-height: 1600px;
    margin-top: 1rem;
}

.navigation-bar {
    margin-top: 1.5rem;
}

.navigation-bar .nav-button {
    flex: 1;
    min-height: 100px;
    padding: 1rem 1.2rem;
    border-radius: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid rgba(228, 178, 61, 0.16);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
}

.navigation-bar .nav-button-label,
.stat-surface-label {
    color: var(--text-secondary);
}

.navigation-bar .nav-button-empty {
    opacity: 0.6;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    padding: 1.35rem 1.4rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(228, 178, 61, 0.16);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-md);
}

.quote-card blockquote {
    margin-bottom: 1rem;
}

.character-card p,
.quote-card span {
    color: var(--text-secondary);
}

.search-results-meta {
    padding: 0.25rem 0.25rem 0.85rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.search-result-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
}

.search-result-reference {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

mark {
    background: rgba(228, 178, 61, 0.3);
    color: inherit;
    border-radius: 0.2rem;
    padding: 0 0.15rem;
}

.loading-card,
.error-card,
.empty-card {
    padding: 2rem;
    text-align: center;
    max-width: 680px;
}

.loading-card,
.error-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.toast {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    background: var(--gray-900);
    color: white;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10002;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.footer-links {
    justify-content: center;
    margin-bottom: 0.9rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

@media (hover: hover) {
    .footer-links a:hover {
        color: var(--saffron-600);
    }
}

@media (max-width: 1024px) {
    .chapter-layout,
    .verse-layout,
    .page-hero,
    .two-column-callout {
        grid-template-columns: 1fr;
    }

    .navbar-container {
        display: grid;
        grid-template-areas: 
            "logo actions"
            "links links";
        grid-template-columns: 1fr auto;
        gap: 0.75rem 1rem;
        align-items: center;
    }
    
    .navbar-logo {
        grid-area: logo;
        font-size: 1.25rem;
    }
    
    .navbar-actions {
        grid-area: actions;
        justify-content: flex-end;
    }
    
    .navbar-links {
        grid-area: links;
        justify-content: center;
        width: 100%;
        margin-top: 0.25rem;
        border-top: 1px solid var(--border-color);
        padding-top: 0.75rem;
        gap: 0.5rem;
    }
    
    .nav-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }
}

@media (max-width: 768px) {
    .page-shell {
        width: min(100% - 1.5rem, 1200px);
    }

    .study-grid,
    .verse-tools-grid,
    .feature-grid,
    .link-grid,
    .faq-preview-grid,
    .quote-grid,
    .character-grid,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .about-section-card {
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }

    .section-header-inline,
    .list-card-head,
    .navigation-bar,
    .quote-meta,
    .chapter-card-top,
    .title-row,
    .action-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .chapter-verse-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .navbar-links {
        justify-content: center;
    }
}

/* ── Mini Chat Side Panel (verse & chapter pages) ──────────── */
.mini-chat-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 380px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-2xl);
    z-index: 1100;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.mini-chat-panel.open {
    right: 0;
}

/* Drag handle */
.mini-chat-resize {
    position: absolute;
    top: 0;
    left: -4px;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    z-index: 10;
}

@media (hover: hover) {
    .mini-chat-resize:hover::after {
        content: '';
        position: absolute;
        top: 0;
        left: 3px;
        width: 2px;
        height: 100%;
        background: var(--saffron-400);
        border-radius: 2px;
        opacity: 0.7;
    }
}

.mini-chat-resize:active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: 2px;
    height: 100%;
    background: var(--saffron-400);
    border-radius: 2px;
    opacity: 0.7;
}

/* Panel header */
.mini-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.mini-chat-title {
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mini-chat-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

.mini-chat-close {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 1.8rem;
    height: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

@media (hover: hover) {
    .mini-chat-close:hover {
        background: rgba(228, 178, 61, 0.08);
        color: var(--text-primary);
    }
}

/* Messages */
.mini-chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.85rem;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mini-chat-msg {
    padding: 0.75rem 0.9rem;
    border-radius: 0.8rem;
    font-size: 0.88rem;
    line-height: 1.6;
    max-width: 94%;
    animation: fadeInUp 0.25s ease-out;
}

.mini-chat-msg.user {
    margin-left: auto;
    background: rgba(228, 178, 61, 0.15);
    border: 1px solid rgba(228, 178, 61, 0.25);
    border-radius: 0.8rem 0.8rem 0.2rem 0.8rem;
}

.mini-chat-msg.assistant {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.8rem 0.8rem 0.8rem 0.2rem;
}

.mini-chat-msg p {
    margin-bottom: 0.5rem;
}

.mini-chat-msg p:last-child {
    margin-bottom: 0;
}

.mini-chat-msg .mini-citations {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mini-chat-msg .mini-citation {
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.4rem;
    background: rgba(228, 178, 61, 0.07);
    border: 1px solid rgba(228, 178, 61, 0.15);
    color: var(--saffron-600);
    text-decoration: none;
    display: flex;
    justify-content: space-between;
}

.dark-mode .mini-chat-msg .mini-citation {
    color: var(--saffron-400);
}

/* Loading dots */
.mini-dots {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.mini-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--saffron-400);
    animation: dotBounce 1.2s ease-in-out infinite;
}

.mini-dots span:nth-child(2) { animation-delay: 0.2s; }
.mini-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Input form */
.mini-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.mini-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
    max-height: 100px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: border-color 0.2s;
}

.mini-chat-input:focus {
    outline: none;
    border-color: var(--saffron-400);
}

.mini-chat-send {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.55rem;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(228, 178, 61, 0.3);
}

@media (hover: hover) {
    .mini-chat-send:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(228, 178, 61, 0.45);
    }
}

.mini-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Overlay for mobile */
.mini-chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1099;
}

.mini-chat-overlay.visible {
    display: block;
}

@media (max-width: 600px) {
    .mini-chat-panel {
        width: 100vw;
        right: -100vw;
    }
}

/* ============================================================
   Cross-Device Compatibility Fixes
   ============================================================ */

/* GAP-01: Prevent iOS auto-zoom on inputs (font-size must be >= 16px) */
@media (max-width: 1024px) {
    .mini-chat-input {
        font-size: 16px;
    }
    .search-input {
        font-size: 16px;
    }
}

/* GAP-05: Release sticky navbar on small screens to save vertical space */
@media (max-width: 768px) {
    .navbar {
        position: relative;
    }
}

/* GAP-08: Enlarge touch targets for icon buttons on mobile */
@media (max-width: 768px) {
    .btn-icon {
        padding: 0.75rem;
        min-width: 44px;
        min-height: 44px;
    }
}
