/* ── Bible reference link ──────────────────────────────────────────────────── */

.sv-bible-ref {
    color: var(--sv-bible-ref-color, #126d45);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
    border-radius: 2px;
    transition: color 0.15s, background-color 0.15s;
}

.sv-bible-ref:hover,
.sv-bible-ref:focus-visible {
    color: var(--sv-bible-ref-hover-color, #0c5a39);
    background-color: var(--sv-bible-ref-hover-bg, rgba(18, 109, 69, 0.08));
    outline: none;
}

/* ── Scripture preview card ───────────────────────────────────────────────── */

#sv-bible-popover {
    position: fixed;
    z-index: 9999;
    width: min(320px, calc(100vw - 20px));
    border-radius: 12px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.10),
        0 12px 32px rgba(0, 0, 0, 0.10);
    pointer-events: auto;
    opacity: 0;
    transform: scale(0.96) translateY(5px);
    transform-origin: top center;
    transition: opacity 0.18s ease, transform 0.18s ease;

    /* Light theme */
    background: var(--sv-bpop-bg, #ffffff);
    color: var(--sv-bpop-color, #2b2b2b);
    border: 1px solid var(--sv-bpop-border, rgba(0, 0, 0, 0.09));
}

#sv-bible-popover.sv-bpop--visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Animate from the bottom edge when card opens above the anchor. */
#sv-bible-popover.sv-bpop--above {
    transform-origin: bottom center;
}

/* ── Header: reference title ──────────────────────────────────────────────── */

.sv-bpop-header {
    padding: 0.75rem 1rem 0.5rem;
}

.sv-bpop-ref-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    color: var(--sv-bpop-title-color, #126d45);
}

/* ── Divider ──────────────────────────────────────────────────────────────── */

.sv-bpop-divider {
    height: 1px;
    margin: 0 1rem;
    background: var(--sv-bpop-divider, rgba(0, 0, 0, 0.08));
}

/* ── Body: verse text ─────────────────────────────────────────────────────── */

.sv-bpop-body {
    padding: 0.625rem 1rem 0.5rem;
}

.sv-bpop-verse {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--sv-bpop-color, #2b2b2b);
    margin: 0;
    /* Elegant truncation at ~4 lines */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Footer: CTA button ───────────────────────────────────────────────────── */

.sv-bpop-footer {
    padding: 0.5rem 1rem 0.875rem;
}

.sv-bpop-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.25;
    white-space: nowrap;
    text-decoration: none;
    color: #ffffff;
    background-color: var(--sv-bpop-cta-bg, #126d45);
    border: none;
    transition: background-color 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.sv-bpop-cta:hover {
    background-color: var(--sv-bpop-cta-hover-bg, #0f5c3a);
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(18, 109, 69, 0.28);
}

.sv-bpop-cta:focus-visible {
    outline: 2px solid var(--sv-bpop-cta-bg, #126d45);
    outline-offset: 3px;
    color: #ffffff;
    text-decoration: none;
}

.sv-bpop-cta svg {
    flex-shrink: 0;
    opacity: 0.85;
}

/* ── Caret pointing toward the anchor ────────────────────────────────────── */

/* Outer border triangle (visible as card border) */
#sv-bible-popover::before {
    content: "";
    position: absolute;
    top: -7px;
    left: var(--sv-caret-left, 50%);
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--sv-bpop-border, rgba(0, 0, 0, 0.09));
    pointer-events: none;
}

/* Inner fill triangle (matches card background) */
#sv-bible-popover::after {
    content: "";
    position: absolute;
    top: -5px;
    left: var(--sv-caret-left, 50%);
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--sv-bpop-bg, #ffffff);
    pointer-events: none;
}

/* Caret flips to bottom when card opens above anchor */
#sv-bible-popover.sv-bpop--above::before {
    top: auto;
    bottom: -7px;
    border-bottom: none;
    border-top: 7px solid var(--sv-bpop-border, rgba(0, 0, 0, 0.09));
}

#sv-bible-popover.sv-bpop--above::after {
    top: auto;
    bottom: -5px;
    border-bottom: none;
    border-top: 5px solid var(--sv-bpop-bg, #ffffff);
}

/* ── Theme: sepia ─────────────────────────────────────────────────────────── */

[data-theme="sepia"] .sv-bible-ref {
    --sv-bible-ref-color: #8b5a07;
    --sv-bible-ref-hover-color: #4d3204;
    --sv-bible-ref-hover-bg: rgba(184, 116, 10, 0.10);
}

[data-theme="sepia"] #sv-bible-popover {
    --sv-bpop-bg: #fdf3e4;
    --sv-bpop-color: #3a2e1a;
    --sv-bpop-border: rgba(139, 90, 7, 0.18);
    --sv-bpop-title-color: #7a4e06;
    --sv-bpop-divider: rgba(139, 90, 7, 0.13);
    --sv-bpop-cta-bg: #8b5a07;
    --sv-bpop-cta-hover-bg: #6b4605;
}

/* ── Theme: dark ──────────────────────────────────────────────────────────── */

[data-theme="dark"] .sv-bible-ref {
    --sv-bible-ref-color: #28a86b;
    --sv-bible-ref-hover-color: #a3d9b8;
    --sv-bible-ref-hover-bg: rgba(40, 168, 107, 0.12);
}

[data-theme="dark"] #sv-bible-popover {
    --sv-bpop-bg: #1b2820;
    --sv-bpop-color: #ddeee5;
    --sv-bpop-border: rgba(255, 255, 255, 0.09);
    --sv-bpop-title-color: #3dd68c;
    --sv-bpop-divider: rgba(255, 255, 255, 0.07);
    --sv-bpop-cta-bg: #28a86b;
    --sv-bpop-cta-hover-bg: #22905a;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.22),
        0 4px 12px rgba(0, 0, 0, 0.32),
        0 12px 32px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .sv-bpop-cta:hover {
    box-shadow: 0 2px 10px rgba(40, 168, 107, 0.32);
}

/* ── Mobile: slightly larger touch target on the ref link ─────────────────── */

@media (hover: none) {
    .sv-bible-ref {
        padding: 0.1em 0.2em;
        margin: -0.1em -0.2em;
    }
}
