/* This page's dictionary modal (.dict-entry-arabic etc. below) references
   'KFGQPC Uthmanic Script HAFS' but never actually loaded it, unlike
   wordbyword.css's identical modal - it silently fell back to plain serif.
   Fixed here alongside adding the optional Indo-Pak alternate below. */
@font-face {
    font-family: 'KFGQPC Uthmanic Script HAFS';
    src: url('../fonts/UthmanicHafs.otf') format('opentype');
    font-display: swap;
}
@font-face {
    font-family: 'AlQuran IndoPak';
    src: url('../fonts/AlQuranIndoPak.ttf') format('truetype');
    font-display: swap;
}

:root {
    --bg: #0a0a2e;
    --panel: #10103d;
    --border: #232357;
    --ink: #ffffff;
    --ink-soft: #b8b8d0;
    --gold: #f5c518;
    --gold-ink: #1a1a1a;
    --green: #22c55e;
    --green-ink: #062012;
}
/* Light alternative to the default navy-blue theme, toggled from
   index.html's #themeToggle (shared 'sitethemePref' localStorage key,
   same pattern as the font toggle) - matches quranwbw.com's "Golden
   Glint" theme exactly (checked directly against its stylesheet:
   --theme-bg-rgb 255 255 255, --theme-text-rgb 0 0 0, --theme-accent-rgb
   177 144 31). --green/--green-ink left untouched - semantic
   correct/verified color, not decorative theme chrome. */
:root[data-theme="gold"] {
    --bg: #ffffff;
    --panel: #fdf9ef;
    --border: rgba(177,144,31,.35);
    --ink: #1a1408;
    --ink-soft: #6b6252;
    --gold: #b1901f;
    --gold-ink: #1a1408;
}
:root[data-theme="gold"] .dict-interlinear { background: rgba(0,0,0,.03); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

.tab-nav { display: flex; gap: 6px; padding: 10px 3vw 0; }
.tab-btn {
    background: transparent; border: none; color: var(--ink-soft); padding: 10px 18px;
    border-radius: 8px 8px 0 0; cursor: pointer; font-weight: 600; font-size: 15px;
    font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px;
    display: inline-block; text-decoration: none;
}
.tab-btn.active { color: var(--ink); border-bottom-color: var(--gold); }
.tab-btn:hover:not(.active) { color: var(--ink); }

body {
    background: var(--bg);
    color: var(--ink);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 3vw;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}
.topbar .title { font-weight: 700; font-size: 16px; color: var(--gold); }
.topbar .jump-group { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; max-width: 60vw; }
.topbar .jump-group select { flex: 1 1 auto; max-width: none; }
.topbar .go-btn {
    flex-shrink: 0; font-size: 13px; font-weight: 700; padding: 7px 14px;
    border: none; border-radius: 8px; background: var(--gold); color: var(--gold-ink);
    cursor: pointer;
}
.topbar .go-btn:hover { filter: brightness(1.08); }
.topbar select {
    font-size: 13px; font-weight: 600; padding: 7px 10px;
    border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--ink);
    flex: 1 1 auto; min-width: 0; max-width: 60vw;
}

/* The verse-jump/back-to-top widget itself now lives in index.html as a
   plain position:fixed element (this page is embedded via a srcdoc iframe
   stretched to its own full content height, so position:fixed in here never
   tracked the real viewport correctly - see index.html for the fix). Only
   the flash-highlight below still applies to elements inside this page. */
.verse-jump-flash { animation: verseJumpFlash 1.3s ease; }
@keyframes verseJumpFlash {
    0%, 100% { background: transparent; }
    20% { background: rgba(245, 197, 24, .18); }
}

main { padding: 0 2vw 30px; max-width: 900px; margin: 0 auto; }

.surah {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 26px 20px;
    margin: 16px 0;
    background: var(--panel);
    scroll-margin-top: 58px;
}
.surah-header {
    font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
    color: var(--gold); margin: 0 0 14px;
}
.surah-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px; color: var(--ink); margin: 0;
}
.translit-ayah {
    display: flex; gap: 10px; align-items: baseline;
    padding: 5px 8px; margin: 0 -8px; border-radius: 6px;
    line-height: 1.7;
}
.translit-ref {
    flex: 0 0 auto; min-width: 2.4em; text-align: right;
    font-family: sans-serif; font-size: 12px; font-weight: 700; color: var(--gold);
}
.translit-text { flex: 1 1 auto; white-space: pre-wrap; word-wrap: break-word; }
.translit-word {
    cursor: help; border-radius: 3px; padding: 0 1px;
    transition: background-color .1s ease, color .1s ease;
}
.translit-word:hover { background-color: var(--gold); color: var(--gold-ink); }
/* A word that opens the dictionary modal (root/preposition/muqatta'at) gets
   a pointer cursor instead of the plain "hover for info" help cursor - same
   distinction the Word by Word tab's own linked Arabic words make. */
.translit-word.has-modal { cursor: pointer; }

.wbw-tooltip {
    position: fixed; transform: translate(-50%, -100%);
    background: var(--panel); border: 1px solid var(--border); color: var(--ink);
    font-family: sans-serif; font-size: 12px; font-weight: 600;
    padding: 6px 10px; border-radius: 6px; white-space: nowrap;
    pointer-events: none; z-index: 50; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.wbw-tooltip.hidden { display: none; }

/* ---- Dictionary entry modal (same panel the Word by Word tab uses) ---- */
.dict-modal-overlay {
    position: absolute; left: 0; right: 0; background: rgba(0,0,0,.65); z-index: 100;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.dict-modal {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    max-width: 700px; width: 100%; padding: 24px 26px; position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,.5); animation: dictModalIn .18s ease;
}
@keyframes dictModalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Sticky (not absolute/fixed) so this stays reachable no matter how far the
   user has scrolled into a long entry — .dict-modal-overlay is a genuine
   self-contained overflow-y:auto scroll box, so position:sticky correctly
   tracks IT (the nearest scrolling ancestor), unaffected by the iframe/outer
   -scroll quirk noted above. NOTE: position:sticky + float:right together do
   NOT actually stick (verified live - a floated sticky element just scrolls
   away with the content), so this is a full-width flex row instead, with its
   buttons pushed to the right edge. Negative top/side margins bleed it into
   .dict-modal's own padding so the buttons sit flush in the same corner the
   old plain-X close button occupied, and a small bottom margin separates it
   from the entry heading below - preserves the original look at rest, and
   stays genuinely reachable once scrolled. */
.dict-modal-toolbar {
    position: sticky; top: -4px; z-index: 5;
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    margin: -12px -14px 8px -12px;
    background: var(--panel);
    padding: 8px 14px 6px 12px;
}
.dict-modal-top-btn {
    font-size: 12px; font-weight: 700; padding: 5px 10px; border: none; border-radius: 6px;
    background: var(--gold); color: var(--gold-ink); cursor: pointer; white-space: nowrap;
    font-family: sans-serif;
}
.dict-modal-top-btn:hover { filter: brightness(1.08); }
.dict-modal-close {
    cursor: pointer; font-size: 26px;
    color: var(--ink-soft); line-height: 1; font-family: sans-serif;
}
.dict-modal-close:hover, .dict-modal-close:focus-visible { color: var(--ink); }
.dict-origin-link {
    position: absolute; top: 14px; left: 20px; font-family: sans-serif; font-size: 13px;
    font-weight: 700; color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold);
}
.dict-origin-link:hover, .dict-origin-link:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }
.dict-entry-arabic {
    font-family: 'KFGQPC Uthmanic Script HAFS', serif; font-weight: bold;
    font-size: 32px; direction: rtl; color: var(--gold); margin: 0 30px 8px 0;
}
.dict-entry-desc { font-family: sans-serif; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; line-height: 1.6; }
.dict-section-heading {
    font-family: sans-serif; font-size: 13px; font-weight: 700; color: #fff;
    margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px dashed var(--border);
}
.dict-section-heading.exact { color: var(--green); border-bottom-color: var(--green); }
.dict-occ { padding: 8px 0; border-bottom: 1px dotted var(--border); font-family: sans-serif; }
.dict-occ:last-child { border-bottom: none; }
.dict-occ.exact { border-left: 2px solid var(--green); padding-left: 8px; }
.dict-occ .meta { font-size: 12px; color: var(--ink-soft); }
.dict-occ .meta.form-heading { font-weight: 700; color: var(--ink); }
.dict-occ .translit { font-style: italic; color: var(--ink-soft); font-size: 13px; }
.dict-occ .gloss { font-weight: 600; color: var(--ink); }
.dict-occ .arabic-line {
    font-family: 'KFGQPC Uthmanic Script HAFS', serif; direction: rtl; text-align: right;
    font-size: 17px; color: #ddd; margin-top: 6px;
}
.dict-occ .arabic-line mark { background: var(--gold); color: var(--gold-ink); padding: 0 2px; border-radius: 3px; }
.dict-occ .arabic-line mark.exact { background: var(--green); color: var(--green-ink); }
.dict-interlinear {
    display: flex; flex-wrap: wrap; gap: 10px 14px; direction: rtl;
    margin-top: 8px; padding: 10px 12px;
    background: rgba(255,255,255,.03); border-radius: 8px;
}
.dict-interlinear .word-unit { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.dict-interlinear .word-unit .ar {
    font-family: 'KFGQPC Uthmanic Script HAFS', serif; font-size: 19px; color: var(--ink); white-space: nowrap;
}
.dict-interlinear .word-unit .gloss {
    font-size: 11px; font-weight: 600; color: var(--ink-soft); text-align: center;
    direction: ltr; max-width: 12ch; line-height: 1.25;
}
/* Urdu gloss text (see setWbwLanguage) needs RTL direction, an Urdu-capable
   font, and more width - Nastaleeq-style Urdu runs noticeably wider per
   character than the equivalent English phrase. */
.gloss.lang-ur {
    direction: rtl !important; font-family: "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", Tahoma, sans-serif;
    max-width: 22ch !important; font-size: 14px;
}
.dict-interlinear .word-unit.hl .ar {
    background: var(--gold); color: var(--gold-ink); padding: 0 3px; border-radius: 3px;
}
.dict-interlinear .word-unit.hl.exact .ar {
    background: var(--green); color: var(--green-ink);
}
.quran-ref-link { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold); }
.quran-ref-link:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---- Lane's Lexicon classical-usage section (within the same modal) ---- */
.lane-entries { font-family: sans-serif; }
.lane-entry { padding: 10px 0; border-bottom: 1px dotted var(--border); }
.lane-entry:last-child { border-bottom: none; }
.lane-headword {
    font-family: 'KFGQPC Uthmanic Script HAFS', serif; direction: rtl; text-align: right;
    font-size: 22px; color: var(--gold); margin-bottom: 6px;
}
.lane-headword.exact { color: var(--green); }
.lane-itype { font-family: sans-serif; font-size: 12px; font-weight: 600; color: var(--ink-soft); direction: ltr; display: inline-block; }
.lane-body { font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.lane-body .lane-ar {
    font-family: 'KFGQPC Uthmanic Script HAFS', serif; direction: rtl; unicode-bidi: embed;
    color: var(--ink); font-size: 15px; padding: 0 2px;
}
.lane-body .lane-ar.exact { background: var(--green); color: var(--green-ink); border-radius: 3px; }
.lane-body em { color: var(--ink); font-style: italic; }
.lane-body .lane-tropical { color: var(--gold); font-style: normal; font-size: 12px; }
.lane-body .lane-sense-num { color: var(--gold); font-weight: 700; }
.lane-body .lane-note { color: var(--ink-soft); font-size: 12px; }
.lane-body .lane-quote {
    display: block; margin: 6px 0; padding: 4px 10px; border-left: 2px solid var(--border);
    font-style: italic;
}
.lane-body .lane-verse-line { direction: rtl; text-align: right; }

.hidden { display: none !important; }

footer {
    text-align: center;
    padding: 20px 20px 60px;
    font-size: 12px;
    color: var(--ink-soft);
}

@media (max-width: 560px) {
    .surah { padding: 16px 14px 14px; }
}

/* Every selector on this page that ever renders Arabic script (only the
   shared dictionary modal - the page's own body is transliterated Latin
   text), gathered so the toggle can override all of them at once without
   touching any of their own (untouched, still-default) font-family rules. */
html.font-indopak .dict-entry-arabic,
html.font-indopak .dict-occ .arabic-line,
html.font-indopak .dict-interlinear .word-unit .ar,
html.font-indopak .lane-headword,
html.font-indopak .lane-body .lane-ar {
    font-family: 'AlQuran IndoPak', serif !important;
}
