/* ============================================================
   Bible Comparison Tool
   ============================================================ */

/* Remove #content padding when comparison is active */
#content:has(.comparison-wrapper) {
    padding: 0;
}

.comparison-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Panes grid --- */
.comparison-panes {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(var(--compare-pane-count, 2), 1fr);
    gap: 1px;
    background: var(--border);
}

/* --- Individual pane --- */
.comparison-pane {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    min-height: 0;
    /* Grid children default to min-width:auto — without this, wide verse
       content forces columns past 1fr and the grid overflows the viewport */
    min-width: 0;
}

.comparison-pane-header {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
}

/* --- Pane header toggle --- */
.comparison-pane-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.25rem 0;
    width: 100%;
}

.comparison-pane-toggle:hover {
    color: var(--primary);
}

.comparison-pane-toggle-label {
    /* Translation name */
}

.comparison-pane-toggle-chevron {
    font-size: 0.7rem;
    transition: transform 0.15s;
}

.comparison-pane-toggle-chevron.open {
    transform: rotate(180deg);
}

.comparison-translation-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 0.3rem;
    transition: max-height 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
}

.comparison-translation-pills.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.comp-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.comp-pill:hover {
    background: var(--hover);
}

.comp-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- Scrollable verse area --- */
.comparison-pane-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem;
}

.comparison-message {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 1rem;
    font-style: italic;
}

/* Verse controls are LIVE in comparison panes (2026-08-26, VerseCard
   refactor): tag button, commentary button + panel, cross-refs, word-tag
   dots — all dataset-driven delegated handlers, safe per-pane. Bookmark
   and note buttons are NOT rendered in panes (their click handlers still
   assume the main reader's location — enable only after that follow-on). */

/* --- Responsive --- */
@media (max-width: 768px) {
    /* Phones: STACK panes vertically (top/bottom, full width) — side-by-side
       half-width panes can never show a whole verse line. Each pane gets an
       equal share of the height and scrolls internally; scroll sync is
       ratio-based so it works unchanged. */
    .comparison-panes {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
        grid-auto-rows: minmax(0, 1fr);
    }

    .comparison-pane-scroll {
        padding: 0.4rem;
    }

    .comparison-pane-scroll .verse-container {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .comparison-pane-scroll .verse-number {
        font-size: 0.7rem;
    }

    /* Dots stack stays visible — panes are full-width on phones now,
       same space as the main reader */
}

@media (max-width: 480px) {
    .comparison-pane-scroll .verse-container {
        font-size: 0.75rem;
        line-height: 1.4;
        padding: 0.25rem;
        margin-bottom: 0.4rem;
    }

    .comparison-pane-header {
        padding: 0.25rem 0.4rem;
    }

    .comp-pill {
        font-size: 0.6rem;
        padding: 1px 5px;
    }
}
