/* Hadith library: browse, search, read and learn. Uses the site's own surfaces and green. */

/* Hero: the shared light page hero (layout.css) in the Learn area's violet. */
.hd-hero { color: var(--ip-ink); }
.hd-hero h1 { font-size: clamp(2rem, 1.35rem + 2.4vw, 3.1rem) !important; line-height: 1.1; }
.hd-hero .hd-hero-sub { max-width: 44rem; margin-inline: auto; font-size: 1.06rem !important; line-height: 1.65; }
.hd-hero .breadcrumb-item, .hd-hero .breadcrumb-item a { color: var(--ip-ink-2); text-decoration: none; }
.hd-hero .breadcrumb-item a:hover { color: var(--ip-area-strong); text-decoration: underline; }
.hd-hero .breadcrumb-item.active { color: var(--ip-ink); font-weight: 600; }
.hd-hero .breadcrumb-item + .breadcrumb-item::before { color: var(--ip-line-strong); }
.hd-hero .text-white { color: var(--ip-area-strong) !important; }
.hd-hero .hd-progress { background: var(--ip-area-tint) !important; }
.hd-hero .hd-progress > span { background: linear-gradient(90deg, var(--ip-area-fill), var(--ip-area)) !important; }
.hd-hero .hd-hero-meta { color: var(--ip-area-strong); font-weight: 600; opacity: 1 !important; }
.hd-search { border: 1px solid var(--ip-line); box-shadow: 0 22px 40px -26px rgba(20, 30, 80, .45), 0 0 0 6px color-mix(in srgb, var(--ip-area) 9%, transparent) !important; }
body.dark .hd-search { background: var(--ip-surface) !important; }
body.dark .hd-search .form-control { background: transparent; color: var(--ip-ink); }

.hd-search { max-width: 640px; }
.hd-search input { min-width: 0; }

.hd-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.hd-quick a { padding: .35rem .9rem; border: 1px solid var(--ip-line); border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--ip-ink-2); background: color-mix(in srgb, var(--ip-surface) 80%, transparent); text-decoration: none; transition: border-color .2s, color .2s, transform .2s var(--ip-ease); }
.hd-quick a:hover { border-color: var(--ip-area); color: var(--ip-area-strong); transform: translateY(-1px); }

/* Topic tiles */
.hd-topic { display: flex; gap: .875rem; align-items: flex-start; height: 100%; padding: 1.125rem; border-radius: 1rem; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.hd-topic:hover { transform: translateY(-2px); box-shadow: 0 10px 28px color-mix(in srgb, var(--ip-area-fill) 12%, transparent); border-color: var(--ip-area) !important; }
.hd-topic-icon { flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; background: var(--ip-area-soft); color: var(--ip-area-strong); }
.hd-topic.is-blue .hd-topic-icon { background: #e8f0fe; color: #1a56c4; }
.hd-topic.is-purple .hd-topic-icon { background: #f1eafd; color: #6b3fc4; }
.hd-topic.is-orange .hd-topic-icon { background: #fff1e0; color: #b45f06; }
.hd-topic.is-teal .hd-topic-icon { background: #e1f6f6; color: #0b7a7a; }
.hd-topic.is-red .hd-topic-icon { background: #fdeaea; color: #b3261e; }
.hd-topic-title { font-weight: 600; font-size: .9375rem; margin-bottom: .125rem; }
.hd-topic-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", serif; font-size: 1rem; opacity: .75; }
.hd-topic-count { font-size: .75rem; }

/* Book cards */
.hd-book { display: block; height: 100%; padding: 1.375rem; border-radius: 1.125rem; text-decoration: none; position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.hd-book:hover { transform: translateY(-2px); box-shadow: 0 10px 28px color-mix(in srgb, var(--ip-area-fill) 12%, transparent); }
.hd-book-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", serif; font-size: 1.375rem; color: var(--ip-area-strong); line-height: 1.6; }
.hd-book.is-empty { opacity: .62; }

/* Filter rail */
.hd-filter-title { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-bottom: .5rem; }
.hd-filter-list { list-style: none; margin: 0 0 1.25rem; padding: 0; max-height: 19rem; overflow-y: auto; }
.hd-filter-list a { display: flex; justify-content: space-between; gap: .5rem; padding: .375rem .625rem; border-radius: .5rem; font-size: .875rem; text-decoration: none; color: inherit; }
.hd-filter-list a:hover { background: var(--ip-area-soft); color: var(--ip-area-strong); }
.hd-filter-list a.active { background: var(--ip-area-fill); color: #fff; font-weight: 600; }
.hd-filter-list a.active small { color: rgba(255, 255, 255, .94) !important; }

.hd-active-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.hd-active-filters a { display: inline-flex; align-items: center; gap: .375rem; padding: .25rem .625rem; border-radius: 999px; font-size: .8125rem; background: var(--ip-area-soft); color: var(--ip-area-strong); text-decoration: none; }
.hd-active-filters a:hover { background: var(--ip-area-tint); }

/* Hadith card in a list */
.hd-card { border-radius: 1.125rem; padding: 1.375rem; margin-bottom: 1rem; transition: box-shadow .18s ease, border-color .18s ease; }
.hd-card:hover { box-shadow: 0 8px 24px color-mix(in srgb, var(--ip-area-fill) 10%, transparent); border-color: var(--ip-area) !important; }
.hd-number { flex: 0 0 auto; min-width: 2.75rem; height: 2.75rem; padding: 0 .5rem; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--ip-area-soft); color: var(--ip-area-strong); }
.hd-card-title { font-size: 1.0625rem; font-weight: 600; margin: 0; }
.hd-card-title a { color: inherit; text-decoration: none; }
.hd-card-title a:hover { color: var(--ip-area-strong); }
.hd-excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hd-source { font-size: .8125rem; }
.hd-tag { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 500; background: #f1f3f5; color: #495057; text-decoration: none; }
.hd-tag:hover { background: var(--ip-area-soft); color: var(--ip-area-strong); }
.hd-grade { font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--ip-area-soft); color: var(--ip-area-strong); }
.hd-grade.is-hasan { background: #fff4db; color: #8a5a00; }
.hd-grade.is-daif { background: #fdeaea; color: #b3261e; }
.hd-stage { font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: #e8f0fe; color: #1a56c4; }
.hd-stage.is-memorised { background: var(--ip-area-fill); color: #fff; }

/* The reading page */
.hd-reader { border-radius: 1.25rem; padding: 2rem; }
.hd-arabic { font-family: "Amiri", "Noto Naskh Arabic", "Scheherazade New", serif; font-size: var(--hd-arabic-size, 1.75rem); line-height: 2.3; text-align: right; direction: rtl; color: var(--ip-ink); }
.hd-translation { font-size: var(--hd-english-size, 1.0625rem); line-height: 1.85; }
.hd-translation a { font-weight: 600; white-space: nowrap; }
.hd-divider { border: 0; height: 1px; background: linear-gradient(90deg, transparent, #c9a24a, transparent); margin: 1.75rem 0; opacity: .6; }

/* English / Arabic / Both: one switch, remembered between visits. */
.hd-view { display: inline-flex; padding: .25rem; border-radius: .75rem; background: #eef2f1; gap: .25rem; }
.hd-view button { border: 0; background: transparent; padding: .375rem .875rem; border-radius: .5625rem; font-size: .875rem; font-weight: 600; color: #5c6f69; }
.hd-view button[aria-pressed="true"] { background: #fff; color: var(--ip-area-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
[data-hd-view="english"] .hd-only-arabic, [data-hd-view="arabic"] .hd-only-english { display: none; }

.hd-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hd-tool { border: 1px solid #dfe5e3; background: transparent; border-radius: .625rem; padding: .375rem .625rem; font-size: .875rem; color: inherit; line-height: 1.2; }
.hd-tool:hover { border-color: var(--ip-area-fill); color: var(--ip-area-strong); }
.hd-tool.is-on { background: var(--ip-area-fill); border-color: var(--ip-area-fill); color: #fff; }

.hd-reference { border-inline-start: 4px solid #c9a24a; border-radius: .75rem; padding: 1rem 1.25rem; background: #fdf8ec; color: #4a3a12; }
.hd-reference dt { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; opacity: .75; }
.hd-reference dd { margin-bottom: .625rem; font-weight: 500; }
.hd-reference dd:last-child { margin-bottom: 0; }

/* Learning stages */
.hd-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.hd-stage-btn { border: 1.5px solid #dfe5e3; background: transparent; border-radius: .875rem; padding: .75rem .5rem; text-align: center; color: inherit; transition: border-color .15s ease, background-color .15s ease; }
.hd-stage-btn i { display: block; font-size: 1.25rem; margin-bottom: .25rem; color: var(--ip-muted); }
.hd-stage-btn span { font-size: .8125rem; font-weight: 600; }
.hd-stage-btn:hover { border-color: var(--ip-area-fill); }
.hd-stage-btn.is-done { border-color: var(--ip-area-fill); background: var(--ip-area-soft); }
.hd-stage-btn.is-done i { color: var(--ip-area-strong); }
.hd-stage-btn.is-current { background: var(--ip-area-fill); border-color: var(--ip-area-fill); color: #fff; }
.hd-stage-btn.is-current i { color: #fff; }

.hd-pager { display: flex; justify-content: space-between; gap: 1rem; }
.hd-pager a { flex: 1 1 0; min-width: 0; padding: 1rem 1.25rem; border-radius: 1rem; text-decoration: none; color: inherit; }
.hd-pager a:hover { border-color: var(--ip-area-fill) !important; }
.hd-pager small { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.hd-pager strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hd-progress { height: .5rem; border-radius: 999px; background: #e6ecea; overflow: hidden; }
.hd-progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--ip-area-fill), var(--ip-area)); }

.hd-stat { border-radius: 1rem; padding: 1rem 1.125rem; height: 100%; }
.hd-stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1.1; color: var(--ip-area-strong); }

.hd-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); padding: .75rem 1.25rem; border-radius: .75rem; background: var(--ip-area-deep); color: #fff; font-size: .9375rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 1080; max-width: calc(100vw - 2rem); }
.hd-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.hd-toast.is-error { background: #8c1d18; }

/* Hadith shown inside a course lesson */
.hadith-lesson-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", serif; font-size: 1.625rem; line-height: 2.2; text-align: right; }
.hadith-lesson-translation { border-inline-start: 4px solid var(--ip-area-fill); padding-block: .25rem .25rem; padding-inline: 1rem 0; margin: 1rem 0; font-size: 1.0625rem; line-height: 1.8; }
.hadith-lesson-verse { border-radius: .75rem; padding: 1rem 1.25rem; margin: .75rem 0; background: #fdf8ec; }
.hadith-lesson-verse .hadith-lesson-arabic { font-size: 1.375rem; margin-bottom: .5rem; }

@media (max-width: 575.98px) {
    .hd-reader { padding: 1.25rem; }
    .hd-arabic { font-size: var(--hd-arabic-size, 1.5rem); line-height: 2.1; }
    .hd-pager { flex-direction: column; }
    .hd-stages { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .hd-topic, .hd-book, .hd-card, .hd-toast { transition: none; }
    .hd-topic:hover, .hd-book:hover { transform: none; }
}

@media print {
    .hd-tools, .hd-view, .hd-pager, .hd-learn, header, footer, nav { display: none !important; }
    [data-hd-view] .hd-only-arabic, [data-hd-view] .hd-only-english { display: block !important; }
}

/* ---- Lapis & Saffron polish (2026) ---- */
.hd-topic, .hd-book, .hd-card, .hd-stat, .hd-pager a { border-radius: var(--ip-radius-lg) !important; background: var(--ip-surface); border-color: var(--ip-line) !important; }
.hd-topic:hover, .hd-book:hover { transform: translateY(-3px); box-shadow: var(--ip-shadow-md); }
.hd-topic-icon { border-radius: 14px; }
.hd-book::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--ip-area-soft); opacity: .9; transition: transform .4s var(--ip-ease); }
.hd-book:hover::after { transform: scale(1.25); }
.hd-book > * { position: relative; z-index: 1; }
.hd-reader { border-radius: var(--ip-radius-xl); background: var(--ip-surface); border-color: var(--ip-line) !important; box-shadow: 0 30px 60px -44px rgba(20, 30, 80, .4), var(--ip-shadow-sm) !important; }
.hd-divider { background: linear-gradient(90deg, transparent, var(--ip-saffron-500), transparent); }
.hd-view { background: var(--ip-surface-2); border-radius: var(--ip-radius-pill); }
.hd-view button { border-radius: var(--ip-radius-pill); color: var(--ip-muted); }
.hd-view button[aria-pressed="true"] { background: var(--ip-surface); }
.hd-tool { border-color: var(--ip-line-strong); border-radius: var(--ip-radius-pill); }
.hd-reference { border-inline-start: 4px solid var(--ip-saffron-500); background: var(--ip-saffron-50); color: #4a3200; border-radius: var(--ip-radius); }
body.dark .hd-reference { background: rgba(255, 197, 107, .08); color: var(--ip-ink-2); }
.hd-stage-btn { border-color: var(--ip-line-strong); border-radius: var(--ip-radius); }
.hd-progress { background: var(--ip-surface-3); }
.hd-tag { background: var(--ip-surface-2); color: var(--ip-ink-2); }
.hd-filter-list a { border-radius: 10px; }
.hd-toast { border-radius: var(--ip-radius-pill); }
.hadith-lesson-verse { background: var(--ip-saffron-50); }
body.dark .hadith-lesson-verse { background: rgba(255, 197, 107, .08); }

/* ==============================================================
   Wave 2: the hadith experience in the house deep green. Hero with search as you type and the hadith of
   the day, dense subject and book grids that filter as you type, a folding filter rail on phones,
   share cards on every hadith and rings for progress.
   ============================================================== */
.hd-xhero .qx-title { margin-bottom: .45rem; }
.hd-xhero--compact .qx-title { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); }
.hd-xsearch {
  position: relative;
  display: flex;
  align-items: center;
  gap: .4rem;
  width: min(40rem, 100%);
  margin-top: 1.1rem;
  padding: .3rem;
  padding-inline-start: 2.6rem;
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface);
  box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .55), 0 0 0 5px rgba(255, 255, 255, .08);
}
.hd-xsearch > i { position: absolute; inset-inline-start: 1rem; color: var(--ip-area-strong); }
.hd-xsearch input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ip-ink);
  font-size: .98rem;
}
.hd-xsearch input:focus { outline: none; }
.hd-xsearch:focus-within { box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .55), 0 0 0 5px rgba(230, 184, 92, .45); }
.hd-xsearch .qx-btn { flex-shrink: 0; }

/* Suggestions under the search field */
.hd-suggest {
  position: absolute;
  z-index: 40;
  inset-inline: 0;
  top: calc(100% + .5rem);
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: .4rem;
  border: 1px solid var(--ip-line);
  border-radius: 18px;
  background: var(--ip-surface);
  color: var(--ip-ink);
  box-shadow: var(--ip-shadow-lg);
  text-align: start;
}
.hd-suggest[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .hd-suggest:not([hidden]) { animation: hd-drop .2s var(--ip-ease); }
}
@keyframes hd-drop {
  from { opacity: 0; transform: translateY(-6px); }
}
.hd-suggest__item {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .55rem .6rem;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}
.hd-suggest__item:hover,
.hd-suggest__item[aria-selected="true"] { background: var(--ip-area-soft); color: inherit; }
.hd-suggest__item .hd-number { min-width: 2.3rem; height: 2.3rem; font-size: .8rem; }
.hd-suggest__body { display: grid; min-width: 0; gap: .05rem; }
.hd-suggest__body strong { font-size: .9rem; }
.hd-suggest__body small { font-size: .74rem; color: var(--ip-muted); }
.hd-suggest__excerpt { font-size: .8rem; color: var(--ip-ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hd-suggest__all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  margin-top: .25rem;
  padding: .55rem;
  border: 0;
  border-radius: 12px;
  background: var(--ip-surface-2);
  color: var(--ip-area-strong);
  font-size: .84rem;
  font-weight: 700;
}
.hd-suggest__all:hover { background: var(--ip-area-soft); }
.hd-suggest__none { margin: 0; padding: .8rem; font-size: .86rem; color: var(--ip-muted); }

.qx-hero .hd-quick { justify-content: flex-start; margin-top: .8rem; }
.qx-hero .hd-quick .qx-chip { min-height: 30px; font-size: .78rem; }

/* Hadith of the day */
.hd-today { display: grid; gap: .55rem; }
.hd-today .qx-glass__title { font-size: 1.05rem; }
.hd-today__ar {
  margin: 0;
  font-family: "Amiri", var(--ip-font-arabic);
  font-size: 1.25rem;
  line-height: 2;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hd-today__en {
  margin: 0;
  font-size: .9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, .85);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hd-today__ref { margin: 0; font-size: .78rem; font-weight: 600; color: #f1d59a; }
.hd-today .qx-actions { margin-top: .2rem; }

/* Continue, and the signed-in reader's progress */
.hd-continue { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; padding: .75rem 1rem; }
.hd-continue[hidden] { display: none; }
.hd-continue__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ip-tile-gold-bg); color: var(--ip-tile-gold-fg); font-size: 1.1rem; }
.hd-continue__text { display: grid; min-width: 0; }
.hd-continue__text small { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ip-muted); }
.hd-continue__text a { font-weight: 700; color: var(--ip-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-continue__text a:hover { color: var(--ip-area-strong); text-decoration: underline; }
.hd-mine { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.4rem; }
.hd-mine__text { flex: 1; min-width: 14rem; }
.hd-mine__stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .4rem 0 0; padding: 0; list-style: none; font-size: .86rem; color: var(--ip-muted); }
.hd-mine__stats strong { color: var(--ip-area-strong); font-size: 1rem; }

/* Subjects */
.hd-topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr));
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hd-topics li[hidden] { display: none; }
.hd-topic { align-items: center; gap: .75rem; padding: .75rem .85rem; border: 1px solid var(--ip-line); border-radius: 16px !important; }
.hd-topic-icon { width: 2.5rem; height: 2.5rem; font-size: 1.1rem; }
.hd-topic-body { flex: 1; min-width: 0; }
.hd-topic-title { font-size: .9rem; color: var(--ip-ink); }
.hd-topic-arabic { font-size: .98rem; color: var(--ip-area-strong); opacity: .9; }
.hd-topic-count {
  flex-shrink: 0;
  min-width: 2.2rem;
  padding: .1rem .45rem;
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface-2);
  color: var(--ip-muted);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.hd-topic:hover .hd-topic-count { background: var(--ip-area-fill); color: #fff; }
.hd-topic-filter { width: min(100%, 15rem); }
.hd-topic-filter input,
.hd-filter-find input { min-height: 38px; font-size: .85rem; }
body.dark .hd-topic.is-blue .hd-topic-icon { background: rgba(108, 182, 255, .14); color: #8cc6ff; }
body.dark .hd-topic.is-purple .hd-topic-icon { background: rgba(169, 139, 255, .15); color: #bfa8ff; }
body.dark .hd-topic.is-orange .hd-topic-icon { background: rgba(255, 197, 107, .14); color: #ffcf85; }
body.dark .hd-topic.is-teal .hd-topic-icon { background: rgba(60, 207, 200, .14); color: #7fe0da; }
body.dark .hd-topic.is-red .hd-topic-icon { background: rgba(255, 140, 140, .14); color: #ff9b9b; }

/* Books */
.hd-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hd-book { padding: 1rem 1.1rem; border: 1px solid var(--ip-line); color: var(--ip-ink); }
.hd-book-arabic { font-size: 1.3rem; line-height: 1.5; }
.hd-book-title { font-weight: 700; font-size: .95rem; color: var(--ip-ink); }
.hd-book-compiler { font-size: .8rem; color: var(--ip-muted); margin-bottom: .45rem; }
.hd-book-count { display: inline-block; padding: .12rem .55rem; border-radius: var(--ip-radius-pill); background: var(--ip-area-soft); color: var(--ip-area-strong); font-size: .74rem; font-weight: 700; }
.hd-book-count.is-soon { background: var(--ip-surface-2); color: var(--ip-muted); }

/* Path and "a good place to begin" side by side */
.hd-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 992px) {
  .hd-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}
.hd-path {
  background:
    radial-gradient(70% 90% at 100% 0%, color-mix(in srgb, var(--ip-violet-500) 12%, transparent), transparent 70%),
    var(--ip-surface);
}
.hd-path p { color: var(--ip-ink-2); font-size: .92rem; line-height: 1.6; }
.hd-path__badge { margin-bottom: .55rem; border-color: color-mix(in srgb, var(--ip-violet-500) 35%, transparent); background: var(--ip-tile-violet-bg); color: var(--ip-tile-violet-fg); }
.hd-path__steps { display: flex; flex-wrap: wrap; gap: .45rem; margin: .2rem 0 0; padding: 0; list-style: none; counter-reset: hd-step; }
.hd-path__steps li {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface-2);
  font-size: .82rem;
  font-weight: 600;
  color: var(--ip-ink-2);
}
.hd-path__steps li i { color: var(--ip-area-strong); }
.hd-begin__list { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.hd-begin__list a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem .55rem;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: background-color .2s var(--ip-ease);
}
.hd-begin__list a:hover { background: var(--ip-area-soft); }
.hd-begin__list .hd-number { min-width: 2.3rem; height: 2.3rem; font-size: .8rem; }
.hd-begin__text { display: grid; min-width: 0; flex: 1; }
.hd-begin__text strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-begin__text small { font-size: .76rem; color: var(--ip-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-begin__go { color: var(--ip-area-strong); transition: transform .25s var(--ip-ease); }
.hd-begin__list a:hover .hd-begin__go { transform: translateX(3px); }
[dir="rtl"] .hd-begin__go,
[dir="rtl"] .hd-card-go .bi-arrow-right { transform: scaleX(-1); }

/* Hadith cards */
.hd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: .75rem; }
.hd-cards .hd-card { margin-bottom: 0; }
.hd-card { position: relative; padding: 1.05rem 1.15rem; border: 1px solid var(--ip-line); background: var(--ip-surface); box-shadow: var(--ip-shadow-sm); margin-bottom: .75rem; }
.hd-card:hover { box-shadow: var(--ip-shadow-md); }
.hd-card::before {
  content: "";
  position: absolute;
  inset-block: 14px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--ip-saffron-500), var(--ip-area));
  opacity: 0;
  transition: opacity .2s var(--ip-ease);
}
.hd-card:hover::before { opacity: 1; }
.hd-card-book { font-size: .76rem; color: var(--ip-muted); }
.hd-card-title { font-size: 1rem; }
.hd-excerpt { margin-bottom: .55rem; font-size: .92rem; line-height: 1.6; color: var(--ip-ink-2); }
.hd-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.hd-source { color: var(--ip-muted); }
.hd-card-actions { display: inline-flex; align-items: center; gap: .35rem; margin-inline-start: auto; }
.hd-card-share {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--ip-line-strong);
  border-radius: 50%;
  background: var(--ip-surface);
  color: var(--ip-ink-2);
  transition: background-color .2s, color .2s, border-color .2s;
}
.hd-card-share:hover { border-color: var(--ip-area); color: var(--ip-area-strong); background: var(--ip-area-soft); }
.hd-card-go { font-size: .85rem; font-weight: 700; color: var(--ip-area-strong); text-decoration: none; }
.hd-card-go:hover { text-decoration: underline; }
.hd-review { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.hd-review.is-done { opacity: .5; }

/* Results with the filter rail */
.hd-results-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 992px) {
  .hd-results-layout { grid-template-columns: 270px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
  .hd-rail { position: sticky; top: calc(var(--ip-header-h) + 1rem); }
}
.hd-filters { padding: .5rem; }
.hd-filters__summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .55rem;
  border-radius: 12px;
  font-weight: 700;
  color: var(--ip-ink);
  list-style: none;
  cursor: pointer;
}
.hd-filters__summary::-webkit-details-marker { display: none; }
.hd-filters__summary:hover { background: var(--ip-surface-2); }
.hd-filters__chev { margin-inline-start: auto; transition: transform .25s var(--ip-ease); }
.hd-filters[open] .hd-filters__chev { transform: rotate(180deg); }
.hd-filters__body { padding: .5rem .45rem .35rem; }
@media (min-width: 992px) {
  .hd-filters__body { max-height: calc(100vh - var(--ip-header-h) - 6rem); overflow-y: auto; scrollbar-width: thin; }
}
.hd-filter-title { margin-top: .4rem; font-size: .7rem; color: var(--ip-muted); }
.hd-filter-list { margin-bottom: .9rem; max-height: 15rem; }
.hd-filter-list li[hidden] { display: none; }
.hd-filter-list a { padding: .32rem .55rem; font-size: .84rem; color: var(--ip-ink-2); }
.hd-filter-list small { color: var(--ip-muted); font-variant-numeric: tabular-nums; }
.hd-filter-list--chips { display: flex; flex-wrap: wrap; gap: .3rem; max-height: none; }
.hd-filter-list--chips a { border: 1px solid var(--ip-line); border-radius: var(--ip-radius-pill); }
.hd-filter-find { margin-bottom: .45rem; }
.hd-results__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .8rem; color: var(--ip-muted); }
.hd-results__bar strong { color: var(--ip-ink); }
.hd-noresults { padding: 2.25rem 1rem; background: var(--ip-surface); }
.hd-noresults h2 { color: var(--ip-ink); margin: .2rem 0 0; }
.hd-pages { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: 1rem; }
.hd-pages__where { font-size: .85rem; font-weight: 700; color: var(--ip-muted); font-variant-numeric: tabular-nums; }
.hd-attribution { margin: 1.1rem 0 0; padding: .8rem 1rem; border-radius: 14px; background: var(--ip-surface-2); font-size: .82rem; color: var(--ip-ink-2); }

/* The jump box and other subjects on the hero */
.hd-jump__form { display: flex; gap: .4rem; }
.hd-jump__form input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: .35rem .8rem;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-weight: 600;
}
.hd-jump__form input::placeholder { color: rgba(255, 255, 255, .6); }
.hd-jump__form input:focus { outline: none; border-color: #f1d59a; box-shadow: 0 0 0 3px rgba(230, 184, 92, .3); }
.hd-jump .qx-glass__text { margin-top: .55rem; }
.hd-jump .qx-glass__text strong { color: #fff; }
.hd-jump__chips { display: flex; flex-wrap: wrap; gap: .35rem; }

/* The reading page */
.hd-place { display: flex; align-items: center; gap: 1rem; }
.hd-place .qx-glass__label { margin-bottom: .2rem; }
.hd-place__nav { display: flex; gap: .4rem; margin-top: .6rem; }
.hd-detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 992px) {
  .hd-detail { grid-template-columns: minmax(0, 1fr) 340px; gap: 1.4rem; align-items: start; }
  .hd-detail__side { position: sticky; top: calc(var(--ip-header-h) + 1rem); }
}
.hd-reader { margin-bottom: 1rem; padding: clamp(1.1rem, .8rem + 1.2vw, 2rem); border: 1px solid var(--ip-line); }
.hd-reader__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1.4rem; }
.hd-tool { display: inline-flex; align-items: center; gap: .3rem; min-height: 36px; padding: .3rem .7rem; color: var(--ip-ink-2); }
.hd-arabic { font-family: "Amiri", "Noto Naskh Arabic", var(--ip-font-arabic); }
.hd-verse-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-block: .15rem .15rem; margin-inline: 0 .25rem;
  padding: .2rem .7rem;
  border: 1px solid color-mix(in srgb, var(--ip-area) 45%, transparent);
  border-radius: var(--ip-radius-pill);
  color: var(--ip-area-strong);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}
.hd-verse-link:hover { background: var(--ip-area-fill); color: #fff; }
.hd-explain h2 i { color: var(--ip-saffron-600); }
.hd-pager a { border: 1px solid var(--ip-line); box-shadow: var(--ip-shadow-sm); transition: transform .2s var(--ip-ease), box-shadow .2s var(--ip-ease); }
.hd-pager a:hover { transform: translateY(-2px); box-shadow: var(--ip-shadow-md); }
.hd-pager small { color: var(--ip-muted); }
.hd-tip { text-align: center; font-size: .8rem; color: var(--ip-muted); }
.hd-related { display: grid; gap: .2rem; margin: 0; padding: 0; list-style: none; }
.hd-related a { display: flex; gap: .7rem; align-items: center; padding: .45rem .4rem; border-radius: 12px; color: inherit; text-decoration: none; }
.hd-related a:hover { background: var(--ip-area-soft); }
.hd-related .hd-number { min-width: 2.2rem; height: 2.2rem; font-size: .78rem; }
.hd-stage-btn { min-height: 64px; }
.hd-stage-btn.is-current { box-shadow: 0 10px 22px -14px rgba(16, 80, 58, .9); }

/* My Hadith */
.hd-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 0 0 1rem; padding: 0; list-style: none; }
@media (min-width: 992px) {
  .hd-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.hd-stat { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--ip-line); background: var(--ip-surface); box-shadow: var(--ip-shadow-sm); }
.hd-stat-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 13px; background: var(--qx-tile-bg); color: var(--qx-tile-fg); font-size: 1.15rem; }
.hd-stat-value { display: block; font-size: 1.5rem; }
.hd-stat-label { display: block; font-size: .8rem; color: var(--ip-muted); }

@media (max-width: 575.98px) {
  .hd-xsearch .qx-btn { padding-inline: .8rem; }
  .qx-hero .hd-quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: .1rem; }
  .qx-hero .hd-quick::-webkit-scrollbar { display: none; }
  .qx-hero .hd-quick .qx-chip { flex-shrink: 0; }
  .hd-today__ar { -webkit-line-clamp: 2; font-size: 1.1rem; }
  .hd-today__en { -webkit-line-clamp: 3; }
  .hd-card { padding: .9rem; }
  .hd-card .d-flex.gap-3 { gap: .7rem !important; }
  .hd-card .hd-number { min-width: 2.3rem; height: 2.3rem; font-size: .8rem; }
  .hd-card-actions { margin-inline-start: 0; width: 100%; justify-content: space-between; }
}
@media print {
  .hd-detail__side,
  .hd-tip { display: none !important; }
}
/* Suggestions sit above the area strip while they are open. */
.hd-xhero { overflow-x: clip; overflow-y: visible; }
.hd-xhero:has(.hd-suggest:not([hidden])) { z-index: 6; }
.qx-title-ar { display: inline-block; }

/* Subject tiles: one compact row each */
.hd-topics { grid-template-columns: repeat(auto-fill, minmax(min(100%, 265px), 1fr)); }
.hd-topic { padding: .6rem .75rem; min-height: 64px; }
.hd-topic-title { line-height: 1.3; }
.hd-topic-arabic { display: inline-block !important; max-width: 100%; font-size: .92rem; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-more { display: none; }
@media (max-width: 575.98px) {
  .hd-topics.is-clamped > li:nth-child(n + 9) { display: none; }
  .hd-more { display: flex; justify-content: center; margin-top: .6rem; }
}
.hd-more[hidden] { display: none !important; }
@media (max-width: 575.98px) {
  .hd-jump--topics { display: none; }
}
.hd-topic-arabic { font-family: var(--ip-font-arabic); line-height: 1.35; }
.hd-topic { min-height: 0; }

/* The books not yet stored: named in one quiet line under the shelf, not offered as cards. */
.hd-books-later { margin: .75rem 0 0; font-size: .875rem; color: var(--ip-muted); display: flex; gap: .4rem; align-items: baseline; }
