/* ============================================================= */
/* ------------------------- IBIS Framework ---------------------- */
/* ============================================================= */

@import url("settings.css");
@import url("elements.css");
@import url("layout.css");
@import url("components.css");
@import url("utilities.css");

/* ============================================================= */
/* ------------------ Application Specific ----------------------- */
/* ============================================================= */

/* 0. Body — tiled regal background across all pages */
body {
    background: url("../../images/regal.png") fixed;
}
.container {
    flex: 1;
}

h1 {
    color: #252d36;
    font-size: 2.5em;
}

/* Hero banner for page-level hero images */
.hero-banner {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: var(--sp-5);
}

/* 1. Navigation Bar
   Desktop (>= 768px): flex row — [Logo] [Dropdowns] [Links]. No hamburger.
   Tablet  (480-767px): hamburger toggle; panel open = centered, dropdowns inline.
   Mobile  (< 480px):   hamburger toggle; panel open = everything stacked. */
.top-nav {
    background: #1a1a2e url("../../images/moroccan-flower-darker.png");
    color: #fff;
    padding: 0 1rem;
    border-bottom: 4px solid #0f3460 ;
}
.nav-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-top-row .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.5rem 0;
}
.hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}
.nav-dropdowns {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.nav-select {
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #555;
    background: #16213e;
    color: #fff;
    font-size: 0.875rem;
    min-width: 100px;
}
.nav-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.nav-go-btn {
    padding: 0.35rem 1rem;
    border-radius: 4px;
    border: none;
    background: #0f3460;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
}
.nav-go-btn:hover {
    background: #1a5276;
    color: #fff;
}
.nav-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.875rem;
}
.nav-links a:hover {
    color: #fff;
}

/* ── Desktop (>= 768 px): no hamburger, full row ── */
@media (min-width: 768px) {
    .top-nav {
        display: flex;
        align-items: center;
    }
    /*.nav-top-row {*/
        /* only contains logo; flex: none keeps it left */
    }
    .hamburger {
        display: none;
    }
    .nav-panel {
        display: flex;
        flex: 1;
        align-items: center;
    }
    .nav-picker {
        flex: 1;
        display: flex;
        justify-content: center;
    }
    .nav-links {
        margin-left: auto;
        display: flex;
        gap: 1rem;
    }
    .nav-links a {
        padding: 0.5rem 0;
    }


/* ── Tablet + Mobile (< 768 px): hamburger, panel hidden by default ── */
@media (max-width: 767px) {
    .top-nav {
        display: flex;
        flex-direction: column;
    }
    .nav-top-row {
        width: 100%;
    }
    .nav-panel {
        display: none;
        width: 100%;
    }
    .nav-panel.open {
        display: flex;
        gap: 1rem;
        padding-bottom: 0.75rem;
    }
    .nav-links a {
        display: block;
        text-align: center;
    }

    /* ── Tablet (480-767 px): panel centered, dropdowns inline ── */
    @media (min-width: 480px) {
        .nav-panel.open {
            flex-direction: column;
            align-items: center;
        }
        .nav-dropdowns {
            flex-direction: row;
        }
        .nav-links {
            display: flex;
            gap: 1.5rem;
        }
    }

    /* ── Mobile (< 480 px): everything stacked ── */
    @media (max-width: 479px) {
        .nav-panel.open {
            flex-direction: column;
        }
        .nav-dropdowns {
            flex-direction: column;
            width: 100%;
        }
        .nav-select {
            width: 100%;
            min-width: unset;
        }
        .nav-go-btn {
            width: 100%;
            padding: 0.5rem;
        }
        .nav-links {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding-top: 0.5rem;
            border-top: 1px solid #333;
        }
        .nav-links a {
            padding: 0.5rem 0;
        }
    }
}

/* 1b. Site Footer */
.site-footer {
    background: #1a1a2e url("../../images/moroccan-flower-darker.png");
    border-top: 4px solid #0f3460;
    color: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 2rem;
    margin-top: auto;
    font-size: 0.85rem;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.footer-brand {
    font-weight: 700;
    color: #fff;
}
.footer-copy {
    opacity: 0.8;
}

/* 2. Book Grid (homepage + /books page)
   Augments IBIS .card when used as a linked book card */
.hero {
    border-style: solid;
    border-color: silver;
    border-width: 1px 2px 2px 1px;
    border-radius: var(--radius);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 8px 32px rgba(0, 0, 0, 0.1);
}
.book-grid {
    padding: 2rem 0;
}
.book-grid .card {
    display: block;
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--content);
    font-weight: 600;
    font-size: 1.1rem;
}
.book-grid .card:hover {
    box-shadow: var(--shadow-lg);
}
.book-grid .card h2 {
    margin: 0;
    font-size: inherit;
}

/* 3. Chapter Grid
   Numbered chapter cards for book browsing */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.chapter-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--content);
    font-weight: 600;
    font-size: 1.1rem;
    transition:
        background 0.15s,
        transform 0.1s;
}
.chapter-card:hover {
    background: var(--surface-raised);
    transform: translateY(-2px);
}
.book-subtitle {
    color: var(--content-muted);
    margin-top: -0.5rem;
}

/* 4. Chapter Navigation Buttons
   Previous/next chapter links, same max-width as chapter-text */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem auto;
    gap: 1rem;
    max-width: 40em;
}
.ch-nav-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--brand-dim);
    color: var(--brand-contrast);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
}
.ch-nav-btn:hover {
    background: var(--brand-deep);
    color: #fff;
}
.ch-nav-btn.disabled {
    background: var(--surface-raised);
    color: var(--content-muted);
    cursor: default;
}

/* 5a. Chapter View Title (centered) */
.ch-title {
    text-align: center;
}

/* 5b. Mode Toggle Buttons (Verse / Inline / Reading) */
.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
}
.mode-btn {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-page);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--content);
}
.mode-btn:hover {
    color: var(--brand-contrast);
}
.mode-btn.active {
    background: var(--brand);
    color: var(--brand-contrast);
    border-color: var(--brand);
}

/* 6. Chapter Text / Verse Display
   Three modes: verse (default), inline, reading.
   All passage text justified. */
.chapter-text {
    margin: 2rem auto;
    padding: 2.5rem 3rem;
    background: url("../../images/lightpaperfibers.png");
    border-style: solid;
    border-color: silver;
    border-width: 1px 2px 2px 1px;
    border-radius: var(--radius);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 8px 32px rgba(0, 0, 0, 0.1);
    line-height: 1.8;
    text-align: justify;
    max-width: 40em;
}

/* Wider max-width inside parallel reader columns */
.torah-col .chapter-text {
    max-width: none;
}
.verse-line {
    margin: 0.25rem 0;
    padding-left: 3.5rem;
    text-indent: -3rem;
}
.verse-num {
    display: inline-block;
    font-weight: 700;
    color: var(--brand);
    min-width: 2rem;
    text-align: right;
    margin-right: 0.5rem;
    font-size: 0.85rem;
}
.no-verses {
    color: var(--content-muted);
    font-style: italic;
}

/* ── Inline mode: verse numbers superscript, continuous text ── */
.mode-inline .verse-line {
    display: inline;
    margin: 0;
    padding-left: 0;
    text-indent: 0;
}
.mode-inline .verse-num {
    display: inline;
    font-size: 0.75rem;
    min-width: 0;
    text-align: left;
    margin: 0 0.1rem 0 0;
    vertical-align: super;
    line-height: 1;
}

/* ── Reading mode: no verse numbers, continuous text ── */
.mode-reading .verse-num {
    display: none;
}
.mode-reading .verse-line {
    display: inline;
    margin: 0;
    padding-left: 0;
    text-indent: 0;
}

/* ── Justified text for all passage display ── */
.passage-full p,
.result-content,
.side-a p,
.side-b p,
.ai-answer {
    text-align: justify;
}

/* 7. Chapter Pagination
   Wrapper around IBIS .pagination in chapter view */
.chapter-pagination {
    margin-top: 2rem;
    text-align: center;
}
.chapter-pagination .pagination a {
    padding: 0.4rem 0.75rem;
    margin: 0 2px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    text-decoration: none;
    /*color: var(--brand);*/
}
.chapter-pagination .pagination a:hover {
    background: var(--surface-subtle);
}
.chapter-pagination .pagination .current {
    background: var(--brand);
    color: var(--brand-contrast);
    border-color: var(--brand);
}

/* Muted/secondary button variant */
.button-muted {
    background: var(--surface-page, #f5f5f5);
    color: var(--content-muted, #666);
    border: 1px solid var(--border-subtle, #ddd);
}
.button-muted:hover {
    background: var(--surface-raised, #eaeaea);
    color: var(--content, #222);
}

/* Keep .button text white on hover (IBIS a:hover can interfere) */
a.button:hover {
    color: var(--brand-contrast);
}

/* 8. Search Results
   Result cards with book/ref/score header */
.search-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--surface-page);
    border-bottom: 1px solid var(--border-subtle);
}
.search-bar input[type="text"] {
    flex: 1;
    max-width: 400px;
}
.search-bar .method {
    font-size: 0.85rem;
    color: var(--content-muted);
}
.results {
    padding: 1rem 0;
}
.result-card.card {
    padding: 1rem;
}
.result-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.result-header .rank {
    font-weight: bold;
    color: var(--brand-deep);
}
.result-header .book {
    font-weight: bold;
}
.result-header .ref {
    color: var(--content-muted);
}
.result-header .score {
    margin-left: auto;
    font-weight: bold;
    color: var(--accent-success);
}
.result-content {
    color: var(--content);
    margin-bottom: 0.5rem;
}
.result-note {
    background: #f0f7f0;
    padding: 0.5rem;
    border-left: 3px solid var(--accent-success);
    font-style: italic;
    margin-bottom: 0.5rem;
}

/* 9. Comparison Page — Side-by-Side Horizontal Scroll */

/* ── Selector form ── */
.cmp-title {
    text-align: center;
}
.compare-form {
    margin-bottom: 1.5rem;
    text-align: center;
}
.compare-selectors {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}
.cmp-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    font-size: 0.9rem;
    min-width: 100px;
    max-width: 160px;
}
.cmp-select[name="chapter_a"] { min-width: 80px; max-width: 80px; }
.cmp-select[name="verse_from"],
.cmp-select[name="verse_to"]   { min-width: 95px; max-width: 100px; }
.cmp-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
/* ── Horizontal scroll container ── */
.cmp-scroll-wrap {
    margin: 1.5rem 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--surface-page);
    overflow: hidden;
}
.cmp-scroll-inner {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: stretch;
    scroll-behavior: smooth;
    /* Reserve space for the horizontal scrollbar */
    padding-bottom: 8px;
}

/* ── Each column in the scroll ── */
.cmp-col {
    flex: 0 0 auto;
    min-width: 360px;
    max-width: 420px;
    width: 400px;
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    background: var(--surface-page);
}

/* ── Source column: sticks to the left ── */
.cmp-source-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--surface-raised);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
}

/* ── Column title bar ── */
.cmp-col-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
    background: inherit;
    gap: 0.5rem;
    flex-shrink: 0;
}
.cmp-col-title a {
    text-decoration: none;
    color: var(--brand-deep);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cmp-col-title a:hover {
    text-decoration: underline;
}

/* ── Score badge ── */
.cmp-score {
    font-size: 0.8rem;
    color: var(--accent-success);
    font-weight: 700;
    white-space: nowrap;
    background: color-mix(in srgb, var(--accent-success) 10%, transparent);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ── Column text area ── */
.cmp-col-text {
    padding: 0.5rem 0.75rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* ── Verse lines ── */
.cmp-verse {
    margin: 0.2rem 0;
    line-height: 1.65;
    text-align: justify;
    font-size: 0.92rem;
}
.cmp-verse sup {
    font-weight: 700;
    color: var(--brand);
    margin-right: 0.3rem;
    font-size: 0.78rem;
}

/* ── Book group divider & header ── */
.cmp-group-divider {
    width: 0;
    flex: 0 0 0;
    border-left: 2px dashed var(--border-subtle);
    margin: 0.5rem 0;
}
.cmp-group-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 0.75rem 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--content-muted);
    background: var(--surface-page);
    border-right: 1px solid var(--border-subtle);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    user-select: none;
}

/* ── Show more button ── */
.cmp-more-btn {
    margin-top: 0.4rem;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.65rem;
    font-size: 0.85rem;
    color: var(--brand);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    width: 100%;
    text-align: center;
}
.cmp-more-btn:hover {
    background: var(--surface-raised);
}
.cmp-extra {
    margin-top: 0.2rem;
}

/* ── Responsive: narrow screens ── */
@media (max-width: 767px) {
    .cmp-scroll-inner {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: 0;
    }
    .cmp-col {
        min-width: unset;
        max-width: unset;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    .cmp-source-col {
        position: static;
        box-shadow: none;
    }
    .cmp-group-divider {
        width: 100%;
        height: 0;
        border-left: none;
        border-top: 2px dashed var(--border-subtle);
        margin: 0;
    }
    .cmp-group-header {
        writing-mode: horizontal-tb;
        padding: 0.4rem 0.75rem;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        justify-content: flex-start;
    }
}

/* ── Selector form responsiveness ── */
@media (max-width: 479px) {
    .compare-selectors {
        flex-direction: column;
        width: 100%;
    }
    .cmp-select {
        width: 100%;
        min-width: unset;
    }
    .compare-selectors .button {
        width: 100%;
    }
}
.cmp-source {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}
.cmp-source h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}
.cmp-source-text {
    max-height: 400px;
    overflow-y: auto;
}
.cmp-verse {
    margin: 0.25rem 0;
    line-height: 1.7;
    text-align: justify;
}
.cmp-verse sup {
    font-weight: 700;
    color: var(--brand);
    margin-right: 0.3rem;
    font-size: 0.8rem;
}
.cmp-parallels h3 {
    margin-bottom: 1rem;
}
.cmp-book-group {
    margin-bottom: 1.5rem;
}
.cmp-book-group h4 {
    background: var(--surface-raised);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}
.cmp-match {
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}
.cmp-match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.cmp-match-header a {
    font-weight: 600;
    text-decoration: none;
}
.cmp-match-header a:hover {
    text-decoration: underline;
}
.cmp-score {
    font-size: 0.85rem;
    color: var(--accent-success);
    font-weight: 600;
}
.cmp-match-text {
    max-height: 300px;
    overflow-y: auto;
}
.cmp-more-btn {
    margin-top: 0.5rem;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    color: var(--brand);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.cmp-more-btn:hover {
    background: var(--surface-raised);
}
.cmp-more-btn[aria-expanded="true"]::after {
    content: "";
}
.cmp-extra {
    margin-top: 0.25rem;
}

/* 10. AI Answers & Sources */
.ai-answer {
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
}
.sources {
    padding: 1rem 0;
}
.source-item {
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

/* 11. Reports Table */
.report-table {
    width: 100%;
    border-collapse: collapse;
}
.report-table td,
.report-table th {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}
.report-table a {
    margin-right: 0.5rem;
}

/* 12. Status Messages */
.error {
    background: var(--accent-error);
    border: 1px solid var(--accent-warm);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--radius);
    color: var(--brand-contrast);
}
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--content-muted);
}

/* 13. Passage View */
.passage-list {
    padding: 1rem 0;
}
.passage-item {
    margin-bottom: 0.75rem;
}
.passage-item .ref {
    font-weight: bold;
    color: var(--brand-deep);
}

/* 14. Navigation Bar — 3-Section Layout (logo, dropdowns, links)
   The template structure uses .nav-left / .nav-center / .nav-right.
   Desktop: full row. Tablet/mobile: hamburger toggle. */

/* ── Base nav link colours ── */
.top-nav a {
    color: #fff;
    text-decoration: none;
}

/* Left: logo + hamburger */
.nav-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.nav-left .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

/* Center: dropdowns, pushed to middle */
.nav-center {
    display: flex;
    justify-content: center;
    flex: 1;
}

/* Right: nav links */
.nav-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-shrink: 0;
}
.nav-right a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.875rem;
}
.nav-right a:hover {
    color: #fff;
}

/* ── Desktop (>= 768 px): flex row, hamburger hidden, links right ── */
@media (min-width: 768px) {
    .top-nav {
        display: flex;
        align-items: center;
    }
    .nav-right {
        margin-left: auto;
    }
    .hamburger {
        display: none;
    }
}

/* ── Mobile (< 768 px): hamburger visible, panels hidden ── */
@media (max-width: 767px) {
    .top-nav {
        flex-direction: column;
        align-items: stretch;
    }
    .nav-left {
        justify-content: space-between;
        padding: 0.75rem 0;
        width: 100%;
    }
    .hamburger {
        display: block !important;
    }
    .nav-center {
        display: none;
        flex-direction: column;
        width: 100%;
    }
    .nav-center.open {
        display: flex;
    }
    .nav-right {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid #333;
    }
    .nav-right.open {
        display: flex;
    }
    .nav-dropdowns {
        width: 100%;
        flex-direction: column;
    }
    .nav-select {
        width: 100%;
        min-width: unset;
    }
    .nav-go-btn {
        width: 100%;
        padding: 0.5rem;
    }
    .nav-right a {
        display: block;
        padding: 0.5rem 0;
    }
}

/* 15. Translation Summary Cards (homepage hero) */
.translation-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    text-align: left;
    margin-bottom: 2rem;
}
.translation-card {
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    transition:
        box-shadow 0.2s,
        transform 0.15s;
    border-left: 3px solid var(--brand);
}
.translation-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.translation-card strong {
    display: block;
    color: var(--brand-deep);
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}
.translation-card span {
    display: block;
    color: var(--content);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ── Pseudepigrapha cards get a subtle accent distinction ── */
.translation-card--pseudepigrapha {
    border-left-color: var(--accent-warm);
}

/* Pseudepigrapha cards row: each card matches the 4 main cards' width */
.pseudepigrapha-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 0 auto 2rem;
    max-width: calc(75% - 0.25rem);
}

/* 15b. Book Columns — Books grouped by version */

/* Four-column grid for the main versions */
.book-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin: 2rem 0;
}

.book-column {
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.book-column-header {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--content-muted);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-deep);
}

.book-column-link {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--brand-deep);
    color: var(--content);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition:
        box-shadow 0.12s,
        transform 0.12s,
        background 0.12s;
}
.book-column-link:hover {
    background: var(--surface-raised);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    color: var(--brand-deep);
}

/* Per-column accent colors for cards and headers */
.book-column--mt .book-column-link {
    border-left-color: var(--brand-deep);
}
.book-column--lxx .book-column-link {
    border-left-color: var(--accent-success);
}
.book-column--eotc .book-column-link {
    border-left-color: #800020;
}
.book-column--targum .book-column-link {
    border-left-color: var(--accent-cool);
}

.book-column--mt .book-column-header {
    border-bottom-color: var(--brand-deep);
}
.book-column--lxx .book-column-header {
    border-bottom-color: var(--accent-success);
}
.book-column--eotc .book-column-header {
    border-bottom-color: #800020;
}
.book-column--targum .book-column-header {
    border-bottom-color: var(--accent-cool);
}

/* Pseudepigrapha section: each link matches book-column-link mini-card width */
.pseudepigrapha-section {
    margin: 0 auto 2rem auto;
    text-align: center;
    max-width: calc(75% - 0.8125rem);
}

.pseudepigrapha-header {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--content-muted);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--accent-warm);
    display: inline-block;
}

.pseudepigrapha-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.pseudepigrapha-link {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent-warm);
    color: var(--content);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition:
        box-shadow 0.12s,
        transform 0.12s,
        background 0.12s;
}
.pseudepigrapha-link:hover {
    background: var(--surface-raised);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    color: var(--brand-deep);
}

/* Responsive: tablets → 2-column grid, phones → stack */
@media (max-width: 767px) {
    .book-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 479px) {
    .book-columns {
        grid-template-columns: 1fr;
    }
}

/* ============================================================= */
/* ─── Notes Module ─── */
/* ============================================================= */

.notes-app {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

/* Tab bar (mobile only, hidden on desktop/tablet) */
.notes-tabs {
    display: none;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}
.notes-tab {
    flex: 1;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: background 0.12s, color 0.12s;
}
.notes-tab.active {
    background: var(--brand, #4682b4);
    color: #fff;
    border-color: var(--brand, #4682b4);
}

/* Three-column layout */
.notes-columns {
    display: flex;
    gap: var(--sp-4);
    align-items: flex-start;
}
.notes-panel {
    background: var(--surface-page, #fff);
    border: 1px solid var(--border-subtle, #ddd);
    border-radius: var(--radius, 6px);
    padding: var(--sp-4, 1rem);
    min-height: 300px;
}
.panel-shared,
.panel-mine {
    flex: 1;
    max-width: 280px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}
.panel-display {
    flex: 2;
    min-width: 0; /* prevent flex overflow */
}

/* Panel headings */
.panel-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 var(--sp-3);
    padding-bottom: var(--sp-2);
    border-bottom: 2px solid var(--brand, #4682b4);
}
.panel-mine-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-3);
    padding-bottom: var(--sp-2);
    border-bottom: 2px solid var(--brand, #4682b4);
}
.panel-mine-header .panel-heading {
    margin: 0;
    padding: 0;
    border: none;
}

/* Note list items */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.notes-list-item {
    padding: var(--sp-3);
    border: 1px solid var(--border-subtle, #e0e0e0);
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s, border-color 0.12s;
    background: var(--surface-raised, #fafafa);
}
.notes-list-item:hover {
    background: var(--surface-hover, #f0f0f0);
    border-color: var(--brand, #4682b4);
}
.notes-list-item.active {
    background: var(--brand-dim, #38678f);
    border-color: var(--brand, #4682b4);
    color: #fff;
}
.notes-list-item.active .note-item-title {
    color: #fff;
}
.notes-list-item.active .note-item-meta,
.notes-list-item.active .note-item-ref {
    color: rgba(255,255,255,0.8);
}
.note-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: var(--sp-1);
    color: var(--content, #333);
}
.note-item-meta {
    font-size: 0.8rem;
    color: var(--content-dim, #888);
}
.note-item-ref {
    font-size: 0.75rem;
    color: var(--brand, #4682b4);
    margin-top: var(--sp-1);
}

/* Note display area */
#note-display-content {
    padding: var(--sp-2);
}
.display-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--content-dim, #999);
    text-align: center;
}

.note-display-header {
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
}
.note-display-header h3 {
    margin: 0 0 var(--sp-2);
    font-size: 1.4rem;
}
.note-display-meta {
    display: flex;
    gap: var(--sp-3);
    font-size: 0.8rem;
    color: var(--content-dim, #888);
    align-items: center;
    flex-wrap: wrap;
}
.note-display-ref {
    margin-top: var(--sp-2);
}
.ref-link {
    font-size: 0.9rem;
    color: var(--brand);
    text-decoration: none;
}
.ref-link:hover {
    text-decoration: underline;
}
.note-display-body {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--content, #333);
    margin-bottom: var(--sp-4);
}
.note-display-actions {
    display: flex;
    gap: var(--sp-2);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border-subtle);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-shared {
    background: var(--accent-success, #4caf50);
    color: #fff;
}

/* Form styles for create/edit */
.notes-form {
    max-width: 720px;
    margin: 0 auto;
}
.notes-form h1 {
    margin-bottom: var(--sp-4);
}
.notes-form .form-group {
    margin-bottom: var(--sp-4);
}
.notes-form label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--sp-2);
    color: var(--content, #333);
}
.notes-form input[type="text"],
.notes-form textarea,
.notes-form select {
    width: 100%;
    padding: var(--sp-3);
    border: 1px solid var(--border-subtle, #ccc);
    border-radius: var(--radius-sm, 4px);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface-page, #fff);
    box-sizing: border-box;
}
.notes-form textarea {
    min-height: 200px;
    line-height: 1.6;
}
.notes-form select {
    cursor: pointer;
}

/* Verse link fields - shown/hidden by checkbox */
.verse-link-fields {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--surface-raised, #f5f5f5);
    border-radius: var(--radius-sm, 4px);
    margin-bottom: var(--sp-4);
}
.verse-link-fields .form-group {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

/* Checkbox group */
.checkbox-group {
    margin-bottom: var(--sp-3);
}
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    cursor: pointer;
    font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
    margin-top: var(--sp-3);
    border-top: 1px solid var(--border-subtle);
}

/* Inline form (for delete button alongside edit) */
.inline-form {
    display: inline;
}

/* New note button */
.new-note-btn {
    font-size: 0.85rem;
    padding: var(--sp-2) var(--sp-3);
    white-space: nowrap;
}

/* ============================================================= */
/* ─── Notes Module: Responsive ─── */
/* ============================================================= */

/* Tablet: 768-991px — 2 column with collapsible left panel */
@media (max-width: 991px) {
    .notes-columns {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .panel-shared,
    .panel-mine {
        flex: 1 1 100%;
        max-width: none;
        max-height: none;
    }
    .panel-shared {
        order: 1;
    }
    .panel-shared .notes-list {
        display: none; /* hidden by default, toggled by heading click */
    }
    .panel-mine {
        order: 2;
    }
    .panel-display {
        flex: 1 1 100%;
        order: 3;
    }
    /* Shared notes heading becomes clickable toggle */
    .panel-shared .panel-heading {
        cursor: pointer;
        position: relative;
    }
    .panel-shared .panel-heading::after {
        content: '\25BC';
        font-size: 0.7rem;
        margin-left: var(--sp-2);
    }
}

/* Mobile: <768px — single column with tab bar */
@media (max-width: 767px) {
    .notes-tabs {
        display: flex;
    }
    .notes-columns {
        flex-direction: column;
    }
    .panel-shared,
    .panel-mine {
        display: none; /* controlled by tabs */
        flex: 1 1 100%;
        max-width: none;
        max-height: none;
    }
    .panel-display {
        flex: 1 1 100%;
    }
    .notes-tabs {
        display: flex;
    }
    .verse-link-fields {
        flex-direction: column;
    }
    .verse-link-fields .form-group {
        min-width: 100%;
    }
    .note-display-meta {
        flex-direction: column;
        gap: var(--sp-1);
    }
}
