/* ─── Ḥadīth.ilmgage — shares the Books.ilmgage design system ─── */

:root {
  --paper: #faf7f1;
  --paper-raised: #ffffff;
  --ink: #2b2620;
  --ink-soft: #6b6257;
  --ink-faint: #9a9084;
  --accent: #1e6f5c;        /* deep green */
  --accent-soft: #e4efeb;
  --gold: #b28a3e;
  --gold-soft: #f3ead8;
  --rule: #e6dfd3;
  --shadow: 0 1px 3px rgba(60, 50, 30, 0.08), 0 8px 24px rgba(60, 50, 30, 0.06);
  --font-ar: "Amiri", "Scheherazade New", "Noto Naskh Arabic", "Geeza Pro", serif;
  --font-ar-quran: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  --font-en: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-en);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Top bar ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 241, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .brand-ar {
  font-family: var(--font-ar);
  font-size: 1.25rem;
  color: var(--accent);
  margin-inline-start: 0.35rem;
}
.brand small {
  display: block;
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar-links {
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.88rem;
}
.topbar-links a { color: var(--ink-soft); font-weight: 500; }
.topbar-links a:hover { color: var(--accent); text-decoration: none; }
.topbar-links a.current { color: var(--accent); font-weight: 600; }

.sec-nav {
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  min-width: 0;
}
.sec-nav .navbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.sec-nav .navbtn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.sec-nav .navbtn.disabled { opacity: 0.3; pointer-events: none; }
.sec-nav .loc {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
.sec-nav .loc a { color: var(--ink); }

/* ─── Section hero (reader) ─── */
.sec-hero {
  max-width: 900px;
  margin: 2.5rem auto 0;
  padding: 0 1.25rem;
  text-align: center;
}
.sec-hero .book-kicker {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-weight: 600;
}
.sec-hero .book-kicker a { color: var(--gold); }
.sec-hero .book-kicker .ar {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  letter-spacing: 0;
  text-transform: none;
  margin-inline-start: 0.4rem;
}
.sec-hero .sec-title-ar {
  font-family: var(--font-ar);
  font-size: 2.3rem;
  line-height: 1.8;
  direction: rtl;
  color: var(--ink);
  margin: 1.1rem 0 0.2rem;
}
.sec-hero .sec-title-en {
  font-family: var(--font-ui);
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.sec-hero .sec-source {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}
.hero-rule {
  width: 72px;
  height: 3px;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  margin: 1.8rem auto 0;
}

/* ─── Reader toolbar ─── */
.toolbar {
  max-width: 1200px;
  margin: 1.6rem auto 0.4rem;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.toolbar-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}
.toolbar-switches { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.switch {
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 0.2rem 0;
}
.switch .switch-ar { font-family: var(--font-ar); font-size: 1rem; }
.switch-track {
  width: 2.1rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--rule);
  position: relative;
  transition: background 0.18s ease;
  flex-shrink: 0;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform 0.18s ease;
}
.switch.on .switch-track { background: var(--accent); }
.switch.on .switch-thumb { transform: translateX(0.95rem); }

/* ─── Reading card: two aligned columns ─── */
.reader {
  max-width: 1200px;
  margin: 1.2rem auto 3rem;
  padding: 0 1.25rem;
}
.text-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 0;
}
.pair + .pair .cell { border-top: 1px dashed var(--rule); }
.cell { padding: 1.05rem 1.5rem; }
.cell.en {
  order: 1;
  font-family: var(--font-en);
  font-size: 0.99rem;
  line-height: 1.75;
  color: var(--ink);
  border-inline-end: 1px solid var(--rule);
}
.cell.ar {
  order: 2;
  direction: rtl;
  text-align: right;
  font-family: var(--font-ar);
  font-size: 1.42rem;
  line-height: 2.1;
  color: var(--ink);
}
.pair:hover .cell { background: #fdfbf6; }
.cell .pnum {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.35rem;
}

/* sub-headings inside a section */
.pair.heading .cell { background: var(--gold-soft); border-top: 1px solid var(--rule) !important; }
.pair.heading .cell.ar { font-size: 1.55rem; font-weight: 700; }
.pair.heading .cell.en { font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem; color: var(--ink-soft); }
/* Qurʾān quotations */
.pair.verse .cell.ar { font-family: var(--font-ar-quran); font-size: 1.5rem; color: #3c5a2a; }
.pair.verse .cell.en { font-style: italic; }
/* poetry: hemistichs on one line */
.pair.poetry .cell.ar { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.pair.poetry .cell.ar .hemi { flex: 1 1 40%; }
.pair.poetry .cell.ar .hemi + .hemi { text-align: left; }
.pair.poetry .hemi-sep { color: var(--gold); }
.pair.poetry .cell.en { font-style: italic; color: var(--ink-soft); }
/* footnotes / editorial notes */
.pair.note .cell { font-size: 0.85em; color: var(--ink-soft); }
.pair.note .cell.ar { font-size: 1.15rem; line-height: 1.9; }

/* Arabic-only practice mode: hide English, let Arabic span the card */
.reader.hide-en .cell.en { display: none; }
.reader.hide-en .pair { grid-template-columns: 1fr; }

/* status */
.status-note {
  font-family: var(--font-ui);
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.9rem;
  padding: 3rem 1rem;
}
.spin {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -0.2rem;
  margin-inline-end: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* prev / next at the foot of a section */
.pager {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.pager a {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper-raised);
  color: var(--ink);
  max-width: 48%;
  transition: all 0.15s ease;
}
.pager a:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.pager a .k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gold); font-weight: 700; }
.pager a .t-ar { font-family: var(--font-ar); font-size: 1.15rem; direction: rtl; }
.pager a.next { margin-inline-start: auto; text-align: end; align-items: flex-end; }
.pager a .t-ar { text-align: inherit; }

/* ─── Landing / library ─── */
.landing {
  max-width: 1000px;
  margin: 4rem auto;
  padding: 0 1.25rem;
  text-align: center;
}
.landing h1 {
  font-family: var(--font-ar);
  font-size: 3rem;
  color: var(--accent);
  font-weight: 400;
}
.landing .tagline {
  font-family: var(--font-ui);
  color: var(--ink-soft);
  margin: 0.8rem 0 2.5rem;
  font-size: 1.02rem;
}
.lib-heading {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin: 2.4rem 0 0.9rem;
  text-align: left;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.1rem;
  text-align: start;
}
.book-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.3rem 1.4rem 1.1rem;
  box-shadow: var(--shadow);
  transition: all 0.16s ease;
  color: var(--ink);
}
.book-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.book-card .b-ar {
  font-family: var(--font-ar);
  direction: rtl;
  text-align: right;
  font-size: 1.75rem;
  line-height: 1.6;
}
.book-card .b-en {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
}
.book-card .b-author {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.book-card .b-author .ar { font-family: var(--font-ar); font-size: 1.05rem; margin-inline-start: 0.3rem; }
.book-card .b-blurb {
  font-family: var(--font-en);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}
.book-card .b-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.level {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.level.beginner { background: #e4efeb; color: #1e6f5c; }
.level.intermediate { background: #f3ead8; color: #8a6a2a; }
.level.advanced { background: #ece4f3; color: #5a3f7a; }
.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent)); }

/* recents */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  text-align: start;
  direction: rtl;
}
.recent-card {
  display: block;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
  transition: all 0.16s ease;
  color: var(--ink);
}
.recent-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.recent-card .k {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  direction: ltr;
  display: block;
  text-align: right;
}
.recent-card .t { font-family: var(--font-ar); font-size: 1.3rem; line-height: 1.8; display: block; }

/* ─── Book page: header + table of contents ─── */
.book-head { text-align: center; margin-top: 1.5rem; }
.book-head .back { font-family: var(--font-ui); font-size: 0.85rem; display: inline-block; margin-bottom: 1rem; }
.book-head .b-title-ar { font-family: var(--font-ar); font-size: 2.6rem; color: var(--ink); direction: rtl; line-height: 1.6; }
.book-head .b-title-en { font-family: var(--font-ui); color: var(--ink-soft); font-size: 1rem; margin-top: 0.2rem; }
.book-head .b-author { font-family: var(--font-ui); color: var(--ink-faint); font-size: 0.85rem; margin-top: 0.4rem; }
.book-head .b-author .ar { font-family: var(--font-ar); font-size: 1.1rem; }
.book-about {
  max-width: 760px;
  margin: 1.6rem auto 0;
  text-align: start;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.2rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
.book-about p + p { margin-top: 0.7rem; }
.book-about strong { color: var(--ink); }

.toc { max-width: 760px; margin: 2rem auto 0; text-align: start; }
.toc-part {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin: 2rem 0 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.toc-part .ar { font-family: var(--font-ar); font-size: 1.25rem; letter-spacing: 0; text-transform: none; color: var(--ink); }
.toc-list { display: flex; flex-direction: column; gap: 0.45rem; }
.toc-item {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  column-gap: 0.8rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  color: var(--ink);
  transition: all 0.15s ease;
}
a.toc-item:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.toc-item.off { opacity: 0.5; }
.toc-item .n {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 8px;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toc-item .names { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.toc-item .t-ar { font-family: var(--font-ar); font-size: 1.25rem; direction: rtl; text-align: right; }
.toc-item .t-en { font-family: var(--font-ui); font-size: 0.74rem; color: var(--ink-faint); }
.toc-item .pg { font-family: var(--font-ui); font-size: 0.68rem; color: var(--ink-faint); white-space: nowrap; }
.toc-item.ready .pg { color: var(--accent); font-weight: 600; }

/* ─── Footer ─── */
.site-footer {
  max-width: 900px;
  margin: 0 auto 3rem;
  padding: 1.4rem 1.25rem 0;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.7;
}
.site-footer p { margin-bottom: 0.4rem; }
.site-footer strong { color: var(--ink-soft); }


/* ─── Qurʾān and ḥadīth inside the text ─── */
:root {
  --quran: #1f6a3a;          /* Qurʾān: deep green */
  --quran-soft: #e7f2ea;
  --hadith: #8a3d24;         /* ḥadīth: warm maroon */
  --hadith-soft: #f7ebe4;
}
.qr { color: var(--quran); }
.cell.ar .qr { font-family: var(--font-ar-quran); }
.cell.en .qr { font-style: italic; }
.qref {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--quran);
  background: var(--quran-soft);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  margin-inline-start: 0.2rem;
  vertical-align: 0.35em;
  white-space: nowrap;
}
.qref:hover { text-decoration: none; filter: brightness(0.95); }
.pair.quran-block .cell { text-align: center; background: linear-gradient(var(--quran-soft), var(--quran-soft)) padding-box; }
.pair.quran-block .cell.ar { font-size: 1.6rem; }
.hd { color: var(--hadith); background: linear-gradient(transparent 88%, rgba(138, 61, 36, 0.18) 88%); }
.hfn {
  font-family: var(--font-ui);
  font-size: 0.66rem;
  font-weight: 700;
  color: #fff;
  background: var(--hadith);
  border-radius: 999px;
  min-width: 1.15rem;
  height: 1.15rem;
  line-height: 1.15rem;
  display: inline-block;
  text-align: center;
  padding: 0 0.25rem;
  margin-inline-start: 0.15rem;
  cursor: pointer;
  vertical-align: 0.45em;
}
.hfn:hover, .hfn:focus { outline: 2px solid var(--hadith-soft); }

/* grade badges */
.gbadge {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
  background: #eee;
  color: #555;
}
.g-sahih { background: #dcefe2; color: #1f6a3a; }
.g-hasan { background: #e5eef7; color: #245b8a; }
.g-daif { background: #fbeed7; color: #8a5a12; }
.g-very-daif, .g-mawdu { background: #f7e0dc; color: #962f22; }
.g-disputed { background: #efe6f5; color: #6a3d8a; }
.g-unknown { background: #eceae6; color: #6b6257; }

/* footnote popover */
.hpop {
  position: absolute;
  z-index: 80;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(60, 50, 30, 0.18);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink);
}
.hpop-body { padding: 0.9rem 1rem; }
.hpop-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
.hpop-title { font-weight: 600; }
.hpop-sum { margin: 0 0 0.5rem; color: var(--ink-soft); }
.hpop ul { list-style: none; margin: 0 0 0.5rem; }
.hpop li { margin: 0.15rem 0; }
.hpop .gr, .hpop .in, .hnote .in { color: var(--ink-faint); }
.unver { color: #a4691b; font-size: 0.9em; }
.hpop-actions { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; border-top: 1px solid var(--rule); padding-top: 0.55rem; }
.hpop-more { font: inherit; font-weight: 600; color: var(--hadith); background: none; border: 0; cursor: pointer; padding: 0; }

/* notes panel under a row */
.hnotes { grid-column: 1 / -1; order: 3; padding: 0 1.5rem 0.9rem; }
.hnote { border: 1px solid var(--rule); border-radius: 10px; background: #fffdf9; margin-top: 0.4rem; font-family: var(--font-ui); font-size: 0.86rem; }
.hnote summary { cursor: pointer; padding: 0.5rem 0.8rem; color: var(--hadith); font-weight: 600; display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.hnote summary::marker { color: var(--hadith); }
.hnote-n { background: var(--hadith); color: #fff; border-radius: 999px; font-size: 0.66rem; min-width: 1.15rem; text-align: center; padding: 0 0.25rem; }
.hnote-title { color: var(--ink); font-weight: 500; }
.hnote-grade { margin-inline-start: auto; }
.hnote-body { padding: 0.2rem 1rem 0.9rem; line-height: 1.65; color: var(--ink); }
.hnote-body h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); margin: 0.8rem 0 0.25rem; }
.hnote-body ul { margin: 0.2rem 0 0 1.1rem; }
.hnote-body li { margin: 0.25rem 0; }
.hn-grade { display: flex; gap: 0.5rem; align-items: baseline; margin-top: 0.4rem; color: var(--ink-soft); }
.hn-rel { list-style: none; margin-left: 0 !important; }
.hn-rel li { border-top: 1px dashed var(--rule); padding-top: 0.45rem; }
.rel-ar { font-family: var(--font-ar); font-size: 1.15rem; direction: rtl; text-align: right; line-height: 1.9; }
.rel-en { font-family: var(--font-en); color: var(--ink-soft); }
.rel-src { font-size: 0.78rem; color: var(--ink-faint); }
.hn-foot { margin-top: 0.7rem; font-size: 0.8rem; }
.muted { color: var(--ink-faint); }
.reader.hide-en .hnotes { grid-column: 1; }

/* ─── Responsive ─── */
@media (max-width: 720px) {
  .pair { grid-template-columns: 1fr; }
  .cell.ar { order: 1; border-inline-end: none; padding-bottom: 0.4rem; }
  .cell.en { order: 2; border-inline-end: none; padding-top: 0.4rem; color: var(--ink-soft); }
  .pair + .pair .cell.en { border-top: none; }
  .hnotes { padding: 0 0.9rem 0.8rem; }
  .sec-hero .sec-title-ar { font-size: 1.8rem; }
  .topbar-inner { padding: 0.55rem 0.9rem; }
  .brand small { display: none; }
  .sec-nav .loc { max-width: 34vw; }
  .toc-item { grid-template-columns: 2rem 1fr; }
  .toc-item .pg { display: none; }
}

/* ─── Ḥadīth database pages ─── */
.hero { max-width: 1100px; margin: 2.2rem auto 1rem; padding: 0 1.25rem; text-align: center; }
.hero h1 { font-family: var(--font-ui); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.01em; }
.hero h1 .ar { font-family: var(--font-ar); color: var(--hadith); font-weight: 400; margin-inline-start: 0.5rem; }
.hero p { color: var(--ink-soft); max-width: 720px; margin: 0.5rem auto 0; }
.stats { font-family: var(--font-ui); font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.6rem; }
.filters { max-width: 1100px; margin: 0 auto 1rem; padding: 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; font-family: var(--font-ui); font-size: 0.85rem; }
.filters input[type=search] { flex: 1 1 320px; font: inherit; font-size: 0.95rem; padding: 0.6rem 0.9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-raised); }
.filters select { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-raised); color: var(--ink); max-width: 14rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { font: inherit; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--rule); background: var(--paper-raised); color: var(--ink-soft); border-radius: 999px; padding: 0.25rem 0.7rem; cursor: pointer; }
.chip.on { border-color: transparent; }
.results { max-width: 1100px; margin: 0 auto 3rem; padding: 0 1.25rem; display: grid; gap: 0.7rem; }
.hcard { display: block; background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 12px; padding: 0.85rem 1.1rem; color: var(--ink); box-shadow: var(--shadow); }
.hcard:hover { text-decoration: none; border-color: #d9cdb8; }
.hcard-top { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; font-family: var(--font-ui); }
.hcard-title { font-weight: 600; font-size: 0.98rem; }
.hcard-src { margin-inline-start: auto; font-size: 0.75rem; color: var(--ink-faint); }
.hcard-ar { font-family: var(--font-ar); font-size: 1.2rem; direction: rtl; text-align: right; line-height: 1.9; margin-top: 0.3rem; }
.hcard-en { color: var(--ink-soft); font-size: 0.92rem; }
.hcard-meta { font-family: var(--font-ui); font-size: 0.72rem; color: var(--ink-faint); margin-top: 0.3rem; }
.empty { text-align: center; color: var(--ink-faint); font-family: var(--font-ui); padding: 2rem 0; }

/* one ḥadīth */
.hpage { max-width: 1100px; margin: 1.5rem auto 3rem; padding: 0 1.25rem; }
.hpage-head { text-align: center; margin-bottom: 1.2rem; }
.hpage-head h1 { font-family: var(--font-ui); font-size: 1.5rem; }
.hpage-head .narr { color: var(--ink-soft); font-family: var(--font-ui); font-size: 0.9rem; margin-top: 0.2rem; }
.hpage-head .gbadge { font-size: 0.8rem; margin-top: 0.5rem; display: inline-block; }
.panel { background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow); padding: 1.1rem 1.4rem; margin-top: 1rem; font-family: var(--font-ui); font-size: 0.9rem; line-height: 1.65; }
.panel h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); margin-bottom: 0.5rem; }
.panel ul { margin-left: 1.1rem; }
.panel li { margin: 0.3rem 0; }
table.gtab { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.gtab th, table.gtab td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.gtab th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }
.topic-list a { margin-inline-end: 0.4rem; }
.navlink { font-family: var(--font-ui); font-size: 0.85rem; font-weight: 600; }
