/* =============================================================================
   VerseFlow — Modern Reader Styling (TICKET-990)
   ============================================================================= */

.vf-reader {
    padding-bottom: 5rem;
}

.vf-reader__header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.vf-reader__header h1 {
    font-family: var(--font-primary, serif);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 500;
    margin: 0 0 0.5rem;
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.92));
}

.vf-reader__subhead {
    font-size: 0.95rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.55));
    letter-spacing: 0.02em;
}

/* ── Picker / Index UI ────────────────────────────────────────────────────── */
.vf-reader__controls {
    margin-bottom: 4rem;
}

.vf-reader__picker fieldset {
    border: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(var(--vf-surface-rgb, 246, 239, 226), 0.6), rgba(var(--vf-surface-rgb, 246, 239, 226), 0.2));
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.03);
}

.vf-reader__picker legend {
    font-family: var(--font-primary, serif);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0 1rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.45));
}

.vf-field {
    margin-bottom: 2rem;
}

/* ── Chapter View ────────────────────────────────────────────────────────── */
.vf-reader-chapter-view {
    padding: 4rem 0;
}

.vf-reader-header {
    margin-bottom: 3rem;
    text-align: center;
}

.vf-reader-header h1 {
    font-size: 3.5rem;
    font-family: var(--font-primary, serif);
    letter-spacing: -0.02em;
    margin: 1rem 0;
}

.vf-reader-breadcrumb {
    font-family: var(--font-primary, serif);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.45));
}

.vf-reader-breadcrumb ol {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.vf-reader-breadcrumb .sep {
    margin: 0 0.75rem;
}

.vf-reader-meta {
    font-size: 0.95rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.6));
}

.vf-reader-translation-tag {
    background: var(--vf-ui-accent, #111);
    color: var(--vf-ui-inverse, #fff);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    vertical-align: middle;
}

/* ── Tools ───────────────────────────────────────────────────────────────── */
.vf-reader-chapter__tools {
    margin: 2rem 0 4rem;
    display: flex;
    justify-content: center;
}

.vf-reader-jump {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.vf-reader-jump__input-group {
    display: flex;
    gap: 0.5rem;
}

.vf-reader-jump input {
    width: 100px;
    text-align: center;
}

/* ── Verses ──────────────────────────────────────────────────────────────── */
.vf-reader-verses {
    font-size: 1.25rem;
    line-height: 1.8;
}

.vf-verse {
    margin-bottom: 1rem;
    display: inline;
}

.vf-verse__num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.4));
    vertical-align: super;
    margin-right: 0.5rem;
    user-select: none;
}

/* ── Highlighting ────────────────────────────────────────────────────────── */
.vf-verse-highlight {
    animation: vf-pulse-highlight 3s ease-out;
}

@keyframes vf-pulse-highlight {
    0% {
        background-color: rgba(var(--vf-accent-rgb, 201, 151, 99), 0.3);
    }

    100% {
        background-color: transparent;
    }
}

/* ── Footer / Infinite ───────────────────────────────────────────────────── */
.vf-reader-nav {
    margin-top: 6rem;
    padding-top: 4rem;
    border-top: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.05));
    text-align: center;
}

.vf-reader-nav__row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* ── Continue / Infinite box ─────────────────────────────────────────────── */
.vf-reader-continue-box {
    background: rgba(var(--vf-surface-rgb, 246, 239, 226), 0.5);
    padding: 3rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.07));
    text-align: center;
}

.vf-reader-continue-hint {
    font-family: var(--font-primary, serif);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.6));
}

/* "Continue to next chapter" button — treat like a .vf-btn--secondary */
[data-vf-continue-next] {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.75rem;
    background: transparent;
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.85));
    border: 1px solid var(--vf-ui-bar-border, rgba(17, 17, 17, 0.2));
    border-radius: 30px;
    font-family: var(--font-primary, serif);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}

[data-vf-continue-next]:hover {
    background: var(--vf-ui-btn-bg, rgba(17, 17, 17, 0.88));
    color: var(--vf-ui-btn-text, rgba(246, 239, 226, 0.96));
    border-color: transparent;
    transform: translateY(-1px);
}

[data-vf-continue-next]:focus-visible {
    outline: 2px solid var(--covenant-accent, #7a1e2c);
    outline-offset: 3px;
}

body.atmosphere-night .vf-reader-continue-box {
    background: rgba(255, 255, 255, 0.03);
}

body.atmosphere-night [data-vf-continue-next] {
    color: rgba(246, 239, 226, 0.75);
    border-color: rgba(255, 255, 255, 0.15);
}

body.atmosphere-night [data-vf-continue-next]:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(246, 239, 226, 0.95);
    border-color: transparent;
}

.vf-reader-infinite-status {
    margin-top: 1rem;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--vf-ui-accent);
}

/* ── Button system ───────────────────────────────────────────────────────── */
/* Base .vf-btn — used by nav prev/next, jump, continue */
.vf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 30px;
    font-family: var(--font-primary, serif);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    white-space: nowrap;
}

.vf-btn:focus-visible {
    outline: 2px solid var(--vf-ui-accent, var(--covenant-accent, #7a1e2c));
    outline-offset: 3px;
}

/* Primary — filled deep parchment-ink */
.vf-btn--primary {
    background: var(--vf-ui-btn-bg, rgba(17, 17, 17, 0.88));
    color: var(--vf-ui-btn-text, rgba(246, 239, 226, 0.96));
    border-color: transparent;
}

.vf-btn--primary:hover,
.vf-btn--primary:focus-visible {
    background: var(--covenant-accent, #7a1e2c);
    color: #fff;
    box-shadow: 0 4px 16px rgba(122, 30, 44, 0.25);
    transform: translateY(-1px);
}

/* Secondary — outlined */
.vf-btn--secondary {
    background: transparent;
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.85));
    border-color: var(--vf-ui-bar-border, rgba(17, 17, 17, 0.2));
}

.vf-btn--secondary:hover,
.vf-btn--secondary:focus-visible {
    background: var(--vf-ui-btn-bg, rgba(17, 17, 17, 0.88));
    color: var(--vf-ui-btn-text, rgba(246, 239, 226, 0.96));
    border-color: transparent;
    transform: translateY(-1px);
}

/* Ghost — no border, accent text colour (for nav links) */
.vf-btn--ghost {
    background: transparent;
    color: var(--vf-ui-accent, var(--covenant-accent, #7a1e2c));
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
}

.vf-btn--ghost:hover {
    text-decoration: underline;
}

/* Disabled state */
.vf-btn--disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

/* Night-mode flips */
body.atmosphere-night .vf-btn--secondary {
    color: rgba(246, 239, 226, 0.75);
    border-color: rgba(255, 255, 255, 0.15);
}

body.atmosphere-night .vf-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(246, 239, 226, 0.95);
    border-color: transparent;
}

body.atmosphere-night .vf-btn--primary {
    background: rgba(246, 239, 226, 0.95);
    color: rgba(17, 17, 17, 0.9);
}

body.atmosphere-night .vf-btn--primary:hover {
    background: var(--covenant-accent, #7a1e2c);
    color: #fff;
}

.is-loading {
    cursor: wait;
    opacity: 0.7;
}

/* ── Debug ───────────────────────────────────────────────────────────────── */
.vf-debug-box {
    font-family: monospace;
    overflow-x: auto;
}

.vf-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.7));
}

.vf-field select,
.vf-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.15));
    border-radius: 8px;
    font-family: var(--font-primary, serif);
    font-size: 1rem;
    background: #fff;
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.9));
}

.vf-help {
    font-size: 0.75rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.45));
    margin-top: 0.4rem;
}

.vf-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ── Chapter Rendering ───────────────────────────────────────────────────── */
.vf-reader-chapter {
    margin-bottom: 6rem;
    animation: vf-fade-in 0.6s ease-out;
}

@keyframes vf-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vf-reader-chapter__header {
    margin-bottom: 2.5rem;
}

.vf-reader-chapter__header h2 {
    font-family: var(--font-primary, serif);
    font-size: 2.25rem;
    margin: 0 0 0.75rem;
}

.vf-reader-chapter__meta {
    display: block;
    font-size: 0.75rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.45));
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.4rem;
}

.vf-reader-sourcing-link {
    color: var(--vf-ui-accent, var(--covenant-accent, #7a1e2c));
    text-decoration: none;
}

.vf-reader-sourcing-link:hover {
    text-decoration: underline;
}

/* ── Verse List ───────────────────────────────────────────────────────────── */
.vf-reader-chapter__mc {
    margin-top: 3rem;
}

.vf-verse {
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    gap: 1rem;
    padding: 0.75rem 0;
    align-items: baseline;
    border-bottom: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.04));
    scroll-margin-top: 2rem;
}

.vf-verse:last-of-type {
    border-bottom: none;
}

.vf-verse__num {
    text-align: right;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.3));
    user-select: none;
}

.vf-verse__text {
    font-family: var(--font-primary, serif);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.88));
}

/* ── Tools / Jump ────────────────────────────────────────────────────────── */
.vf-reader-chapter__tools {
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
    background: rgba(var(--vf-surface-rgb, 246, 239, 226), 0.35);
    border: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.07));
    border-radius: 12px;
    display: flex;
    justify-content: center;
}

.vf-reader-jump label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.45));
    margin-bottom: 0.6rem;
    display: block;
    text-align: center;
}

.vf-reader-jump__input-group,
.vf-reader-jump__row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.vf-reader-jump input[type="number"],
.vf-reader-jump input {
    max-width: 120px;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.15));
    border-radius: 8px;
    font-family: var(--font-primary, serif);
    font-size: 0.95rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    color: var(--vf-ui-text, rgba(17, 17, 17, 0.88));
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
    appearance: textfield;
}

.vf-reader-jump input:focus {
    outline: none;
    border-color: var(--vf-ui-accent, var(--covenant-accent, #7a1e2c));
    box-shadow: 0 0 0 3px rgba(122, 30, 44, 0.12);
}

.vf-reader-jump button[type="submit"],
.vf-reader-jump .vf-btn {
    /* Override the vf-btn defaults for compact jump button */
    padding: 0.45rem 1.1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ── Navigation Actions ──────────────────────────────────────────────────── */
.vf-reader-chapter__footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--vf-ui-bar-border, rgba(0, 0, 0, 0.1));
}

.vf-reader-actions__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 3rem;
}

.vf-reader-infinite {
    text-align: center;
    padding: 2.5rem;
    background: rgba(var(--vf-surface-rgb, 246, 239, 226), 0.4);
    border-radius: 12px;
    margin-bottom: 4rem;
}

.vf-reader-infinite__hint {
    font-size: 0.85rem;
    color: var(--vf-ui-muted, rgba(17, 17, 17, 0.55));
    margin-bottom: 1.25rem;
}

.vf-reader-infinite__status {
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 1rem;
    color: var(--vf-ui-accent);
}

/* ── Next Steps ──────────────────────────────────────────────────────────── */
.vf-reader-next-steps {
    background: rgba(0, 0, 0, 0.02);
    padding: 2rem;
    border-radius: 12px;
}

.vf-reader-next-steps h3 {
    font-family: var(--font-primary, serif);
    font-size: 1.1rem;
    margin-top: 0;
}

.vf-reader-next-steps ul {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.vf-reader-next-steps li {
    margin-bottom: 0.75rem;
}

.vf-reader-next-steps a {
    color: var(--vf-ui-accent, var(--covenant-accent, #7a1e2c));
    text-decoration: none;
    font-size: 0.95rem;
}

.vf-reader-next-steps a:hover {
    text-decoration: underline;
}

/* ── Atmosphere Hooks ────────────────────────────────────────────────────── */
body.atmosphere-night .vf-reader__picker fieldset,
body.atmosphere-night .vf-reader-infinite {
    background: rgba(255, 255, 255, 0.03);
}

body.atmosphere-night .vf-field select,
body.atmosphere-night .vf-field input {
    background: #111;
    color: #eee;
    border-color: rgba(255, 255, 255, 0.1);
}

@media screen and (max-width: 600px) {
    .vf-reader-actions__row {
        flex-direction: column;
    }

    .vf-reader-actions__row .vf-btn {
        width: 100%;
        text-align: center;
    }
}