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

:root {
    --bg: #faf8f5;
    --bg-warm: #f5f1ea;
    --text: #2c2c2c;
    --text-muted: #8a8578;
    --accent: #cba449;
    --accent-subtle: rgba(203,164,73,0.08);
    --link: #2563a8;
    --god: #b5342b;
    --note: #2563a8;
    --border: #e8e3d9;
    --header-bg: #142e42;
    --header-text: #e8e3d9;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --font-body: 'EB Garamond', Georgia, serif;
    --font-ui: 'Fira Sans', system-ui, sans-serif;
}

html { font-size: 19px; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.82;
    -webkit-font-smoothing: antialiased;
}

/* === Header === */
header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    font-family: var(--font-ui);
    font-weight: 300;
    font-size: 16px;
    letter-spacing: 0.03em;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}
.logo strong {
    color: var(--accent);
    font-weight: 600;
}
.header-spacer { flex: 1; }
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}
.icon-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s;
}
.icon-btn:hover { color: var(--accent); background: rgba(255,255,255,0.08); }

/* === Navigation === */
nav.book-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 44px;
    gap: 8px;
    position: sticky;
    top: 52px;
    z-index: 99;
}
.book-selector {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.15s;
    text-decoration: none;
}
.book-selector:hover { border-color: var(--accent); color: var(--accent); }
.book-selector .arrow { font-size: 9px; opacity: 0.5; }
.nav-arrow {
    font-size: 18px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.nav-arrow:hover { color: var(--accent); }
.nav-arrow.disabled { opacity: 0.25; pointer-events: none; }

/* === Picker overlay === */
.picker-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 500; display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease;
}
.picker-overlay.hidden { display: none; }
.picker-panel {
    background: #fff; border-radius: 14px;
    max-width: 520px; width: 92%; max-height: 75vh;
    overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.picker-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: #fff;
    border-radius: 14px 14px 0 0; z-index: 1;
}
.picker-header h2 { font-family: var(--font-ui); font-size: 17px; font-weight: 600; }
.picker-close {
    font-size: 22px; background: none; border: none;
    color: var(--text-muted); cursor: pointer; padding: 2px 6px;
}
.picker-step { padding: 12px 20px 20px; }
.picker-step.hidden { display: none; }
.picker-group { margin-bottom: 16px; }
.picker-group-label {
    font-family: var(--font-ui); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--accent); margin-bottom: 6px;
}
.picker-items { display: flex; flex-wrap: wrap; gap: 5px; }
.picker-book {
    font-family: var(--font-ui); font-size: 13px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 5px 11px; cursor: pointer;
    color: var(--text); transition: all 0.12s; text-decoration: none;
}
.picker-book:hover { border-color: var(--accent); background: var(--accent-subtle); }
.picker-book.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.picker-back {
    font-family: var(--font-ui); font-size: 13px; color: var(--accent);
    background: none; border: none; cursor: pointer; padding: 4px 0;
    margin-bottom: 12px; font-weight: 500;
}
.picker-back:hover { text-decoration: underline; }
.picker-chapter-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px;
}
.picker-ch {
    font-family: var(--font-ui); font-size: 14px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 0; text-align: center;
    cursor: pointer; color: var(--text); transition: all 0.12s;
    text-decoration: none; display: block;
}
.picker-ch:hover { border-color: var(--accent); background: var(--accent-subtle); }
.picker-ch.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Content === */
main {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 24px 120px;
}
.chapter-title {
    font-family: var(--font-body);
    font-size: 32px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.chapter-intro {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

/* Book intro */
.book-intro {
    background: var(--bg-warm);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 14px 18px;
    margin-bottom: 28px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
}
.book-intro-label {
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}
.book-intro-toggle {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--accent);
    float: right;
    margin-top: -18px;
}
.book-intro-text {
    display: none;
}
.book-intro.open .book-intro-text {
    display: block;
}
.book-intro.open .book-intro-toggle {
    display: none;
}

/* Verses */
.verses {
    line-height: 1.9;
}
.verse-span {
    display: block;
    margin-bottom: 4px;
}
.verse-span.paragraph-break {
    margin-top: 18px;
}
.v-num {
    font-family: var(--font-ui);
    font-size: 0.52em;
    font-weight: 700;
    color: var(--text-muted);
    vertical-align: super;
    margin-right: 1px;
    cursor: pointer;
    user-select: none;
    padding: 2px 1px;
    border-radius: 2px;
    transition: all 0.1s;
}
.v-num:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}
.god-speaks {
    color: var(--god);
    font-style: italic;
}
.direct-speech {
    font-style: italic;
}
.note-ref {
    font-family: var(--font-ui);
    font-size: 0.5em;
    font-weight: 700;
    color: var(--note);
    vertical-align: super;
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 2px;
    transition: background 0.1s;
}
.note-ref:hover {
    background: rgba(37,99,168,0.1);
}

/* Inline note */
.note-inline {
    display: none;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--note);
    border-radius: 0 6px 6px 0;
    padding: 10px 14px;
    margin: 8px 0 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
    box-shadow: var(--shadow);
    animation: fadeIn 0.15s ease;
}
.note-inline.visible { display: block; }
.note-inline .note-marker-label {
    font-weight: 700;
    color: var(--note);
    margin-right: 4px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hidden states for notes */
body:not(.show-notes) .note-ref { display: none; }
body:not(.show-notes) .note-inline { display: none !important; }

/* Begrippen links */
.begrip-link {
    color: inherit;
    text-decoration: none;
    pointer-events: none;
}
body.show-begrippen .begrip-link {
    color: #c87f1a;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    pointer-events: auto;
    cursor: pointer;
}
body.show-begrippen .begrip-link:hover {
    background: rgba(200,127,26,0.08);
    border-radius: 2px;
}
body.show-begrippen .god-speaks .begrip-link {
    color: #c87f1a;
}
body.show-begrippen .direct-speech .begrip-link {
    color: #c87f1a;
}

/* Footer nav */
.chapter-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}
.ch-nav-link {
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.15s;
}
.ch-nav-link:hover { background: var(--accent-subtle); }

/* === Settings overlay === */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.settings-overlay.hidden { display: none; }
.settings-panel {
    background: #fff;
    border-radius: 14px;
    max-width: 380px;
    width: 92%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
}
.settings-header h2 {
    font-family: var(--font-ui);
    font-size: 17px;
    font-weight: 600;
}
.settings-close {
    font-size: 22px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
}
.settings-body { padding: 8px 20px 20px; }
.setting-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    align-items: center;
}
.setting-row:last-child { border-bottom: none; }
.setting-label {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    grid-column: 1;
    grid-row: 1;
}
.setting-desc {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-muted);
    grid-column: 1;
    grid-row: 2;
}
.setting-toggle {
    grid-column: 2;
    grid-row: 1 / 3;
    appearance: none;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.setting-toggle:checked { background: var(--accent); }
.setting-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.setting-toggle:checked::before { transform: translateX(20px); }

/* === Index page === */
.index-main {
    max-width: 780px;
    margin: 0 auto;
    padding: 40px 24px 120px;
}
.index-title {
    font-family: var(--font-body);
    font-size: 32px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 6px;
}
.index-subtitle {
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
}
.book-group { margin-bottom: 28px; }
.book-group-label {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 8px;
}
.book-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.book-link {
    font-family: var(--font-ui);
    font-size: 13px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.book-link:hover { border-color: var(--accent); background: var(--accent-subtle); }
.book-link .ch-count {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
}
