/* =========================================
   1. VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
    /* Colors */
    --background-color: #f4f3eb;
    --text-color: #333333;
    --psalm-color: #5b5a50;
    --border-color: #d1d1c6;
    --accent-gold: #D4AF37;
    --accent-red: #8B0000;
    --selah-color: #e1e6d5; 
    /* Taxonomy Colors */
    --color-lament: #6c8953;
    --color-praise: #d44443;
    --color-historical: #e9e9e9;
    --color-accents: #94c8bb;
    --color-thanksgiving: #f15431;
    --color-penitential: #feb74d;
    --color-imprecatory: #59bfd6;
    --color-acrostic: #fff;
    --color-messianic: #fffce3;

    /* Author Identity Colors */
    --author-david: #84a368;
    --author-asaph: #20b1aa;
    --author-korah: #efb764;
    --author-hezekiah: #ee5f61;
    --author-solomon: #77608a;
    --author-moses: #f59733;
    --author-heman: #595355;
    --author-ethan: #749c93;
    --author-anonymous: #9e9e9e;

    /* Typography */
    --serif-font: 'Georgia', 'Times New Roman', serif;
    --sans-serif-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

    /* Spacing (Converted to rem: 16px = 1rem) */
    --sidebar-width: 17.5rem;
    /* 280px */
    --commentary-width: 20rem;
    /* 320px */

    /* NEW: Enables native height: auto animations */
    interpolate-size: allow-keywords;
}

::selection {
    background-color: var(--psalm-color);
    color: var(--background-color);
}

/* =========================================
   2. GLOBAL RESET & BASE STYLES
   ========================================= */
* {
    box-sizing: border-box;
}

html {
    background-color: var(--background-color);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");
    font-family: var(--sans-serif-font);
    color: var(--text-color);
    font-size: 16px;
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

/* --- TYPOGRAPHY UPGRADES (text-wrap) --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    text-wrap: balance;
}

p,
.verse,
.commentary-content,
li {
    text-wrap: pretty;
}

/* =========================================
   2B. CUSTOM SCROLLBARS (Hover-Only PC)
   ========================================= */
/* Target all scrollable elements */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: transparent;
}

::-webkit-scrollbar-track {
    background-color: transparent;
}

/* Make the thumb invisible by default */
::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

/* Only show the thumb when hovering over the scrollable area */
*:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
}

*:hover::-webkit-scrollbar-thumb:hover {
    background-color: rgba(212, 175, 55, 0.6);
    /* Accent Gold on direct hover */
}

/* =========================================
   3. LAYOUT ENGINE (The Grid)
   ========================================= */
.wrapper {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--commentary-width);
    gap: 2rem;
    max-width: 100rem;
    /* 1600px */
    margin: 0 auto;
    padding: 2rem;
    height: 100vh;
}

/* Hide mobile close buttons & group the commentary header on desktop */
.mobile-close-btn {
    display: none;
}

.commentary-header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* --- Desktop Scroll Lock Fix --- */
nav#left-bar,
main#main-content,
aside#right-bar {
    min-height: 0;
}

/* =========================================
   4. NAVIGATION SIDEBAR (Left)
   ========================================= */
nav#left-bar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding-right: 1.5rem;
}

.selector {
    margin-bottom: 2rem;
}

.selector img {
    max-width: 11rem;
    /* 160px */
    opacity: 0.9;
}

.filter-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #b0b0b0;
    border-radius: 4px;
    background-color: #fff;
    font-family: var(--sans-serif-font);
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
}

select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.psalms-grid {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 2rem;
    padding-right: 1rem;
    scrollbar-width: thin;
    scrollbar-color: #908F80 transparent;
}

.book-section {
    margin-bottom: 2rem;
}

.book-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    /* border-bottom: 1px solid var(--border-color); */
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

/* =========================================
   5. GRID BUTTONS (Base Styles)
   ========================================= */
.grid-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-family: var(--sans-serif-font);
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-gold);
    z-index: 10;
}

.badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 1.2rem;
    /* 19px */
    height: 1.2rem;
    font-size: 0.75rem;
    /* 12px */
    font-weight: 700;
    border-radius: 50%;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 11;
    border: 2px solid var(--background-color);
    color: white;
    background-color: #333;
}

/* =========================================
   6. DYNAMIC COLORING ENGINE & HEATMAP
   ========================================= */
/* Author Badge Colors */
.grid-item[data-author="david"] .badge {
    background-color: var(--author-david);
}

.grid-item[data-author="asaph"] .badge {
    background-color: var(--author-asaph);
}

.grid-item[data-author="korah"] .badge {
    background-color: var(--author-korah);
}

.grid-item[data-author="solomon"] .badge {
    background-color: var(--author-solomon);
    color: #f1f1f1;
}

.grid-item[data-author="moses"] .badge {
    background-color: var(--author-moses);
    color: var(--text-color);
}

.grid-item[data-author="heman"] .badge {
    background-color: var(--author-heman);
}

.grid-item[data-author="ethan"] .badge {
    background-color: var(--author-ethan);
}

.grid-item[data-author="anonymous"] .badge {
    background-color: var(--author-anonymous);
    color: #fff;
}

.grid-item[data-author="hezekiah"] .badge {
    background-color: var(--author-hezekiah);
    color: #fff;
}

/* Active & Hover States (Theme Coloring) */
.grid-item.active {
    background-color: #333;
    border-color: #333;
    color: white;
}

.grid-item.active[data-theme*="lament"],
.grid-item:hover[data-theme*="lament"],
body[data-filter-theme="lament"] .grid-item[data-theme-match] {
    background-color: var(--color-lament) !important;
    border-color: var(--color-lament) !important;
    color: white !important;
}

.grid-item.active[data-theme*="praise"],
.grid-item:hover[data-theme*="praise"],
body[data-filter-theme="praise"] .grid-item[data-theme-match] {
    background-color: var(--color-praise) !important;
    border-color: var(--color-praise) !important;
    color: white !important;
}

.grid-item.active[data-theme*="historical"],
.grid-item:hover[data-theme*="historical"],
body[data-filter-theme="historical"] .grid-item[data-theme-match] {
    background-color: var(--color-historical) !important;
    border-color: #d0d0d0 !important;
    color: var(--text-color) !important;
}

.grid-item.active[data-theme*="accents"],
.grid-item:hover[data-theme*="accents"],
body[data-filter-theme="accents"] .grid-item[data-theme-match] {
    background-color: var(--color-accents) !important;
    border-color: var(--color-accents) !important;
    color: white !important;
}

.grid-item.active[data-theme*="thanksgiving"],
.grid-item:hover[data-theme*="thanksgiving"],
body[data-filter-theme="thanksgiving"] .grid-item[data-theme-match] {
    background-color: var(--color-thanksgiving) !important;
    border-color: var(--color-thanksgiving) !important;
    color: var(--text-color) !important;
}

.grid-item.active[data-theme*="penitential"],
.grid-item:hover[data-theme*="penitential"],
body[data-filter-theme="penitential"] .grid-item[data-theme-match] {
    background-color: var(--color-penitential) !important;
    border-color: var(--color-penitential) !important;
    color: var(--text-color) !important;
}

.grid-item.active[data-theme*="imprecatory"],
.grid-item:hover[data-theme*="imprecatory"],
body[data-filter-theme="imprecatory"] .grid-item[data-theme-match] {
    background-color: var(--color-imprecatory) !important;
    border-color: var(--color-imprecatory) !important;
    color: white !important;
}

.grid-item.active[data-theme*="acrostic"],
.grid-item:hover[data-theme*="acrostic"],
body[data-filter-theme="acrostic"] .grid-item[data-theme-match] {
    background-color: var(--color-acrostic) !important;
    border-color: #3a3a3a !important;
    border-style: dashed !important;
    color: var(--text-color) !important;
}

.grid-item.active[data-theme*="messianic"],
.grid-item:hover[data-theme*="messianic"],
body[data-filter-theme="messianic"] .grid-item[data-theme-match] {
    background-color: var(--color-messianic) !important;
    border-color: #d4d1b0 !important;
    color: var(--text-color) !important;
}

/* Filtering Dim States */
body:not([data-filter-author=""]) .grid-item:not([data-author-match]) {
    opacity: 0.15;
    pointer-events: none;
    filter: grayscale(100%);
}

body:not([data-filter-theme=""]) .grid-item:not([data-theme-match]) {
    opacity: 0.15;
    pointer-events: none;
    filter: grayscale(100%);
}

body:not([data-filter-author=""]) .grid-item[data-author-match] .badge,
.grid-item:hover .badge,
.grid-item.active .badge {
    opacity: 1;
    transform: scale(1);
}


/* =========================================
   7. MAIN CONTENT (Scripture Reading)
   ========================================= */
main#main-content {
    height: 100%;
    overflow-y: auto;
    padding: 2rem 4rem 6rem 0rem;
    padding-bottom: 2rem;
    padding-right: 1rem;
    scrollbar-width: thin;
    scrollbar-color: #dddbd3 transparent;
    /* padding-bottom: 20rem; */
}

.psalm-header {
    margin-bottom: 4rem;
    text-align: left;
}

.psalm-header h2 {
    font-family: var(--serif-font);
    font-size: 4.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
    color: var(--text-color);
    letter-spacing: -2px;
}

.psalm-header h3 {
    font-family: var(--serif-font);
    font-size: 2rem;
    font-weight: 400;
    font-style: italic;
    color: var(--psalm-color);
    margin-top: 1rem;
    margin-bottom: 1rem;
    text-transform: capitalize !important;
}

.psalm-header h4.psalm-subtitle {
    font-family: var(--serif-font);
    font-size: 1.2rem;
    font-weight: 400;
    font-style: normal !important;
    color: var(--psalm-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    text-transform: capitalize !important;
    letter-spacing: 0;
}

.psalm-header h4 {
    font-family: var(--sans-serif-font);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #888;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



.psalm-text {
    font-family: var(--serif-font);
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--psalm-color);
    max-width: 43.75rem;
    /* 700px */
}

.stanza {
    margin-bottom: 2.5rem;
}

.verse {
    display: inline;
    margin-right: 0.25rem;
}

.v-num {
    font-family: var(--sans-serif-font);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-gold);
    vertical-align: super;
    margin-right: 0.2rem;
    opacity: 0.8;
}

.acrostic-header {
    background-color: var(--psalm-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px 4px 0 0;
    /* margin-bottom: 1.5rem; */
    display: flex;
    justify-content: space-between;
    font-family: var(--sans-serif-font);
    font-weight: 600;
    font-size: 1.2rem;
}

/* =========================================
   8. RIGHT SIDEBAR (Commentary)
   ========================================= */
aside#right-bar {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-left: 0.5rem;
}

aside header.commentary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    /* border-bottom: 1px solid var(--border-color); */
}

aside header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
    margin-left: -8.5rem;
}

input[type=range] {
    -webkit-appearance: none;
    width: 3rem;
    /* 80px */
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin: 0;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0.875rem;
    /* 14px */
    height: 0.875rem;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--text-color);
}

input[type=range]::-moz-range-thumb {
    width: 0.875rem;
    height: 0.875rem;
    border: none;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0, 0, 0, 0.2);
}

.commentary-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.commentary-card {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 1rem;
    background: #fff;
    transition: all 0.2s;
}

.commentary-card summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.commentary-card[open] {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.commentary-card[open] summary {
    border-color: var(--psalm-color);
    background-color: var(--psalm-color);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.commentary-content {
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
}

/* =========================================
   9. CUSTOM SELECTS & BADGES (The Legend)
   ========================================= */
/* Ensure Icons inside the colorful trigger are crisp */
.custom-select-trigger[data-selected-value] i {
    opacity: 1;
    color: inherit;
}

/* Trigger Backgrounds mapping */
.custom-select-trigger[data-selected-value="david"] {
    background-color: var(--author-david);
    color: #fff;
    border-color: var(--author-david);
}

.custom-select-trigger[data-selected-value="asaph"] {
    background-color: var(--author-asaph);
    color: #fff;
    border-color: var(--author-asaph);
}

.custom-select-trigger[data-selected-value="korah"] {
    background-color: var(--author-korah);
    color: #fff;
    border-color: var(--author-korah);
}

.custom-select-trigger[data-selected-value="solomon"] {
    background-color: var(--author-solomon);
    color: #f1f1f1;
    border-color: var(--author-solomon);
}

.custom-select-trigger[data-selected-value="moses"] {
    background-color: var(--author-moses);
    color: #fff;
    border-color: var(--author-moses);
}

.custom-select-trigger[data-selected-value="heman"] {
    background-color: var(--author-heman);
    color: #fff;
    border-color: var(--author-heman);
}

.custom-select-trigger[data-selected-value="ethan"] {
    background-color: var(--author-ethan);
    color: #fff;
    border-color: var(--author-ethan);
}

.custom-select-trigger[data-selected-value="anonymous"] {
    background-color: var(--author-anonymous);
    color: #fff;
    border-color: var(--author-anonymous);
}

.custom-select-trigger[data-selected-value="hezekiah"] {
    background-color: var(--author-hezekiah);
    color: #fff;
    border-color: var(--author-hezekiah);
}

.custom-select-trigger[data-selected-value="lament"] {
    background-color: var(--color-lament);
    border-color: var(--color-lament);
    color: #fff;
}

.custom-select-trigger[data-selected-value="praise"] {
    background-color: var(--color-praise);
    border-color: var(--color-praise);
    color: #fff;
}

.custom-select-trigger[data-selected-value="historical"] {
    background-color: var(--color-historical);
    border-color: #d0d0d0;
    color: var(--text-color);
}

.custom-select-trigger[data-selected-value="accents"] {
    background-color: var(--color-accents);
    border-color: var(--color-accents);
    color: #fff;
}

.custom-select-trigger[data-selected-value="thanksgiving"] {
    background-color: var(--color-thanksgiving);
    border-color: var(--color-thanksgiving);
    color: var(--text-color);
}

.custom-select-trigger[data-selected-value="penitential"] {
    background-color: var(--color-penitential);
    border-color: var(--color-penitential);
    color: var(--text-color);
}

.custom-select-trigger[data-selected-value="imprecatory"] {
    background-color: var(--color-imprecatory);
    border-color: var(--color-imprecatory);
    color: #fff;
}

.custom-select-trigger[data-selected-value="acrostic"] {
    background-color: var(--color-acrostic);
    border-color: #ccc;
    color: var(--text-color);
}

.custom-select-trigger[data-selected-value="messianic"] {
    background-color: var(--color-messianic);
    border-color: #d4d1b0;
    color: var(--text-color);
}

/* Custom Select Dropdown UI */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
    font-family: var(--sans-serif-font);
    font-size: 0.9rem;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #b0b0b0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-select-trigger:hover {
    border-color: var(--accent-gold);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: var(--text-color);
}

.arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #333;
    transition: transform 0.2s;
}

.custom-select-wrapper.open .arrow {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 0.1rem solid var(--text-color);
    border-top: 0;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    max-height: 18.75rem;
    overflow-y: auto;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
}

.custom-option {
    display: block;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 0.5rem solid transparent;
}

.custom-option:hover {
    background-color: #f0f0f0;
    padding-left: 1.25rem;
}

.custom-option.selected {
    background-color: #e0e0e0;
    font-weight: 600;
}

.custom-option,
.trigger-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.custom-option i,
.trigger-content i {
    font-size: 1.1rem;
    opacity: 0.7;
}

/* =========================================
   DROPDOWN OPTION STATES (The Legend)
   ========================================= */

/* --- 1. AUTHOR OPTIONS --- */
.custom-option[data-value="david"] {
    border-left-color: var(--author-david);
}

.custom-option[data-value="david"]:hover {
    background-color: var(--author-david);
    color: #fff;
}

.custom-option[data-value="asaph"] {
    border-left-color: var(--author-asaph);
}

.custom-option[data-value="asaph"]:hover {
    background-color: var(--author-asaph);
    color: #fff;
}

.custom-option[data-value="korah"] {
    border-left-color: var(--author-korah);
}

.custom-option[data-value="korah"]:hover {
    background-color: var(--author-korah);
    color: #fff;
}

.custom-option[data-value="solomon"] {
    border-left-color: var(--author-solomon);
}

.custom-option[data-value="solomon"]:hover {
    background-color: var(--author-solomon);
    color: #f1f1f1;
}

.custom-option[data-value="moses"] {
    border-left-color: var(--author-moses);
}

.custom-option[data-value="moses"]:hover {
    background-color: var(--author-moses);
    color: #fff;
}

.custom-option[data-value="heman"] {
    border-left-color: var(--author-heman);
}

.custom-option[data-value="heman"]:hover {
    background-color: var(--author-heman);
    color: #fff;
}

.custom-option[data-value="ethan"] {
    border-left-color: var(--author-ethan);
}

.custom-option[data-value="ethan"]:hover {
    background-color: var(--author-ethan);
    color: #fff;
}

.custom-option[data-value="anonymous"] {
    border-left-color: var(--author-anonymous);
}

.custom-option[data-value="anonymous"]:hover {
    background-color: var(--author-anonymous);
    color: #fff;
}

.custom-option[data-value="hezekiah"] {
    border-left-color: var(--author-hezekiah);
}

.custom-option[data-value="hezekiah"]:hover {
    background-color: var(--author-hezekiah);
    color: #fff;
}

/* --- 2. THEME OPTIONS (Taxonomy) --- */
.custom-option[data-value="lament"] {
    border-left-color: var(--color-lament);
}

.custom-option[data-value="lament"]:hover {
    background-color: var(--color-lament);
    color: #fff;
}

.custom-option[data-value="praise"] {
    border-left-color: var(--color-praise);
}

.custom-option[data-value="praise"]:hover {
    background-color: var(--color-praise);
    color: #fff;
}

.custom-option[data-value="historical"] {
    border-left-color: var(--color-historical);
}

.custom-option[data-value="historical"]:hover {
    background-color: var(--color-historical);
    color: var(--text-color);
}

.custom-option[data-value="accents"] {
    border-left-color: var(--color-accents);
}

.custom-option[data-value="accents"]:hover {
    background-color: var(--color-accents);
    color: #fff;
}

.custom-option[data-value="thanksgiving"] {
    border-left-color: var(--color-thanksgiving);
}

.custom-option[data-value="thanksgiving"]:hover {
    background-color: var(--color-thanksgiving);
    color: var(--text-color);
}

.custom-option[data-value="penitential"] {
    border-left-color: var(--color-penitential);
}

.custom-option[data-value="penitential"]:hover {
    background-color: var(--color-penitential);
    color: var(--text-color);
}

.custom-option[data-value="imprecatory"] {
    border-left-color: var(--color-imprecatory);
}

.custom-option[data-value="imprecatory"]:hover {
    background-color: var(--color-imprecatory);
    color: #fff;
}

.custom-option[data-value="acrostic"] {
    border-left-color: var(--color-acrostic);
}

.custom-option[data-value="acrostic"]:hover {
    background-color: var(--color-acrostic);
    color: var(--text-color);
}

.custom-option[data-value="messianic"] {
    border-left-color: var(--color-messianic);
}

.custom-option[data-value="messianic"]:hover {
    background-color: var(--color-messianic);
    color: var(--text-color);
}

/* Ensure Icons inherit the hover text color cleanly */
.custom-option:hover i {
    opacity: 1;
    color: inherit;
}

/* The Legend Tags */
.meta-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    font-family: var(--sans-serif-font);
    font-size: 0.75rem;
    flex-wrap: wrap
}

.meta-row .tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.65rem;
}

.tag-lament {
    background-color: var(--color-lament);
    color: white;
}

.tag-praise {
    background-color: var(--color-praise);
    color: white;
}

.tag-historical {
    background-color: var(--color-historical);
    color: var(--text-color);
}

.tag-accents {
    background-color: var(--color-accents);
    color: white;
}

.tag-thanksgiving {
    background-color: var(--color-thanksgiving);
    color: var(--text-color);
}

.tag-penitential {
    background-color: var(--color-penitential);
    color: var(--text-color);
}

.tag-imprecatory {
    background-color: var(--color-imprecatory);
    color: white;
}

.tag-acrostic {
    background-color: var(--color-acrostic);
    color: var(--text-color);
    border: 1px solid #ccc;
}

.tag-messianic {
    background-color: var(--color-messianic);
    color: var(--text-color);
    border: 1px solid #d4d1b0;
}

.tag-david {
    background-color: var(--author-david);
    color: white;
}

.tag-asaph {
    background-color: var(--author-asaph);
    color: white;
}

.tag-korah {
    background-color: var(--author-korah);
    color: white;
}

.tag-solomon {
    background-color: var(--author-solomon);
    color: #f1f1f1;
}

.tag-moses {
    background-color: var(--author-moses);
    color: white;
}

.tag-heman {
    background-color: var(--author-heman);
    color: white;
}

.tag-ethan {
    background-color: var(--author-ethan);
    color: white;
}

.tag-anonymous {
    background-color: var(--author-anonymous);
    color: white;
}

.tag-hezekiah {
    background-color: var(--author-hezekiah);
    color: white;
}

.tag-custom {
    background-color: #333;
    color: white;
}

.read-time {
    color: #999;
    font-style: italic;
    font-family: var(--serif-font);
}

/* =========================================
   10. READING MODES (The Format Engine)
   ========================================= */
.layout-poetry .verse {
    display: block;
    margin-bottom: 0.5rem;
    text-indent: -1.2rem;
    padding-left: 1.2rem;
}

.layout-poetry .stanza {
    margin-bottom: 2.5rem;
}

.layout-prose .verse {
    display: inline;
    margin-right: 0.25rem;
}

.layout-prose .stanza {
    margin-bottom: 2rem;
    text-indent: 2rem;
}

.stanza-accordion {
    /* border: 1px solid var(--border-color); */
    border-radius: 6px;
    margin-bottom: 1rem;
    background: white;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stanza-accordion[open] {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--psalm-color);
}

.acrostic-header {
    background-color: #ffffff;
    color: #666;
    padding: 1rem;
    font-family: var(--sans-serif-font);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    transition: background 0.2s;
}

.acrostic-header::-webkit-details-marker {
    display: none;
}

.stanza-accordion[open] .acrostic-header {
    background-color: var(--psalm-color);
    color: white;
}

.stanza-body {
    padding: 1.5rem;
    line-height: 1.8;
}

.stanza-body .verse {
    display: block;
    margin-bottom: 0.5rem;
}

/* =========================================
   11. MEDIA & UI COMPONENTS
   ========================================= */
dialog#video-modal {
    width: 90%;
    max-width: 56.25rem;
    /* 900px */
    border: none;
    border-radius: 12px;
    padding: 0;
    background: #000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

dialog#video-modal::backdrop {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #1a1a1a;
    color: white;
    font-family: var(--sans-serif-font);
    font-weight: 600;
    border-bottom: 1px solid #333;
}

#close-modal-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

#close-modal-btn:hover {
    color: var(--accent-red);
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#sticky-audio-player {
    position: fixed;
    bottom: -6.25rem;
    left: 0;
    width: 100%;
    height: 5.625rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

#sticky-audio-player.visible {
    bottom: 0;
}

.player-track-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 15.625rem;
    /* 250px */
}

.track-icon {
    width: 3rem;
    height: 3rem;
    background: var(--accent-gold);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.track-text {
    display: flex;
    flex-direction: column;
}

#audio-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
}

#audio-subtitle {
    font-size: 0.75rem;
    color: #888;
}

.player-controls {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

audio {
    width: 100%;
    max-width: 31.25rem;
    height: 2.5rem;
}

audio::-webkit-media-controls-panel {
    background-color: #f4f3eb;
}

#close-audio-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #888;
    margin-left: 1rem;
}

#close-audio-btn:hover {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.media-trigger-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.media-trigger-card:hover {
    background: #fff;
    border-color: var(--accent-gold);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.media-icon {
    font-size: 1.8rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
}

.video-trigger .media-icon {
    color: var(--accent-red);
}

.media-info {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.media-info strong {
    color: var(--text-color);
}

.media-info span {
    color: #888;
    font-size: 0.75rem;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.version-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: #e0e0e0;
    border-radius: 20px;
    padding: 0.3rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.version-select-wrapper:hover {
    background: #d1d1d1;
}

.version-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-family: var(--sans-serif-font);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-color);
    padding-right: 0.5rem;
    cursor: pointer;
}

.version-select-wrapper select:focus {
    outline: none;
    box-shadow: none;
}

.version-select-wrapper i {
    font-size: 0.8rem;
    color: #666;
    pointer-events: none;
}

.selah-divider {
    display: flex;
    align-items: center;
    margin: 3rem 0;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.selah-divider:hover {
    opacity: 0.8;
}

.selah-divider .line {
    flex-grow: 1;
    height: 1px;
    background-color: var(--selah-color);
}

.selah-divider .selah-text {
    padding: 0 1.5rem;
    font-family: var(--sans-serif-font);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--psalm-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Empty State */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    color: var(--psalm-color);
    animation: fadeIn 0.5s ease-in;
}

.dove-animation-box {
    /* width: 7.5rem;
    height: 7.5rem; */
    padding: 2rem;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: var(--accent-gold);
    font-size: 3rem;
}

.empty-state-container h2 {
    font-size: 3.5rem;
    margin: 0;
}

.empty-state-container h3 {
    font-family: var(--serif-font);
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    margin-top: 0;
    line-height: 2.8rem;
}

/* Custom Header Version */
.custom-version-wrapper {
    position: relative;
    user-select: none;
}

.version-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #e0e0e0;
    border-radius: 20px;
    padding: 0.4rem 1.2rem;
    cursor: pointer;
    font-family: var(--sans-serif-font);
    font-weight: 700;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.version-trigger:hover {
    background: #d1d1d1;
}

.version-options-panel {
    position: absolute;
    top: 110%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 17.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.custom-version-wrapper.open .version-options-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.v-opt {
    padding: 1rem;
    font-family: var(--sans-serif-font);
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.v-opt:last-child {
    border-bottom: none;
}

.v-opt:hover {
    background: #f9f9f9;
}

.v-opt.active {
    font-weight: 700;
    color: var(--accent-gold);
}

/* Resources Footer */
.psalm-resources {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--border-color);
    margin-bottom: 12rem;
}

.psalm-resources h4 {
    font-family: var(--sans-serif-font);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    margin-bottom: 1.5rem;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.625rem, 1fr));
    gap: 1rem;
}

.resource-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
}

.resource-card:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.resource-icon {
    font-size: 2.5rem;
    color: var(--accent-gold);
}

.resource-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.resource-text span {
    font-size: 0.7rem;
    color: #888;
    font-family: var(--sans-serif-font);
    letter-spacing: 0.05rem;
}

footer#page-footer {
    padding-top: 1rem;
    font-size: 0.8rem;
    color: #727272;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================
   12. MOBILE & TABLET LAYOUT (The Breakpoint)
   ========================================= */
/* Hide the mobile nav pill on desktop */
.mobile-nav-pill {
    display: none;
}

@media (max-width: 64rem) {

    /* 1024px */
    .wrapper {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        padding: 0;
        gap: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .wrapper::-webkit-scrollbar {
        display: none;
    }

    /* THE PEEK: Sidebars take 85% of screen, leaving the edge of Main Content visible */
    nav#left-bar {
        flex: 0 0 85vw;
        width: 85vw;
        max-width: 85vw;
        scroll-snap-align: start;
        padding: 2rem 1.5rem;
    }

    .psalm-resources {
        margin-bottom: 12rem;
    }

    aside#right-bar {
        flex: 0 0 85vw;
        width: 85vw;
        max-width: 85vw;
        scroll-snap-align: end;
        padding: 2rem 1.5rem;
        /* border-left: 1px solid var(--border-color); */
        /* Visual separation for the peek */
    }

    /* --- MOB-01: Commentary Header Stacking --- */
    aside header.commentary {
        flex-direction: row;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .profile-selector {
        width: 100%;
        display: flex;
        justify-content: center;
        padding-bottom: 0.5rem;
    }

    /* --- TAB-01: Tablet/Mobile Overflow Lock Fix --- */
    aside#right-bar {
        height: 100vh;
        /* Lock the outer container to the screen */
        overflow: hidden;
        /* Prevent double-scroll conflict */
        padding-bottom: 0;
        /* Remove bottom padding from the wrapper */
    }

    .commentary-scroll-area {
        overflow-y: auto;
        /* Add deep padding so the text clears the floating pill & iOS safe areas */
        padding-bottom: 8rem;
        /* Hardware acceleration for buttery smooth scrolling on iOS */
        -webkit-overflow-scrolling: touch;
    }

    /* Main content stays 100% */
    main#main-content {
        flex: 0 0 100vw;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        scroll-snap-align: center;
        overflow-y: auto;
        padding: 2rem 1.5rem 2rem 1.5rem;
        /* Extra bottom padding for the pill */
        display: block;
        position: relative;
    }

    .psalm-header h2 {
        font-size: 3rem;
    }

    .psalm-header h3 {
        font-size: 1.5rem;
    }

    .psalm-text {
        font-size: 1.15rem;
    }

    /* --- THE FLOATING NAV PILL --- */
    .mobile-nav-pill {
        display: flex;
        align-items: center;
        position: fixed;
        bottom: 2rem;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 30px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        z-index: 100;
        padding: 0.25rem;
    }

    .mobile-nav-pill button {
        background: transparent;
        border: none;
        font-family: var(--sans-serif-font);
        font-weight: 600;
        font-size: 0.85rem;
        color: var(--text-color);
        padding: 0.6rem 1.2rem;
        border-radius: 25px;
        display: flex;
        align-items: center;
        gap: 0.4rem;
        cursor: pointer;
        transition: background 0.2s;
    }

    .mobile-nav-pill button:active {
        background: rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-pill button i {
        font-size: 1.1rem;
        color: var(--accent-gold);
    }

    .pill-divider {
        width: 1px;
        height: 20px;
        background: var(--border-color);
        margin: 0 0.2rem;
    }

    /* --- TABLET/MOBILE GRID FIX (MOB-02) --- */
    .grid-container {
        /* Forces minimum 5 columns on small phones, scaling up gracefully on tablets */
        grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
        gap: 0.4rem;
        /* Slightly tighter gap to fit more buttons */
    }

    .grid-item {
        font-size: 0.8rem;
        /* Slightly scale down text to fit the new tighter box */
    }

    /* --- MOBILE CLOSE BUTTONS --- */
    .selector {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        background: #e0e0e0;
        border: none;
        color: var(--text-color);
        font-size: 1.2rem;
        cursor: pointer;
        transition: background 0.2s;
    }

    .mobile-close-btn:hover {
        background: #d1d1d1;
    }

    /* --- SCALED AUTHOR BADGES FOR MOBILE/TABLET --- */
    .grid-item .badge {
        width: 1.8rem;
        /* Increased from 1.2rem */
        height: 1.8rem;
        /* Increased from 1.2rem */
        font-size: 0.85rem;
        /* Increased from 0.75rem */
        bottom: -0.4rem;
        /* Adjusted offset */
        right: -0.4rem;
        /* Adjusted offset */
        border-width: 3px;
        /* Thicker border to match the larger scale */
    }

    /* --- CUSTOM SELECT MOBILE FIX (MOB-03) --- */
    .custom-options {
        /* Ensure the custom dropdown doesn't get clipped by the screen edge */
        max-height: 40vh;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    }

    .custom-option {
        /* Larger touch targets for mobile thumbs */
        padding: 1rem;
        font-size: 1rem;
    }
}

/* =========================================
   17. THE CINEMATIC SCROLL (Motion Engine)
   ========================================= */

/* The Keyframes: A subtle rise, scale, and fade */
@keyframes cinematic-reveal {
    from {
        opacity: 0;
        transform: translateY(3.5rem) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 1. Base Fallback (For older browsers: fades in on load) */
.psalm-text .stanza,
.selah-divider,
.psalm-resources, .stanza-accordion {
    animation: cinematic-reveal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* 2. The Magic: Scroll-Driven Animations (Modern Browsers) */
@supports (animation-timeline: view()) {

    .psalm-text .stanza,
    .selah-divider,
    .psalm-resources, .stanza-accordion {
        /* Switch from a timed animation to a scroll-linked animation */
        animation: cinematic-reveal linear both;
        animation-timeline: view();

        /* * entry 5%: Starts animating when the top of the stanza is 5% past the bottom of the screen.
         * cover 15%: Finishes animating completely when the element covers 15% of the viewport.
         * This prevents long stanzas from remaining transparent while you read them.
         */
        animation-range: entry 15% cover 35%;
    }
}

/* =========================================
   18. VIEW TRANSITIONS (The SPA Router)
   ========================================= */

main#main-content {
    view-transition-name: psalm-area;
}

/* 1. Disable default cross-fade ghosting */
::view-transition-old(psalm-area),
::view-transition-new(psalm-area) {
    mix-blend-mode: normal;
    height: 100%;
}

/* -----------------------------------------
   A. CHAPTER CHANGE (Vertical Slide)
   ----------------------------------------- */
:root.transition-chapter ::view-transition-old(psalm-area) {
    animation: slide-up-out 0.5s cubic-bezier(0.86, 0, 0.07, 1) both;
}

:root.transition-chapter ::view-transition-new(psalm-area) {
    animation: slide-up-in 0.5s cubic-bezier(0.86, 0, 0.07, 1) both;
}

@keyframes slide-up-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-5rem);
    }
}

@keyframes slide-up-in {
    from {
        opacity: 0;
        transform: translateY(5rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -----------------------------------------
   B. VERSION CHANGE (Horizontal Slide)
   ----------------------------------------- */
:root.transition-version ::view-transition-old(psalm-area) {
    animation: slide-left-out 0.5s cubic-bezier(0.86, 0, 0.07, 1) both;
}

:root.transition-version ::view-transition-new(psalm-area) {
    animation: slide-left-in 0.5s cubic-bezier(0.86, 0, 0.07, 1) both;
}

@keyframes slide-left-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-5rem);
    }
}

@keyframes slide-left-in {
    from {
        opacity: 0;
        transform: translateX(5rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =========================================
   19. ACCORDION PHYSICS (Native details-content)
   ========================================= */

/* The Magic Pseudo-Element wrapper */
details::details-content {
    opacity: 0;
    block-size: 0;
    overflow-y: clip;
    transition: content-visibility 0.4s allow-discrete,
        block-size 0.4s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

details[open]::details-content {
    opacity: 1;
    block-size: auto;
}


/* --- The Chevron Animations --- */

/* 1. Commentary Sidebar Chevron */
.commentary-card summary .icon-chevron i {
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: inline-block;
}

.commentary-card[open] summary .icon-chevron i {
    transform: rotate(180deg);
}

/* 2. Acrostic Stanza Chevron (Psalm 119) */
.acrostic-header i {
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.stanza-accordion[open] .acrostic-header i {
    transform: rotate(180deg);
}

/* =========================================
   20. INLINE COMMENTARY (The Tooltip/Sheet)
   ========================================= */

/* The Interactive Verse Indicator */
.verse.has-note {
    position: relative;
    cursor: pointer;
    /* Use modern text-decoration properties */
    text-decoration: underline dashed var(--accent-gold) 1px;
    text-underline-offset: 4px;
    /* Gives it the same breathing room as a border */
    transition: background 0.2s, color 0.2s;
    display: inline-block;
}

.verse.has-note:hover {
    background-color: rgba(212, 175, 55, 0.1);
    text-decoration-style: solid;
}

/* The Modal Base */
dialog#inline-note-modal {
    border: none;
    padding: 0;
    background: #fff;
    color: var(--text-color);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    font-family: var(--sans-serif-font);
}

dialog#inline-note-modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.note-content {
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* --- Responsive Modal Behavior --- */

/* Mobile: Bottom Sheet */
@media (max-width: 64rem) {
    dialog#inline-note-modal {
        width: 100%;
        max-width: 100vw;
        margin: auto auto 0 auto;
        /* Push to bottom */
        border-radius: 16px 16px 0 0;
        animation: slideUpSheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }
}

/* Desktop: Centered Floating Dialog */
@media (min-width: 64.01rem) {
    dialog#inline-note-modal {
        width: 90%;
        max-width: 500px;
        margin: auto;
        /* Center on screen */
        border-radius: 8px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
        animation: popInModal 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }
}

@keyframes slideUpSheet {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes popInModal {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =========================================
   21. THE SPOTLIGHT ENGINE (Onboarding Tour)
   ========================================= */

#spotlight-overlay {
    position: fixed;
    background: transparent;
    /* The Magic: A massive shadow that darkens the rest of the screen */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    border: 2px solid var(--accent-gold);
    /* Silky smooth movement as it jumps from element to element */
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 9999;
    pointer-events: none;
    /* Let clicks pass through the spotlight hole */
    opacity: 0;
}

#spotlight-overlay.active {
    opacity: 1;
}

.tour-tooltip {
    position: absolute;
    background: #fff;
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: 8px;
    width: 17.5rem;
    /* 280px */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    /* Allow clicking the buttons inside */
    font-family: var(--sans-serif-font);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tour-tooltip.visible {
    opacity: 1;
}

.tour-tooltip h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--accent-gold);
    font-size: 1.1rem;
}

.tour-tooltip p {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
}

.tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-btn {
    background: var(--text-color);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.tour-btn:hover {
    background: var(--accent-gold);
}

.tour-skip {
    background: transparent;
    color: #888;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: underline;
}

/* --- ACROSTIC ACCORDION & STUDY HOLDERS --- */
.stanza-accordion summary::-webkit-details-marker {
    display: none;
}

.stanza-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.hebrew-letter {
    font-size: 2rem;
    color: var(--color-historical);
    font-family: serif;
}

.letter-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.stanza-accordion[open] .accordion-icon {
    transform: rotate(180deg);
}

.stanza-content {
    padding-bottom: 2rem;
    animation: slideDown 0.3s ease-out forwards;
}

/* Study Grid Injection */
.stanza-studies-grid {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.stanza-studies-grid h5 {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: var(--sans-serif-font);
    letter-spacing: 2px;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.study-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
}

.study-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}

.study-card:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.study-card i {
    color: #D4AF37;
    /* The Brand Gold */
    font-size: 1.1rem;
}

.stanza-theme-title {
    font-weight: 400;
    opacity: 0.6;
    font-style: italic;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    margin-top: 0;
    margin-left: 0.5rem;
}

/* =========================================
   V1.1 SPRINT PATCHES
   ========================================= */

/* UI-02: Network Buffer Loading State */
body.system-loading {
    pointer-events: none;
    /* Locks all clicks/swipes */
}

body.system-loading .psalm-text,
body.system-loading #commentary-feed {
    opacity: 0.4;
    filter: blur(2px);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* MOB-06: FAQ / Modal Z-Index Collision */
dialog,
.faq-modal-wrapper,
.about-section-wrapper {
    z-index: 9999 !important;
    /* Forces modals above the mobile nav pill */
}

/* TAB-02: iPad Pro Landscape Spacing */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    aside#right-bar header.commentary {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 2rem;
    }

    .slider-wrapper {
        flex-shrink: 0;
        /* Prevents the slider from crushing the title */
    }
}

a.faq-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

a.verse-ref {
    color:#908E7F;
    text-decoration:dotted underline;
    text-underline-offset: 0.4rem;
    font-weight: 700;
}

.note-content em {
    opacity: 0.8;
    font-weight: 700;
}

.hebrew-word {
    font-family: var(--serif-font);
    font-weight: 900;
    text-decoration: overline #908E7F 1px;
    text-transform: lowercase;
    color: #908E7F;
    letter-spacing: 0.04rem;
    padding: 0 0.5rem;
}

button.media-btn {
    width: 100%;
    padding: 1rem 0.5rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-color);
    font-family: var(--sans-serif-font);
    text-align: left;
    & i {
        font-size: 2rem;
    }
}

.tag-custom[style*="--bg"] {
    background-color: var(--bg);
    color: var(--text);
    border: none;
}

.publisher-signature {
    display: none;
}