/**
 * scripture-cards.css — the verse/hadith card look, shared by every page that
 * renders one: /search (still keeps its own copy — it predates this file and
 * was already verified; not worth the risk of touching it to de-duplicate),
 * /ayah/<key>, /hadith/<id>, and /daily.
 *
 * One file so a future page reaches for this instead of writing an Nth copy —
 * see the note in dual_search.html about the theme system having drifted out
 * of sync across six separate copies before. Card styling should not repeat
 * that history.
 *
 * Each page must still link its own Google Fonts <link> (font hrefs aren't
 * something a stylesheet can fetch on a page's behalf) but every rule that
 * *uses* those fonts, and the --font-* tokens themselves, live here once.
 */

:root {
    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --font-body:    'Spectral', Georgia, 'Times New Roman', serif;
    --font-ui:      'Segoe UI', -apple-system, system-ui, sans-serif;
    --font-quran:   'Amiri Quran', 'Traditional Arabic', 'Arabic Typesetting', serif;
    --font-arabic:  'Amiri Quran', 'Amiri', 'Traditional Arabic', serif;
    --font-urdu:    'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', 'Amiri', serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.result-card {
    background: var(--card-bg); border-radius: 11px; margin-bottom: 12px;
    overflow: hidden; box-shadow: 0 3px 12px rgba(0,0,0,0.12);
    border: 1px solid transparent;
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.2s;
    animation: sc-fadeInUp 0.35s ease both;
}
.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.22);
    border-color: var(--filter-border);
}
@keyframes sc-fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.card-head { padding: 12px 15px; cursor: pointer; }
.card-head:hover { background: var(--surface-soft); }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.meta-badge {
    font-size: 0.7rem; padding: 3px 9px; border-radius: 5px; font-weight: 600;
    background: var(--surface-soft); color: var(--text-muted);
}
.meta-badge.primary { background: var(--accent); color: #fff; }
.meta-badge.gold { background: var(--gold); color: var(--accent); }

.match-row { display: flex; align-items: center; gap: 10px; }
.match-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; }
.match-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.match-bar-fill.excellent, .match-percentage.excellent { background: #10b981; }
.match-bar-fill.good,      .match-percentage.good      { background: #3b82f6; }
.match-bar-fill.fair,      .match-percentage.fair      { background: #f59e0b; }
.match-bar-fill.weak,      .match-percentage.weak      { background: #ef4444; }
.match-percentage {
    font-size: 0.72rem; font-weight: 700; color: #fff;
    padding: 2px 8px; border-radius: 5px; min-width: 44px; text-align: center;
}
.expand-arrow { float: right; color: var(--text-muted); transition: transform 0.3s; font-size: 0.8rem; }
.result-card.expanded .expand-arrow { transform: rotate(180deg); }

.card-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.result-card.expanded .card-body, .result-card.always-open .card-body { max-height: 4000px; }
.card-body-inner { padding: 0 15px 15px; }

.text-block { margin-bottom: 13px; }
.block-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 6px; flex-wrap: wrap;
}
.block-title {
    font-family: var(--font-ui); font-size: 0.7rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.09em;
}

/* Qur'anic Arabic gets Amiri Quran and a lot of leading — Uthmani diacritics
   stack above and below the line and collide at tighter line-heights. */
.arabic-text {
    font-family: var(--font-quran);
    direction: rtl; text-align: right;
    font-size: 1.62em; line-height: 2.35;
    color: var(--text-main);
    padding: 2px 0;
}
/* Hadith Arabic now matches the Qur'an face (Amiri Quran) for consistency;
   its stacked diacritics still need real leading, so it can't go below ~2.2. */
.hadith-card .arabic-text {
    font-family: var(--font-arabic);
    font-size: 1.4em; line-height: 2.3;
}
.translation-text {
    font-family: var(--font-body);
    font-size: 1.02em; line-height: 1.72; color: var(--text-main);
}
.translation-text.rtl {
    font-family: var(--font-urdu);
    direction: rtl; text-align: right; font-size: 1.3em; line-height: 2.25;
}
.translator-name {
    font-family: var(--font-ui); font-size: 0.71rem;
    color: var(--text-muted); font-style: italic; margin-top: 4px;
}

.lang-toggle {
    padding: 4px 11px; background: var(--gold); color: var(--accent); border: none;
    border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 0.76rem;
}
.lang-toggle:hover { transform: scale(1.06); }

.card-refs {
    border-top: 1px solid var(--filter-border); padding-top: 10px; margin-top: 4px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 0.78rem;
}
.ref-link { color: var(--gold); text-decoration: none; font-weight: 600; }
.ref-link:hover { text-decoration: underline; }
.card-actions { margin-left: auto; display: flex; gap: 7px; }
.action-btn {
    padding: 4px 11px; background: transparent; border: 1px solid var(--filter-border);
    color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: 0.74rem;
}
.action-btn:hover { border-color: var(--gold); color: var(--gold); }

.pane-empty {
    text-align: center; padding: 32px 18px; color: var(--text-muted);
    font-size: 0.88rem; line-height: 1.65;
}
.pane-empty .big { font-size: 1.8rem; display: block; margin-bottom: 8px; opacity: 0.6; }
.pane-empty code {
    background: var(--surface-soft); padding: 2px 6px; border-radius: 4px;
    font-size: 0.85em; color: var(--gold);
}

/* ---------- tafsir accordion ---------- */
.tafsir-block { border-top: 1px solid var(--filter-border); margin-top: 10px; padding-top: 10px; }
.tafsir-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: transparent; border: none; cursor: pointer; padding: 4px 0;
    color: var(--gold); font-weight: 700; font-size: 0.8rem; text-align: left;
}
.tafsir-toggle .caret { transition: transform 0.25s; font-size: 0.7rem; }
.tafsir-toggle[aria-expanded="true"] .caret { transform: rotate(90deg); }
.tafsir-toggle .src { color: var(--text-muted); font-weight: 500; margin-left: auto; font-size: 0.72rem; }
.tafsir-body {
    display: none; margin-top: 9px; padding: 12px 14px;
    background: var(--surface-soft); border-radius: 8px;
    font-family: var(--font-urdu);
    direction: rtl; text-align: right; font-size: 1.18em; line-height: 2.15;
    color: var(--text-main); white-space: pre-wrap; max-height: 460px; overflow-y: auto;
}
.tafsir-body.open { display: block; }
.tafsir-body.plain {
    font-family: inherit; direction: ltr; text-align: left;
    font-size: 0.9em; line-height: 1.6; color: var(--text-muted);
}

/* Surah number in a bordered lozenge, the way a mushaf marks chapter headings. */
.surah-no {
    flex-shrink: 0; min-width: 1.9rem; text-align: center; display: inline-block;
    font-family: var(--font-ui); font-size: 0.68rem; font-weight: 700;
    color: var(--gold); border: 1px solid var(--gold); border-radius: 4px;
    padding: 2px 5px; font-variant-numeric: tabular-nums; opacity: 0.85;
}
.surah-ar {
    font-family: var(--font-arabic); font-size: 1.12rem; color: var(--text-muted);
    direction: rtl;
}

.pane-title, .page-title, h1.sc-title { font-family: var(--font-display); letter-spacing: -0.01em; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
