/* Plain pages for each lesson and the lesson list (built by scripts/build_seo_pages.js).
   These copy the app's own styles in index.html: the All Lessons tree for /lessons/
   and the lesson view for /lessons/NNN-NN/, so a visitor from a search feels at home. */

:root {
    --bg: #FAFAF8;
    --surface: #FFFFFF;
    --surface-warm: #F7F6F3;
    --text-primary: #1A1A1A;
    --text-secondary: #5C5C5C;
    --text-tertiary: #6B6B6B;
    --accent: #2D6A4F;
    --border: #E8E6E1;
    --border-light: #F0EEE9;
    --verse-bg: #F9F7F2;
    --verse-border: #B7A98F;
    --blue-heading: #2B5A83;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --max-w: 640px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

a:focus-visible {
    outline: 2.5px solid var(--accent);
    outline-offset: 2px;
}

/* Round back and menu buttons */
.back-btn,
.toc-menu-btn,
.tree-close-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
    -webkit-tap-highlight-color: transparent;
}

.tree-close-btn {
    color: var(--text-secondary);
}

.back-btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(45, 106, 79, 0.09);
    background: color-mix(in srgb, var(--accent) 11%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.back-btn-circle svg {
    display: block;
    transform: translateX(-1px);
}

.toc-menu-btn .back-btn-circle svg {
    transform: none;
}

.back-btn:hover .back-btn-circle,
.toc-menu-btn:hover .back-btn-circle {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.tree-close-btn .back-btn-circle {
    background: rgba(26, 26, 26, 0.06);
}

.tree-close-btn:hover .back-btn-circle {
    background: rgba(26, 26, 26, 0.11);
}

/* ============================================
   ALL LESSONS (the app's tree view)
   ============================================ */
.tree-topbar {
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 20px;
    padding-top: max(env(safe-area-inset-top), 12px);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.tree-topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.65;
    color: var(--text-primary);
}

.tree-content {
    padding: 16px 24px 40px;
}

.tree-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    align-items: start;
}

.tree-course-section {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.tree-course-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    font-size: inherit;
}

.tree-course-badge {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.5);
}

.tree-course-name {
    font-size: 0.82rem;
    font-weight: 700;
    flex: 1;
    line-height: 1.2;
}

.coming-soon-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #FCEAE8;
    color: #B04C48;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
}

.tree-lesson-list {
    list-style: none;
    padding: 4px 0;
}

.tree-lesson-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    color: inherit;
    text-decoration: none;
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
}

a.tree-lesson-row:hover,
a.tree-lesson-row:active {
    background: var(--surface-warm);
}

.tree-lesson-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tree-lesson-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tree-lesson-topic {
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.tree-lesson-subtitle {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

@media (max-width: 900px) {
    .tree-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tree-course-name {
        font-size: 0.95rem;
    }

    .tree-lesson-topic {
        font-size: 0.9rem;
    }

    .tree-lesson-subtitle {
        font-size: 0.78rem;
    }

    .tree-lesson-num {
        width: 28px;
        height: 28px;
        font-size: 0.72rem;
    }

    .tree-lesson-row {
        padding: 9px 14px;
        gap: 10px;
    }
}

/* ============================================
   LESSON PAGE (the app's lesson view)
   ============================================ */
.app-container {
    max-width: var(--max-w);
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.lesson-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    padding: 2px 12px;
    padding-top: max(env(safe-area-inset-top), 2px);
}

.topbar-row-1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.compact-lesson-label {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    color: var(--accent);
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
}

.compact-lesson-code {
    flex-shrink: 0;
    font-size: 12px;
}

.compact-lesson-topic {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lesson-content {
    flex: 1;
    padding: 24px 20px 8px;
    overflow-wrap: anywhere;
}

.session-course-logo {
    float: right;
    width: 168px;
    height: 168px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 0 12px 16px;
    opacity: 0.85;
}

.session-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    line-height: 1.3;
}

.session-description {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.75;
    margin-bottom: 20px;
}

.start-row {
    clear: both;
    margin: 0 0 24px;
}

.start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.start-btn:hover,
.start-btn:active {
    filter: brightness(0.9);
}

.block-verse {
    background: var(--verse-bg);
    border-left: 3px solid var(--verse-border);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    padding: 20px;
    margin: 24px 0;
}

.verse-ref {
    display: block;
    font-style: normal;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.verse-text {
    font-size: 1rem;
    line-height: 1.75;
}

.block-heading {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--blue-heading);
    margin-top: 40px;
    margin-bottom: 16px;
    line-height: 1.3;
}

.lesson-contents {
    list-style: none;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}

.lesson-contents li {
    padding: 6px 12px;
    color: var(--blue-heading);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.lesson-contents li + li {
    border-top: 1px solid var(--border-light);
}

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

.question-label {
    margin: 0 0 20px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.esv-footnote {
    padding: 16px 20px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
}

.bottom-nav {
    margin-top: 16px;
    border-top: 1px solid var(--border-light);
    padding: 20px;
    padding-bottom: max(env(safe-area-inset-bottom), 24px);
}

.bottom-nav-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn-prev {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.nav-btn-next {
    background: var(--accent);
    color: #FFFFFF;
}

.nav-btn-off {
    visibility: hidden;
}

.nav-session-num {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    min-width: 44px;
}
