/* The Bible reader page (resources/views/public/bible/show.blade.php),
   loaded after the compiled site CSS so these rules keep their order. */

/* Sidebar scrollbar */
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--jag-hairline); border-radius: 2px; }

/* Scripture text sizing */
.scripture-text { font-size: var(--scripture-size, 1.125rem); line-height: 1.9; }

/* Smooth transitions for dark mode */
* { transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; }

/* Chapter grid: 44px tap targets on phones */
.chapter-grid-cell {
    width: 2.75rem;
    height: 2.75rem;
    min-width: 44px;
    min-height: 44px;
}

#scripture-content .verse-block {
    scroll-margin-top: 8rem;
    scroll-margin-bottom: 1.5rem;
}

/* A verse picked to share with others as one picture or link */
#scripture-content .verse-block.verse-picked {
    background: rgba(212, 160, 23, 0.16);
    box-shadow: inset 3px 0 0 #d4a017;
}
#scripture-content.picking-verses {
    padding-bottom: 7rem;
}

/* The verse the audio Bible is reading now. Both the tint and the gold edge
   are backgrounds, so nothing moves and the action ring (a box-shadow) still
   shows on the verse. Gold and its tint follow Ivory, Paper and Night. */
#scripture-content .verse-block.verse-following {
    background: linear-gradient(90deg, var(--jag-gold) 0 3px, transparent 3px) var(--jag-gold-tint);
}
#scripture-content[dir="rtl"] .verse-block.verse-following {
    background-image: linear-gradient(270deg, var(--jag-gold) 0 3px, transparent 3px);
}
/* While the recording has verse marks, a verse number plays from that verse. */
#scripture-content.audio-follow .verse-num:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Verse action bar glassmorphism */
.verse-action-bar {
    background: color-mix(in oklab, var(--jag-surface) 96%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--jag-hairline);
    box-shadow: var(--jag-shadow-lift);
    color: var(--jag-ink);
}

@media (max-width: 767px) {
    #verse-action-bar:not(.hidden) {
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0;
        width: 100%;
        border-radius: 1rem 1rem 0 0;
        padding: 0.5rem 0.5rem max(0.5rem, env(safe-area-inset-bottom));
        display: flex;
        justify-content: center;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12), 0 -2px 8px rgba(0, 0, 0, 0.06);
    }
    #scripture-content {
        padding-bottom: 6.5rem;
    }
    #scripture-content .verse-block {
        scroll-margin-bottom: 6.5rem;
    }
}
.verse-action-bar svg {
    color: inherit;
}
.dark .verse-action-bar {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* Toast notification */
.toast-notification {
    animation: toastIn 0.35s ease-out, toastOut 0.35s ease-in forwards;
    animation-delay: 0s, 2.8s;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* Reading surfaces. Paper is the app's sepia page (PaperReader). */
html[data-reader-surface="paper"] {
    --jag-canvas: #f4ecd8;
    --jag-surface: #fbf6ea;
    --jag-raised: #ebe1c9;
    --jag-ink: #2b2418;
    --jag-ink-soft: #6b5d43;
    --jag-hairline: #e0d2b2;
    --jag-gold-ink: #6e5409;
    --jag-gold-tint: #e4d5af;
    --jag-red-letter: #9b1c1c;
}
html[data-reader-surface="paper"] #scripture-content { color: var(--jag-ink); }
html[data-reader-surface="paper"] [data-reader-theme-button],
html[data-reader-surface="night"] [data-reader-theme-button] { display: none; }

/* Words of Jesus: 4.5:1 or better on every surface and highlight. */
:root { --jag-red-letter: #b91c1c; }
.dark { --jag-red-letter: #fca5a5; }
#scripture-content .text-red-600 { color: var(--jag-red-letter); }

/* Highlights: a rounded marker behind the verse text, never a block
   over the row. Ink keeps 4.5:1 or better on every fill. */
.verse-block { --hl-ink: var(--jag-ink); }
.hl-gold { --hl: #fef3c7; }
.hl-blue { --hl: #dbeafe; }
.hl-green { --hl: #d1fae5; }
.hl-pink { --hl: #fce7f3; }
.hl-purple { --hl: #ede9fe; }
.hl-orange { --hl: #ffedd5; }
html[data-reader-surface="paper"] .hl-gold { --hl: rgba(250, 204, 21, 0.45); }
html[data-reader-surface="paper"] .hl-blue { --hl: rgba(96, 165, 250, 0.45); }
html[data-reader-surface="paper"] .hl-green { --hl: rgba(74, 222, 128, 0.45); }
html[data-reader-surface="paper"] .hl-pink { --hl: rgba(249, 168, 212, 0.45); }
html[data-reader-surface="paper"] .hl-purple { --hl: rgba(216, 180, 254, 0.45); }
html[data-reader-surface="paper"] .hl-orange { --hl: rgba(253, 186, 116, 0.45); }
.dark .hl-gold { --hl: rgba(250, 204, 21, 0.26); }
.dark .hl-blue { --hl: rgba(96, 165, 250, 0.26); }
.dark .hl-green { --hl: rgba(74, 222, 128, 0.26); }
.dark .hl-pink { --hl: rgba(249, 168, 212, 0.26); }
.dark .hl-purple { --hl: rgba(216, 180, 254, 0.26); }
.dark .hl-orange { --hl: rgba(253, 186, 116, 0.26); }
:is(.hl-gold, .hl-blue, .hl-green, .hl-pink, .hl-purple, .hl-orange) .verse-text {
    background-color: var(--hl);
    color: var(--hl-ink);
    border-radius: 0.35em;
    padding: 0.08em 0.25em;
    margin: 0 -0.25em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* Verse numbers: small gold, on the first line, inside the column. */
#scripture-content .verse-num {
    font-size: 0.62em;
    line-height: 0;
    vertical-align: 0.55em;
    margin-right: 0.3em;
}

/* Bookmark and note markers sit in the verse gutter. */
.verse-markers {
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    line-height: 0;
}
@media (min-width: 640px) {
    .verse-markers { width: 2rem; }
}
.bookmark-indicator { color: #be123c; }
.note-indicator { color: #0369a1; }
.dark .bookmark-indicator { color: #fda4af; }
.dark .note-indicator { color: #7dd3fc; }

/* Cross-references: a labeled pill with a link mark and the count,
   shown only while cross-references are switched on. */
.xref-badge {
    display: none;
    align-items: center;
    gap: 0.2rem;
    height: 1.25rem;
    padding: 0 0.4rem;
    margin-right: 0.3rem;
    border: 1px solid var(--jag-hairline);
    border-radius: 999px;
    background: var(--jag-surface);
    color: var(--jag-ink-soft);
    font: 600 0.6875rem/1 'Inter', system-ui, sans-serif;
    vertical-align: 0.2em;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.xref-badge:not(.hidden) { display: inline-flex; }
.xref-badge::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 007.07 0l3-3a5 5 0 00-7.07-7.07l-1.5 1.5'/%3E%3Cpath d='M14 11a5 5 0 00-7.07 0l-3 3a5 5 0 007.07 7.07l1.5-1.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 007.07 0l3-3a5 5 0 00-7.07-7.07l-1.5 1.5'/%3E%3Cpath d='M14 11a5 5 0 00-7.07 0l-3 3a5 5 0 007.07 7.07l1.5-1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.xref-badge:hover,
.xref-badge:focus-visible {
    border-color: var(--jag-gold);
    color: var(--jag-gold-ink);
    outline: none;
}

/* Highlight swatches carry a hairline ring so pale yellow shows on
   Ivory and the deeper fills show on Night. */
.color-swatch { box-shadow: 0 0 0 1px var(--jag-hairline); }

/* Reader tools: inline on wide screens, a labeled More panel below. */
@media (max-width: 1279px) {
    #reader-more-tools {
        position: absolute;
        right: 0.5rem;
        top: 100%;
        margin-top: 0.5rem;
        width: min(17rem, calc(100vw - 1rem));
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem;
        border: 1px solid var(--jag-hairline);
        border-radius: 1rem;
        background: var(--jag-surface);
        box-shadow: var(--jag-shadow-lift);
        z-index: 60;
    }
    .dark #reader-more-tools { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
}

/* Note modal */
.note-modal-backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

/* Color picker button active ring */
.color-swatch.active { box-shadow: 0 0 0 2px var(--jag-gold); }

/* Commentary panel */
.commentary-panel {
    transition: max-height 0.4s ease, opacity 0.3s ease;
    overflow: hidden;
}
.commentary-panel.collapsed {
    max-height: 0;
    opacity: 0;
}
.commentary-panel.expanded {
    max-height: 5000px;
    opacity: 1;
}
.commentary-card {
    border-left: 3px solid var(--jag-gold);
}
.commentary-card .commentary-content {
    font-size: 0.935rem;
    line-height: 1.75;
}

/* Audio player bar */
.audio-player-bar {
    background: color-mix(in oklab, var(--jag-surface) 96%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 1px solid var(--jag-hairline);
    box-shadow: 0 -10px 28px -12px rgba(90, 74, 42, 0.22);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
.dark .audio-player-bar {
    box-shadow: none;
}
.audio-player-bar.audio-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}
.audio-player-bar.audio-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Audio progress bar */
.audio-progress-container {
    cursor: pointer;
    position: relative;
}
.audio-progress-track {
    height: 4px;
    border-radius: 2px;
    background: var(--jag-hairline);
    overflow: hidden;
    position: relative;
}
.audio-progress-fill {
    height: 100%;
    background: var(--jag-gold);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}
.audio-progress-container:hover .audio-progress-track {
    height: 6px;
}
.audio-progress-container:hover .audio-progress-thumb {
    opacity: 1;
    transform: scale(1);
}
.audio-progress-thumb {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--jag-gold);
    border: 2px solid var(--jag-surface);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
}

/* Speed control dropdown */
.audio-speed-menu {
    background: var(--jag-surface);
    border: 1px solid var(--jag-hairline);
    box-shadow: var(--jag-shadow-lift);
}

/* Cross-reference popup */
.xref-popup {
    background: color-mix(in oklab, var(--jag-surface) 98%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--jag-hairline);
    box-shadow: var(--jag-shadow-lift);
}
.dark .xref-popup {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* Strong's Concordance */
.strongs-word {
    border-bottom: 2px dotted color-mix(in oklab, var(--jag-gold) 75%, transparent);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.strongs-word:hover {
    background-color: var(--jag-gold-tint);
    border-bottom-color: var(--jag-gold);
}

.strongs-popup {
    background: var(--jag-surface);
    border: 1px solid var(--jag-hairline);
    box-shadow: var(--jag-shadow-lift);
}
.dark .strongs-popup {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* Ask JagAI: a chat card in the middle of the reader. */
.ask-chat-card {
    background: var(--jag-surface);
    border: 1px solid var(--jag-hairline);
    box-shadow: var(--jag-shadow-lift);
    max-height: min(85vh, 46rem);
}
.dark .ask-chat-card {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.ask-chat-mark,
.ask-chat-send {
    background: var(--jag-gold);
    color: var(--jag-on-gold);
}
.ask-chat-verse {
    background: var(--jag-gold-tint);
    border-left: 3px solid var(--jag-gold);
}
.ask-chat-bubble {
    width: fit-content;
    max-width: 88%;
    border-radius: 1.25rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.ask-chat-bubble-ai {
    background: var(--jag-raised);
    color: var(--jag-ink);
    border-bottom-left-radius: 0.375rem;
}
.ask-chat-bubble-me {
    margin-left: auto;
    background: var(--jag-gold);
    color: var(--jag-on-gold);
    border-bottom-right-radius: 0.375rem;
    white-space: pre-wrap;
}
.ask-chat-reply > * + * { margin-top: 0.625rem; }
.ask-chat-reply h1, .ask-chat-reply h2, .ask-chat-reply h3, .ask-chat-reply h4 { font-weight: 700; line-height: 1.35; }
.ask-chat-reply h1, .ask-chat-reply h2 { font-size: 1.0625rem; }
.ask-chat-reply h3, .ask-chat-reply h4 { font-size: 1rem; }
.ask-chat-reply ul { list-style: disc; padding-left: 1.25rem; }
.ask-chat-reply ol { list-style: decimal; padding-left: 1.25rem; }
.ask-chat-reply li + li { margin-top: 0.25rem; }
.ask-chat-reply blockquote { border-left: 3px solid var(--jag-gold); padding-left: 0.75rem; }
.ask-chat-reply a { color: var(--jag-gold-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ask-chat-reply a:focus-visible { outline: 2px solid var(--jag-gold); outline-offset: 2px; border-radius: 2px; }
.ask-chat-reply code { border-radius: 4px; background-color: color-mix(in oklab, currentColor 10%, transparent); padding: 0 0.25rem; }
@media (min-width: 768px) {
    #strongs-popup:not(.hidden) {
        top: 5.5rem !important;
        right: 1rem !important;
        left: auto !important;
        bottom: auto !important;
        width: 22rem;
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
        border-radius: 1rem;
    }
}
@media (max-width: 767px) {
    #strongs-popup:not(.hidden) {
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100%;
        max-width: none;
        max-height: 50vh;
        overflow-y: auto;
        border-radius: 1rem 1rem 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
}
.strongs-lang-badge-hebrew {
    background: var(--jag-raised);
    color: var(--jag-ink);
}
.strongs-lang-badge-greek {
    background: var(--jag-gold-tint);
    color: var(--jag-gold-ink);
}
