/* ============================================================
   Parwaz-e-Deen — premium.css
   The home page's look, carried to every inner page: the deep
   ground with its star lattice, the glass menu bar, the display
   type, hairline panels and gold accents.

   Loaded from partials/nav.html, after each page's own styles,
   so a rule here wins over a page rule of the same weight.
   ============================================================ */

@font-face { font-family: 'Jameel Noori Nastaleeq'; src: url('/static/fonts/Jameel%20Noori%20Nastaleeq%20Kasheeda.ttf') format('truetype'); font-display: swap; }

:root {
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Spectral', Georgia, serif;
  --font-ui: 'Segoe UI', -apple-system, system-ui, sans-serif;
  --pd-urdu: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', 'Amiri', serif;
  --pd-hair: rgba(255,255,255,.12);
  --pd-gold-hair: color-mix(in srgb, var(--gold) 32%, transparent);
  --pd-panel: color-mix(in srgb, var(--bg-main) 86%, black);
  --pd-ink: color-mix(in srgb, var(--bg-main) 78%, black);
  --pd-ease: cubic-bezier(.22,1,.36,1);
}
[data-mode="light"] { --pd-hair: rgba(0,0,0,.12); --pd-panel: #ffffff; --pd-ink: #12261f; }

/* The green theme takes the home page's deep emerald. The theme scripts set
   these as inline styles on <html>; this is the one place that overrides them. */
html[data-theme="green-gold-dark"]:not([data-mode="light"]),
html:not([data-theme]):not([data-mode="light"]) {
  --bg-main: #022c22 !important; --bg-alt: #06382c !important; --card-bg: #06382c !important;
  --filter-bg: #06382c !important; --surface: #032419 !important; --surface-soft: #0a4636 !important;
  --text-main: #f4f7f5 !important; --text-muted: #a9c9bb !important;
}

/* Golden yellow: brighter and yellower than the amber (#fbbf24) the theme scripts
   set. This is the one place that decides the gold of the inner pages; the home
   page and the footer carry the same value. */
html[data-theme="green-gold-dark"]:not([data-mode="light"]),
html[data-theme="green-navy-gold"]:not([data-mode="light"]),
html[data-theme="royal-purple"]:not([data-mode="light"]),
html:not([data-theme]):not([data-mode="light"]) { --gold: #ffff0c !important; }

/* Royal purple: its cards were a bright indigo and its panels a stray grey.
   Both now sit close to the page's own deep purple. */
html[data-theme="royal-purple"]:not([data-mode="light"]) {
  --bg-alt: #272459 !important; --card-bg: #272459 !important; --filter-bg: #272459 !important;
  --surface: #17153a !important; --surface-soft: #2d2a66 !important;
}

/* ---------- ground ---------- */
html:not([data-mode="light"]) { background: var(--bg-main) !important; }
html:not([data-mode="light"]) body {
  background-color: var(--bg-main) !important;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 84 84'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.05' stroke-width='1'%3E%3Cpath d='M42 6l10.5 25.5L78 42 52.5 52.5 42 78 31.5 52.5 6 42l25.5-10.5z'/%3E%3Crect x='24' y='24' width='36' height='36' transform='rotate(45 42 42)'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(1200px 700px at 50% -10%, var(--accent-soft), transparent 62%),
    radial-gradient(900px 600px at 100% 55%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 65%),
    radial-gradient(900px 700px at 0% 100%, color-mix(in srgb, var(--accent-soft) 35%, transparent), transparent 60%) !important;
  background-attachment: fixed !important;
}
::selection { background: var(--gold); color: var(--pd-ink); }

/* ---------- menu bar ---------- */
header.site-header {
  position: sticky; top: 0; z-index: 600; padding: 10px 22px;
  background: color-mix(in srgb, var(--bg-main) 80%, transparent) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid var(--pd-hair); box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
header.site-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .5; pointer-events: none; }
.site-header .header-content { max-width: 1280px; flex-direction: row; flex-wrap: nowrap; gap: 16px; }
.site-header .logo { font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; color: var(--gold); text-shadow: none; gap: 10px; }
.site-header .logo-img { height: 36px !important; width: auto; border-radius: 5px; filter: none; }
.site-header .logo-text { font-size: 1.08rem !important; margin: 0 !important; }
.site-header nav { gap: 2px; flex-wrap: nowrap; }
.site-header nav a {
  font-family: var(--font-ui); font-size: .84rem; font-weight: 600; padding: 7px 13px; margin: 0;
  border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: color-mix(in srgb, var(--text-main) 80%, transparent); transition: color .25s, background .25s;
}
.site-header nav a:hover { background: rgba(255,255,255,.07); color: var(--gold); transform: none; }
.site-header nav a.active { background: var(--gold); color: var(--pd-ink); font-weight: 700; }
.site-header .theme-controls select {
  font-family: var(--font-ui); font-size: .78rem; font-weight: 600; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--pd-hair); background: rgba(0,0,0,.3); color: var(--text-main);
}
.site-header .theme-controls select:hover { background: rgba(0,0,0,.45); color: var(--text-main); transform: none; border-color: var(--pd-gold-hair); }
.site-header .theme-controls select option { background: var(--bg-main); color: var(--text-main); }
@media (max-width: 860px) {
  .site-header { padding: 8px 14px; }
  .site-header .header-content { flex-wrap: wrap; gap: 8px; }
  .site-header .logo { flex: 1 1 auto; }
  .site-header .theme-controls select { max-width: 128px; }
  .site-header nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { flex-shrink: 0; }
}

/* ---------- page opening (partials/page_hero.html) ---------- */
.pd-hero {
  position: relative; overflow: hidden; width: min(1180px, calc(100% - 32px)); margin: 18px auto 28px; padding: 30px 34px;
  display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,.7fr); gap: 28px; align-items: center; text-align: left;
  border-radius: 26px; border: 1px solid var(--pd-hair);
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--accent) 48%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.05), transparent),
    var(--pd-panel);
  box-shadow: 0 24px 60px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
  animation: pd-rise .8s var(--pd-ease) backwards;
}
.container > .pd-hero, .about-container > .pd-hero, .page-wrap > .pd-hero { width: 100%; margin-top: 0; }
.pd-hero::before { content: ''; position: absolute; left: 34px; right: 34px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .7; }
.pd-hero::after { content: ''; position: absolute; right: -90px; top: -110px; width: 360px; height: 360px; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 20%, transparent), transparent 66%); }
/* slim: one band, so the page's content starts high on the screen */
.pd-hero--slim { grid-template-columns: minmax(0,1fr) auto; padding: 14px 30px; margin: 14px auto 16px; border-radius: 20px; gap: 20px; }
.pd-hero--slim .pd-hero-text { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "eyebrow facts" "title urdu"; align-items: center; gap: 4px 22px; }
.pd-hero--slim .pd-eyebrow { grid-area: eyebrow; margin: 0; }
.pd-hero--slim .pd-facts { grid-area: facts; margin: 0; }
.pd-hero--slim h1 { grid-area: title; }
.pd-hero--slim .pd-urdu { grid-area: urdu; }
.pd-hero--slim h1 { font-size: clamp(1.35rem, 2.3vw, 1.8rem); }
.pd-hero--slim .pd-urdu { font-size: 1.2rem; margin: 0; line-height: 1.9; }
.pd-hero--slim .pd-lede { display: none; }
.pd-hero--slim .pd-motif { height: 62px; width: 110px; }
.pd-hero-text { position: relative; z-index: 1; min-width: 0; }
.pd-eyebrow { font-family: var(--font-ui); font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pd-eyebrow b { font-family: var(--font-display); font-size: .98rem; letter-spacing: 0; border: 1px solid var(--pd-gold-hair); border-radius: 6px; padding: 1px 8px; }
.pd-hero h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 3.4vw, 2.7rem); font-weight: 600; letter-spacing: -.015em;
  line-height: 1.1; color: var(--text-main); text-shadow: none; margin: 0; text-wrap: balance; }
.pd-urdu { font-family: var(--pd-urdu); font-size: 1.35rem; color: var(--gold); line-height: 2.1; margin-top: 2px; text-align: left; }
.pd-lede { font-family: var(--font-body); font-size: 1.05rem; line-height: 1.55; max-width: 40rem; margin: 6px 0 0;
  color: color-mix(in srgb, var(--text-main) 84%, transparent); text-wrap: pretty; }
.pd-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pd-facts span { font-family: var(--font-ui); font-size: .76rem; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.055); border: 1px solid var(--pd-hair); color: var(--text-main); font-variant-numeric: tabular-nums; }
.pd-motif { position: relative; z-index: 1; height: 150px; display: flex; align-items: center; justify-content: center; }
.pd-motif i, .pd-motif s { display: block; font-style: normal; text-decoration: none; }
@keyframes pd-rise { from { opacity: 0; transform: translateY(22px); } }

/* compact: once the visitor starts working, the opening folds up into one row —
   number, title (same size), Urdu line and ornament — and the description and
   fact chips lift away. Its width never changes. static/js/page-hero.js moves it. */
.container:has(> .pd-hero[data-compact-on]) { width: 100%; }   /* a fixed column, so folding cannot narrow the page */
.pd-hero-more { display: none; }
.pd-hero.is-compact { grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 26px; padding: 12px 58px 12px 30px;
  border-radius: 18px; margin-bottom: 16px; cursor: pointer; box-shadow: 0 12px 30px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.08); }
.pd-hero.is-compact:hover { border-color: var(--pd-gold-hair); }
.pd-hero.is-compact .pd-hero-text { display: flex; align-items: center; gap: 4px 20px; min-height: 56px; }
.pd-hero.is-compact .pd-eyebrow { margin: 0; flex-shrink: 0; }
.pd-hero.is-compact h1 { flex-shrink: 0; }
.pd-hero.is-compact .pd-urdu { margin: 0 0 0 auto; line-height: 1.9; white-space: nowrap; }
.pd-hero.is-compact .pd-lede, .pd-hero.is-compact .pd-facts {
  position: absolute; left: 30px; top: 10px; width: min(40rem, calc(100% - 60px)); margin: 0; opacity: 0; visibility: hidden; pointer-events: none; }
.pd-hero.is-compact .pd-motif { height: 56px; }
.pd-hero.is-compact.pd-hero--pair .pd-motif .pg { width: 68px; padding: 10px 10px; gap: 6px; animation: none; }
.pd-hero.is-compact.pd-hero--books .pd-motif { height: 56px; }
.pd-hero.is-compact.pd-hero--day .pd-motif .moon { width: 50px; height: 50px; box-shadow: inset 0 -12px 0 0 var(--gold); }
.pd-hero.is-compact.pd-hero--star .pd-motif .rub { width: 48px; height: 48px; }
.pd-hero.is-compact .pd-hero-more { display: grid; place-items: center; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--pd-gold-hair); background: transparent; color: var(--gold);
  font-size: .8rem; line-height: 1; cursor: pointer; transition: background .25s, border-color .25s; }
.pd-hero.is-compact:hover .pd-hero-more { background: color-mix(in srgb, var(--gold) 16%, transparent); border-color: var(--gold); }
@media (max-width: 1100px) {
  .pd-hero.is-compact { grid-template-columns: minmax(0,1fr); }
  .pd-hero.is-compact .pd-hero-text { flex-wrap: wrap; min-height: 0; }
  .pd-hero.is-compact .pd-motif { position: absolute; right: 58px; top: 12px; opacity: 0; visibility: hidden; }
}
@media (max-width: 760px) {
  .pd-hero.is-compact { padding: 12px 52px 12px 20px; }
  .pd-hero.is-compact .pd-urdu { margin-left: 0; white-space: normal; }
}

/* Bayans: a level meter that never sits still */
.pd-hero--audio .pd-motif { gap: 5px; }
.pd-hero--audio .pd-motif i { width: 5px; height: var(--h); border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), color-mix(in srgb, var(--gold) 22%, transparent));
  animation: pd-eq 1.5s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.21s); }
@keyframes pd-eq { from { transform: scaleY(.3); opacity: .55; } to { transform: scaleY(1); opacity: 1; } }

/* eBooks: a shelf, with one volume being drawn out */
.pd-hero--books .pd-motif { align-items: flex-end; gap: 4px; height: 132px; padding: 0 14px; border-bottom: 2px solid var(--pd-gold-hair); }
.pd-hero--books .pd-motif i { position: relative; width: 18px; height: var(--h); border-radius: 3px 3px 1px 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.2), transparent 38%, rgba(0,0,0,.28)), var(--gold); }
.pd-hero--books .pd-motif i:nth-child(3n+2) { background: linear-gradient(90deg, rgba(255,255,255,.2), transparent 38%, rgba(0,0,0,.28)), color-mix(in srgb, var(--accent-soft) 72%, white); width: 22px; }
.pd-hero--books .pd-motif i:nth-child(3n) { background: linear-gradient(90deg, rgba(255,255,255,.16), transparent 38%, rgba(0,0,0,.3)), color-mix(in srgb, var(--gold) 45%, var(--bg-main)); width: 15px; }
.pd-hero--books .pd-motif i::after { content: ''; position: absolute; left: 3px; right: 3px; top: 14%; height: 2px; background: rgba(0,0,0,.34); box-shadow: 0 6px 0 rgba(0,0,0,.34); }
.pd-hero--books .pd-motif i:nth-child(5) { animation: pd-pull 5.5s var(--pd-ease) infinite; }
.pd-hero--books .pd-motif i:nth-child(9) { transform: rotate(-9deg); transform-origin: bottom right; margin-left: 7px; }
@keyframes pd-pull { 0%, 55%, 100% { transform: translateY(0); } 68%, 86% { transform: translateY(-16px); } }

/* Hadith: narrator to narrator, down to the saying itself */
.pd-hero--chain .pd-motif .n { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--gold); flex-shrink: 0;
  animation: pd-node 4.2s ease-in-out infinite; animation-delay: calc(var(--i) * .5s); }
.pd-hero--chain .pd-motif .l { width: 26px; height: 2px; background: var(--pd-gold-hair); flex-shrink: 1; }
.pd-hero--chain .pd-motif .t { width: 92px; padding: 12px 12px; margin-left: 4px; border-radius: 12px; border: 1px solid var(--pd-gold-hair);
  background: rgba(0,0,0,.26); display: grid; gap: 7px; flex-shrink: 0; animation: pd-text 4.2s ease-in-out infinite; animation-delay: 2.5s; }
.pd-hero--chain .pd-motif .t s { height: 3px; border-radius: 2px; background: var(--gold); opacity: .75; }
.pd-hero--chain .pd-motif .t s:nth-child(2) { width: 82%; margin-left: auto; }
.pd-hero--chain .pd-motif .t s:nth-child(3) { width: 58%; margin-left: auto; }
@keyframes pd-node { 0%, 30%, 100% { background: transparent; box-shadow: none; } 12% { background: var(--gold); box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 18%, transparent); } }
@keyframes pd-text { 0%, 30%, 100% { border-color: var(--pd-gold-hair); box-shadow: none; } 12% { border-color: var(--gold); box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 12%, transparent); } }

/* Daily: the new moon that turns the day */
/* lit along its lower edge, horns pointing up */
.pd-hero--day .pd-motif .moon { width: 96px; height: 96px; border-radius: 50%; box-shadow: inset 0 -24px 0 0 var(--gold); transform: rotate(22deg);
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--gold) 40%, transparent)); }
.pd-hero--day .pd-motif .s { position: absolute; color: var(--gold); font-size: 1rem; line-height: 1; animation: pd-twinkle 3.2s ease-in-out infinite; }
.pd-hero--day .pd-motif .s:nth-of-type(2) { left: 22%; top: 18%; }
.pd-hero--day .pd-motif .s:nth-of-type(3) { left: 30%; top: 70%; font-size: .7rem; animation-delay: 1.1s; }
.pd-hero--day .pd-motif .s:nth-of-type(4) { right: 20%; top: 26%; font-size: .8rem; animation-delay: 2s; }
@keyframes pd-twinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

.pd-hero--slim.pd-hero--day .pd-motif .moon { width: 56px; height: 56px; box-shadow: inset 0 -14px 0 0 var(--gold); }
.pd-hero--slim.pd-hero--day .pd-motif .s { font-size: .7rem; }

/* Combined study: a page of the Qur'an and a hadith, joined */
.pd-hero--pair .pd-motif .pg { width: 88px; padding: 15px 12px; border-radius: 12px; border: 1px solid var(--pd-gold-hair); background: rgba(0,0,0,.26);
  display: grid; gap: 8px; flex-shrink: 0; animation: pd-bob 5s ease-in-out infinite; }
.pd-hero--pair .pd-motif .pg.h { animation-delay: -2.5s; }
.pd-hero--pair .pd-motif .pg s { height: 3px; border-radius: 2px; background: var(--gold); opacity: .78; }
.pd-hero--pair .pd-motif .pg.q s:nth-child(2) { width: 80%; margin-left: auto; }
.pd-hero--pair .pd-motif .pg.q s:nth-child(3) { width: 55%; margin-left: auto; }
.pd-hero--pair .pd-motif .pg.h s:nth-child(2) { width: 86%; }
.pd-hero--pair .pd-motif .pg.h s:nth-child(3) { width: 60%; }
.pd-hero--pair .pd-motif .lk { width: 34px; height: 2px; background: linear-gradient(90deg, var(--pd-gold-hair), var(--gold), var(--pd-gold-hair)); animation: pd-link 2.5s ease-in-out infinite; }
@keyframes pd-bob { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(6px); } }
@keyframes pd-link { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* Everything else: the eight-point star, turning slowly */
.pd-hero--star .pd-motif .rub { position: relative; width: 92px; height: 92px; animation: pd-spin 70s linear infinite; }
.pd-hero--star .pd-motif .rub::before, .pd-hero--star .pd-motif .rub::after { content: ''; position: absolute; inset: 0; border: 2px solid var(--gold); border-radius: 7px; }
.pd-hero--star .pd-motif .rub::after { transform: rotate(45deg); }
.pd-hero--star .pd-motif .rub i { position: absolute; inset: 31%; border-radius: 50%; border: 2px solid var(--gold); }
@keyframes pd-spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .pd-hero { grid-template-columns: 1fr; padding: 22px 20px; border-radius: 20px; margin-bottom: 20px; }
  .pd-hero::before { left: 20px; right: 20px; }
  .pd-motif { display: none; }
  .pd-urdu { font-size: 1.2rem; }
  .pd-hero--slim { padding: 14px 18px; }
  .pd-hero--slim .pd-hero-text { grid-template-columns: 1fr; grid-template-areas: "eyebrow" "title" "urdu" "facts"; }
}

/* ---------- Bayans ---------- */
.filters .filter-btn { font-family: var(--font-ui); border-radius: 999px; padding: 7px 16px; border: 1px solid var(--pd-hair);
  background: rgba(255,255,255,.05); color: var(--text-main); }
.filters .filter-btn:hover { background: rgba(255,255,255,.09); border-color: var(--pd-gold-hair); color: var(--gold); }
.filters .filter-btn.active { background: var(--gold); border-color: var(--gold); color: var(--pd-ink); }
/* the page scrolls as one; the lists inside each card keep their own scroll */
.series-scroll-wrap { height: auto; overflow: visible; padding-right: 0; }
.series-grid { gap: 18px; padding-bottom: 40px; }
.series-grid > .group-card { animation: pd-rise .7s var(--pd-ease) backwards; }
.series-grid > .group-card:nth-child(2) { animation-delay: .1s; }
.group-card { position: relative; border-radius: 20px; border: 1px solid var(--pd-hair);
  background: linear-gradient(180deg, rgba(255,255,255,.055), transparent 60%), var(--pd-panel);
  box-shadow: 0 14px 34px rgba(0,0,0,.2); transition: border-color .3s, box-shadow .4s var(--pd-ease); }
.group-card::before { content: ''; position: absolute; left: 22px; right: 22px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0; transition: opacity .3s; }
.group-card:hover, .group-card.expanded { border-color: var(--pd-gold-hair); box-shadow: 0 22px 46px rgba(0,0,0,.32); }
.group-card:hover::before, .group-card.expanded::before { opacity: .9; }
.group-header { padding: 18px 18px; border-radius: 20px; }
.group-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--text-main); }
.group-sub { font-family: var(--font-ui); }
.group-body { padding: 0 12px 12px; }
.group-body .series-card, .series-card { border-radius: 14px; border: 1px solid var(--pd-hair); background: rgba(0,0,0,.2); }
.series-card:hover, .series-card.expanded { border-color: var(--pd-gold-hair); }
.series-header { padding: 12px 14px; border-radius: 14px; }
.series-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; }
.direct-list { border-radius: 14px; border-color: var(--pd-hair); }
.bayan-item { padding: 9px 14px; border-top-color: var(--pd-hair); }
.bayan-item:hover { background: rgba(255,255,255,.05); }
.track-number { min-width: 34px; height: 20px; border-radius: 6px; background: transparent; border: 1px solid var(--pd-gold-hair);
  color: var(--gold); font-family: var(--font-ui); font-size: .72em; font-variant-numeric: tabular-nums; }
.bayan-item.playing .track-number { background: var(--gold); color: var(--pd-ink); border-color: var(--gold); }
.language-tag { font-family: var(--font-ui); }
.audio-player { border: 1px solid var(--pd-gold-hair); border-radius: 18px; background: color-mix(in srgb, var(--bg-main) 88%, black);
  box-shadow: 0 24px 60px rgba(0,0,0,.55); }
@media (min-width: 769px) { .audio-player { bottom: 64px; right: 16px; } }   /* clear of the footer bar */
.player-title { font-family: var(--font-display); font-weight: 600; }
.control-btn, .speed-btn { font-family: var(--font-ui); border-color: var(--pd-gold-hair); background: rgba(255,255,255,.05); }
.control-btn:hover, .speed-btn:hover, .speed-btn.active { background: var(--gold); color: var(--pd-ink); }

/* ---------- eBooks ---------- */
.category-section { max-width: 1180px; margin: 0 auto 14px; animation: pd-rise .7s var(--pd-ease) backwards; }
.category-section:nth-of-type(2) { animation-delay: .08s; }
.category-section:nth-of-type(3) { animation-delay: .16s; }
.category-header { border-radius: 18px; border: 1px solid var(--pd-hair); padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), transparent 70%), var(--pd-panel); }
.category-header:hover { border-color: var(--pd-gold-hair); box-shadow: 0 16px 34px rgba(0,0,0,.28); }
.category-section.expanded .category-header { border-radius: 18px 18px 0 0; border-color: var(--pd-gold-hair); border-bottom-color: transparent; }
.category-icon { width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--gold) 16%, transparent); border: 1px solid var(--pd-gold-hair); }
.category-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--text-main); }
.category-count { font-family: var(--font-ui); border-radius: 999px; padding: 3px 11px; }
.category-section.expanded .books-container { border-radius: 0 0 18px 18px; border-color: var(--pd-gold-hair); background: color-mix(in srgb, var(--pd-panel) 70%, transparent); }
/* each book stands on its spine */
.book-card { position: relative; border-radius: 4px 14px 14px 4px; border: 1px solid var(--pd-hair); border-left: 7px solid var(--gold);
  background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 14px), linear-gradient(180deg, rgba(255,255,255,.06), transparent 70%), var(--pd-panel);
  box-shadow: 0 10px 24px rgba(0,0,0,.22); }
.book-card:hover { border-color: var(--pd-gold-hair); border-left-color: var(--gold); transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 22px 40px rgba(0,0,0,.38); }
.book-title { font-family: var(--font-display); font-size: .98em; font-weight: 600; }
/* a book with a cover: the cover stands at the left, its details beside it */
.book-card.has-cover { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 10px 12px; align-items: start; }
.book-card.has-cover .book-actions { grid-column: 1 / -1; }
.book-cover { display: block; width: 66px; aspect-ratio: 12 / 17; border-radius: 3px 5px 5px 3px; overflow: hidden; background: rgba(0,0,0,.25);
  box-shadow: 0 6px 14px rgba(0,0,0,.45), inset 2px 0 0 rgba(255,255,255,.12); transition: transform .4s var(--pd-ease), box-shadow .4s var(--pd-ease); }
.book-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book-card:hover .book-cover { transform: translateY(-2px) rotate(-2deg) scale(1.05); box-shadow: 0 12px 22px rgba(0,0,0,.55), inset 2px 0 0 rgba(255,255,255,.12); }
.book-card.has-cover .book-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.book-card.has-cover .book-meta { margin-bottom: 0; }
.book-author { font-family: var(--font-body); font-style: italic; }
.book-badge { font-family: var(--font-ui); border-radius: 999px; padding: 2px 9px; background: rgba(255,255,255,.055); border: 1px solid var(--pd-hair); color: var(--text-main); }
.book-btn.btn-read { font-family: var(--font-ui); border-radius: 999px; background: var(--gold); color: var(--pd-ink); font-weight: 700; }
.book-btn.btn-read:hover { transform: translateY(-1px); opacity: 1; box-shadow: 0 8px 20px rgba(0,0,0,.3); }

/* ---------- Verse & Hadith of the Day ---------- */
/* each card lies flat: translation on the left, Arabic on the right, so both are read without scrolling */
.sc-page.sc-page--wide { max-width: none; width: min(1180px, calc(100% - 32px)); padding: 0 0 40px; }
.sc-page--wide .sc-section-label { margin: 14px 4px 6px; font-family: var(--font-ui); color: var(--gold); }
.sc-page--wide .result-card { border-radius: 20px; border: 1px solid var(--pd-hair); margin-bottom: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 60%), var(--pd-panel); box-shadow: 0 14px 34px rgba(0,0,0,.2); }
.sc-page--wide .result-card:hover { transform: none; border-color: var(--pd-gold-hair); }
.sc-page--wide .card-body-inner { padding: 12px 22px 12px !important; }
.sc-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 0 26px; align-items: start; }
.sc-pair > .text-block { margin-bottom: 8px; }
.sc-pair > .text-block:first-child { order: 2; padding-left: 26px; border-left: 1px solid var(--pd-hair); }
.sc-pair > .text-block:only-child { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
.sc-page--wide .arabic-text { font-size: 1.5rem; line-height: 2.15; }
.sc-page--wide .hadith-card .arabic-text { font-size: 1.22rem; line-height: 2.1; }
.sc-page--wide .translation-text { font-size: 1.02rem; line-height: 1.62; }
.sc-page--wide .translation-text.rtl { font-size: 1.22rem; line-height: 2.1; }
.sc-page--wide .card-refs { border-top-color: var(--pd-hair); padding-top: 8px; margin-top: 0; }
/* on a wide screen a long text scrolls inside its own half, so the page itself stays on one screen */
@media (min-width: 801px) {
  .sc-pair > .text-block { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--pd-gold-hair) transparent; padding-right: 6px; }
  .quran-card .sc-pair > .text-block { max-height: max(200px, calc(100vh - 620px)); }
  .hadith-card .sc-pair > .text-block { max-height: max(240px, calc(100vh - 580px)); }
}
@media (max-width: 800px) {
  .sc-pair { grid-template-columns: 1fr; }
  .sc-pair > .text-block:first-child { order: 0; padding-left: 0; border-left: 0; }
}

/* ---------- Hadith search ---------- */
.mode-sidebar { background: var(--pd-panel); border: 1px solid var(--pd-hair); border-right: 1px solid var(--pd-gold-hair); overflow: hidden; }
.mode-sidebar-btn { font-family: var(--font-ui); }
.mode-sidebar-btn.active { background: var(--gold); color: var(--pd-ink); }
.search-area { background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 60%), var(--pd-panel); border: 1px solid var(--pd-hair); box-shadow: 0 18px 44px rgba(0,0,0,.26); }
.search-area .input-group label { color: var(--gold); font-family: var(--font-ui); font-size: .9rem; }
.search-btn, .filter-bar .search-btn-inline { font-family: var(--font-ui); border-radius: 999px; background: var(--gold); color: var(--pd-ink); font-weight: 700; }
.search-btn:hover, .filter-bar .search-btn-inline:hover { box-shadow: 0 14px 30px rgba(0,0,0,.35); }
/* on a phone the three modes sit across the top of the search panel, not beside it */
@media (max-width: 760px) {
  .query-layout { flex-direction: column; }
  .mode-sidebar { width: 100%; display: flex; border-radius: 14px 14px 0 0; border-right: 1px solid var(--pd-hair); border-bottom: 1px solid var(--pd-gold-hair); }
  .mode-sidebar-btn { flex: 1; padding: 12px 6px; font-size: .8rem; text-align: center; border-bottom: none; }
  .query-layout .search-container { width: 100%; }
  .search-area { border-radius: 0 0 14px 14px; padding: 16px 14px; }
}

/* ---------- About ---------- */
.about-container .section { border-radius: 20px; border: 1px solid var(--pd-hair);
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 60%), var(--pd-panel); box-shadow: 0 14px 34px rgba(0,0,0,.2); }
.about-container .section h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; }
.about-container .section p { font-family: var(--font-body); font-size: 1.04rem; line-height: 1.7; }
.value-card { border-radius: 16px; border: 1px solid var(--pd-hair); background: rgba(0,0,0,.2); transition: transform .4s var(--pd-ease), border-color .3s; }
.value-card:hover { transform: translateY(-4px); border-color: var(--pd-gold-hair); }
.value-card h3 { font-family: var(--font-display); font-weight: 600; }

/* ---------- Contact, FAQ, Privacy, Sitemap ---------- */
html .page-wrap .card { border-radius: 20px; border: 1px solid var(--pd-hair);
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 60%), var(--pd-panel);
  box-shadow: 0 14px 34px rgba(0,0,0,.2); animation: pd-rise .7s var(--pd-ease) backwards; }
html .page-wrap .card:hover { border-color: var(--pd-gold-hair); }
.page-wrap .card h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; }
.page-wrap .card h3 { font-family: var(--font-display); font-weight: 600; }
.page-wrap .card p, .page-wrap .card li { font-family: var(--font-body); font-size: 1.03rem; line-height: 1.7; }
.page-wrap .btn-primary { font-family: var(--font-ui); border-radius: 999px; background: var(--gold); color: var(--pd-ink); border: none; }

/* ---------- 404 and holding pages ---------- */
.error-code, .error-title { font-family: var(--font-display); }
.error-msg { font-family: var(--font-body); }
.error-actions .btn-home { border-radius: 999px; background: var(--gold); color: var(--pd-ink); font-family: var(--font-ui); }
.error-actions .btn-outline, .quick-links a { border-radius: 999px; font-family: var(--font-ui); }

/* Only the ornaments' endless loops follow the device's "reduce motion" setting.
   Everything that moves because the visitor did something always plays. */
@media (prefers-reduced-motion: reduce) {
  .pd-motif, .pd-motif * { animation: none !important; }
}

/* ============================================================
   Search workspace — shared by the Hadith page and the Qur'an &
   Hadith page (behaviour: static/js/search-workspace.js)

   #workspace has three states:
     (no class)                 first visit: the search panel alone
     .has-results.is-collapsed  results showing, panel folded away
     .has-results               results showing, panel open above them

   Results come in three levels: a card per source with its count,
   the closed cards of the chosen source, and the reading area that
   stays fixed on screen.
   ============================================================ */
.workspace { display: grid; width: 100%; scroll-margin-top: 80px;
  grid-template-columns: 0px minmax(0, 1fr); grid-template-areas: "rail panel" "rail results"; column-gap: 0; }
.workspace.has-results { grid-template-columns: 74px minmax(0, 1fr); column-gap: 18px; }

/* the panel folds upward to nothing, and unfolds back, by its own height */
.ws-search { grid-area: panel; min-width: 0; display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 750ms cubic-bezier(.45,0,.15,1), opacity 600ms ease; }
.ws-search-inner { min-width: 0; min-height: 0; overflow: hidden; }
.workspace.is-collapsed .ws-search { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }

.ws-results { grid-area: results; min-width: 0; display: none; }
.workspace.has-results .ws-results { display: block; }
.pristine-hint { display: block; }
.workspace.has-results ~ .pristine-hint { display: none; }

/* "Edit search": the one gold piece on the page, so it is found at once */
.search-rail { grid-area: rail; display: none; position: sticky; top: 76px; align-self: start;
  width: 74px; min-height: 250px; box-sizing: border-box; padding: 12px 8px 14px;
  flex-direction: column; align-items: center; gap: 12px;
  font: inherit; text-align: center; cursor: pointer; color: var(--pd-ink);
  border: 1px solid color-mix(in srgb, var(--gold) 70%, white); border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 66%, white) 0%, var(--gold) 38%, color-mix(in srgb, var(--gold) 82%, #6b3f00) 100%);
  box-shadow: 0 14px 32px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform 300ms var(--pd-ease), box-shadow 300ms var(--pd-ease); }
.workspace.has-results .search-rail { display: flex; }
.search-rail:hover, .search-rail:focus-visible { transform: translateY(-2px); outline: none;
  box-shadow: 0 20px 40px rgba(0,0,0,.45), 0 0 0 4px color-mix(in srgb, var(--gold) 24%, transparent), inset 0 1px 0 rgba(255,255,255,.7); }
.rail-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--pd-ink); color: var(--gold); font-size: 1.05rem; line-height: 1; transition: transform 420ms var(--pd-ease); }
.workspace:not(.is-collapsed) .rail-icon { transform: rotate(-90deg); }
.rail-body { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 0; flex: 1 1 auto; }
.rail-label { writing-mode: vertical-rl; text-orientation: mixed; white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-ui); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; color: var(--pd-ink); }
.rail-query { writing-mode: vertical-rl; text-orientation: mixed; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: 220px; min-height: 0; font-family: var(--font-ui); font-size: .8rem; font-weight: 600; color: var(--pd-ink); opacity: .82; }
.rail-count { flex-shrink: 0; font-family: var(--font-ui); font-size: .74rem; font-weight: 800; color: var(--gold); background: var(--pd-ink);
  border-radius: 20px; padding: 4px 9px; font-variant-numeric: tabular-nums; }

/* LEVEL 1 — one card per source, with how many were found in it */
.coll-strip { display: grid; grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.coll-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0;
  padding: 12px 13px 11px; font: inherit; text-align: left; cursor: pointer; color: var(--text-main);
  border: 1px solid var(--pd-hair); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), transparent 70%), var(--pd-panel);
  transition: transform 320ms var(--pd-ease), border-color 240ms ease, box-shadow 320ms var(--pd-ease);
  animation: coll-in 650ms cubic-bezier(.3,.7,.2,1) backwards; animation-delay: calc(260ms + var(--i, 0) * 70ms); }
@keyframes coll-in { from { opacity: 0; transform: translateY(14px); } }
.coll-card:hover { transform: translateY(-3px); border-color: var(--pd-gold-hair); box-shadow: 0 14px 30px rgba(0,0,0,.3); }
.coll-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.coll-card.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 14px 30px rgba(0,0,0,.32); }
.coll-card.is-active::after { content: ''; position: absolute; left: 26px; bottom: -7px; width: 12px; height: 12px;
  background: var(--gold); transform: rotate(45deg); border-radius: 2px; }   /* points down to the list it opened */
.coll-card.is-empty { opacity: .42; cursor: default; }
.coll-card.is-empty:hover { transform: none; box-shadow: none; border-color: var(--pd-hair); }
.coll-card--quran { border-color: var(--pd-gold-hair);
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 13%, transparent), transparent 75%), var(--pd-panel); }
.coll-count { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.coll-name { font-family: var(--font-display); font-size: .92rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.coll-sub { font-family: var(--font-ui); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--text-muted); }

/* the chosen source's closed cards on the left, the reading area on the right */
.result-split { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 18px; align-items: start; }
.book-tree { min-width: 0; }

/* LEVEL 2 — closed cards */
.coll-list { display: flex; flex-direction: column; gap: 8px; animation: reading-in 360ms var(--pd-ease); }
.coll-list-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 0 2px 4px; }
.coll-list-name { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; color: var(--text-main); }
.coll-list-n { font-family: var(--font-ui); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.mini-card { display: block; width: 100%; box-sizing: border-box; text-align: left; font: inherit; cursor: pointer;
  padding: 10px 13px; color: var(--text-main);
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 70%), var(--pd-panel);
  border: 1px solid var(--pd-hair); border-left: 3px solid var(--pd-gold-hair); border-radius: 10px;
  transition: border-color 200ms ease, background 200ms ease, transform 260ms var(--pd-ease); }
.mini-card:hover { border-left-color: var(--gold); transform: translateX(3px); }
.mini-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.mini-card.is-active { border-color: var(--gold); border-left-color: var(--gold); background: color-mix(in srgb, var(--gold) 9%, var(--pd-panel)); }
.mini-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.mini-ref { font-family: var(--font-ui); font-size: .8rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.mini-book { font-family: var(--font-ui); font-size: .76rem; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.mini-grade { font-family: var(--font-ui); font-size: .66rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap;
  border: 1px solid var(--pd-hair); color: var(--text-muted); }
.mini-score { margin-left: auto; font-family: var(--font-ui); font-size: .72rem; font-weight: 700; }
.mini-snippet { font-size: .84rem; line-height: 1.5; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-snippet.rtl { direction: rtl; text-align: right; font-family: var(--pd-urdu); font-size: 1rem; line-height: 2; }

/* LEVEL 3 — the reading area, fixed on screen while the list scrolls */
.reading-pane { position: sticky; top: 76px; min-width: 0; box-sizing: border-box; padding: 6px;
  max-height: calc(100vh - 146px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--pd-gold-hair) transparent;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 60%), var(--pd-panel);
  border: 1px solid var(--pd-gold-hair); border-radius: 18px; box-shadow: 0 18px 44px rgba(0,0,0,.28); }
.reading-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 220px; padding: 24px; text-align: center; color: var(--text-muted); font-size: .9rem; }
.reading-empty-icon { font-size: 1.9rem; opacity: .6; }
.reading-body { display: none; }
.reading-pane.has-hadith .reading-empty { display: none; }
.reading-pane.has-hadith .reading-body { display: block; }
@keyframes reading-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1100px) {
  .coll-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .result-split { grid-template-columns: 1fr; }
  .reading-pane { position: static; max-height: none; order: -1; }
}
@media (max-width: 900px) {
  .workspace, .workspace.has-results { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rail" "panel" "results"; column-gap: 0; }
  /* the strip lies down as one bar above the results */
  .search-rail { position: static; width: 100%; min-height: 0; flex-direction: row; text-align: left; gap: 10px; padding: 9px 12px; margin-bottom: 14px; }
  .rail-body { flex-direction: row; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
  .rail-label, .rail-query { writing-mode: horizontal-tb; max-height: none; }
}
@media (max-width: 760px) {
  .coll-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   Qur'an & Hadith page — the two panes
   The verse cards, the surah rows and the pane itself take the
   same quiet panel as the hadith cards beside them, in every theme.
   ============================================================ */
.corpus-pane { background: var(--pd-panel); border: 1px solid var(--pd-hair); border-radius: 18px; box-shadow: 0 14px 34px rgba(0,0,0,.2); }
.corpus-pane .pane-head { background: linear-gradient(180deg, rgba(255,255,255,.06), transparent), var(--pd-panel); }
.corpus-pane.pane-expanded .pane-head { border-bottom-color: var(--pd-hair); }
.corpus-pane .pane-title { font-family: var(--font-display); font-weight: 600; }
.corpus-pane .tree-head { background: rgba(255,255,255,.045); border-color: var(--pd-hair); }
.corpus-pane .tree-head:hover, .corpus-pane .tree-head[aria-expanded="true"] { border-color: var(--pd-gold-hair); }
.corpus-pane .result-card { background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 70%), var(--pd-panel); border: 1px solid var(--pd-hair); }
.corpus-pane .result-card:hover { border-color: var(--pd-gold-hair); }
.search-panel { background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 60%), var(--pd-panel); border-color: var(--pd-hair); }

/* the line under a list of results: how to get better ones */
.refine-note { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 14px 2px 4px; padding: 11px 14px;
  border: 1px dashed var(--pd-gold-hair); border-radius: 12px; background: rgba(255,255,255,.03);
  font-family: var(--font-body); font-size: .95rem; line-height: 1.5; color: var(--text-muted); }
.refine-note b { color: var(--text-main); font-weight: 600; }
.refine-note span { flex: 1 1 16rem; min-width: 0; }
.refine-btn { flex-shrink: 0; cursor: pointer; font-family: var(--font-ui); font-size: .8rem; font-weight: 700; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--pd-gold-hair); background: transparent; color: var(--gold); transition: background .25s, border-color .25s; }
.refine-btn:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); border-color: var(--gold); }
