/* ==========================================================================
   Hadith page
   ========================================================================== */

.hd-page { position: relative; overflow: hidden; color: var(--ink-700); }

/* Colour coding of quoted speech, brackets, verses… (see _colorize() in hadith.php) */
.c1 { color: #8E6455; }
.c2 { color: #388E3C; }
.c3 { color: #7C7C02; }
.c4 { color: #947721; }
.c5 { color: #B6B6B6; }
.c6 { color: #1976D2; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hd-hero { min-height: 0; }
.hd-hero .page-hero__emblem { top: calc(50% - 110px); }
/* The QR code sits at the inline end, level with the breadcrumb; keep text clear of it */
.hd-hero .page-hero__inner { gap: 12px; padding-bottom: 116px; padding-inline-end: calc(var(--gutter) + 98px); }
.hd-hero__title {
  max-width: 860px;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.5;
  text-wrap: balance;
}
.lang-ar .hd-hero__title { max-width: 920px; font-family: var(--font-display); line-height: 1.45; }
.hd-hero__eyebrow { display: block; margin-bottom: 7px; color: var(--green-600); font-family: var(--font-sans); font-size: 13px; }
.hd-hero__title .note-btn { vertical-align: middle; }

.hd-hero__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hd-hero__tags a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--green-150);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 600;
}
.hd-hero__tags a:hover { border-color: var(--green-400); background: #FFFFFF; }

.hd-hero__qr {
  position: absolute;
  z-index: 2;
  inset-inline-end: var(--gutter);
  top: clamp(18px, 3vw, 32px);
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  padding: 7px;
  border: 1px solid var(--green-150);
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 12px 30px rgba(67, 82, 42, .1);
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.hd-hero__qr:hover,
.hd-hero__qr:focus-visible { border-color: var(--green-400); box-shadow: 0 14px 34px rgba(67, 82, 42, .16); transform: translateY(-2px); }
.hd-hero__qr.is-unavailable { display: none; }
.hd-hero__qr-code,
.hd-hero__qr-code img { display: block; width: 100%; height: 100%; }
.hd-hero__qr-code img { border-radius: 10px; object-fit: contain; }
.hd-hero__qr:not(.is-ready) .hd-hero__qr-code { padding: 14px; }

/* --------------------------------------------------------------------------
   Main column and cards
   -------------------------------------------------------------------------- */
.hd-main { position: relative; z-index: 2; margin-top: -88px; padding-bottom: 48px; }
.hd-article { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.hd-card {
  min-width: 0;
  border: 1px solid var(--line-150);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.hd-section { padding: clamp(20px, 3vw, 32px); }

.hd-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--green-800);
  font-size: 21px;
  line-height: 1.5;
}
.lang-ar .hd-section__title { font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 26px); line-height: 1.4; }
.hd-section__art { width: 30px; height: 30px; }

/* --------------------------------------------------------------------------
   Toolbar (diacritics, font size, copy / share / PDF / print)
   -------------------------------------------------------------------------- */
.hd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 2.5vw, 24px);
  border-bottom: 1px dashed var(--line-150);
  border-radius: 24px 24px 0 0;
}
.hd-toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hd-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-150);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 600;
}
.switch-btn:hover { border-color: var(--green-400); }
.switch {
  display: flex;
  justify-content: flex-end;
  width: 36px;
  height: 20px;
  padding: 2px;
  border-radius: 999px;
  background: var(--ink-300);
  transition: background-color .2s;
}
.switch::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch-btn[aria-checked="true"] .switch { justify-content: flex-start; background: var(--green-600); }

.font-size {
  display: inline-flex;
  align-items: center;
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--line-150);
  border-radius: 11px;
  background: var(--surface);
}
.font-size button {
  width: 40px;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink-700);
  font-size: 18px;
  font-weight: 700;
}
.font-size button:hover { background: var(--green-25); color: var(--green-800); }
.font-size > span {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 100%;
  padding: 0 6px;
  border-inline: 1px solid var(--line-150);
  color: var(--green-800);
  font-size: 15px;
  font-weight: 700;
}

.act-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-150);
  border-radius: 11px;
  background: var(--surface);
  color: var(--green-800);
  cursor: pointer;
}
.act-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.act-btn:hover,
.act-btn[aria-expanded="true"] { border-color: var(--green-400); background: var(--green-25); color: var(--green-900); }
.act-btn.is-copied { border-color: var(--green-600); background: var(--green-600); color: #FFFFFF; }
/* "Copied" bubble under the copy button */
.act-btn[data-copied-label]::after {
  content: attr(data-copied-label);
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--ink-900);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .18s, transform .18s;
}
.act-btn.is-copied::after { opacity: 1; transform: none; }

/* Share menu */
.share-wrap { position: relative; display: inline-flex; }
.share-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 20;
  display: none;
  min-width: 210px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid var(--green-150);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(35, 36, 31, .14);
}
.share-wrap.is-open > .share-menu { display: block; }
.share-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-700);
  text-align: start;
  white-space: normal;
  cursor: pointer;
}
.share-menu__item:hover,
.share-menu__item:focus-visible { background: var(--green-25); color: var(--green-800); }
.share-menu__item svg { width: 17px; height: 17px; }
.share-menu__item img { width: 18px; height: 18px; filter: grayscale(1); opacity: .85; }
.share-menu__icon--stroke { fill: none; stroke: currentColor; stroke-width: 2.2; }

/* --------------------------------------------------------------------------
   Hadith text, grades, feedback buttons
   -------------------------------------------------------------------------- */
.hd-text { display: flow-root; padding: clamp(15px, 2vw, 22px) clamp(22px, 4vw, 42px) 0; }
.hd-text__matn,
.hd-text__alt,
.hd-text__intro {
  margin-bottom: 24px;
  color: var(--ink-900);
  font-family: var(--font-hadith);
  font-size: 18px;
  font-weight: 600;
  line-height: 2.05;
  text-wrap: pretty;
}
.hd-text__alt { font-family: 'Noto Naskh Arabic', serif; font-weight: 500; line-height: 1.95; }
body:not(.lang-ar) .hd-text__matn { font-size: 17px; line-height: 1.9; }
.hd-text__more { display: flex; margin-top: 14px; }
.more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 16px;
  border: 1px solid var(--green-200);
  border-radius: 11px;
  background: var(--green-50);
  color: var(--green-800);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.more-btn:hover { border-color: var(--green-500); background: var(--green-600); color: #FFFFFF; }
.more-btn svg { width: 15px; height: 15px; }

.hd-grades {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  margin: 0;
  padding: 12px clamp(18px, 3vw, 32px);
  list-style: none;
  border-top: 1px dashed var(--line-150);
  border-radius: 0 0 24px 24px;
  background: rgba(248, 249, 245, .72);
}
.grade-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid #E1E3DC;
  border-radius: 999px;
  background: #EEF0EB;
  color: #62665D;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.note-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 2px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-300);
  vertical-align: middle;
  cursor: pointer;
}
.note-btn:hover { background: var(--green-25); color: var(--green-800); }
.note-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

.notice {
  margin: 16px 0 0;
  padding: 12px 15px;
  border: 1px solid #EAD9A6;
  border-radius: 12px;
  background: #FBF6E6;
  color: #6B5A1E;
  line-height: 1.7;
}
.notice a { color: inherit; font-weight: 700; text-decoration: underline; }
.notice svg { display: inline-block; width: 16px; height: 16px; margin-inline-end: 6px; vertical-align: -2px; }

/* --------------------------------------------------------------------------
   Explanation, benefits, word meanings
   -------------------------------------------------------------------------- */
.hd-section__text {
  padding-bottom: 8px;
  color: var(--ink-700);
  font-family: var(--font-hadith);
  font-size: 17px;
  font-weight: 600;
  line-height: 2;
  text-wrap: pretty;
}
.lang-ar .hd-section__text { font-size: 18px; }

.benefits { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: benefit; }
.benefits li {
  position: relative;
  min-height: 48px;
  padding-block: 12px;
  padding-inline: 50px 14px;
  border: 1px solid var(--green-150);
  border-radius: 13px;
  background: var(--green-25);
  color: var(--ink-700);
  font-family: var(--font-hadith);
  font-size: 17px;
  line-height: 1.9;
  counter-increment: benefit;
}
.lang-ar .benefits li { font-size: 18px; font-weight: 600; }
.benefits li::before {
  content: counter(benefit);
  position: absolute;
  top: 10px;
  inset-inline-start: 11px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--green-600);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
}

.meanings dt { margin-top: 10px; color: var(--green-800); font-weight: 700; }
.meanings dd { margin: 3px 0 12px; color: var(--ink-500); line-height: 1.8; }

/* Reviewer notes shown in ?note=1 mode */
.note-item { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--green-150); border-radius: 12px; background: var(--green-25); font-size: 14px; line-height: 1.8; }
.note-item__label { display: inline-block; margin-inline-end: 6px; padding: 2px 8px; border-radius: 999px; background: var(--green-50); color: var(--green-800); font-size: 12px; font-weight: 700; }
.note-item blockquote { margin: 6px 0; padding: 6px 10px; border-inline-start: 3px solid var(--green-200); background: #F5F5F5; font-size: 13px; }
ins { color: darkgreen; }
del { color: orangered; }

/* --------------------------------------------------------------------------
   Translations grid
   -------------------------------------------------------------------------- */
.trans-section { position: relative; padding: clamp(18px, 2.5vw, 26px); overflow: hidden; }
.hd-section__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-150);
}
.hd-section__head .hd-section__title { margin: 0; }
.trans-search {
  flex: 1 1 240px;
  max-width: 360px;
  min-height: 40px;
  margin-inline-start: auto;
  border-color: var(--green-150);
  border-radius: 11px;
  color: var(--green-700);
}
.trans-search svg { width: 17px; height: 17px; }
.trans-search input { height: 26px; font-size: 12.5px; }
.count-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 30px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green-800);
  font-size: 12px;
  font-weight: 700;
}

.trans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.trans-grid:not(.is-expanded):not(.is-filtering) > li:nth-child(n+9) { display: none; }

.trans-tile {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 46px;
  overflow: hidden;
  border: 1px solid var(--green-150);
  border-radius: 12px;
  background: var(--green-25);
  color: var(--ink-900);
  transition: transform .2s, border-color .2s, background-color .2s, box-shadow .2s;
}
.trans-tile:hover { transform: translateY(-1px); border-color: var(--green-400); background: #FFFFFF; color: var(--green-800); box-shadow: 0 7px 18px rgba(65, 83, 36, .07); }
.trans-tile__main { display: grid; grid-template-columns: 30px minmax(0, 1fr); flex: 1 1 auto; align-items: center; gap: 7px; min-width: 0; padding-block: 6px; padding-inline: 7px 4px; }
.trans-tile__code {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--green-700);
  font-family: system-ui, sans-serif;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.trans-tile__text { display: flex; align-items: baseline; gap: 5px; min-width: 0; white-space: nowrap; }
.trans-tile__name,
.trans-tile__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trans-tile__name { flex: 0 1 auto; font-size: 12px; font-weight: 700; unicode-bidi: isolate; }
.lang-ar .trans-tile__name { font-size: 13px; }
.trans-tile__meta { flex: 1 1 auto; color: var(--ink-300); font-size: 9.5px; }
.lang-ar .trans-tile__meta { font-size: 10.5px; }
.trans-tile__actions { display: grid; grid-template-columns: repeat(3, 25px); flex: 0 0 auto; }
.trans-action {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-700);
  cursor: pointer;
}
.trans-action svg { width: 14px; height: 14px; }
.trans-action--stroke svg { fill: none; stroke: currentColor; stroke-width: 2; }
.trans-action:hover,
.trans-action:focus-visible { background: var(--green-100); color: var(--green-900); }
.trans-action:focus-visible { position: relative; z-index: 1; outline-offset: -2px; }
.trans-action.is-active,
.trans-action[aria-expanded="true"] { background: var(--green-600); color: #FFFFFF; }

.trans-empty { margin: 18px 0 4px; color: var(--ink-300); font-size: 13px; text-align: center; }
.trans-section.is-filtering .trans-toggle { display: none; }
.trans-toggle-row { display: flex; justify-content: center; margin-top: 16px; }

/* Inline translation preview (loaded into the preview modal from partials/trans.php) */
.preview-modal .modal__head { min-height: 62px; padding: 15px 20px; border-bottom: 1px solid var(--line-150); background: var(--green-25); }
.preview-modal .modal__body { padding: 0; }
.inline-translations__status { display: flex; align-items: center; justify-content: center; min-height: 90px; padding: 18px; color: var(--ink-300); font-size: 13px; }
.inline-translation { border-bottom: 1px solid var(--line-150); background: #FFFFFF; }
.inline-translation:last-child { border-bottom: 0; }
.inline-translation__summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 9px 12px;
  list-style: none;
  cursor: pointer;
}
.inline-translation__summary::-webkit-details-marker { display: none; }
.inline-translation__summary:hover { background: var(--green-25); }
.inline-translation__code {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--green-50);
  color: var(--green-800);
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.inline-translation__name { display: flex; flex-direction: column; min-width: 0; }
.inline-translation__name strong,
.inline-translation__name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-translation__name strong { color: var(--ink-900); font-size: 13.5px; }
.inline-translation__name small { color: var(--ink-300); font-size: 11px; }
.inline-translation__open { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--green-150); border-radius: 9px; color: var(--green-700); }
.inline-translation__open svg { width: 13px; height: 13px; }
.inline-translation__chevron { width: 16px; height: 16px; color: var(--green-700); transition: transform .2s; }
.inline-translation[open] .inline-translation__chevron { transform: rotate(180deg); }
.inline-translation__body { padding: 18px clamp(14px, 3vw, 24px) 20px; border-top: 1px solid var(--line-150); }
.inline-translation__block + .inline-translation__block { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-150); }
.inline-translation__label { display: inline-flex; margin-bottom: 8px; padding: 4px 9px; border-radius: 999px; background: var(--green-50); color: var(--green-800); font-size: 11px; font-weight: 700; }
.inline-translation__text { color: var(--ink-700); font-size: 15.5px; line-height: 1.95; text-align: start; }
.inline-translation__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.inline-translation__meta span { padding: 4px 9px; border-radius: 999px; background: #EEF0EB; color: #62665D; font-size: 11px; }
.inline-translation__benefits { margin: 8px 0 0; padding-inline-start: 22px; color: var(--ink-500); font-size: 13.5px; line-height: 1.8; }

/* --------------------------------------------------------------------------
   References, categories, related hadiths, pager
   -------------------------------------------------------------------------- */
.refs { overflow: hidden; }
.refs__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 14px clamp(18px, 3vw, 30px);
  list-style: none;
  cursor: pointer;
}
.refs__toggle::-webkit-details-marker { display: none; }
.refs__label { display: flex; align-items: center; gap: 10px; color: var(--green-800); font-size: 18px; font-weight: 700; }
.refs__label svg { width: 26px; height: 26px; }
.refs__toggle .chevron { width: 18px; height: 18px; color: var(--green-700); }
.refs[open] .refs__toggle .chevron { transform: rotate(180deg); }
.refs__body { padding: 0 clamp(18px, 3vw, 30px) 24px; border-top: 1px solid var(--line-150); }
.refs__list,
.hd-cats { margin: 0; padding-inline-start: 24px; }
.refs__list li,
.hd-cats li { padding: 7px 0; color: var(--ink-500); line-height: 1.8; }
.refs__list li { font-size: 15px; }
.hd-cats a,
.related a { color: var(--green-800); }
.hd-cats__sep { color: var(--ink-300); }

.related { margin: 0; padding: 0; list-style: none; }
.related li + li { border-top: 1px solid var(--line-150); }
.related a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  font-family: var(--font-hadith);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.85;
  text-wrap: pretty;
}
.related a svg { width: 16px; height: 16px; color: var(--green-400); }
.related a:hover { color: var(--green-900); }

.hd-pager { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hd-pager > a,
.hd-pager > span {
  flex: 0 1 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--green-200);
  border-radius: 12px;
  background: var(--surface);
  color: var(--green-800);
  font-weight: 600;
}
.hd-pager > a:hover { border-color: var(--green-400); background: var(--green-25); }
.hd-pager__next { border-color: var(--green-600) !important; background: var(--green-600) !important; color: #FFFFFF !important; }
.hd-pager__next:hover { background: var(--green-700) !important; }
.hd-pager > span[aria-disabled="true"] { opacity: .48; }
.hd-pager svg { width: 15px; height: 15px; }

/* "More" panel with the Arabic explanation, meanings, benefits, references */
.arabic-more { margin-top: 12px; }
.arabic-more__section { margin-bottom: 14px; }
.arabic-more__section > summary { color: var(--green-800); font-weight: 700; cursor: pointer; }
.arabic-more__section dd { margin-inline-start: 30px; margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   Modals: feedback, copy / PDF, languages, share image, QR
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label,
.field__label { font-weight: 600; }
.field__quote { margin: 0; padding: 10px 14px; border-inline-start: 3px solid var(--green-200); border-radius: 10px; background: var(--green-25); font-size: 15px; line-height: 1.9; }
.field__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }

/* Copy & print modal: options column + live preview */
.copy-modal { width: min(100%, 980px); }
.copy-modal__body { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 20px; align-items: start; }
.copy-modal__options { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.copy-modal__group { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 4px 10px 8px; border: 1px solid var(--line-150); border-radius: 14px; background: var(--green-10); }
.copy-modal__legend { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; padding: 0 4px; color: var(--green-800); font-size: 14px; font-weight: 700; }
.copy-modal__preview > .copy-modal__legend { margin-bottom: 6px; padding: 0; }
.copy-modal__filter { min-height: 36px; margin-bottom: 4px; background: var(--surface); }
.copy-modal__filter input { height: 34px; font-size: 13px; }
.copy-modal__lang-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }

.check-row { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 3px 6px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.check-row:hover { background: var(--green-50); }
.check-row input { flex: 0 0 auto; width: 17px; height: 17px; margin: 0; accent-color: var(--green-600); }
.check-row input:disabled + span { color: var(--ink-500); }
.check-row__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-row__meta { color: var(--ink-300); font-family: system-ui, sans-serif; font-size: 11px; font-weight: 700; }

.copy-modal__preview { min-width: 0; }
.copy-preview { max-height: 56vh; padding: 16px 18px; overflow-y: auto; border: 1px solid var(--line-150); border-radius: 14px; background: var(--surface); }
.copy-preview__status { color: var(--ink-300); text-align: center; }
.copy-preview__link { margin-top: 10px; color: var(--ink-300); font-size: 12px; word-break: break-all; }
.copy-sec + .copy-sec { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-200); }
.copy-sec__lang { display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 999px; background: var(--green-600); color: #FFFFFF; font-size: 12px; }
.copy-sec__text { margin: 0 0 8px; color: var(--ink-900); font-weight: 600; line-height: 1.95; white-space: pre-line; }
.copy-sec[lang="ar"] { font-family: 'Noto Naskh Arabic', serif; }
.copy-sec__meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; padding: 0; list-style: none; }
.copy-sec__meta li { padding: 2px 9px; border-radius: 999px; background: #EEF0EB; color: #62665D; font-family: var(--font-sans); font-size: 11.5px; }
.copy-sec__heading { margin: 10px 0 4px; color: var(--green-800); font-family: var(--font-sans); font-size: 14px; }
.copy-sec__para { margin-bottom: 6px; line-height: 1.9; white-space: pre-line; }
.copy-sec__list { margin: 0; padding-inline-start: 20px; line-height: 1.8; }
.copy-sec__list--refs { color: var(--ink-500); font-size: 13px; }

@media (max-width: 767px) {
  .copy-modal__body { grid-template-columns: minmax(0, 1fr); }
  .copy-modal__lang-list { max-height: 180px; }
  .copy-preview { max-height: none; }
}

.image-modal { width: min(100%, 1000px); }
.image-preview img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.qr-modal { width: min(100%, 360px); text-align: center; }
.qr-modal__name { margin-bottom: 8px; font-weight: 700; line-height: 1.6; }
.qr-modal__code { display: flex; justify-content: center; margin: 15px 0; }
.qr-modal__link { display: block; font-size: 12px; word-break: break-all; }
.modal__foot--center { justify-content: center; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (min-width: 1600px) {
  .hd-text__matn,
  .hd-text__alt { font-size: clamp(18px, 1.08vw, 22px); }
  body:not(.lang-ar) .hd-text__matn { font-size: clamp(17px, 1.02vw, 20px); }
  .hd-section__text,
  .benefits li { font-size: clamp(18px, 1.05vw, 21px) !important; }
}

@media (max-width: 900px) {
  .hd-hero .page-hero__emblem { display: none; }
  .hd-hero .page-hero__inner { padding-bottom: 104px; padding-inline-end: calc(var(--gutter) + 84px); }
  .hd-hero__qr { width: 70px; height: 70px; padding: 6px; border-radius: 16px; }
  .hd-main { margin-top: -80px; padding-inline: 10px; }
  .trans-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .hd-hero .page-hero__inner { gap: 10px; padding: 14px 88px 92px 16px; padding-inline: 16px 88px; }
  .hd-hero__title { font-size: clamp(17px, 4.8vw, 21px); }
  .hd-hero__tags { gap: 6px; }
  .hd-hero__tags a { min-height: 30px; padding: 4px 10px; font-size: 11.5px; }
  .hd-hero__qr { inset-inline-end: 16px; top: 14px; width: 62px; height: 62px; padding: 5px; border-radius: 14px; }
  .hd-main { margin-top: -72px; padding-inline: 8px; padding-bottom: 32px; }
  .hd-card { border-radius: 18px; }
  .hd-toolbar { flex-wrap: nowrap; gap: 6px; padding: 7px 8px; border-radius: 18px 18px 0 0; }
  .hd-toolbar__group { flex: 1 1 auto; flex-wrap: nowrap; gap: 4px; min-width: 0; }
  .hd-actions { gap: 4px; }
  .share-menu { width: min(210px, calc(100vw - 24px)); min-width: 0; }
  .switch-btn > span:first-child { display: none; }
  .switch-btn { height: 36px; padding-inline: 6px; }
  .switch { width: 32px; height: 18px; }
  .switch::before { width: 14px; height: 14px; }
  .font-size { height: 36px; }
  .font-size button { width: 30px; }
  .font-size > span { min-width: 28px; padding-inline: 4px; }
  .act-btn { width: 34px; height: 34px; border-radius: 9px; }
  .hd-text { padding: 14px 16px 0; }
  .hd-grades { padding: 11px 16px; border-radius: 0 0 18px 18px; }
  .hd-text__matn,
  .hd-text__alt { font-size: 17px; line-height: 1.95; }
  .hd-section__text { font-size: 18px; line-height: 1.9; }
  .hd-section { padding: 18px 15px; }
  .benefits li { padding-inline-end: 10px; }
  .trans-section { padding: 16px 12px; }
  .trans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .hd-section__head { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; }
  .hd-section__head .hd-section__title { flex: 1 1 auto; }
  .trans-search { order: 3; flex-basis: 100%; max-width: none; margin-inline-start: 0; }
  .trans-tile { min-height: 44px; }
  .trans-tile__main { grid-template-columns: 28px minmax(0, 1fr); gap: 5px; padding-block: 5px; padding-inline: 5px 3px; }
  .trans-tile__code { width: 28px; height: 28px; }
  .trans-tile__meta { display: none; }
  .trans-tile__actions { grid-template-columns: repeat(3, 23px); }
  .trans-action { min-height: 44px; }
  .inline-translation__summary { grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 7px; padding-inline: 8px; }
  .inline-translation__body { padding: 15px 12px 17px; }
  .inline-translation__text { font-size: 14.5px; }
  .hd-pager > a,
  .hd-pager > span { flex: 1 1 0; min-height: 42px; padding-inline: 9px; font-size: 12px; }
}

@media (max-width: 319px) {
  .hd-toolbar { flex-wrap: wrap; justify-content: center; }
  .hd-toolbar__group,
  .hd-actions { justify-content: center; }
}

@media print {
  .hd-page { overflow: visible; }
  .hd-hero { min-height: 0; background: none; }
  .hd-hero .page-hero__inner { gap: 6pt; padding: 0 0 10pt; }
  .hd-hero .page-hero__emblem,
  .hd-hero__tags,
  .hd-hero__qr,
  .hd-hero__note,
  .note-btn,
  .hd-text__more,
  .refs__toggle .chevron { display: none !important; }
  .hd-hero__title { max-width: none; font-size: 16pt; }

  .hd-main { margin-top: 0; padding: 0; }
  .hd-article { gap: 12pt; }
  .hd-card { border: 0; border-radius: 0; box-shadow: none; background: none; }
  .hd-section,
  .hd-text { padding: 0; }
  .hd-section__title { margin-bottom: 6pt; font-size: 14pt; }
  .hd-section__art { width: 20pt; height: 20pt; }

  .hd-text__matn,
  .hd-text__alt { margin-bottom: 8pt; font-size: 14pt; line-height: 1.9; }
  .hd-section__text,
  .benefits li { font-size: 12pt !important; line-height: 1.85; }
  .hd-grades { min-height: 0; padding: 0 0 4pt; border: 0; background: none; }
  .grade-chip { min-height: 0; padding: 2pt 9pt; font-size: 9.5pt; }
  .benefits li { min-height: 0; padding-block: 6pt; }

  /* references are expanded by hadith-page.js while printing */
  .refs__toggle { min-height: 0; padding: 0 0 6pt; }
  .refs__label { font-size: 14pt; }
  .refs__body { padding: 0; border: 0; }
  .refs__list li { font-size: 10.5pt; }
  .hd-cats li { padding: 2pt 0; }
}

/* Semantic wrappers: the hadith text is a quotation (figure > blockquote) captioned by its grade and source */
.hd-figure { margin: 0; }
.hd-hero__note { display: inline-flex; margin-top: -8px; }
.hd-grades__list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hd-grades__list dd { margin: 0; }
.hd-grades cite { font-style: normal; }
.refs__label { margin: 0; font-size: 18px; }

/* Copy modal: both actions together at the end (print last, as the primary action); page size under the languages */
.copy-modal .modal__foot { justify-content: flex-end; gap: 8px; }
.copy-modal__size { flex: 0 0 auto; }
.copy-modal__size .segmented { display: flex; }
.copy-modal__size .segmented__option { flex: 1 1 0; }
.copy-modal__size .segmented__option span { justify-content: center; width: 100%; }

/* Segmented control built from native radios (keyboard + screen-reader friendly) */
.segmented { display: inline-flex; margin: 0; padding: 3px; border: 1px solid var(--green-150); border-radius: 11px; background: var(--surface); }
.segmented__option { position: relative; display: inline-flex; cursor: pointer; }
.segmented__option input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented__option span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 8px; color: var(--ink-500); font-size: 13px; font-weight: 600; transition: background-color .15s, color .15s; }
.segmented__option input:checked + span { background: var(--green-600); color: #FFFFFF; }
.segmented__option input:focus-visible + span { outline: 2px solid var(--green-600); outline-offset: 2px; }

/* Desktop: the dialog body doesn't scroll; the language list and the preview fill the height */
@media (min-width: 768px) {
  .copy-modal .modal__body.copy-modal__body { overflow: hidden; height: min(62vh, 560px); }
  .copy-modal__options,
  .copy-modal__preview { height: 100%; min-height: 0; }
  .copy-modal__langs { flex: 1 1 auto; min-height: 0; }
  .copy-modal__lang-list { flex: 1 1 auto; max-height: none; min-height: 0; }
  .copy-modal__preview { display: flex; flex-direction: column; }
  .copy-preview { flex: 1 1 auto; max-height: none; min-height: 0; }
}
@media (min-width: 768px) {
  /* Content options in two columns, leaving more height for the language list */
  .copy-modal__options > .copy-modal__group:first-child { display: grid; grid-template-columns: 1fr 1fr; column-gap: 4px; }
  .copy-modal__options > .copy-modal__group:first-child > .copy-modal__legend { grid-column: 1 / -1; }
}
