/* ParallelQuran Mushaf View - Phase 1 + Lang Toggles + Bio Cards (v2.66.10l)
 *
 * Layout: 2L + center + 2R + 1 below.
 * v2.66.10k added: per-panel EN/AR pill toggle, single-lang badge, (i) gap
 *                  tooltip, Qur'an center translator dropdown.
 * v2.66.10l adds: ayah nav moved INTO the Qur'an center panel (green-pill
 *                 style matching the Qur'an ayah pages); commentator name
 *                 hover/focus bio card with name, dates, region, school,
 *                 and approach drawn from inc/mushaf-sources.php registry.
 * Desktop (>=1100px): 3-column CSS grid.
 *   row 1: panel0 | center | panel2
 *   row 2: panel1 | center | panel3   (center spans both rows)
 *   row 3: panel4 (spans all 3 cols)
 * Tablet (700-1099px): center on top, then 2x2 panels, then panel4 full-width.
 * Mobile (<700px): single column stack.
 */

.pq-mushaf-page { padding: 16px 0 48px; }
.pq-mushaf-page .container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* Toolbar */
.pq-mushaf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 16px;
    padding: 8px 12px;
    background: #f6f7f8;
    border: 1px solid #e1e3e6;
    border-radius: 6px;
}
.pq-mushaf-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pq-mushaf-navbtn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #c8ccd1;
    border-radius: 4px;
    background: #fff;
    color: #222;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}
.pq-mushaf-navbtn:hover { background: #eef1f4; }
.pq-mushaf-navbtn-disabled { color: #999; cursor: not-allowed; background: #f3f4f5; }
.pq-mushaf-ref { font-weight: 600; color: #333; font-size: 14px; }
.pq-mushaf-info-toggle {
    background: transparent;
    border: 1px solid #c8ccd1;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    color: #2a4d8f;
    padding: 0;
}
.pq-mushaf-info-toggle:hover { background: #eef1f4; }

/* Dismissible explainer note */
.pq-mushaf-note {
    margin: 0 0 16px;
    border: 1px solid #d9e3f0;
    background: #f0f6fc;
    border-left: 4px solid #2a4d8f;
    border-radius: 4px;
}
.pq-mushaf-note[hidden] { display: none; }
.pq-mushaf-note-inner { padding: 14px 16px; }
.pq-mushaf-note-inner p { margin: 0 0 8px; line-height: 1.55; color: #1a1a1a; font-size: 14px; }
.pq-mushaf-note-inner p.pq-mushaf-note-meta { color: #555; font-size: 13px; }
.pq-mushaf-note-inner a { color: #2a4d8f; }
.pq-mushaf-note-dismiss {
    margin-top: 8px;
    padding: 6px 12px;
    border: 1px solid #2a4d8f;
    background: #fff;
    color: #2a4d8f;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.pq-mushaf-note-dismiss:hover { background: #2a4d8f; color: #fff; }

/* Grid */
.pq-mushaf-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr 1.4fr 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "p0 center p2"
        "p1 center p3"
        "p4 p4     p4";
    align-items: stretch;
}

.pq-mushaf-center {
    grid-area: center;
    background: #fffaf3;
    border: 1px solid #e6d9c0;
    border-radius: 8px;
    padding: 28px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 280px;
}
.pq-mushaf-ref-mini {
    font-size: 12px;
    color: #8a6a3a;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.pq-mushaf-arabic {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 28px;
    line-height: 1.9;
    color: #1a1a1a;
    margin: 0 0 16px;
}
.pq-mushaf-english {
    font-size: 16px;
    line-height: 1.7;
    color: #333;
    font-style: italic;
}
.pq-mushaf-missing { color: #888; font-size: 14px; }

/* Panels */
.pq-mushaf-panel {
    background: #fff;
    border: 1px solid #d9dde2;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.pq-mushaf-slot-0 { grid-area: p0; }
.pq-mushaf-slot-1 { grid-area: p1; }
.pq-mushaf-slot-2 { grid-area: p2; }
.pq-mushaf-slot-3 { grid-area: p3; }
.pq-mushaf-slot-4 { grid-area: p4; }

.pq-mushaf-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f3f5f7;
    border-bottom: 1px solid #e1e3e6;
    border-radius: 6px 6px 0 0;
}
.pq-mushaf-panel-name { font-weight: 600; color: #222; font-size: 13px; flex: 1 1 auto; }
.pq-mushaf-panel-lang {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: #6a7480;
    padding: 2px 6px;
    border-radius: 3px;
}
.pq-mushaf-panel-toggle {
    background: transparent;
    border: 1px solid #c8ccd1;
    border-radius: 3px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    font-weight: bold;
    color: #444;
}
.pq-mushaf-panel-toggle:hover { background: #eef1f4; }
.pq-mushaf-panel-toggle .pq-mushaf-toggle-closed { display: none; }
.pq-mushaf-panel[data-collapsed="1"] .pq-mushaf-toggle-open { display: none; }
.pq-mushaf-panel[data-collapsed="1"] .pq-mushaf-toggle-closed { display: inline; }
.pq-mushaf-panel[data-collapsed="1"] .pq-mushaf-panel-body { display: none; }

.pq-mushaf-panel-body {
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.65;
    color: #1a1a1a;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-height: 480px;
    overflow-y: auto;
}
.pq-mushaf-panel-body p { margin: 0 0 10px; }
.pq-mushaf-panel-body p:last-child { margin-bottom: 0; }

/* Bottom (panel4) panel gets a wider read area */
.pq-mushaf-slot-4 .pq-mushaf-panel-body { max-height: 380px; }

/* ===== v2.66.10k: per-panel controls (lang toggle + info button) ===== */
.pq-mushaf-panel-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.pq-mushaf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* EN/AR pill toggle (both editions available) */
.pq-mushaf-lang-toggle {
    display: inline-flex;
    border: 1px solid #c8ccd1;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
}
.pq-mushaf-lang-pill {
    background: transparent;
    border: 0;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #5a6470;
    cursor: pointer;
    line-height: 1.4;
    text-transform: uppercase;
}
.pq-mushaf-lang-pill + .pq-mushaf-lang-pill { border-left: 1px solid #e1e3e6; }
.pq-mushaf-lang-pill:hover { background: #eef1f4; color: #222; }
.pq-mushaf-lang-pill.is-active {
    background: #2a4d8f;
    color: #fff;
}
.pq-mushaf-lang-pill.is-active:hover { background: #233f76; }
.pq-mushaf-lang-pill:focus-visible {
    outline: 2px solid #2a4d8f;
    outline-offset: 1px;
}

/* Single-language badge (only one edition exists) */
.pq-mushaf-lang-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
    line-height: 1.5;
}
.pq-mushaf-lang-badge--en { background: #4a6fb3; }
.pq-mushaf-lang-badge--ar { background: #8a6a3a; }

/* (i) gap-explainer info button + tooltip */
.pq-mushaf-panel-info {
    position: relative;
    background: transparent;
    border: 1px solid #b8c5d8;
    color: #2a4d8f;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    cursor: help;
    font-style: italic;
    font-family: Georgia, serif;
}
.pq-mushaf-panel-info:hover,
.pq-mushaf-panel-info:focus-visible {
    background: #eef3fa;
    outline: none;
    border-color: #2a4d8f;
}
.pq-mushaf-panel-info::after {
    content: attr(data-gap-text);
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    width: 260px;
    padding: 10px 12px;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    pointer-events: none;
}
.pq-mushaf-panel-info:hover::after,
.pq-mushaf-panel-info:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0s;
}
/* Tooltip flip-left for right-edge panels (slots 2 and 3) to avoid overflow */
.pq-mushaf-slot-2 .pq-mushaf-panel-info::after,
.pq-mushaf-slot-3 .pq-mushaf-panel-info::after {
    right: auto;
    left: 0;
}

/* Arabic edition body (RTL + serif Arabic stack) */
.pq-mushaf-edition[hidden] { display: none; }
.pq-mushaf-edition--ar {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 16px;
    line-height: 1.95;
    direction: rtl;
    text-align: right;
}
.pq-mushaf-edition--ar p { margin: 0 0 10px; }

/* ===== v2.66.10k: Qur'an center panel translator dropdown ===== */
.pq-mushaf-center.pq-mushaf-panel-quran {
    padding: 0;
    text-align: left;
    background: #fffaf3;
    border-color: #e6d9c0;
}
.pq-mushaf-panel-quran .pq-mushaf-panel-header {
    background: #f5ecd8;
    border-bottom-color: #e6d9c0;
}
.pq-mushaf-panel-quran .pq-mushaf-panel-body {
    background: #fffaf3;
    padding: 24px 22px;
    text-align: center;
    max-height: none;
    overflow: visible;
}
.pq-mushaf-translator-select {
    max-width: 220px;
    padding: 3px 8px;
    font-size: 12px;
    border: 1px solid #c8ccd1;
    border-radius: 4px;
    background: #fff;
    color: #222;
    line-height: 1.4;
    cursor: pointer;
}
.pq-mushaf-translator-select:focus-visible {
    outline: 2px solid #2a4d8f;
    outline-offset: 1px;
}
.pq-mushaf-translator-select optgroup { font-weight: 600; color: #444; }

/* ===== v2.66.10l: compact top bar (only holds the 'About this view' (i)) ===== */
.pq-mushaf-topbar {
    /* v2.66.10p: center the controls so they stay in the same spot whether
     * wide mode is on or off (used to be flex-end, which felt like the
     * buttons jumped after the page expanded). */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 12px 0 16px;
}
.pq-mushaf-topbar .pq-mushaf-info-toggle {
    width: auto;
    height: auto;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #2a4d8f;
    background: #fff;
    border-color: #c8ccd1;
}
.pq-mushaf-topbar .pq-mushaf-info-toggle:hover { background: #eef3fa; border-color: #2a4d8f; }

/* ===== v2.66.10o: wide-mode toggle for large monitors ===== */
/* Button styling mirrors the (i) About pill (rounded, white, blue accents).
 * Two SVG icons are stacked inside; data-wide-state on the button selects
 * which one is visible. Label text also swaps via the same attribute.
 * The whole control is hidden below 1100px (wide mode only matters when the
 * 3-column desktop grid is active).
 */
.pq-mushaf-wide-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: auto;
    border: 1px solid #c8ccd1;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #2a4d8f;
    background: #fff;
    cursor: pointer;
}
.pq-mushaf-wide-toggle:hover { background: #eef3fa; border-color: #2a4d8f; }
.pq-mushaf-wide-toggle:focus-visible { outline: 2px solid #2a4d8f; outline-offset: 2px; }
.pq-mushaf-wide-toggle-icon { display: inline-flex; align-items: center; }
.pq-mushaf-wide-toggle-icon svg { display: block; }
/* Show expand icon when off; show restore icon when on. */
.pq-mushaf-wide-toggle[data-wide-state="off"] .pq-mushaf-wide-toggle-icon-restore { display: none; }
.pq-mushaf-wide-toggle[data-wide-state="on"]  .pq-mushaf-wide-toggle-icon-expand  { display: none; }
.pq-mushaf-wide-toggle[data-wide-state="on"] {
    background: #eef3fa;
    border-color: #2a4d8f;
}
/* Below the 3-column breakpoint the wide toggle is meaningless. */
@media (max-width: 1099px) {
    .pq-mushaf-wide-toggle { display: none; }
}

/* Wide-mode overrides: applied via .pq-mushaf--wide on <body>. */
.pq-mushaf--wide .pq-mushaf-page .container {
    max-width: none;
    padding-left: 32px;
    padding-right: 32px;
}
/* Grow the center Qur'an panel a bit more on very wide screens so the
 * five mufassirun corners do not become absurdly tall relative to it. */
@media (min-width: 1400px) {
    .pq-mushaf--wide .pq-mushaf-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
    }
}

/* ===== v2.66.10l: inline ayah nav inside the Qur'an center panel ===== */
/* The .verse-nav class is shared with the Qur'an ayah pages (style.css)   */
/* so the pills inherit green-outline look automatically. We just trim the */
/* top border + tighten spacing for use inside a panel.                    */
.pq-mushaf-verse-nav.verse-nav {
    padding: 0;
    margin: 0 0 16px;
    border-top: 0;
    gap: 8px;
}
.pq-mushaf-verse-nav.verse-nav a { text-decoration: none; }
.pq-mushaf-verse-nav .pq-mushaf-verse-nav-surah {
    /* center label is a link to the surah landing page */
    flex: 0 1 auto;
    text-align: center;
}
.pq-mushaf-verse-nav-disabled {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    color: #b8c2cc;
    background: #f6f7f8;
    border: 1px solid #e5e7ea;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: not-allowed;
}

/* ===== v2.66.10l: commentator bio card (hover/focus) ===== */
.pq-mushaf-bio-trigger {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: #222;
    font-weight: 600;
    font-size: 13px;
    text-align: left;
    cursor: help;
    flex: 1 1 auto;
    border-bottom: 1px dotted #b8c5d8;
    line-height: 1.4;
}
.pq-mushaf-bio-trigger:hover,
.pq-mushaf-bio-trigger:focus-visible {
    color: #2a4d8f;
    border-bottom-color: #2a4d8f;
    outline: none;
}

.pq-mushaf-bio-card {
    position: absolute;
    z-index: 50;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #d9dde2;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    padding: 0;
    font-size: 12.5px;
    line-height: 1.55;
    pointer-events: none;
}
.pq-mushaf-bio-card[hidden] { display: none; }
.pq-mushaf-bio-card-inner { padding: 12px 14px; }
.pq-mushaf-bio-card .pq-mushaf-bio-label {
    margin: 0 0 2px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6a7480;
    font-weight: 600;
}
.pq-mushaf-bio-card .pq-mushaf-bio-name {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.35;
}
.pq-mushaf-bio-meta {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 10px;
    row-gap: 6px;
}
.pq-mushaf-bio-meta dt {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6a7480;
    font-weight: 600;
    padding-top: 1px;
}
.pq-mushaf-bio-meta dd {
    margin: 0;
    color: #1a1a1a;
}
/* Empty rows are hidden by JS at render time. */
.pq-mushaf-bio-meta dt[hidden],
.pq-mushaf-bio-meta dd[hidden] { display: none; }

/* Footer */
.pq-mushaf-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e1e3e6;
    color: #666;
    font-size: 13px;
    text-align: center;
}
.pq-mushaf-footer a { color: #2a4d8f; }

/* Tablet */
@media (max-width: 1099px) {
    .pq-mushaf-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "center center"
            "p0     p2"
            "p1     p3"
            "p4     p4";
    }
    .pq-mushaf-center { min-height: 220px; }
    .pq-mushaf-arabic { font-size: 24px; }
}

/* Mobile */
@media (max-width: 699px) {
    .pq-mushaf-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        grid-template-areas:
            "center"
            "p0"
            "p1"
            "p2"
            "p3"
            "p4";
    }
    .pq-mushaf-center { padding: 20px 14px; min-height: 0; }
    .pq-mushaf-arabic { font-size: 22px; line-height: 1.85; }
    .pq-mushaf-english { font-size: 15px; }
    .pq-mushaf-panel-body { max-height: 360px; }
    .pq-mushaf-toolbar { flex-direction: column; align-items: stretch; }
    .pq-mushaf-nav { justify-content: space-between; }
}
