/* =========================================================================
   verse-popover.css — Modal-style verse context (Phase 2).
   ========================================================================= */

.ub-verse-link {
    color: var(--ub-accent-500);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    cursor: pointer;
    white-space: nowrap;
}

    .ub-verse-link:hover,
    .ub-verse-link:focus-visible {
        border-bottom-style: solid;
    }

    .ub-verse-link:focus-visible {
        outline: 2px solid var(--ub-accent-500);
        outline-offset: 2px;
        border-radius: 2px;
    }

/* ---------------------------------------------------------------- Overlay / Layout */

.ub-verse-popover {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: var(--ub-z-dialog);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: var(--ub-space-4);
    transform: none !important;
}

    .ub-verse-popover[hidden] {
        display: none !important;
    }

.ub-verse-popover__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.ub-verse-popover__box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--ub-paper-raised);
    border: var(--ub-rule-strong);
    border-radius: var(--ub-radius-lg);
    box-shadow: var(--ub-shadow-float);
    overflow: hidden;
}

/* ---- Header & Tabs ---------------------------------------------------- */

.ub-verse-popover__head {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: var(--ub-space-4);
    padding: var(--ub-space-5);
    background: var(--ub-paper-sunken);
    border-bottom: var(--ub-rule);
}

@media (min-width: 40rem) {
    .ub-verse-popover__head {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.ub-verse-popover__head-main {
    flex: 1;
}

.ub-verse-popover__ref {
    font-family: var(--ub-font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--ub-tracking-eyebrow);
    color: var(--ub-ink-muted);
    margin: 0 0 var(--ub-space-3);
}

.ub-verse-popover__tabs {
    display: flex;
    gap: var(--ub-space-4);
}

.ub-verse-popover__tab {
    background: transparent;
    border: 0;
    padding: 0 0 var(--ub-space-1);
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-sm);
    font-weight: 700;
    color: var(--ub-ink-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--ub-duration-fast) var(--ub-ease);
}

    .ub-verse-popover__tab:hover {
        color: var(--ub-ink);
    }

    .ub-verse-popover__tab.is-selected {
        color: var(--ub-accent-500);
        border-bottom-color: var(--ub-accent-500);
    }

.ub-verse-popover__back {
    background: transparent;
    border: 0;
    color: var(--ub-accent-500);
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-xs);
    font-weight: 700;
    cursor: pointer;
    margin-bottom: var(--ub-space-2);
}

.ub-verse-popover__close {
    width: 2rem;
    height: 2rem;
    border-radius: var(--ub-radius-pill);
    border: var(--ub-rule);
    background: var(--ub-paper);
    color: var(--ub-ink-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all var(--ub-duration-fast) var(--ub-ease);
    align-self: flex-end;
}

    .ub-verse-popover__close:hover {
        background: var(--ub-paper-sunken);
        color: var(--ub-ink);
        border-color: var(--ub-accent-500);
    }

/* ---- Body / Panels ---------------------------------------------------- */

.ub-verse-popover__panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    /* Without this, a flex child's automatic minimum height defaults to its
       content's natural size, which can win out over flex-grow/shrink and
       let this panel grow past its allotted space instead of triggering its
       own overflow-y:auto scrollbar -- pushing the footer down (and, since
       .ub-verse-popover__box clips overflow, potentially off past its
       max-height entirely). This is what actually makes "flex:1 +
       overflow-y:auto" reliably scroll instead of just being ignored. */
    min-height: 0;
    overflow-y: auto;
    background: var(--ub-paper);
}

    .ub-verse-popover__panel[hidden] {
        display: none !important;
    }

/* The native scrollbar (boxy, light-grey, theme-blind) was the loudest thing
   in the dialog against a dark reading panel — themed to match instead.
   Firefox via scrollbar-color/-width; WebKit/Blink/Chromium via the
   pseudo-elements. Applied to every scrollable region in the popover
   (reading panel, cross-ref/word-study/discussion lists) via the shared
   selector list below rather than repeating this per panel. */
.ub-verse-popover__panel,
.ub-verse-popover__discuss-list {
    scrollbar-width: thin;
    scrollbar-color: var(--ub-line-strong) transparent;
}

    .ub-verse-popover__panel::-webkit-scrollbar,
    .ub-verse-popover__discuss-list::-webkit-scrollbar {
        width: 8px;
    }

    .ub-verse-popover__panel::-webkit-scrollbar-track,
    .ub-verse-popover__discuss-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .ub-verse-popover__panel::-webkit-scrollbar-thumb,
    .ub-verse-popover__discuss-list::-webkit-scrollbar-thumb {
        background-color: var(--ub-line-strong);
        border-radius: var(--ub-radius-pill);
        border: 2px solid transparent;
        background-clip: content-box;
    }

        .ub-verse-popover__panel::-webkit-scrollbar-thumb:hover,
        .ub-verse-popover__discuss-list::-webkit-scrollbar-thumb:hover {
            background-color: var(--ub-ink-muted);
        }

.ub-verse-popover__body {
    padding: var(--ub-space-6) var(--ub-space-6) var(--ub-space-8);
    flex: 1;
}

.ub-verse-popover__text {
    font-family: var(--ub-font-body);
    font-size: var(--ub-text-lg);
    line-height: var(--ub-leading-reading);
    color: var(--ub-ink-soft);
    margin: 0;
}

    /* Text highlighted/returned by the API */
    .ub-verse-popover__text mark {
        background: var(--ub-accent-100);
        color: var(--ub-ink);
        padding: var(--ub-space-4) var(--ub-space-5);
        border-left: 4px solid var(--ub-accent-500);
        border-radius: var(--ub-radius-md);
        display: block;
        margin: var(--ub-space-5) 0;
        box-shadow: var(--ub-shadow-soft);
    }

.ub-verse-popover__status {
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-sm);
    color: var(--ub-ink-muted);
    margin: 0;
    padding: var(--ub-space-5);
}

/* ---- Shared Lists (XRef, Study) --------------------------------------- */

.ub-verse-popover__list {
    list-style: none;
    margin: 0;
    padding: var(--ub-space-5);
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-4);
}

    .ub-verse-popover__list li {
        padding: var(--ub-space-4);
        border: var(--ub-rule);
        border-radius: var(--ub-radius-sm);
        background: var(--ub-paper-raised);
        cursor: pointer;
        transition: border-color var(--ub-duration-fast) var(--ub-ease);
    }

        .ub-verse-popover__list li:hover {
            border-color: var(--ub-accent-500);
        }

/* Cross-reference specific */
.ub-verse-popover__xref-link {
    display: inline-block;
    color: var(--ub-accent-500);
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--ub-line);
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
}

/* Word Study specific */
.ub-verse-popover__study-item {
    padding: 0.4rem 0;
    border-bottom: var(--ub-rule);
}

    .ub-verse-popover__study-item:last-child {
        border-bottom: none;
    }

.ub-verse-popover__study-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.ub-verse-popover__study-word {
    font-weight: 600;
    color: var(--ub-ink);
}

.ub-verse-popover__study-orig {
    display: inline-flex;
    align-items: baseline;
    gap: 0.375rem;
}

.ub-verse-popover__study-lemma {
    font-family: var(--ub-font-body);
    font-size: 1.05em;
    color: var(--ub-ink);
}

.ub-verse-popover__study-translit {
    font-style: italic;
    color: var(--ub-ink-muted);
}

.ub-verse-popover__study-strongs {
    margin-left: auto;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--ub-ink-muted);
    border: var(--ub-rule);
    border-radius: 4px;
    padding: 0 0.3rem;
}

.ub-verse-popover__study-gloss {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--ub-ink-muted);
}

/* ---- Setting panel (12.5: places + timeline) --------------------------
   Reuses .ub-verse-popover__list's own <ul> padding/gap wholesale (both
   lists carry that class in the markup). Individual <li>s use the same
   flat divider-row shape as .ub-verse-popover__study-item -- deliberately
   NOT the boxed/hoverable card look .ub-verse-popover__list li defines,
   since these rows aren't clickable. Same specificity level as
   .ub-verse-popover__study-item, for the same reason: a single class,
   matching how the rest of this file already lets that pattern win. */

.ub-verse-popover__setting-label {
    margin: 0;
    padding: var(--ub-space-5) var(--ub-space-5) 0;
    font-family: var(--ub-font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--ub-tracking-eyebrow);
    color: var(--ub-ink-muted);
}

    .ub-verse-popover__setting-label[hidden] {
        display: none !important;
    }

.ub-verse-popover__setting-map {
    display: flex;
    justify-content: center;
    padding: var(--ub-space-5) var(--ub-space-5) 0;
}

    .ub-verse-popover__setting-map[hidden] {
        display: none !important;
    }

.ub-verse-popover__setting-svg {
    width: 100%;
    max-width: 26rem;
    aspect-ratio: 300 / 220;
    border: var(--ub-rule);
    border-radius: var(--ub-radius-md);
    overflow: hidden;
}

/* Sea/land distinction reuses the existing raised/sunken paper vocabulary
   rather than introducing new colors (e.g. a generic map-blue) that would
   sit outside this design system's coral+neutral palette. */
.ub-verse-popover__setting-sea {
    fill: var(--ub-paper-sunken);
}

.ub-verse-popover__setting-land {
    fill: var(--ub-paper-raised);
    stroke: var(--ub-line);
    stroke-width: 0.75;
}

.ub-verse-popover__setting-grid {
    stroke: var(--ub-line);
    stroke-width: 1;
    opacity: 0.6;
}

.ub-verse-popover__setting-marker circle {
    fill: var(--ub-accent-500);
    stroke: var(--ub-paper);
    stroke-width: 1.5;
}

.ub-verse-popover__setting-marker text {
    font-family: var(--ub-font-ui);
    font-size: 7px;
    font-weight: 600;
    fill: var(--ub-ink-soft);
}

    /* A place outside the map's bounding box (e.g. Rome, in most NT
       passages) is clamped to the nearest edge rather than dropped -- this
       marks it as approximate instead of letting it read as precisely
       plotted. */
    .ub-verse-popover__setting-marker.is-offmap circle {
        fill: var(--ub-ink-muted);
        stroke-dasharray: 2 1;
    }

    .ub-verse-popover__setting-marker.is-offmap text {
        font-style: italic;
        fill: var(--ub-ink-muted);
    }

.ub-verse-popover__setting-item {
    padding: 0.4rem 0;
    border-bottom: var(--ub-rule);
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

    .ub-verse-popover__setting-item:last-child {
        border-bottom: none;
    }

.ub-verse-popover__setting-name {
    font-weight: 600;
    color: var(--ub-ink);
}

/* Confidence band (places) and display date (events) are the same small
   muted badge -- same treatment .ub-verse-popover__study-strongs already
   uses for its Strong's-number badge, reused here rather than restyled. */
.ub-verse-popover__setting-confidence,
.ub-verse-popover__setting-date {
    margin-left: auto;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--ub-ink-muted);
    border: var(--ub-rule);
    border-radius: 4px;
    padding: 0 0.3rem;
    white-space: nowrap;
}

.ub-verse-popover__setting-gloss {
    flex-basis: 100%;
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--ub-ink-muted);
}

    .ub-verse-popover__setting-gloss p {
        margin: 0 0 0.4em;
    }

        .ub-verse-popover__setting-gloss p:last-child {
            margin-bottom: 0;
        }

/* The "traditions differ" framing on contested event dates -- italic,
   same signal .ub-verse-popover__study-translit already uses for
   supplementary/uncertain annotation text. */
.ub-verse-popover__setting-note {
    flex-basis: 100%;
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    font-style: italic;
    line-height: 1.45;
    color: var(--ub-ink-muted);
}

/* ---- Footer Actions --------------------------------------------------- */

.ub-verse-popover__foot {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: var(--ub-space-4);
    padding: var(--ub-space-5) var(--ub-space-6);
    border-top: var(--ub-rule);
    background: var(--ub-paper-sunken);
}

@media (min-width: 40rem) {
    .ub-verse-popover__foot {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.ub-verse-popover__context {
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-xs);
    font-weight: 700;
    color: var(--ub-ink-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color var(--ub-duration-fast) var(--ub-ease);
}

    .ub-verse-popover__context:hover {
        color: var(--ub-ink);
    }

.ub-verse-popover__actions {
    display: flex;
    align-items: center;
    gap: var(--ub-space-4);
    width: 100%;
}

@media (min-width: 40rem) {
    .ub-verse-popover__actions {
        width: auto;
    }
}

.ub-verse-popover__translation {
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-xs);
    font-weight: 700;
    color: var(--ub-ink-muted);
}

.ub-verse-popover__add {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--ub-space-2) var(--ub-space-4);
    border: var(--ub-rule);
    border-radius: var(--ub-radius-sm);
    background: var(--ub-paper-raised);
    color: var(--ub-ink);
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-xs);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--ub-shadow-soft);
    transition: background var(--ub-duration-fast) var(--ub-ease);
}

    .ub-verse-popover__add:hover {
        background: var(--ub-paper-sunken);
    }

/* Had no rule at all before -- was inheriting the popover's default (serif, scripture-
   text) styling instead of the UI chrome, which is why it read as body copy rather than
   an interface message. Matches .ub-verse-popover__add's own font on purpose: it's the
   status line for that exact button. */
.ub-verse-popover__add-status {
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-xs);
    font-weight: 600;
    color: var(--ub-ink-muted);
}

    /* AddCardOutcome.LimitReached only (see verse-popover.js's setAddStatus) -- every
       other status (Added / Already in your deck / sign-in / retry) stays neutral. */
    .ub-verse-popover__add-status--limit {
        color: var(--ub-danger-700);
    }
.ub-verse-popover__share {
     flex: 1;
     display: inline-flex;
     align-items: center;
     justify-content: center;
     gap: 0.375rem;
     padding: var(--ub-space-2) var(--ub-space-4);
     border: 1px solid transparent;
     border-radius: var(--ub-radius-sm);
     background: var(--ub-accent-100);
     color: var(--ub-accent-700);
     font-family: var(--ub-font-ui);
     font-size: var(--ub-text-xs);
     font-weight: 700;
     cursor: pointer;
     transition: background var(--ub-duration-fast) var(--ub-ease),  color var(--ub-duration-fast) var(--ub-ease);
    
}


 .ub-verse-popover__share svg {
     flex-shrink: 0;
    
}


 /* Fills solid on hover -- the light tint "lights up" rather than just darkening a
       shade, which reads as more inviting for an action whose whole point is to be
       tapped, not just tolerated. */
 .ub-verse-popover__share:hover {
     background: var(--ub-accent-500);
     color: var(--ub-accent-contrast);
    
}


 /* Set by shareCurrentVerse() in verse-popover.js while the card image is being
       fetched -- same disabled treatment .ub-verse-popover__discuss-action already uses,
       but keeps the coral identity instead of going fully neutral/gray. */
 .ub-verse-popover__share:disabled {
     opacity: 0.6;
     cursor: default;
     background: var(--ub-accent-100);
     color: var(--ub-accent-700);
    
}

/* ---- Discussion Panel -------------------------------------- */
.ub-verse-popover__discuss-list {
    margin: 0 0 0.5rem;
    padding: var(--ub-space-5);
    list-style: none;
    max-height: 13rem;
    overflow-y: auto;
}

.ub-verse-popover__discuss-signin {
    padding: var(--ub-space-5);
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-sm);
    color: var(--ub-ink-muted);
    text-align: center;
}

    .ub-verse-popover__discuss-signin a {
        color: var(--ub-accent-500);
        text-decoration: underline;
        font-weight: 600;
    }

.ub-verse-popover__discuss-item {
    padding: 0.4rem 0;
    border-bottom: var(--ub-rule);
}

    .ub-verse-popover__discuss-item:last-child {
        border-bottom: none;
    }

.ub-verse-popover__discuss-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.ub-verse-popover__discuss-author {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--ub-ink);
}

.ub-verse-popover__discuss-time {
    font-size: 0.75rem;
    color: var(--ub-ink-muted);
}

.ub-verse-popover__discuss-body {
    font-size: 0.875rem;
    color: var(--ub-ink);
}

    .ub-verse-popover__discuss-body p {
        margin: 0.25rem 0;
    }

        .ub-verse-popover__discuss-body p:first-child {
            margin-top: 0.15rem;
        }

    .ub-verse-popover__discuss-body a {
        color: var(--ub-accent-500);
    }

.ub-verse-popover__discuss-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.15rem;
}

.ub-verse-popover__discuss-action {
    font: inherit;
    font-size: 0.75rem;
    color: var(--ub-ink-muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

    .ub-verse-popover__discuss-action:hover {
        color: var(--ub-ink);
        text-decoration: underline;
    }

    .ub-verse-popover__discuss-action:disabled {
        opacity: 0.6;
        cursor: default;
        text-decoration: none;
    }

.ub-verse-popover__composer {
    padding: var(--ub-space-5);
    border-top: var(--ub-rule);
    background: var(--ub-paper-sunken);
}

.ub-verse-popover__composer-input {
    width: 100%;
    padding: var(--ub-space-3);
    border: var(--ub-rule);
    border-radius: var(--ub-radius-sm);
    background: var(--ub-paper);
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-sm);
    color: var(--ub-ink);
    resize: vertical;
    margin-bottom: var(--ub-space-3);
}

    .ub-verse-popover__composer-input:focus {
        outline: none;
        border-color: var(--ub-accent-500);
        box-shadow: var(--ub-focus-ring);
    }

.ub-verse-popover__composer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ub-verse-popover__composer-status {
    font-size: 0.75rem;
    color: var(--ub-ink-muted);
}

.ub-verse-popover__composer-post {
    background: var(--ub-accent-500);
    color: var(--ub-accent-contrast);
    border: none;
    padding: var(--ub-space-2) var(--ub-space-5);
    border-radius: var(--ub-radius-sm);
    font-family: var(--ub-font-ui);
    font-size: var(--ub-text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background var(--ub-duration-fast) var(--ub-ease);
}

    .ub-verse-popover__composer-post:hover {
        background: var(--ub-accent-700);
    }
