@font-face {
    font-family: "SourceSerif4";
    src: url("/assets/fonts/SourceSerif4-Variable.ttf") format("truetype");
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
}

:root {
    --navy: #061f4a;
    --navy-dark: #001b3f;
    --gold: #d59a34;
    --gold-dark: #a86500;
    --text: #071b3d;
    --border: #97a9c5;
    --bg: #ffffff;
    --shadow: 0 8px 24px rgba(6, 31, 74, 0.08);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --radius-small: 6px;
    --radius-medium: 10px;
    --radius-large: 16px;

    --header-height: 118px;
    --footer-height: 118px;

    --page-width: calc(100% - 80px);
    --page-max-width: 1880px;
}

/* BASE RESET */

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

/* HEADER */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 2px solid var(--navy);
}

.header-inner {
    width: var(--page-width);
    max-width: var(--page-max-width);
    min-height: var(--header-height);
    margin: 0 auto;
    padding: 10px 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    color: var(--navy);
}

.brand-logo {
    width: 210px;
    height: auto;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.7rem, 3vw, 2.7rem);
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
}

.site-subtitle {
    font-size: 1.12rem;
    letter-spacing: 1.8px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: clamp(28px, 4vw, 66px);
    font-weight: 700;
    font-size: 0.95rem;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
    padding: 18px 0;
    border-bottom: 4px solid transparent;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--navy);
    border-bottom-color: var(--gold);
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    margin: 5px auto;
    background: var(--navy);
}

/* Compact navigation for small laptops and landscape tablets. */
@media (min-width: 901px) and (max-width: 1100px) {
    .menu-toggle {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        right: 0;
        left: 0;
        z-index: 999;
        display: none;
        flex-direction: column;
        gap: 0;
        border-bottom: 2px solid var(--navy);
        background: #fff;
        box-shadow: var(--shadow);
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav a {
        width: 100%;
        padding: 15px 20px;
        border-bottom: 1px solid #e5eaf1;
        text-align: center;
    }
}

/* MAIN CONTENT AREA */

.page-main {
    position: absolute;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    right: 0;
    overflow-y: auto;
    padding: 20px 38px 60px;
}

.books-section {
    width: var(--page-width);
    max-width: var(--page-max-width);
    margin: 0 auto;
}

/* SECTION TITLES */

.section-title-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
}

.section-title-wrap h1 {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(2rem, 3.2vw, 3.1rem);
    color: var(--navy);
    letter-spacing: 1px;
}

.decor-line {
    width: min(120px, 12vw);
    height: 2px;
    background: var(--border);
}

.decor-leaf {
    color: var(--gold);
    font-size: 2rem;
}

.small-gold-line {
    width: 92px;
    height: 2px;
    margin: 16px auto 28px;
    background: var(--gold);
    position: relative;
}

.site-introduction {
    max-width: 720px;
    margin: 6px auto 14px;
    color: #42516a;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
}

.small-gold-line::after {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid var(--gold);
    background: #fff;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.testament-block h2 {
    text-align: center;
    color: var(--navy);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    letter-spacing: 1px;
    margin: 0 0 28px;
}

.new-testament {
    margin-top: 46px;
}

/* BOOK / CHAPTER BUTTONS */

.book-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(130px, 1fr));
    gap: 6px 8px;
}

.book-button {
    min-height: 42px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff, #fbfcff);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.2;
    text-align: center;
    padding: 8px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 0 3px 8px rgba(6, 31, 74, 0.035);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.book-label-primary,
.book-label-english {
    display: block;
}

.book-label-english {
    margin-top: 2px;
    color: #65738a;
    font-size: 0.78em;
    font-weight: 500;
    line-height: 1.1;
}

.book-button:hover {
    border-color: var(--navy);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* FOOTER */

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(90deg, #011a3e, #062a61);
    color: #fff;
    border-top: 3px solid var(--gold);
}

.footer-inner {
    width: var(--page-width);
    max-width: var(--page-max-width);
    min-height: var(--footer-height);
    margin: 0 auto;
    padding: 22px 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: center;
    gap: 22px;
}

.footer-verse {
    text-align: center;
    line-height: 1.45;
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-credit {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #dce6f5;
    font-size: 0.78rem;
    line-height: 1.25;
    text-align: right;
}

.footer-credit strong {
    color: #fff;
    font-size: 0.88rem;
}

/* RESPONSIVE BREAKPOINTS */

/* Large desktop / wide laptop */
@media (max-width: 1600px) {
    :root {
        --page-width: calc(100% - 70px);
    }

    .book-grid {
        grid-template-columns: repeat(7, minmax(125px, 1fr));
    }
}

/* Standard desktop */
@media (max-width: 1440px) {
    :root {
        --page-width: calc(100% - 60px);
    }

    .brand-logo {
        width: 185px;
    }

    .main-nav {
        gap: 32px;
    }

    .book-grid {
        grid-template-columns: repeat(5, minmax(105px, 1fr));
    }
}

/* Small laptop */
@media (max-width: 1280px) {
    :root {
        --page-width: calc(100% - 48px);
        --header-height: 104px;
        --footer-height: 108px;
    }

    .header-inner {
        padding: 10px 24px;
    }

    .brand-logo {
        width: 155px;
    }

    .site-title {
        font-size: 1.8rem;
    }

    .site-subtitle {
        font-size: 0.95rem;
    }

    .main-nav {
        gap: 24px;
        font-size: 0.88rem;
    }

    .page-main {
        padding: 42px 28px 48px;
    }

    .footer-inner {
        grid-template-columns: minmax(0, 1fr) 220px;
        gap: 18px;
    }

    .footer-verse {
        font-size: 0.92rem;
    }
}

/* Tablet landscape */
@media (max-width: 1100px) {
    :root {
        --page-width: calc(100% - 36px);
        --header-height: 96px;
        --footer-height: 99px;
    }

    .brand-logo {
        width: 130px;
    }

    .site-title {
        font-size: 1.55rem;
    }

    .site-subtitle {
        font-size: 0.85rem;
    }

    .main-nav {
        gap: 18px;
        font-size: 0.82rem;
    }

    .book-grid {
        grid-template-columns: repeat(5, minmax(105px, 1fr));
        gap: 6px;
    }

    .book-button {
        font-size: 0.92rem;
    }

    .footer-inner {
        padding: 8px 20px;
        grid-template-columns: minmax(0, 1fr) 210px;
    }

    .footer-verse {
        font-size: 0.8rem;
        line-height: 1.35;
    }
}

/* Tablet portrait / mobile navigation starts */
@media (max-width: 900px) {
    :root {
        --header-height: 86px;
        --footer-height: 0px;
        --page-width: calc(100% - 28px);
    }

    .header-inner {
        min-height: var(--header-height);
        padding: 8px 14px;
    }

    .brand {
        gap: 12px;
    }

    .brand-logo {
        width: 112px;
    }

    .site-title {
        font-size: 1.35rem;
    }

    .site-subtitle {
        font-size: 0.78rem;
        letter-spacing: 1.2px;
    }

    .menu-toggle {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        gap: 0;
        background: #fff;
        border-bottom: 2px solid var(--navy);
        box-shadow: var(--shadow);
        z-index: 999;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav a {
        width: 100%;
        padding: 15px 20px;
        text-align: center;
        border-bottom: 1px solid #e5eaf1;
    }

    .page-main {
        bottom: 0;
        padding: 32px 16px 44px;
    }

    .section-title-wrap {
        gap: 6px;
    }

    .section-title-wrap h1 {
        font-size: 1.9rem;
    }

    .decor-line {
        width: 50px;
    }

    .decor-leaf {
        font-size: 1.4rem;
    }

    .book-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .book-button {
        min-height: 44px;
        font-size: 0.86rem;
        padding: 8px 9px;
    }

    .site-footer {
        display: none;
    }
}

/* Small tablets */
@media (max-width: 768px) {
    :root {
        --header-height: 80px;
        --page-width: calc(100% - 24px);
    }

    .brand-logo {
        width: 95px;
    }

    .site-title {
        font-size: 1.18rem;
    }

    .site-subtitle {
        font-size: 0.72rem;
    }

    .page-main {
        padding: 28px 14px 40px;
    }

    .section-title-wrap h1 {
        font-size: 1.65rem;
    }

    .decor-line {
        width: 36px;
    }

    .small-gold-line {
        margin-bottom: 24px;
    }

    .testament-block h2 {
        font-size: 1.05rem;
        margin-bottom: 20px;
    }

    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .book-button {
        min-height: 34px;
        font-size: 0.78rem;
        padding: 5px 5px;
    }

    .new-testament {
        margin-top: 36px;
    }

}

/* =========================
   VISUAL SYSTEM REFINEMENTS
========================= */

.books-page-main {
    background:
        radial-gradient(circle at 50% 0, rgba(213, 154, 52, 0.055), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.books-section .testament-block {
    margin-right: -6px;
    margin-left: -6px;
    padding: 6px;
    border: 1px solid rgba(151, 169, 197, 0.24);
    border-radius: var(--radius-large);
    background: rgba(247, 250, 255, 0.72);
}

.books-section .new-testament {
    border-color: rgba(213, 154, 52, 0.28);
    background: rgba(255, 250, 240, 0.72);
}

.books-section .new-testament::before {
    content: "";
    display: block;
    width: min(280px, 42%);
    height: 2px;
    margin: -10px auto 8px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.book-button {
    border-radius: var(--radius-medium);
}

.book-button:hover {
    border-color: var(--navy);
    background: linear-gradient(180deg, #fffdf7, #eef4ff);
    box-shadow: 0 6px 16px rgba(6, 31, 74, 0.12);
}

.book-button:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 5px rgba(6, 31, 74, 0.12);
}

.book-label-english {
    color: #526178;
}

.main-nav a {
    font-weight: 700;
}

.footer-verse-reference {
    color: #f1bd5d;
    letter-spacing: 0.02em;
}

.reader-title-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.reader-current-chapter,
.reader-current-chapter .reader-title-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reader-current-chapter .book-label-english {
    margin-top: 1px;
    font-size: 0.68em;
}

.reading-size-controls {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: #fff;
}

.reading-size-controls button {
    min-width: 31px;
    min-height: 29px;
    padding: 3px 6px;
    border: 0;
    border-right: 1px solid #dce4ef;
    background: #fff;
    color: var(--navy);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.reading-size-controls button:last-child {
    border-right: 0;
}

.reading-size-controls button:hover {
    background: #eef4ff;
}

.reader-nav-button {
    flex-direction: column;
    min-width: 82px;
    gap: 1px;
    border-radius: var(--radius-medium);
}

.reader-nav-direction {
    color: var(--navy);
    font-size: 0.72rem;
    font-weight: 700;
}

.reader-nav-destination {
    color: #42516a;
    font-size: 0.76rem;
}

.chapter-availability-legend {
    margin: 5px 4px 0;
    color: #68758a;
    font-size: 0.68rem;
    line-height: 1.35;
    text-align: center;
}

.read-page-main {
    --reader-font-scale: 1;
}

.read-page-main .bible-text {
    font-family: "SourceSerif4", Georgia, "Times New Roman", serif;
    font-size: calc(1.125rem * var(--reader-font-scale));
}

.search-result-snippet {
    font-family: "SourceSerif4", Georgia, "Times New Roman", serif;
}

.scripture-search-form,
.search-summary,
.copyright-box,
.author-card,
.information-card {
    border-radius: var(--radius-large);
}

.search-result-link,
.reader-nav-button,
.reader-book-link {
    border-radius: var(--radius-medium);
}

@media (min-width: 1600px) and (min-height: 900px) {
    .books-page-main {
        display: flex;
        align-items: center;
    }
}

@media (min-width: 1101px) and (max-height: 850px) {
    :root {
        --header-height: 92px;
        --footer-height: 92px;
    }

    .header-inner {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .brand-logo {
        width: 150px;
    }

    .site-title {
        font-size: 1.75rem;
    }

    .site-subtitle {
        font-size: 0.88rem;
    }

    .footer-inner {
        min-height: var(--footer-height);
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .footer-verse {
        font-size: 0.86rem;
    }
}

@media (max-width: 900px) {
    .reader-title-area {
        gap: var(--space-2);
    }

    .reading-size-controls button {
        min-width: 29px;
        min-height: 28px;
        padding: 2px 5px;
    }
}

@media (max-width: 600px) {
    .books-section .testament-block {
        margin-right: 0;
        margin-left: 0;
        padding: 8px;
    }

    .books-section .new-testament::before {
        margin-top: -13px;
    }

    .reader-title-area {
        flex-direction: column;
        gap: 3px;
    }

    .reading-size-controls {
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        opacity: 0;
        pointer-events: none;
    }

    .reader-top-nav:focus-within .reading-size-controls {
        opacity: 1;
        pointer-events: auto;
    }

    .reader-nav-button {
        min-width: 72px;
        padding: 5px 7px;
    }
}

/* Large phones */
@media (max-width: 600px) {
    :root {
        --header-height: 74px;
        --page-width: calc(100% - 20px);
    }

    .header-inner {
        padding: 6px 10px;
    }

    .brand-logo {
        width: 78px;
    }

    .brand-text {
        gap: 2px;
    }

    .site-title {
        font-size: 1rem;
        letter-spacing: 0.5px;
    }

    .site-subtitle {
        font-size: 0.66rem;
        letter-spacing: 0.8px;
    }

    .menu-toggle {
        width: 40px;
        height: 40px;
    }

    .page-main {
        padding: 22px 10px 36px;
    }

    .section-title-wrap h1 {
        font-size: 1.45rem;
    }

    .decor-line,
    .decor-leaf {
        display: none;
    }

    .small-gold-line {
        width: 72px;
        margin-top: 12px;
        margin-bottom: 20px;
    }

    .testament-block h2 {
        font-size: 0.98rem;
        margin-bottom: 16px;
    }

    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .book-button {
        min-height: 28px;
        height: auto;
        font-size: 0.70rem;
        padding: 3px 4px;
        border-radius: 10px;
        line-height: 1.1;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .small-gold-line {
        margin-top: 6px;
        margin-bottom: 8px;
    }
}

/* =========================
   DEVELOPER CREDIT
========================= */

@media (min-width: 1101px) {
    .footer-inner {
        grid-template-columns: minmax(0, 1fr) 220px;
    }
}

@media (max-width: 900px) {
    :root {
        --footer-height: 61px;
    }

    .page-main {
        bottom: var(--footer-height);
    }

    .site-footer {
        display: block;
    }

    .footer-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: var(--footer-height);
        padding: 8px 16px;
    }

    .footer-verse {
        display: none;
    }

    .footer-credit {
        gap: 2px;
        font-size: 0.72rem;
        text-align: center;
    }

    .footer-credit strong {
        font-size: 0.82rem;
    }

    .mobile-books-button {
        bottom: calc(var(--footer-height) + 14px + env(safe-area-inset-bottom));
    }
}

/* Modern small phones */
@media (max-width: 430px) {
    :root {
        --header-height: 68px;
        --page-width: calc(100% - 16px);
    }

    .brand-logo {
        width: 66px;
    }

    .site-title {
        font-size: 0.92rem;
    }

    .site-subtitle {
        font-size: 0.6rem;
    }

    .page-main {
        padding: 20px 8px 34px;
    }

    .section-title-wrap h1 {
        font-size: 1.28rem;
    }

    .testament-block h2 {
        font-size: 0.92rem;
        margin-bottom: 14px;
    }

    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .book-button {
        min-height: 26px;
        height: auto;
        font-size: 0.66rem;
        padding: 3px 3px;
        border-radius: 10px;
        line-height: 1.1;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* iPhone SE / narrow phones */
@media (max-width: 375px) {
    .brand-logo {
        width: 58px;
    }

    .site-title {
        font-size: 0.82rem;
    }

    .site-subtitle {
        font-size: 0.56rem;
    }

    .menu-toggle {
        width: 36px;
    }

    .menu-toggle span {
        width: 23px;
    }

    .page-main {
        padding: 18px 8px 32px;
    }

    .section-title-wrap h1 {
        font-size: 1.18rem;
    }

    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .book-button {
        min-height: 24px;
        height: auto;
        font-size: 0.62rem;
        padding: 3px 2px;
        line-height: 1.08;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Very small phones */
@media (max-width: 320px) {
    .brand-logo {
        width: 50px;
    }

    .site-title {
        font-size: 0.74rem;
    }

    .site-subtitle {
        display: none;
    }

    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .book-button {
        min-height: 24px;
        height: auto;
        font-size: 0.58rem;
        padding: 3px 2px;
        line-height: 1.08;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

:where(a, button, summary):focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

/* =========================
   BIBLE READER
========================= */

.read-page-main {
    overflow: hidden;
}

.reader-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 10px;
    height: 100%;
    min-height: 0;
}

.bible-sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    height: 100%;
    padding: 8px 14px 8px 6px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: #f8fbff;
    scrollbar-gutter: stable;
}

.reader-book-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reader-testament-label {
    margin: 10px 4px 4px;
    padding-bottom: 5px;
    border-bottom: 1px solid #d7dfeb;
    color: #6b778c;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reader-testament-label:first-child {
    margin-top: 2px;
}

.reader-book-link,
.chapter-number-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border: 1px solid #e3eaf5;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
}

.reader-book-link {
    flex-direction: column;
    min-height: 36px;
    padding: 7px 9px;
    font-size: 0.92rem;
    font-weight: 700;
}

.book-summary .book-label-primary,
.book-summary .book-label-english {
    margin-left: 16px;
}

.reader-current-chapter .book-name {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
}

.reader-current-chapter .book-label-english {
    font-size: 0.62em;
}

.reader-book-link:hover,
.reader-book-link:focus-visible,
.chapter-number-link:hover,
.book-summary:hover {
    background: #eef4ff;
}

.book-collapse {
    margin-bottom: 6px;
}

.current-book {
    padding-bottom: 8px;
    border-bottom: 1px solid #dfe6f0;
}

.book-summary {
    padding: 8px;
    color: var(--navy);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    list-style: none;
}

.current-book .book-summary {
    border-left: 3px solid var(--gold);
    border-radius: 6px;
    background: #fff8eb;
}

.book-summary::-webkit-details-marker {
    display: none;
}

.book-summary::before {
    content: "▸";
    margin-right: 4px;
}

.book-collapse[open] > .book-summary::before {
    content: "▾";
}

.chapter-number-list,
.current-book .chapter-number-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(42px, 1fr));
    gap: 5px;
    margin: 3px 0 6px;
    padding: 6px 4px 2px;
}

.chapter-number-link,
.current-book .chapter-number-link {
    min-height: 38px;
    padding: 6px 4px;
    font-size: 0.92rem;
}

.chapter-number-link.active {
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
    font-weight: 700;
}

.chapter-number-link.unavailable {
    border-style: dashed;
    border-color: #c7ced8;
    background: #f2f3f5;
    color: #7a8493;
    cursor: not-allowed;
    opacity: 0.72;
}

.reader-content {
    display: grid;
    grid-template-rows: 56px minmax(0, 1fr) 48px;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.reader-content .testament-block {
    min-height: 0;
    overflow: hidden;
}

.reader-top-nav,
.reader-bottom-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.reader-top-nav {
    height: 56px;
    margin: 0;
    padding: 6px 10px;
    background: #fff;
}

.reader-bottom-nav {
    height: 48px;
    margin: 0;
    padding: 8px 0;
    border-top: 1px solid #e5eaf1;
}

.reader-nav-left {
    justify-self: start;
}

.reader-nav-right {
    justify-self: end;
}

.reader-current-chapter {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.reader-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbff;
    color: var(--navy);
    font-size: 0.85rem;
    text-decoration: none;
}

.reader-nav-button:hover {
    background: #eef4ff;
}

.reading-box,
.reader-content .reading-box {
    height: 100%;
    min-height: 0;
    padding: 12px 10px 12px 22px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bible-text {
    width: min(100%, 72ch);
    max-width: 72ch;
    margin: 0 auto;
    padding: 14px 20px 28px;
    color: var(--text);
    font-size: 1.125rem;
    line-height: 1.75;
}

.verse {
    margin: 0 0 1rem;
}

.verse sup,
.poetry sup {
    margin-right: 0.18em;
    color: #a66200;
    font-size: 0.7em;
    font-weight: 800;
    line-height: 0;
    vertical-align: super;
}

.verse.indent {
    margin-top: -8px;
    margin-bottom: 0;
    margin-left: 28px;
}

.poetry {
    margin-top: -4px;
    margin-bottom: 12px;
    margin-left: 28px;
    line-height: 1.65;
}

.poetry div {
    margin-bottom: 3px;
}

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

.mobile-books-button,
.mobile-sidebar-close,
.mobile-sidebar-overlay {
    display: none;
}

/* =========================
   HEADER INTERACTION
========================= */

.menu-toggle span {
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
}

.menu-toggle.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =========================
   READER: TABLET AND MOBILE
========================= */

@media (max-width: 900px) {
    .main-nav.open {
        display: flex;
    }

    .main-nav a {
        font-size: 0.9rem;
        font-weight: 700;
        letter-spacing: 0.5px;
    }

    .read-page-main {
        padding: 18px 18px 84px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .reader-layout {
        display: block;
        height: auto;
        min-height: 100%;
    }

    .reader-content {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .reader-content .testament-block,
    .reader-content .reading-box {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .reader-content .reading-box {
        flex: none;
        padding: 12px 4px 20px;
    }

    .bible-text {
        width: min(100%, 62ch);
        max-width: 62ch;
        font-size: 1.1rem;
        line-height: 1.72;
    }

    .reader-top-nav,
    .reader-bottom-nav {
        position: static;
    }

    .mobile-books-button {
        display: inline-flex;
        position: fixed;
        right: 14px;
        bottom: calc(18px + env(safe-area-inset-bottom));
        z-index: 1400;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 9px 13px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--navy);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
        color: #fff;
        font-size: 0.84rem;
        font-weight: 700;
        cursor: pointer;
    }

    .mobile-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1500;
        visibility: hidden;
        background: rgba(0, 0, 0, 0.38);
        opacity: 0;
        transition: opacity 0.22s ease, visibility 0s linear 0.22s;
    }

    .mobile-sidebar-overlay.mobile-open {
        visibility: visible;
        opacity: 1;
        transition-delay: 0s;
    }

    .bible-sidebar {
        position: fixed;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        z-index: 1600;
        visibility: hidden;
        width: min(360px, 88vw);
        min-width: 0;
        max-width: none;
        height: auto;
        padding: 52px 14px 24px;
        overflow-y: auto;
        background: #f8fbff;
        box-shadow: 4px 0 18px rgba(0, 0, 0, 0.16);
        pointer-events: none;
        transform: translateX(-105%);
        transition: transform 0.24s ease, visibility 0s linear 0.24s;
    }

    .bible-sidebar.mobile-open {
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
        transition-delay: 0s;
    }

    .mobile-sidebar-close {
        display: flex;
        position: absolute;
        top: 10px;
        right: 10px;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 1px solid #d7dfeb;
        border-radius: 50%;
        background: #fff;
        color: var(--navy);
        font-size: 1.25rem;
        font-weight: 700;
        cursor: pointer;
    }

    .bible-sidebar .reader-book-link,
    .bible-sidebar .book-summary {
        min-height: 44px;
        padding: 10px 8px;
        overflow: visible;
        font-size: 1rem;
        white-space: normal;
        text-overflow: clip;
    }

    .chapter-number-list,
    .current-book .chapter-number-list {
        grid-template-columns: repeat(5, minmax(44px, 1fr));
        gap: 7px;
    }

    .chapter-number-link,
    .current-book .chapter-number-link {
        min-height: 44px;
        padding: 6px 4px;
        font-size: 1rem;
    }

    body.mobile-sidebar-active {
        overflow: hidden;
    }
}

@media (max-width: 600px) {
    .read-page-main {
        padding: 12px 10px 82px;
    }

    .reader-content .reading-box {
        padding: 8px 4px 20px;
    }

    .bible-text {
        width: min(100%, 58ch);
        max-width: 58ch;
        padding: 10px 8px 24px;
        font-size: 1.0625rem;
        line-height: 1.72;
    }

    .reader-current-chapter {
        font-size: 1.05rem;
        white-space: nowrap;
    }

    .reader-nav-button {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
        font-size: 0.85rem;
    }

    .reader-bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        margin-bottom: 10px;
    }

    .bible-sidebar {
        width: min(330px, 90vw);
    }

    .chapter-number-list,
    .current-book .chapter-number-list {
        grid-template-columns: repeat(4, minmax(44px, 1fr));
    }
}

/* =========================
   VISUAL REFINEMENT
========================= */

@media (min-width: 901px) {
    .header-inner {
        gap: 20px;
    }

    .brand-logo {
        width: 150px;
    }

    .main-nav {
        gap: clamp(18px, 2.2vw, 36px);
        font-size: 0.9rem;
    }

    .main-nav a {
        white-space: nowrap;
    }

    .book-grid {
        grid-template-columns: repeat(6, minmax(130px, 1fr));
        gap: 8px 10px;
    }
}

@media (min-width: 1600px) {
    .bible-text {
        width: min(100%, 88ch);
        max-width: min(88ch, 950px);
    }
}

.book-button,
.reader-nav-button,
.chapter-number-link,
.reader-book-link {
    border-radius: 8px;
}

.footer-verse {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.footer-verse-reference {
    display: block;
    margin-top: 2px;
}

@media (max-width: 600px) {
    .books-section {
        width: calc(100% - 8px);
    }

    .section-title-wrap h1 {
        font-size: clamp(1.25rem, 6.2vw, 1.55rem);
        line-height: 1.12;
    }

    .testament-block h2 {
        margin-bottom: 18px;
        font-size: 1rem;
    }

    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px 8px;
    }

    .book-button {
        min-height: 42px;
        padding: 7px 8px;
        font-size: 0.78rem;
        line-height: 1.2;
    }

    .new-testament {
        margin-top: 42px;
    }
}

@media (max-width: 375px) {
    .book-button {
        min-height: 40px;
        font-size: 0.74rem;
    }
}

/* Keep the complete 66-book selector within desktop and tablet viewports. */
@media (min-width: 901px) {
    .books-page-main {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .books-section .section-title-wrap h1 {
        font-size: clamp(1.55rem, 2vw, 2.05rem);
    }

    .books-section .decor-leaf {
        font-size: 1.35rem;
    }

    .books-section .small-gold-line {
        margin-top: 5px;
        margin-bottom: 8px;
    }

    .books-section .testament-block h2 {
        margin-bottom: 7px;
        font-size: 0.92rem;
    }

    .books-section .new-testament {
        margin-top: 9px;
    }

    .books-section .book-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        gap: 3px 7px;
    }

    .books-section .book-button {
        min-height: 30px;
        padding: 2px 7px;
        font-size: 0.76rem;
        line-height: 1.08;
    }
}

@media (min-width: 601px) and (max-width: 1100px) {
    .books-page-main {
        padding: 10px 10px 12px;
    }

    .books-section .section-title-wrap h1 {
        font-size: 1.35rem;
    }

    .books-section .decor-line {
        width: 32px;
    }

    .books-section .decor-leaf {
        font-size: 1.05rem;
    }

    .books-section .small-gold-line {
        margin-top: 6px;
        margin-bottom: 9px;
    }

    .books-section .site-introduction {
        margin: 0 auto;
        font-size: 0.76rem;
        line-height: 1.2;
    }

    .books-section .testament-block h2 {
        margin-bottom: 7px;
        font-size: 0.86rem;
    }

    .books-section .new-testament {
        margin-top: 7px;
    }

    .books-section .book-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 3px 5px;
    }

    .books-section .book-button {
        min-height: 27px;
        padding: 2px 5px;
        font-size: 0.68rem;
        line-height: 1.05;
    }
}

/* Spacious desktop monitors can use the available height without scrolling. */
@media (min-width: 1600px) and (min-height: 800px) {
    .books-page-main {
        padding-top: clamp(16px, 2vh, 24px);
        padding-bottom: clamp(16px, 2vh, 24px);
    }

    .books-section .section-title-wrap h1 {
        font-size: clamp(2.25rem, 3.8vh, 3rem);
    }

    .books-section .decor-leaf {
        font-size: clamp(1.5rem, 2.4vh, 2rem);
    }

    .books-section .small-gold-line {
        margin-top: clamp(8px, 1vh, 12px);
        margin-bottom: clamp(12px, 1.5vh, 18px);
    }

    .books-section .testament-block h2 {
        margin-bottom: clamp(10px, 1.3vh, 15px);
        font-size: clamp(1.05rem, 1.8vh, 1.3rem);
    }

    .books-section .new-testament {
        margin-top: clamp(16px, 2vh, 24px);
    }

    .books-section .book-grid {
        gap: clamp(5px, 0.7vh, 8px) 9px;
    }

    .books-section .book-button {
        min-height: clamp(44px, 4.7vh, 56px);
        padding: clamp(5px, 0.7vh, 8px) 10px;
        font-size: clamp(0.92rem, 1.65vh, 1.08rem);
        line-height: 1.12;
    }

    .books-section .book-label-english {
        margin-top: 3px;
    }
}

/* =========================
   COPYRIGHT PAGE
========================= */

.about-page-main {
    overflow-y: auto;
}

.about-page {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: clamp(24px, 4vw, 48px);
    border: 1px solid #d9e1ed;
    border-radius: var(--radius-large);
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--text);
}

.about-page h1,
.about-page h2 {
    color: var(--navy);
    font-family: "SourceSerif4", Georgia, "Times New Roman", serif;
}

.about-page h1 {
    margin: 0 0 24px;
    font-size: clamp(2rem, 4vw, 2.8rem);
}

.about-page h2 {
    margin: 30px 0 16px;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.about-page p,
.about-issue {
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    line-height: 1.7;
}

.about-page p {
    margin: 0 0 22px;
}

.about-page a {
    color: var(--navy);
    font-weight: 700;
    text-underline-offset: 3px;
}

.about-issue {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 3px solid var(--gold);
}

.information-page-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.information-page {
    width: min(100%, 900px);
    padding-top: 28px;
    text-align: center;
}

.information-page h1 {
    margin: 0;
    color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(2rem, 4vw, 3rem);
}

.copyright-page {
    position: absolute;
    top: var(--header-height);
    right: 0;
    bottom: var(--footer-height);
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    padding: 24px 20px;
    color: var(--navy);
}

.copyright-image img {
    display: block;
    width: min(300px, 80vw);
    height: auto;
    margin-bottom: 12px;
    border: 4px solid var(--gold);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}

.copyright-title {
    margin: 0 0 18px;
    color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
}

.copyright-title::before,
.copyright-title::after {
    content: "❦";
    margin: 0 14px;
    color: var(--gold);
}

.copyright-box {
    width: min(100%, 820px);
    padding: 24px 34px;
    border-left: 6px solid var(--gold);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.copyright-text,
.copyright-translation-text {
    margin: 0;
    color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.08rem;
    font-weight: 400;
    line-height: 1.7;
    text-align: justify;
}

.copyright-signature {
    width: min(100%, 820px);
    margin-top: 15px;
    color: var(--navy);
    text-align: right;
}

.copyright-signature strong {
    font-size: 1.2rem;
}

.copyright-signature em {
    color: #555;
    font-size: 1rem;
}

.copyright-translation {
    margin-top: 22px;
    border-left-color: var(--navy);
}

.copyright-language {
    margin: 0 0 10px;
    color: #6b778c;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.copyright-translation-author {
    margin: 12px 0 0;
    color: var(--navy);
    font-size: 1rem;
    text-align: right;
}

.copyright-translation-author strong {
    font-size: 1.2rem;
}

.copyright-translation-author em {
    color: #555;
    font-size: 1rem;
    font-weight: 400;
}

/* USFM Scripture structure. */

.usfm-scripture {
    max-width: 76ch;
    margin: 0 auto;
    color: var(--navy);
    font-family: "SourceSerif4", Georgia, "Times New Roman", serif;
    font-size: clamp(1.08rem, 1.5vw, 1.2rem);
    line-height: 1.82;
}

.usfm-paragraph {
    margin: 0 0 1.1em;
}

.usfm-verse-number {
    margin-right: 0.12em;
    color: #a86500;
    font-size: 0.68em;
    font-weight: 700;
}

.usfm-verse {
    display: block;
    border-radius: 3px;
    scroll-margin-block: 5rem;
    transition: background-color 0.8s ease;
}

.usfm-verse:target,
.usfm-poetry:target {
    background: #fff0bd;
    box-shadow: 0 0 0 3px #fff0bd;
}

.verse-arrival-notice {
    position: fixed;
    top: calc(var(--header-height) + 12px);
    left: 50%;
    z-index: 1500;
    padding: 8px 14px;
    border: 1px solid var(--gold);
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    box-shadow: var(--shadow);
    font-size: 0.88rem;
    font-weight: 700;
    pointer-events: none;
    transform: translateX(-50%);
    animation: verse-arrival 3.2s ease forwards;
}

@keyframes verse-arrival {
    0% { opacity: 0; transform: translate(-50%, -6px); }
    12%, 78% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -4px); }
}

.usfm-poetry {
    padding-left: 1.8em;
}

.usfm-poetry-2 {
    padding-left: 3.4em;
}

.testament-block .usfm-heading,
.usfm-heading {
    margin: 0.75em 0 0.18em;
    color: var(--navy);
    font-size: 1.08em;
    line-height: 1.3;
    text-align: left;
}

.usfm-reference {
    margin: 0 0 0.9em;
    color: #5d6878;
    font-size: 0.9em;
    font-style: italic;
}

@media (max-width: 600px) {
    .usfm-poetry {
        padding-left: 1em;
    }

    .usfm-poetry-2 {
        padding-left: 2em;
    }
}

@media print {
    @page {
        margin: 18mm;
    }

    html,
    body {
        height: auto;
        overflow: visible;
        background: #fff;
    }

    .site-header,
    .site-footer,
    .bible-sidebar,
    .mobile-books-button,
    .mobile-sidebar-overlay,
    .mobile-sidebar-close,
    .reader-nav-left,
    .reader-nav-right,
    .reader-bottom-nav,
    .verse-arrival-notice,
    .back-to-top-button,
    .nav-overlay,
    .reading-size-controls {
        display: none !important;
    }

    .page-main,
    .read-page-main,
    .reader-layout,
    .reader-content,
    .reader-content .testament-block,
    .reading-box,
    .reader-content .reading-box {
        position: static;
        display: block;
        width: 100%;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .reader-top-nav {
        display: block;
        height: auto;
        margin-bottom: 18pt;
        padding: 0;
    }

    .reader-current-chapter {
        color: #000;
        font-size: 18pt;
    }

    .bible-text,
    .usfm-scripture {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        color: #000;
        font-size: 12pt;
        line-height: 1.55;
    }

    .usfm-verse:target,
    .usfm-verse.verse-arrival-target,
    .usfm-poetry:target,
    .usfm-poetry.verse-arrival-target {
        background: transparent;
        box-shadow: none;
        animation: none;
    }

    .usfm-heading {
        break-after: avoid;
    }

    .usfm-paragraph,
    .usfm-poetry {
        orphans: 3;
        widows: 3;
    }
}

/* Search pagination, unavailable passages, and friendly errors. */
.chapter-unavailable-card,
.error-page {
    width: min(100%, 620px);
    margin: 32px auto;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid #d9e1ed;
    border-top: 4px solid var(--gold);
    border-radius: var(--radius-large);
    background: #fffaf0;
    box-shadow: var(--shadow);
    text-align: center;
}

.chapter-unavailable-symbol {
    display: block;
    margin-bottom: 8px;
    color: var(--gold-dark);
    font-size: 2rem;
}

.chapter-unavailable-card h2,
.error-page h1 {
    margin: 0 0 10px;
    color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.18;
}

.chapter-unavailable-card p,
.error-page p {
    margin: 0 auto 12px;
    color: #42516a;
    line-height: 1.65;
}

.chapter-unavailable-note {
    font-size: 0.9rem;
}

.error-page-main {
    display: grid;
    place-items: center;
}

.error-page {
    background: #fff;
}

.error-code {
    display: block;
    margin-bottom: 4px;
    color: var(--gold-dark);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(2.8rem, 8vw, 5rem);
    font-weight: 700;
    line-height: 1;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.error-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid var(--navy);
    border-radius: var(--radius-small);
    background: #fff;
    color: var(--navy);
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.error-action.primary,
.error-action:hover,
.error-action:focus-visible {
    background: var(--navy);
    color: #fff;
}

@media (max-width: 600px) {
    .search-pagination {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 9px;
    }

    .pagination-status {
        grid-column: 1 / -1;
        grid-row: 1;
        text-align: center;
    }

    .pagination-direction {
        grid-row: 2;
        padding-inline: 10px;
    }

    .pagination-direction:last-child {
        justify-self: stretch;
    }

    .chapter-unavailable-card,
    .error-page {
        margin-block: 18px;
        padding: 24px 18px;
    }

    .error-actions {
        flex-direction: column;
    }
}

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

@media (max-width: 768px) {
    .copyright-page {
        justify-content: flex-start;
        padding: 24px 18px 40px;
    }

    .copyright-image img {
        width: 105px;
    }

    .copyright-title {
        font-size: 1.5rem;
    }

    .copyright-box {
        padding: 18px 22px;
    }

    .copyright-text,
    .copyright-translation-text {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* =========================
   SCRIPTURE SEARCH
========================= */

.search-page-main {
    padding-top: 0;
}

.search-page {
    width: min(100%, 1060px);
    margin: 0 auto;
}

@media (min-width: 901px) {
    .search-sticky-panel {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 12px 0 10px;
        background: #fff;
        box-shadow: 0 8px 12px -12px rgba(6, 31, 74, 0.35);
    }
}

.search-heading {
    margin-bottom: 10px;
    text-align: center;
}

.search-heading h1 {
    margin: 0 0 4px;
    color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.75rem, 2.5vw, 2.25rem);
    line-height: 1.12;
}

.search-heading p {
    margin: 0;
    font-size: 0.95rem;
}

.search-heading p,
.search-help,
.search-summary p {
    color: #42516a;
    line-height: 1.55;
}

.search-toolbar {
    width: min(100%, 760px);
    margin: 0 auto;
}

.search-toolbar.has-search-feedback {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    align-items: stretch;
    width: 100%;
    gap: 10px;
}

.scripture-search-form {
    padding: 14px 18px;
    border: 1px solid #d9e1ed;
    border-radius: 12px;
    background: #f8fbff;
    box-shadow: var(--shadow);
}

.scripture-search-form label {
    display: block;
    color: var(--navy);
    font-weight: 700;
}

.search-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 230px) auto;
    align-items: end;
    gap: 10px;
}

.search-field span {
    display: block;
    margin-bottom: 5px;
}

.search-controls input,
.search-controls select {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.search-controls select {
    cursor: pointer;
}

.search-controls button {
    min-height: 44px;
    padding: 8px 22px;
    border: 2px solid var(--navy);
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.search-controls button:hover {
    background: var(--navy-dark);
}

.search-help {
    margin: 5px 0 0;
    font-size: 0.82rem;
}

.search-message,
.search-summary {
    margin-top: 0;
    padding: 10px 14px;
    border-radius: 10px;
}

.search-error {
    border: 1px solid #b24a3a;
    background: #fff4f2;
    color: #7a261d;
}

.search-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 5px solid var(--gold);
    background: #fffaf0;
}

.search-summary h2,
.search-summary p {
    margin: 0;
}

.search-summary h2 {
    font-size: 1.3rem;
}

.search-summary p {
    margin-top: 3px;
    font-size: 0.9rem;
}

.search-results {
    margin-top: 14px;
}

.search-book-group {
    margin-bottom: 30px;
}

.search-book-group h2 {
    margin: 0 0 10px;
    padding-bottom: 7px;
    border-bottom: 2px solid var(--gold);
    color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
}

.search-result-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.search-result-list li + li {
    margin-top: 8px;
}

.search-result-link {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid #dfe6f0;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
}

.search-result-link:hover,
.search-result-link:focus-visible {
    border-color: var(--navy);
    background: #f8fbff;
    box-shadow: 0 4px 12px rgba(6, 31, 74, 0.08);
}

.search-result-reference,
.search-result-snippet {
    display: block;
}

.search-result-reference {
    padding-left: 10px;
    border-left: 3px solid var(--gold);
    color: var(--navy);
    font-weight: 700;
}

.search-result-snippet {
    line-height: 1.6;
}

.search-match,
.reader-search-match {
    padding: 0 0.08em;
    border-radius: 2px;
    color: inherit;
    font-weight: 700;
}

.search-match {
    background: #ffe6a8;
}

.reader-search-match {
    background: #ffc94d;
}

.search-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    width: min(100%, 620px);
    margin: 24px auto 6px;
    padding: 12px;
    border: 1px solid #dfe6f0;
    border-radius: var(--radius-medium);
    background: #f8fbff;
}

.pagination-direction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: #fff;
    color: var(--navy);
    font-weight: 700;
    text-decoration: none;
}

.pagination-direction:last-child {
    justify-self: end;
}

.pagination-direction:hover,
.pagination-direction:focus-visible {
    border-color: var(--navy);
    background: #eef4ff;
}

.pagination-direction.disabled {
    border-color: #e1e5eb;
    background: #f4f5f7;
    color: #7a8493;
}

.pagination-status {
    color: #42516a;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .search-page-main {
        padding: 22px 12px 42px;
    }

    .scripture-search-form {
        padding: 16px;
    }

    .search-controls {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .search-query-field {
        grid-column: 1 / -1;
    }

    .search-result-link {
        display: block;
        padding: 13px;
    }

    .search-result-reference {
        margin-bottom: 7px;
    }
}

@media (max-width: 900px) {
    .search-toolbar.has-search-feedback {
        grid-template-columns: 1fr;
    }

    .search-message,
    .search-summary {
        margin-top: 10px;
    }

    /* Keep mobile content and floating controls clear of the credit footer. */
    .footer-inner {
        min-height: calc(var(--footer-height) - 3px);
    }

    .mobile-books-button {
        bottom: calc(var(--footer-height) + 14px + env(safe-area-inset-bottom));
    }
}

/* Final component polish: kept last so it wins over legacy responsive rules. */
.reader-title-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.reader-current-chapter,
.reader-current-chapter .reader-title-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reader-current-chapter .book-label-english {
    margin-top: 1px;
    font-size: 0.68em;
}

.reading-size-controls {
    display: inline-flex;
    overflow: hidden;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: #fff;
}

.reading-size-controls button {
    min-width: 31px;
    min-height: 29px;
    padding: 3px 6px;
    border: 0;
    border-right: 1px solid #dce4ef;
    background: #fff;
    color: var(--navy);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.reading-size-controls button:last-child {
    border-right: 0;
}

.reading-size-controls button:hover {
    background: #eef4ff;
}

.reader-nav-button {
    flex-direction: column;
    min-width: 82px;
    gap: 1px;
    border-radius: var(--radius-medium);
}

.reader-nav-direction {
    color: var(--navy);
    font-size: 0.72rem;
    font-weight: 700;
}

.reader-nav-destination {
    color: #42516a;
    font-size: 0.76rem;
}

.chapter-availability-legend {
    margin: 5px 4px 0;
    color: #68758a;
    font-size: 0.68rem;
    line-height: 1.35;
    text-align: center;
}

.read-page-main {
    --reader-font-scale: 1;
}

.read-page-main .bible-text {
    font-size: calc(1.125rem * var(--reader-font-scale));
}

@media (max-width: 900px) {
    .read-page-main .bible-text {
        font-size: calc(1.1rem * var(--reader-font-scale));
    }
}

@media (max-width: 600px) {
    .reader-top-nav {
        min-height: 84px;
        height: auto;
    }

    .reader-title-area {
        flex-direction: column;
        gap: 3px;
    }

    .reading-size-controls {
        position: static;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .reading-size-controls button {
        min-width: 28px;
        min-height: 25px;
        padding: 1px 4px;
        font-size: 0.68rem;
    }

    .reader-nav-button {
        min-width: 68px;
        min-height: 48px;
        padding: 5px 6px;
    }

    .reader-nav-direction {
        font-size: 0.66rem;
    }

    .reader-nav-destination {
        font-size: 0.7rem;
    }

    .read-page-main .bible-text {
        font-size: calc(1.0625rem * var(--reader-font-scale));
    }
}

@media (min-width: 901px) {
    .reader-content {
        grid-template-rows: 56px minmax(0, 1fr) 58px;
    }

    .reader-bottom-nav {
        height: 58px;
        padding: 4px 0;
    }
}

/* Final usability and accessibility polish. */
.nav-overlay,
.back-to-top-button {
    display: none;
}

.back-to-top-button {
    position: fixed;
    right: 14px;
    bottom: calc(var(--footer-height) + 68px + env(safe-area-inset-bottom));
    z-index: 1390;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 58px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    box-shadow: 0 6px 18px rgba(6, 31, 74, 0.16);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.back-to-top-button:not([hidden]) {
    display: inline-flex;
}

.back-to-top-button:hover {
    border-color: var(--navy);
    background: #f8fbff;
}

.usfm-verse:target,
.usfm-verse.verse-arrival-target,
.usfm-poetry:target,
.usfm-poetry.verse-arrival-target {
    animation: verse-target-emphasis 3.8s ease-out both;
}

@keyframes verse-target-emphasis {
    0%, 65% {
        background: #ffe39a;
        box-shadow: 0 0 0 4px #ffe39a;
    }
    100% {
        background: #fff0bd;
        box-shadow: 0 0 0 3px #fff0bd;
    }
}

@media (max-width: 900px) {
    .nav-overlay {
        display: block;
        position: fixed;
        inset: var(--header-height) 0 0;
        z-index: 980;
        visibility: hidden;
        width: 100%;
        border: 0;
        background: rgba(6, 31, 74, 0.32);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    }

    .nav-overlay.open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .main-nav,
    .main-nav.open {
        display: flex;
        visibility: hidden;
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: max-height 0.22s ease, opacity 0.18s ease, transform 0.22s ease,
            visibility 0s linear 0.22s;
    }

    .main-nav.open {
        visibility: visible;
        max-height: 360px;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        transition-delay: 0s;
    }

    .main-nav a {
        padding: 13px 20px;
    }

    .back-to-top-button {
        bottom: calc(var(--footer-height) + 68px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 600px) {
    .reader-top-nav {
        grid-template-columns: minmax(64px, 0.8fr) minmax(112px, auto) minmax(64px, 0.8fr);
        padding-inline: 4px;
    }

    .reader-nav-button {
        min-width: 62px;
        min-height: 44px;
        padding: 4px 5px;
    }

    .reader-nav-direction {
        font-size: 0.61rem;
    }

    .reader-nav-destination {
        max-width: 72px;
        overflow: hidden;
        font-size: 0.67rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .search-heading {
        margin-bottom: 7px;
    }

    .search-heading h1 {
        font-size: 1.65rem;
    }

    .search-heading p {
        font-size: 0.88rem;
        line-height: 1.4;
    }

    .scripture-search-form {
        padding: 12px;
    }

    .scripture-search-form label {
        margin-bottom: 3px;
        font-size: 0.92rem;
    }

    .search-controls {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px;
    }

    .search-controls input,
    .search-controls button {
        min-height: 42px;
    }

    .search-controls button {
        width: auto;
        padding-inline: 15px;
    }

    .search-help {
        font-size: 0.76rem;
        line-height: 1.35;
    }

    .search-summary {
        padding: 9px 11px;
    }

    .search-result-link {
        padding: 11px 12px;
    }

    .search-result-reference {
        margin-bottom: 4px;
    }

    .search-result-snippet {
        font-size: 0.94rem;
        line-height: 1.5;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .usfm-verse,
    .usfm-poetry {
        transition: none;
    }

    .verse-arrival-notice {
        animation: none;
    }
}
