/* =============================================================================
   SCRIPTURE STYLES
   ============================================================================= */

/*
 * Styles for the Scripture reading experience.
 * Uses design tokens from tokens.css.
 *
 * Pages:
 * - /scripture (book selection)
 * - /scripture/{book} (reading page)
 */


/* =============================================================================
   BOOK SELECTION PAGE (/scripture)
   ============================================================================= */

/* Two-column testament layout */
.scripture-testaments {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

/* Testament sections */
.scripture-testament {
    min-width: 0;
}

.testament-heading {
    font-family: var(--serif-font);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

/* Sub-columns within each testament on wide screens */
.scripture-books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
}

.scripture-book-link {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--color-text);
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.9375rem;
}

.scripture-book-link:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-hover);
}

.scripture-book-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 500;
}


/* =============================================================================
   BOOK GROUPS (within testaments)
   ============================================================================= */

/* Container for all groups within a testament */
.scripture-book-groups {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Individual group container - fieldset-like box */
.scripture-book-group {
    position: relative;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    padding: 0.75rem 0.5rem 0.5rem;
    margin-top: 0.5rem; /* Space for the header */
}

/* Group header - centered legend-style label */
.scripture-group-header {
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);

    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    white-space: nowrap;

    /* Background to "cut through" the border */
    background: var(--color-background);
    padding: 0 0.5rem;

    cursor: default;
}

/* Tooltip indicator for groups with explanations */
.scripture-group-header[title] {
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

/* Books within a group - grid layout */
.scripture-group-books {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
}

/* Overlay-specific adjustments */
.scripture-book-groups--overlay {
    gap: 1rem;
}

.scripture-book-groups--overlay .scripture-book-group {
    padding: 0.625rem 0.375rem 0.375rem;
    margin-top: 0.375rem;
}

.scripture-book-groups--overlay .scripture-group-header {
    font-size: 0.5625rem;
    top: -0.4rem;
    /* Use surface color for overlay background */
    background: var(--color-surface);
}


/* =============================================================================
   USER READING HISTORY (authenticated users)
   ============================================================================= */

.scripture-user-history {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border-radius: 6px;
    border: 1px solid var(--color-border);
    font-size: 0.9375rem;
}

.scripture-history-link {
    color: var(--color-text);
    text-decoration: none;
    padding: 0.25rem 0.375rem;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.scripture-history-link:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* First item (current position) - slightly emphasized */
.scripture-history-link--current {
    font-weight: 500;
}

.scripture-history-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 0.375rem;
}

.scripture-history-sep {
    color: var(--color-text-muted);
    opacity: 0.5;
    user-select: none;
}

/* Overlay-specific history styles */
.scripture-overlay-history {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.scripture-overlay-history .scripture-history-label {
    margin-bottom: 0.375rem;
    text-align: left;
}

.scripture-user-history--overlay {
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}


/* =============================================================================
   READING PAGE (/scripture/{book})
   ============================================================================= */

.scripture-reader {
    max-width: 720px;
    margin: 0 auto;
}

/* =============================================================================
   SCRIPTURE HEADER
   ============================================================================= */

/* Sticky header - book and chapter centered, toggles right */
.scripture-header {
    position: sticky;
    top: var(--nav-header-height, 60px); /* Below site header */
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    margin: 0 -1rem;
}

/* Navigation container - centered book and chapter */
.scripture-header-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

/* Shared selector button styles */
.scripture-selector {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.scripture-selector:hover {
    background: var(--color-surface);
}

.scripture-selector-chevron {
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.scripture-selector:hover .scripture-selector-chevron {
    opacity: 0.7;
}

/* Book selector - larger, serif font */
.scripture-book-selector {
    font-family: var(--serif-font);
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--color-text);
}

.scripture-book-name {
    white-space: nowrap;
}

/* Chapter selector - smaller, muted */
.scripture-chapter-selector {
    font-family: var(--primary-font);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.scripture-chapter-selector:hover {
    color: var(--color-text);
}

/* Mode toggle - text button showing current mode */
.scripture-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.scripture-mode-toggle:hover {
    background: var(--color-background);
    color: var(--color-text);
}

/* Mode toggle icon states (P for prose, V for verse) */
.scripture-mode-toggle .mode-toggle-verse {
    display: none;
}

.scripture-mode-toggle.active .mode-toggle-prose {
    display: none;
}

.scripture-mode-toggle.active .mode-toggle-verse {
    display: flex;
}

/* Icon toggle buttons (structure, verse numbers) */
.scripture-structure-toggle,
.scripture-verse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.scripture-structure-toggle:hover,
.scripture-verse-toggle:hover {
    background: var(--color-background);
    color: var(--color-text);
}

/* Structure toggle icon states */
.scripture-structure-toggle .structure-toggle-on {
    display: none;
}

.scripture-structure-toggle.active .structure-toggle-off {
    display: none;
}

.scripture-structure-toggle.active .structure-toggle-on {
    display: flex;
}

/* Verse number toggle icon states */
.scripture-verse-toggle .verse-toggle-hidden {
    display: none;
}

.scripture-verse-toggle.active .verse-toggle-visible {
    display: none;
}

.scripture-verse-toggle.active .verse-toggle-hidden {
    display: flex;
}

/* Chapter container */
.scripture-chapters {
    padding: 1.5rem 1rem 3rem;
}

/* Chapter section */
.scripture-chapter {
    margin-bottom: 2rem;
}

.chapter-heading {
    font-family: var(--primary-font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
}

/* Book start - large book name for Chapter 1 */
.chapter-heading--book-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.chapter-book-name {
    font-family: var(--serif-font);
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0.25rem;
}

.chapter-label {
    font-family: var(--primary-font);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Verses */
.scripture-verses {
    font-family: var(--serif-font);
    font-size: 1.125rem;
    line-height: 2;
    color: var(--color-text);
}

.verse {
    display: inline;
}

.verse-num {
    font-family: var(--primary-font);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-text-light);
    vertical-align: super;
    margin-right: 0.125em;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Prose/Verse text display switching */
/* Default: Prose mode - show plain text, hide formatted */
.verse-text-formatted {
    display: none;
}

/* Verse mode - show formatted text, hide plain */
.scripture-reader.verse-mode .verse-text-prose {
    display: none;
}

.scripture-reader.verse-mode .verse-text-formatted {
    display: inline;
}

/* Footnotes visible in prose mode - use formatted text (has footnote markers) */
.scripture-reader.footnotes-visible:not(.verse-mode) .verse-text-prose {
    display: none;
}

.scripture-reader.footnotes-visible:not(.verse-mode) .verse-text-formatted {
    display: inline;
}

/* In prose mode with footnotes, keep poetry as inline (no line breaks) */
.scripture-reader.footnotes-visible:not(.verse-mode) .verse-text-formatted .line {
    display: inline;
}

.scripture-reader.footnotes-visible:not(.verse-mode) .verse-text-formatted br {
    display: none;
}

/* Verse numbers hidden state */
.scripture-reader.verse-numbers-hidden .verse-num {
    opacity: 0;
}

/* Show verse numbers on scroll (JS adds this class) */
.scripture-reader.verse-numbers-hidden.is-scrolling .verse-num {
    opacity: 0.5;
}

/* =============================================================================
   SECTION HEADINGS & REFERENCES (Structure)
   ============================================================================= */

/* Hidden by default, shown when structure-visible class is on reader */
.verse-heading,
.verse-reference,
.verse-major-section,
.verse-acrostic,
.verse-description {
    display: none;
}

.scripture-reader.structure-visible .verse-heading {
    display: block;
    font-family: var(--serif-font);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 1.5rem 0 0.5rem;
    padding-top: 0.5rem;
}

/* First heading in chapter doesn't need top margin */
.scripture-verses .verse-heading:first-child {
    margin-top: 0;
}

.scripture-reader.structure-visible .verse-reference {
    display: block;
    font-family: var(--primary-font);
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

/* Acrostic headings (Hebrew letters in Psalm 119, etc.) - shown with structure */
.scripture-reader.structure-visible .verse-acrostic {
    display: block;
    font-family: var(--serif-font);
    font-size: 1rem;
    font-weight: 600;
    font-style: italic;
    color: var(--color-text-muted);
    text-align: center;
    margin: 1.25rem 0 0.75rem;
    padding: 0.25rem 0;
    letter-spacing: 0.1em;
}

/* Major section headings (BOOK I, BOOK II, etc. in Psalms) - shown with structure */
.scripture-reader.structure-visible .verse-major-section {
    display: block;
    font-family: var(--primary-font);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 2rem 0 1rem;
    padding: 0.5rem 0;
}

/* First major section doesn't need top margin */
.scripture-reader.structure-visible .verse-major-section:first-child {
    margin-top: 0;
}

/* Descriptive titles (Psalm superscriptions) - shown with structure */
.scripture-reader.structure-visible .verse-description {
    display: block;
    font-family: var(--serif-font);
    font-size: 0.9375rem;
    font-style: italic;
    color: var(--color-text-muted);
    margin: 0.5rem 0 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--color-border);
}

/* =============================================================================
   VERSE MODE (each verse on own line)
   ============================================================================= */

/* Verse mode: each verse on its own line like a printed Bible */
.scripture-reader.verse-mode .verse {
    display: block;
    margin-bottom: 0.75rem;
    padding-left: 2rem;
    text-indent: -2rem;
}

.scripture-reader.verse-mode .verse-num {
    display: inline-block;
    width: 1.75rem;
    text-align: right;
    margin-right: 0.25rem;
    vertical-align: baseline;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* Reduce line height in verse mode since verses are separate */
.scripture-reader.verse-mode .scripture-verses {
    line-height: 1.6;
}

/* =============================================================================
   POETRY & LIST FORMATTING (Verse mode only)
   ============================================================================= */

/* Poetry line indentation - applies to individual lines within verse text */
/* These .line spans are generated by the parser for multi-line poetry */
.scripture-reader.verse-mode .verse-text-formatted .line {
    display: block;
    text-indent: 0; /* Reset text-indent from verse */
}

/* Hide br tags since .line is block - they're redundant */
.scripture-reader.verse-mode .verse-text-formatted br {
    display: none;
}

/* First line flows after verse number */
.scripture-reader.verse-mode .verse-text-formatted .line:first-child {
    display: inline;
}

/* If first line has higher indentation level, add margin */
.scripture-reader.verse-mode .verse-text-formatted .line.poetry-q2:first-child {
    margin-left: 1.5rem;
}

.scripture-reader.verse-mode .verse-text-formatted .line.poetry-q3:first-child {
    margin-left: 3rem;
}

.scripture-reader.verse-mode .verse-text-formatted .line.poetry-q1 {
    padding-left: 1rem;
}

.scripture-reader.verse-mode .verse-text-formatted .line.poetry-q2 {
    padding-left: 2.5rem;
}

.scripture-reader.verse-mode .verse-text-formatted .line.poetry-q3 {
    padding-left: 4rem;
}

.scripture-reader.verse-mode .verse-text-formatted .line.selah,
.scripture-reader.verse-mode .verse-text-formatted .line.poetry-qr {
    text-align: right;
    font-style: italic;
    padding-right: 1rem;
    padding-left: 0;
}

.scripture-reader.verse-mode .verse-text-formatted .line.list-li1 {
    padding-left: 1rem;
}

.scripture-reader.verse-mode .verse-text-formatted .line.list-li2 {
    padding-left: 2.5rem;
}

/* Centered paragraphs - inscriptions like "HOLY TO THE LORD", "MENE TEKEL" */
.scripture-reader.verse-mode .verse-text-formatted .line.para-centered {
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding-left: 0;
}

/* Centered poetry */
.scripture-reader.verse-mode .verse-text-formatted .line.poetry-qc {
    text-align: center;
    padding-left: 0;
}

/*
 * NOTE: Verse-level poetry/list padding removed to keep verse numbers aligned.
 * Poetry and list indentation is now handled only at the .line level inside
 * .verse-text-formatted, so verse numbers stay in a consistent column.
 * See .line.poetry-q1, .line.poetry-q2, etc. rules above.
 */

/* Selah marker - right-align the text but keep verse number position */
.scripture-reader.verse-mode .verse.selah .verse-text-formatted {
    display: block;
    text-align: right;
    font-style: italic;
    padding-right: 1rem;
}

/* Paragraph spacing */
.scripture-reader.verse-mode .verse.para-margin {
    margin-top: 0;
}

.scripture-reader.verse-mode .verse.break-before {
    margin-top: 1rem;
}

/* =============================================================================
   USFM INLINE STYLING
   ============================================================================= */

/* Words of Jesus - red letter */
.scripture-verses .wj {
    color: var(--color-danger, #b91c1c);
}

/* Divine name - small caps (LORD) */
.scripture-verses .nd {
    font-variant: small-caps;
    text-transform: lowercase;
}

/* Added/implied words - subtle italic */
.scripture-verses .add {
    font-style: italic;
    opacity: 0.85;
}

/* Italic */
.scripture-verses .it {
    font-style: italic;
}

/* Bold */
.scripture-verses .bd {
    font-weight: 600;
}

/* Transliteration */
.scripture-verses .tl {
    font-style: italic;
}

/* Small caps */
.scripture-verses .sc {
    font-variant: small-caps;
}


/* =============================================================================
   FOOTNOTES
   ============================================================================= */

/* Footnote toggle button */
.scripture-footnote-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.scripture-footnote-toggle:hover {
    background: var(--color-background);
    color: var(--color-text);
}

/* Footnote toggle icon states */
.scripture-footnote-toggle .footnote-toggle-hidden {
    display: none;
}

.scripture-footnote-toggle.active .footnote-toggle-visible {
    display: none;
}

.scripture-footnote-toggle.active .footnote-toggle-hidden {
    display: flex;
}

/* Footnote markers - superscript numbers in verse text */
.scripture-verses .fn {
    font-family: var(--primary-font);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--color-primary);
    vertical-align: super;
    cursor: pointer;
    padding: 0 0.125em;
    border-radius: 2px;
    transition: background 0.15s ease, color 0.15s ease;
    /* Hidden by default */
    display: none;
}

/* Show footnotes when toggle is active */
.scripture-reader.footnotes-visible .scripture-verses .fn {
    display: inline;
}

.scripture-verses .fn:hover {
    background: var(--color-primary-light);
}

/* Ensure footnotes are clickable */
.scripture-verses .fn {
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
}

/* =============================================================================
   MISSING VERSES (dagger markers for intentionally omitted verses)
   ============================================================================= */

/*
 * The BSB translation omits 17 verses that exist in some manuscript traditions.
 * These are marked with a dagger (†) where the verse would appear.
 * The dagger follows verse number visibility toggle behavior.
 */

/* Missing verse marker - just the dagger, no text content */
.verse-missing {
    /* Inherits .verse display for prose/verse mode consistency */
}

/* Missing verse dagger - styled like verse numbers */
.verse-num-missing {
    /* Match .verse-num sizing - dagger needs slightly larger font to appear same size */
    font-family: var(--primary-font);
    font-size: 0.8125rem;
    font-weight: 600;
    vertical-align: super;
    margin-right: 0.125em;
    cursor: help;
    color: var(--color-text-muted);
}

/* Hover effect */
.verse-num-missing:hover {
    color: var(--color-primary);
}

/* Follows verse number visibility toggle */
.scripture-reader.verse-numbers-hidden .verse-num-missing {
    opacity: 0;
}

.scripture-reader.verse-numbers-hidden.is-scrolling .verse-num-missing {
    opacity: 0.5;
}

/* When prior verse has footnotes, show pointer cursor for click-to-show */
.verse-missing.has-footnotes .verse-num-missing {
    cursor: pointer;
}

/* Verse mode: missing verse on its own line like other verses */
.scripture-reader.verse-mode .verse-missing {
    display: block;
    margin-bottom: 0.75rem;
    padding-left: 2rem;
    text-indent: -2rem;
}

.scripture-reader.verse-mode .verse-num-missing {
    display: inline-block;
    width: 1.75rem;
    text-align: right;
    margin-right: 0.25rem;
    vertical-align: baseline;
    /* Dagger needs slightly larger font to appear same size as verse numbers */
    font-size: 0.875rem;
    font-weight: 600;
}

/* Mobile adjustments for verse mode */
@media (max-width: 640px) {
    .scripture-reader.verse-mode .verse-missing {
        padding-left: 1.75rem;
        text-indent: -1.75rem;
        margin-bottom: 0.5rem;
    }

    .scripture-reader.verse-mode .verse-num-missing {
        width: 1.5rem;
    }
}

/* =============================================================================
   VERSE INFO PANEL (inline expansion below verse)
   ============================================================================= */

/*
 * The verse-info panel appears below a verse when clicking a footnote marker.
 * It provides a home for footnotes and future verse-level info.
 * Uses display:block to break out of inline verse flow in prose mode.
 */
.verse-info {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 1rem;
    background: var(--color-verse-info-bg);
    border-left: 3px solid var(--color-info-accent);
    border-radius: 0 0.5rem 0.5rem 0;
    font-family: var(--primary-font);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-info-text);
    /* Animation - start collapsed */
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.15s ease, max-height 0.2s ease, margin 0.2s ease, padding 0.2s ease;
}

.verse-info.visible {
    opacity: 1;
    max-height: 1000px; /* Large enough for any realistic content */
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    overflow: visible;
}

/* Individual footnote item */
.verse-info-item {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.verse-info-item + .verse-info-item {
    margin-top: 0.5rem;
}

/* Footnote number label */
.verse-info-num {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--color-info-accent);
    min-width: 1rem;
}

/* =============================================================================
   FOOTNOTE TERM TOOLTIPS
   ============================================================================= */

/*
 * Manuscript source abbreviations (LXX, MT, DSS, etc.) in footnotes are
 * wrapped with .fn-term and display a tooltip with the full definition.
 * Works on hover (desktop) and click (mobile via JS).
 */

.fn-term {
    position: relative;
    font-weight: 600;
    cursor: help;
}

/* Tooltip via CSS pseudo-element (hover on desktop) */
.fn-term::after {
    content: attr(data-def);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    z-index: 100;

    /* Styling */
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 0.5rem 0.75rem;
    box-shadow: var(--shadow-md);

    /* Text */
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    width: max-content;
    max-width: 280px;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

/* Arrow pointing down to the term */
.fn-term::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    z-index: 101;

    border: 6px solid transparent;
    border-top-color: var(--color-border);

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

/* Show tooltip on hover (desktop) */
.fn-term:hover::after,
.fn-term:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Active state for click (mobile) - JS adds this class */
.fn-term.active::after,
.fn-term.active::before {
    opacity: 1;
    visibility: visible;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .fn-term::after {
        /* Position at top-left of viewport for small screens */
        position: fixed;
        left: 1rem;
        right: 1rem;
        bottom: auto;
        top: auto;
        transform: none;
        max-width: none;
        width: auto;
    }

    .fn-term::before {
        display: none; /* Hide arrow on mobile */
    }
}

/* =============================================================================
   SCRIPTURE REFERENCE LINKS
   ============================================================================= */

/*
 * Cross-references in headings and footnotes link to other scripture passages.
 * Styled subtly to not distract from reading flow.
 */

.scripture-ref {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.scripture-ref:hover {
    color: var(--color-primary);
}

/* In verse-reference headers */
.verse-reference .scripture-ref {
    color: var(--color-text-muted);
}

.verse-reference .scripture-ref:hover {
    color: var(--color-primary);
}

/* In footnote panels */
.verse-info .scripture-ref {
    color: var(--color-text);
}

/* =============================================================================
   VERSE HIGHLIGHTING (deep links to specific verses)
   ============================================================================= */

/*
 * Highlighted verses have a grey background and dark left border.
 * Used when linking to specific verses (e.g., ?chapter=3&verse=16-18).
 * Highlight clears when user scrolls to a different chapter.
 *
 * Both modes use a wrapper div that includes verses AND any structural
 * elements (headings, references) within the highlighted range.
 */

/* ==========================================================================
   HIGHLIGHT WRAPPER (both modes)
   ========================================================================== */

/* Wrapper creates a continuous block with left border at reading area edge */
.verse-highlight-wrapper {
    display: block;
    position: relative;
    background: var(--color-scripture-bg);
    border-left: 3px solid var(--color-text-muted);
    padding: 0.25rem 0.25rem 0.25rem 0.75rem;
    margin-left: -0.78rem; /* Align border with reading area edge */
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 0 4px 4px 0;
}

/* First highlighted verse - scroll margin for scrollIntoView */
/* 130px = ~60px site header + ~50px scripture header + 20px margin */
.verse.verse-highlight-first {
    scroll-margin-top: 130px;
}

/* Verses inside wrapper don't need their own highlighting */
.verse-highlight-wrapper .verse {
    background: transparent;
    padding: 0;
    border: none;
    margin: 0;
}

/* Structural elements inside wrapper get proper spacing */
.verse-highlight-wrapper .verse-heading,
.verse-highlight-wrapper .verse-reference,
.verse-highlight-wrapper .verse-description,
.verse-highlight-wrapper .verse-acrostic,
.verse-highlight-wrapper .verse-major-section {
    /* Inherit visibility from structure-visible setting */
}

/* ==========================================================================
   VERSE MODE: Wrapper adjustments
   ========================================================================== */

/* In verse mode, adjust wrapper padding for verse indentation */
.scripture-reader.verse-mode .verse-highlight-wrapper {
    padding-left: calc(2rem + 0.5rem);
    margin-left: -0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Verses in wrapper keep their verse-mode styling */
.scripture-reader.verse-mode .verse-highlight-wrapper .verse {
    display: block;
    margin-bottom: 0.5rem;
    padding-left: 2rem;
    text-indent: -2rem;
}

/* Last verse in wrapper doesn't need bottom margin */
.scripture-reader.verse-mode .verse-highlight-wrapper .verse:last-of-type {
    margin-bottom: 0;
}


/* Infinite scroll triggers */
.scripture-load-trigger {
    height: 1px;
    visibility: hidden;
}

/* Previous chapter trigger - hidden by default, made visible by JS */
.scripture-load-prev {
    height: 1px;
    visibility: hidden;
}

.scripture-load-prev--visible {
    visibility: visible;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin-bottom: 1rem;
    font-family: var(--primary-font);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
}

.scripture-load-prev--visible::before {
    content: "Scroll up or tap to load previous chapter";
}

.scripture-load-prev--visible:hover {
    color: var(--color-text);
}

.scripture-load-prev--loading::before {
    content: "Loading...";
}

.scripture-load-prev--loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Book transition in chapter heading */
.scripture-chapter[data-book]:not(:first-of-type) .chapter-heading {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--color-border);
}


/* =============================================================================
   DROPDOWN POPOVERS (Book & Chapter Selection)
   ============================================================================= */

.scripture-overlay {
    position: fixed;
    z-index: 1000;
    /* Centered horizontally, positioned below scripture header */
    top: calc(var(--nav-header-height, 60px) + 52px + 0.5rem);
    left: 50%;
    /* Animation - starts hidden */
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

/* Open state - triggered by JS adding .open class */
.scripture-overlay.open {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Hidden attribute - completely hide after animation */
.scripture-overlay[hidden] {
    display: none;
}

.scripture-overlay-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay-backdrop);
    z-index: -1;
}

.scripture-overlay-content {
    position: relative;
    width: max-content;
    max-width: min(800px, calc(100vw - 2rem));
    max-height: calc(100vh - 150px);
    background: var(--color-background);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Arrow pointing up to header */
.scripture-overlay-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: var(--color-background);
    border-left: 1px solid var(--color-border);
    border-top: 1px solid var(--color-border);
    transform: translateX(-50%) rotate(45deg);
}

.scripture-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-surface);
}

.scripture-overlay-title {
    font-family: var(--serif-font);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.scripture-overlay-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.scripture-overlay-close svg {
    width: 14px;
    height: 14px;
}

.scripture-overlay-close:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.scripture-overlay-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

/* Overlay testament grid - side by side */
.scripture-testaments--overlay {
    margin-top: 0;
}

.scripture-testaments--overlay .testament-heading {
    font-size: 1rem;
}

/* Chapter overlay - more compact */
.scripture-overlay-content--compact {
    max-width: 400px;
}

/* Chapter grid - numbers in a grid */
.scripture-chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 0.5rem;
}

.scripture-chapter-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    font-family: var(--primary-font);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    background: var(--color-surface);
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.scripture-chapter-link:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.scripture-chapter-link.active {
    background: var(--color-primary);
    color: white;
}


/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* Tablet: single sub-column per testament */
@media (max-width: 1024px) {
    .scripture-group-books {
        grid-template-columns: 1fr;
    }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    /* Keep testaments side-by-side on mobile, just tighter */
    .scripture-testaments {
        gap: 1rem;
    }

    /* Reduce spacing between groups */
    .scripture-book-groups {
        gap: 1rem;
    }

    /* Single column for books within each group */
    .scripture-group-books {
        grid-template-columns: 1fr;
        gap: 0.125rem;
    }

    .scripture-book-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }

    /* ==========================================================================
       MOBILE: Floating pill header
       ========================================================================== */

    .scripture-header {
        /* Floating pill - centered */
        position: fixed;
        top: calc(var(--nav-header-height, 60px) + 0.75rem);
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;

        /* Pill shape */
        padding: 0.5rem 0.75rem;
        margin: 0;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        background: var(--overlay-glass-light);
        backdrop-filter: blur(8px);
        box-shadow: var(--shadow-md);

        /* Layout */
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;

        /* Transition for site header show/hide */
        transition: top 0.3s ease, opacity 0.3s ease;
    }

    /* When site header is hidden, pill moves up */
    body.site-header-hidden .scripture-header {
        top: 0.75rem;
    }

    /* Reset the nav container positioning for pill */
    .scripture-header-nav {
        position: static;
        transform: none;
    }

    .scripture-book-selector {
        font-size: 0.875rem;
        padding: 0.25rem 0.375rem;
    }

    .scripture-chapter-selector {
        font-size: 0.6875rem;
        padding: 0.25rem 0.375rem;
        white-space: nowrap;
    }

    .scripture-chapter-label {
        white-space: nowrap;
    }

    .scripture-selector-chevron {
        opacity: 0.5;
    }

    .scripture-mode-toggle,
    .scripture-structure-toggle,
    .scripture-verse-toggle,
    .scripture-footnote-toggle {
        width: 26px;
        height: 26px;
        border: none;
        background: transparent;
    }

    .scripture-mode-toggle:hover,
    .scripture-structure-toggle:hover,
    .scripture-verse-toggle:hover,
    .scripture-footnote-toggle:hover {
        background: var(--color-surface);
    }

    /* Divider between nav and toggles */
    .scripture-header-nav::after {
        content: '';
        width: 1px;
        height: 18px;
        background: var(--color-border);
        margin-left: 0.25rem;
    }

    .scripture-chapters {
        /* Extra top padding for floating pill */
        padding: 3.5rem 0.75rem 2rem;
    }

    /* Mobile scroll margins - floating pill header */
    /* 120px = ~60px site header + ~42px floating pill + 18px margin */
    .verse.verse-highlight-first {
        scroll-margin-top: 120px;
    }

    .scripture-verses {
        font-size: 1.0625rem;
        line-height: 1.9;
    }

    /* First chapter heading needs less top margin since we have padding */
    .scripture-chapter:first-of-type .chapter-heading {
        margin-top: 0;
    }

    /* ==========================================================================
       MOBILE: Verse mode adjustments
       ========================================================================== */

    .scripture-reader.verse-mode .verse {
        padding-left: 1.75rem;
        text-indent: -1.75rem;
        margin-bottom: 0.5rem;
    }

    .scripture-reader.verse-mode .verse-num {
        width: 1.5rem;
    }

    .scripture-reader.verse-mode .scripture-verses {
        line-height: 1.5;
    }

    /* Poetry line adjustments for mobile */
    .scripture-reader.verse-mode .verse-text-formatted .line.poetry-q1 {
        padding-left: 0.75rem;
    }

    .scripture-reader.verse-mode .verse-text-formatted .line.poetry-q2 {
        padding-left: 2rem;
    }

    .scripture-reader.verse-mode .verse-text-formatted .line.poetry-q3 {
        padding-left: 3rem;
    }

    /* Verse-level poetry padding removed - handled at .line level for consistent verse number alignment */

    /* Section headings on mobile */
    .scripture-reader.structure-visible .verse-heading {
        font-size: 1rem;
        margin: 1.25rem 0 0.375rem;
    }

    .scripture-reader.structure-visible .verse-reference {
        font-size: 0.75rem;
    }

    /* Acrostic headings on mobile */
    .scripture-reader.structure-visible .verse-acrostic {
        font-size: 0.875rem;
        margin: 1rem 0 0.5rem;
    }

    /* Major section headings on mobile */
    .scripture-reader.structure-visible .verse-major-section {
        font-size: 0.75rem;
        margin: 1.5rem 0 0.75rem;
        padding: 0.5rem 0;
    }

    /* Descriptive titles on mobile */
    .scripture-reader.structure-visible .verse-description {
        font-size: 0.875rem;
        margin: 0.375rem 0 0.75rem;
        padding-left: 0.75rem;
    }

    /* ==========================================================================
       MOBILE: Dropdown popover adjustments
       ========================================================================== */

    .scripture-overlay {
        /* Centered, positioned below the floating pill */
        top: calc(var(--nav-header-height, 60px) + 0.75rem + 42px + 0.5rem);
        left: 50%;
        width: calc(100% - 2rem);
        max-width: 400px;
        transform: translateX(-50%) translateY(-8px);
        /* Smooth transition when site header hides/shows */
        transition: opacity 0.2s ease, transform 0.2s ease, top 0.3s ease;
    }

    .scripture-overlay.open {
        transform: translateX(-50%) translateY(0);
    }

    /* When site header is hidden, pill moves up, so overlay moves up too */
    body.site-header-hidden .scripture-overlay {
        top: calc(0.75rem + 42px + 0.5rem);
    }

    .scripture-overlay-content {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 8rem);
        border-radius: 12px;
    }

    /* Book overlay needs more width for two columns */
    #book-overlay {
        max-width: calc(100% - 1rem);
        width: calc(100% - 1rem);
    }

    /* Chapter overlay stays compact */
    .scripture-overlay--chapters {
        max-width: 320px;
    }

    .scripture-overlay-body {
        padding: 0.75rem;
    }

    /* Keep overlay testaments side-by-side too */
    .scripture-testaments--overlay {
        gap: 0.75rem;
    }

    .scripture-testaments--overlay .testament-heading {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.25rem;
    }

    /* ==========================================================================
       MOBILE: Site header auto-hide (scripture pages only)
       ========================================================================== */

    /* Site header transitions for scripture pages on mobile */
    body.scripture-page .site-header {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    /* Hide site header when stationary - overlays without pushing content */
    body.scripture-page.site-header-hidden .site-header {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }

    /* Show site header when scrolling */
    body.scripture-page.site-header-visible .site-header {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* Scripture header stays in place - doesn't move with site header */
    body.scripture-page .scripture-header {
        /* Keep at fixed position below where site header would be */
        top: var(--nav-header-height, 60px);
    }
}

/* Large screens: wider reading area */
@media (min-width: 1200px) {
    .scripture-testaments {
        max-width: 1000px;
        margin-left: auto;
        margin-right: auto;
    }
}


/* =============================================================================
   STUDY PANELS (interlinear word-level data)
   ============================================================================= */

/* Study panel container */
.verse-study-panel {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    margin: 0.5rem 0 1rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    background: var(--color-verse-info-bg);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 0.5rem 0.5rem 0;
}

.verse-study-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Footnotes section in study panel */
.verse-study-footnotes {
    background: var(--color-verse-info-bg);
    border-left: 3px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.verse-study-footnotes .verse-info-item {
    margin-bottom: 0.25rem;
}

.verse-study-footnotes .verse-info-item:last-child {
    margin-bottom: 0;
}

.verse-study-footnotes .verse-info-num {
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: 0.25rem;
}

/* Literal translation row */
.verse-study-literal {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.verse-study-box {
    flex: 1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-family: var(--serif-font);
    font-size: 0.9375rem;
    line-height: 1.6;
    transition: all 0.2s ease;
    position: relative;
}

/* Header in literal box (before and after expansion) */
.verse-study-box > .verse-study-column-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--color-border);
}

/* When literal box becomes a column */
.verse-study-box.verse-study-column {
    padding: 0.75rem; /* Reset padding for column layout */
}

/* Untranslated words (articles, etc.) */
.verse-study-box .word-untranslated,
.verse-study-column .word-untranslated {
    color: var(--color-text-muted);
    cursor: help;
}

/* Red letter (Jesus' words) */
.verse-study-box .word-red,
.verse-study-column .word-red {
    color: var(--color-danger);
}

/* Interlinear study container */
.verse-study-interlinear {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Interlinear title (links to info modal) */
.verse-study-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
}

.verse-study-title a {
    color: var(--color-primary);
    text-decoration: none;
}

.verse-study-title a:hover {
    text-decoration: underline;
}

/* Two-column layout for interlinear */
.verse-study-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Column styles */
.verse-study-column {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.verse-study-column .verse-study-column-content {
    flex: 1; /* Fill remaining space */
}

.verse-study-column--original.rtl {
    direction: rtl;
    text-align: right;
}

.verse-study-column-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--color-border);
}

/* Sort order buttons in column headers */
.sort-order-btn {
    background: none;
    border: none;
    padding: 0.125rem 0.25rem;
    margin: -0.125rem -0.25rem; /* Expand clickable area */
    font-size: inherit;
    font-weight: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.sort-order-btn:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.sort-order-btn.active {
    color: var(--color-primary);
    font-weight: 700;
}

.sort-order-btn.active:hover {
    background: none;
    cursor: default;
}

.verse-study-column-content {
    font-size: 1rem;
    line-height: 1.8;
}

/* Original language column uses larger font */
.verse-study-column--original .verse-study-column-content {
    font-family: var(--serif-font);
    font-size: 1.125rem;
}

/* Interlinear word items */
.interlinear-word {
    display: inline;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.1s ease;
}

.interlinear-word:hover,
.interlinear-word.highlighted {
    background: var(--color-primary-light);
}

/* Word info panel */
.word-info-panel {
    background: var(--color-verse-info-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    position: relative;
}

.word-info-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
}

.word-info-close:hover {
    color: var(--color-text);
}

.word-info-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.word-info-row:last-child {
    margin-bottom: 0;
}

.word-info-original {
    font-family: var(--serif-font);
    font-size: 1.25rem;
    font-weight: 500;
}

.word-info-translit {
    color: var(--color-text-muted);
    font-style: italic;
}

.word-info-label {
    font-weight: 600;
    color: var(--color-text-muted);
    min-width: 60px;
}

.word-info-value {
    color: var(--color-text);
}

.word-info-strongs {
    font-family: var(--mono-font, monospace);
    font-size: 0.8125rem;
    background: var(--color-surface);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

.word-info-parsing-long {
    margin-top: 0.125rem;
    padding-left: calc(60px + 0.5rem); /* Indent to align under grammar code value */
}

.word-info-parsing-long .word-info-value {
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--color-text-muted);
}

.word-info-footnote {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.word-info-footnote .word-info-value {
    font-style: italic;
    color: var(--color-text-muted);
}

/* Scripture refs in word info footnotes */
.word-info-footnote .scripture-ref {
    color: var(--color-text-muted);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.word-info-footnote .scripture-ref:hover {
    color: var(--color-primary);
    text-decoration-style: solid;
}


/* =============================================================================
   STUDY MODE MODAL (mobile)
   ============================================================================= */

.study-mode-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.study-mode-modal.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Ensure hidden attribute works */
.study-mode-modal[hidden] {
    display: none !important;
}

.study-mode-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.study-mode-modal-content {
    position: relative;
    background: var(--color-background);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 90%;
    width: 320px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.study-mode-modal.visible .study-mode-modal-content {
    transform: scale(1);
}

.study-mode-modal-content h3 {
    font-family: var(--serif-font);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--color-text);
}

.study-mode-modal-content p {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-text-muted);
    margin: 0 0 0.75rem;
}

.study-mode-modal-content ul {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text-muted);
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}

.study-mode-modal-content li {
    margin-bottom: 0.25rem;
}

.study-mode-modal-close {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: white;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.study-mode-modal-close:hover {
    background: var(--color-primary-hover);
}

/* Modal with two buttons */
.study-mode-modal-buttons {
    display: flex;
    gap: 0.75rem;
}

.study-mode-modal-buttons .study-mode-modal-close {
    flex: 1;
}

.study-mode-modal-link {
    flex: 1;
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.study-mode-modal-link:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Interlinear info link in header */
.interlinear-info-link {
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
}

.interlinear-info-link:hover {
    text-decoration: underline;
}

/* Interlinear guide modal headings */
.study-mode-modal-content h4 {
    font-family: var(--primary-font);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 1rem 0 0.5rem;
}

.study-mode-modal-content h4:first-of-type {
    margin-top: 0.5rem;
}

/* Interlinear guide list */
.interlinear-guide-list {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
    color: var(--color-text);
}

.interlinear-guide-list li {
    margin-bottom: 0.375rem;
}

.interlinear-guide-list li:last-child {
    margin-bottom: 0;
}

.interlinear-guide-list strong {
    color: var(--color-text);
}

/* Interlinear notation definition list */
.interlinear-notation-list {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0 0 1rem;
}

.interlinear-notation-list dt {
    font-weight: 600;
    color: var(--color-text);
    font-family: var(--font-mono, monospace);
    margin-top: 0.5rem;
}

.interlinear-notation-list dt:first-child {
    margin-top: 0;
}

.interlinear-notation-list dd {
    color: var(--color-text-muted);
    margin-left: 1rem;
    margin-bottom: 0;
}


/* =============================================================================
   RESPONSIVE: Study panels
   ============================================================================= */

@media (max-width: 640px) {
    /* Stack columns vertically on mobile */
    .verse-study-columns {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .verse-study-column {
        padding: 0.5rem 0.75rem;
    }

    .verse-study-column-content {
        font-size: 0.9375rem;
        line-height: 1.7;
    }

    .verse-study-column--original .verse-study-column-content {
        font-size: 1rem;
    }

    /* Word info panel adjustments */
    .word-info-panel {
        padding: 0.5rem 0.75rem;
    }
}
