:root {
    color-scheme: dark light;
    --bg: #09111f;
    --surface: #101a2e;
    --surface-2: #16233c;
    --text: #edf4ff;
    --muted: #a9b7cc;
    --line: #273653;
    --brand: #0b7fc3;
    --brand-2: #7cc7ff;
    --focus: #f9c74f;
    --shadow: 0 16px 40px rgba(0, 0, 0, .24);
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #eaf1f8;
    --text: #152033;
    --muted: #5c6a7d;
    --line: #d9e1eb;
    --brand: #086aa7;
    --brand-2: #0b5784;
    --shadow: 0 12px 32px rgba(21, 32, 51, .12);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

a {
    color: var(--brand-2);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

button,
input,
select {
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--brand);
    color: #fff;
    text-decoration: none;
}

.secondary {
    background: transparent;
}

input,
select {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    padding: 8px 10px;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.wrap {
    width: min(100% - 32px, 1100px);
    margin-inline: auto;
}

.narrow {
    max-width: 860px;
}

.section {
    padding: 42px 0;
}

.main {
    min-height: 70vh;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -80px;
    z-index: 30;
    background: var(--focus);
    color: #121212;
    padding: 8px 12px;
    border-radius: 8px;
}

.skip-link:focus {
    top: 16px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--brand);
    border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
}

.brand {
    color: #fff;
    font-size: 1.18rem;
    font-weight: 900;
    letter-spacing: 0;
}

.brand:hover {
    color: #e8f6ff;
    text-decoration: none;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.primary-nav a,
.theme-toggle {
    min-height: 42px;
    border-radius: 8px;
    padding: 9px 12px;
    color: #fff;
    font-weight: 700;
}

.primary-nav a[aria-current="page"],
.primary-nav a:hover,
.theme-toggle:hover {
    background: rgba(0, 0, 0, .22);
    text-decoration: none;
}

.theme-toggle {
    width: 42px;
    border-color: rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .08);
}

.theme-toggle span {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--focus);
    display: block;
}

.nav-toggle {
    display: none;
    width: 44px;
    padding: 8px;
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .25);
}

.nav-toggle span:not(.sr-only) {
    display: block;
    width: 20px;
    height: 2px;
    margin: 3px auto;
    background: #fff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
    gap: 24px;
    align-items: start;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.08;
    margin-bottom: 16px;
}

h2 {
    font-size: 1.55rem;
    line-height: 1.2;
}

.lead {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 70ch;
}

.eyebrow {
    color: var(--brand-2);
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.panel,
.book-card,
.result-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.daily-verse {
    padding: 22px;
}

.daily-verse blockquote {
    margin: 0 0 18px;
    padding-left: 16px;
    border-left: 4px solid var(--brand);
}

.daily-verse cite {
    color: var(--muted);
    font-style: normal;
}

.version-form,
.quick-search,
.search-form,
.find-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.translation-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
    color: var(--muted);
}

.search-form + .translation-list {
    margin-top: 18px;
}

.translation-list p {
    margin-bottom: 8px;
}

.section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.quick-search input,
.search-form input {
    width: min(100%, 320px);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 10px;
}

.book-card {
    min-height: 82px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.book-card span,
.verse-num {
    color: var(--muted);
    font-size: .82rem;
}

.book-card strong {
    color: var(--brand-2);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    margin-bottom: 24px;
    font-size: .92rem;
}

.book-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.chapter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0;
}

.chapter-grid a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--brand-2);
    font-weight: 800;
}

.chapter-grid a[aria-current="page"],
.chapter-grid a:hover {
    background: var(--brand);
    color: #fff;
    text-decoration: none;
}

.compact a {
    width: 36px;
    height: 36px;
    font-size: .9rem;
}

.chapter-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.reader-tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.verses {
    font-size: 1.08rem;
}

.verse {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    align-items: start;
    margin: 0;
    padding: 8px 0;
    border-radius: 8px;
    scroll-margin-top: 92px;
}

.verse:hover,
.verse:target,
.verse.is-speaking,
.verse.is-match {
    background: var(--surface-2);
}

.verse button {
    min-height: 30px;
    padding: 3px 8px;
    font-size: .82rem;
}

.results-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.result-item {
    display: grid;
    gap: 6px;
    padding: 14px;
}

.result-item span {
    color: var(--muted);
}

.result-count {
    color: var(--muted);
    margin-top: 22px;
}

.prose {
    font-size: 1.04rem;
}

.prose h2 {
    margin-top: 30px;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0;
    color: var(--muted);
}

.footer-inner {
    display: grid;
    gap: 10px;
}

.footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 760px) {
    .wrap {
        width: min(100% - 24px, 1100px);
    }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
    }

    .primary-nav {
        position: absolute;
        inset: 64px 12px auto 12px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: var(--shadow);
    }

    .primary-nav.is-open {
        display: flex;
    }

    .primary-nav a,
    .theme-toggle {
        color: var(--text);
        justify-content: flex-start;
    }

    .content-grid,
    .translation-list {
        grid-template-columns: 1fr;
    }

    .section-header,
    .chapter-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .quick-search input,
    .search-form input,
    .find-form input {
        width: 100%;
    }

    .search-form > * {
        flex: 1 1 100%;
    }

    .books-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .verse button {
        grid-column: 2;
        justify-self: start;
    }
}

@media (max-width: 420px) {
    .books-grid {
        grid-template-columns: 1fr;
    }
}
