/* ==========================================================================
   WORD OF WISDOM — DEFERRED STYLESHEET (lazy-style.css)
   ==========================================================================

   Non-critical styles loaded after the initial paint to avoid blocking
   the critical rendering path. All content here is purely decorative:
   scrollbars, hover states, transitions, animations, and glassmorphism.

   Companion to style.css. Always load via the preload/onload pattern,
   never as a standard blocking <link rel="stylesheet">.

   Contents:
     §2.2  Panel Scrollbars
     §3.4  Custom Select Dropdown (moved from style.css — elements built by lazy-script.js)
           §3.4.1  Container & Hidden Native Select
           §3.4.2  Trigger Button & Arrow (base + hover)
           §3.4.3  Dropdown Panel
           §3.4.4  Options List
           §3.4.5  Scrollbar Styling
           §3.4.6  States & Animations
     §4.0  Keyframe Definitions
     §4.1  Glassmorphism Utility Class
     §4.2  Verse Interactions
     §4.3  Button Animations
     §6.0  Deferred Transitions, Hover States & Glassmorphism

   ========================================================================== */


/* ==========================================================================
   ADDITIONAL FONT FACES (deferred — not the default font)
   ========================================================================== */

/* +++ LIBRE BASKERVILLE +++ */
@font-face {
  font-family: "LibreBaskerville";
  font-style: normal;
  font-display: swap;
  src:
    local("Libre Baskerville"),
    url("fonts/Libre_Baskerville/LibreBaskerville-VariableFont_wght.woff2") format("woff2"),
    url("fonts/Libre_Baskerville/LibreBaskerville-VariableFont_wght.ttf") format("truetype");
}
@font-face {
  font-family: "LibreBaskerville";
  font-style: italic;
  font-display: swap;
  src:
    local("Libre Baskerville"),
    url("fonts/Libre_Baskerville/LibreBaskerville-Italic-VariableFont_wght.woff2") format("woff2"),
    url("fonts/Libre_Baskerville/LibreBaskerville-Italic-VariableFont_wght.ttf") format("truetype");
}

/* +++ CORMORANT GARAMOND +++ */
@font-face {
  font-family: "CormorantGaramond";
  font-style: normal;
  font-display: swap;
  src:
    local("Cormorant Garamond"),
    url("fonts/Cormorant_Garamond/CormorantGaramond-VariableFont_wght.woff2") format("woff2"),
    url("fonts/Cormorant_Garamond/CormorantGaramond-VariableFont_wght.ttf") format("truetype");
}
@font-face {
  font-family: "CormorantGaramond";
  font-style: italic;
  font-display: swap;
  src:
    local("Cormorant Garamond"),
    url("fonts/Cormorant_Garamond/CormorantGaramond-Italic-VariableFont_wght.woff2") format("woff2"),
    url("fonts/Cormorant_Garamond/CormorantGaramond-Italic-VariableFont_wght.ttf") format("truetype");
}

/* +++ EB GARAMOND +++ */
@font-face {
  font-family: "EBGaramond";
  font-style: normal;
  font-display: swap;
  src:
    local("EB Garamond"),
    url("fonts/EB_Garamond/EBGaramond-VariableFont_wght.woff2") format("woff2"),
    url("fonts/EB_Garamond/EBGaramond-VariableFont_wght.ttf") format("truetype");
}
@font-face {
  font-family: "EBGaramond";
  font-style: italic;
  font-display: swap;
  src:
    local("EB Garamond"),
    url("fonts/EB_Garamond/EBGaramond-Italic-VariableFont_wght.woff2") format("woff2"),
    url("fonts/EB_Garamond/EBGaramond-Italic-VariableFont_wght.ttf") format("truetype");
}


/* ==========================================================================
   §2.2 PANEL SCROLLBARS
   ==========================================================================

   Firefox scrollbar overrides and WebKit scrollbar styling for all panels.
   Purely decorative — removing has zero layout impact.

   ========================================================================== */

/* --- Firefox overrides --- */

.settings-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) var(--color-bg-light);
}

.bibletext-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) var(--color-bg-medium);
}

.commentary-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) var(--color-bg-dark);
}


/* --- Settings Panel Scrollbar (WebKit) --- */

.settings-panel::-webkit-scrollbar {
    width: 8px;
}

.settings-panel::-webkit-scrollbar-track {
    background: var(--color-bg-light);
    border-radius: 4px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
    border: 2px solid var(--color-bg-light);
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}


/* --- Bible Text Panel Scrollbar (WebKit) --- */

.bibletext-panel::-webkit-scrollbar {
    width: 8px;
}

.bibletext-panel::-webkit-scrollbar-track {
    background: var(--color-bg-medium);
    border-radius: 4px;
}

.bibletext-panel::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
    border: 2px solid var(--color-bg-medium);
}

.bibletext-panel::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}


/* --- Commentary Panel Scrollbar (WebKit) --- */

.commentary-panel::-webkit-scrollbar {
    width: 8px;
}

.commentary-panel::-webkit-scrollbar-track {
    background: var(--color-bg-dark);
    border-radius: 4px;
}

.commentary-panel::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
    border: 2px solid var(--color-bg-dark);
}

.commentary-panel::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}


/* ==========================================================================
   §3.4 CUSTOM SELECT DROPDOWN
   ==========================================================================

   Moved from style.css: these styles apply exclusively to .custom-select*
   elements, which are built by lazy-script.js (deferred) and therefore
   do not exist at FCP time.

   ========================================================================== */

/* ----------------------------------------------------------------------
   §3.4.1 Container & Hidden Native Select
   ---------------------------------------------------------------------- */

.custom-select {
    position: relative;
    width: 100%;
    margin: 0 0 var(--spacing-xs) 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-small);
}

/* Hide the native select but keep it accessible for screen readers */
.custom-select select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}


/* ----------------------------------------------------------------------
   §3.4.2 Trigger Button & Arrow
   ---------------------------------------------------------------------- */

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--color-bg-medium);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    cursor: pointer;
}

.custom-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-primary);
}

.custom-select-value.placeholder {
    color: var(--color-text-secondary);
}

/* Arrow Icon */
.custom-select-arrow {
    width: 12px;
    height: 12px;
    margin-left: var(--spacing-sm);
    flex-shrink: 0;
}

.custom-select-arrow svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--color-text-primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Arrow rotates when dropdown is open */
.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

/* Trigger hover */
.custom-select-trigger:hover {
    background-image: var(--grad-neutral-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-m);
}


/* ----------------------------------------------------------------------
   §3.4.3 Dropdown Panel
   ---------------------------------------------------------------------- */

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;

    background: color-mix(in srgb, var(--color-bg-light), transparent 33.3%);

    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);

    overflow: hidden;
}

/* Show dropdown when open */
.custom-select.open .custom-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


/* ----------------------------------------------------------------------
   §3.4.4 Options List
   ---------------------------------------------------------------------- */

.custom-select-options {
    max-height: 21rem;
    overflow-y: auto;
    padding: var(--spacing-xs) 0;
}

.custom-select-option {
    padding: var(--spacing-sm) var(--spacing-sm);
    cursor: pointer;
    color: var(--color-text-primary);
}

.custom-select-option.selected {
    background: var(--color-accent-light);
    background-image: var(--grad-neutral-active);
    color: var(--color-text-primary);
    font-weight: 500;
}

/* Disabled option styling */
.custom-select-option.disabled {
    color: var(--color-text-secondary);
    cursor: not-allowed;
    font-style: italic;
}


/* ==========================================================================
   §3.4.5 SCROLLBAR STYLING (Custom Select)
   ========================================================================== */

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: var(--color-bg-dark);
    border-radius: 4px;
    margin: var(--spacing-xs) 0;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
    border: 2px solid var(--color-bg-dark);
    transition: background 0.2s ease;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* Firefox scrollbar */
.custom-select-options {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) var(--color-bg-dark);
}


/* ==========================================================================
   §3.4.6 STATES & ANIMATIONS
   ========================================================================== */

/* Focus state (keyboard navigation) */
.custom-select.focused .custom-select-trigger {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-s);
}

/* Open state trigger styling */
.custom-select.open .custom-select-trigger {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-m);
    transform: translateY(0);
}

/* Selection shimmer animation */
@keyframes option-select-shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.custom-select-option.just-selected {
    background: linear-gradient(
        90deg,
        var(--color-accent-light) 0%,
        var(--glass-highlight-strong) 50%,
        var(--color-accent-light) 100%
    );
    background-size: 200% 100%;
    animation: option-select-shimmer 0.5s ease-out;
}


/* ==========================================================================
   §4.0 KEYFRAME DEFINITIONS
   ========================================================================== */

@keyframes shimmer-swipe {
    0% {
        left: -100%;
        opacity: 0;
    }
    10% {
        opacity: var(--shimmer-opacity-peak);
    }
    100% {
        left: 200%;
        opacity: 0;
    }
}


/* ==========================================================================
   §4.1 GLASSMORPHISM UTILITY CLASS
   ========================================================================== */

.glass {
    background-image: var(--grad-neutral-normal);
    box-shadow: var(--shadow-s);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass:hover {
    background-image: var(--grad-neutral-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-m);
}

.glass:active,
.glass.active {
    box-shadow: var(--shadow-in);
    transform: translateY(0);
}


/* ==========================================================================
   §4.2 VERSE INTERACTIONS
   ========================================================================== */

.verse,
.verse strong {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.verse:hover {
    background-color: var(--color-accent-light);
    background-image: var(--grad-accent-hover);
    box-shadow: var(--shadow-l);
    transform: translateY(-1px);
}

.verse:hover strong {
    color: var(--color-accent);
}

.verse.selected {
    background-color: var(--color-accent-light);
    background-image: var(--grad-accent-selected);
    box-shadow: var(--shadow-m);
}

/* Shimmer effect on verse selection */
.verse.selected::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--grad-shimmer);
    animation: shimmer-swipe 1s ease-out forwards;
}


/* ==========================================================================
   §4.3 BUTTON ANIMATIONS
   ========================================================================== */

.btn.active::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--grad-shimmer);
    animation: shimmer-swipe 1s ease-out forwards;
}


/* ==========================================================================
   §6.0 DEFERRED TRANSITIONS, HOVER STATES & GLASSMORPHISM
   ==========================================================================

   Rules moved here from style.css to reduce blocking CSS size.
   None of these affect initial layout or first-paint appearance —
   they only activate on user interaction (hover, click, font-size change).

   ========================================================================== */


/* --- Transitions (font size, panel collapse, interactive controls) --- */

h1, h2 {
    transition: font-size 0.3s ease;
}

select {
    transition: background 0.3s ease, border-color 0.3s ease;
}

.settings-panel {
    transition: width 0.3s ease, border-right-width 0.3s ease;
}

.settings-toggle-handle {
    transition: left 0.3s ease, width 0.2s ease, background-color 0.2s;
}

.settings-collapse-btn {
    transition: color 0.2s, opacity 0.15s ease;
}

.panel-resizer {
    transition: background-color 0.2s;
}

.nav-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.commentary-text {
    transition: font-size 0.3s ease;
}

.custom-select-trigger {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.custom-select-arrow {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.custom-select-dropdown {
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
    box-shadow: var(--shadow-l);
    transition:
        opacity 0.2s ease,
        transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1),
        visibility 0.2s;
}

.custom-select-option {
    transition: all 0.15s ease;
}


/* --- Glassmorphism sheen on dropdown trigger --- */

.custom-select-trigger {
    background-image: var(--grad-neutral-normal);
    box-shadow: var(--shadow-s);
}


/* --- Hover & active states --- */

.settings-toggle-handle:hover {
    width: 1.5rem;
    background-color: var(--color-bg-medium);
}

.settings-toggle-handle:hover .settings-collapse-btn {
    opacity: 1;
}

.settings-collapse-btn:hover {
    color: var(--color-accent);
}

.panel-resizer:hover,
.panel-resizer.dragging {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

.custom-select-option:hover {
    background: var(--color-bg-dark);
}

.custom-select-option.selected:hover {
    background: var(--color-accent-light);
    background-image: var(--grad-neutral-selected);
}

.custom-select-option.disabled:hover {
    background: transparent;
}


/* ==========================================================================
   END OF DEFERRED STYLESHEET
   ========================================================================== */
