/* Hadith and matn corpus (M20). Design tokens from maqraa.css; logical properties only. */
.hadith-text {
  font-family: var(--font-display); font-size: clamp(1.15rem, 2.2vw, 1.35rem); line-height: 2.15;
  white-space: pre-line; text-align: start; margin-block-end: .75rem;
}
.hadith-detail .hadith-text { font-size: clamp(1.25rem, 2.6vw, 1.5rem); }
/* Long English book titles, the checksum and source URLs must wrap instead of widening the page (375px).
   The details grid gets a shrinkable value column; on phones the labels stack above the values. */
.hadith-detail { overflow-wrap: anywhere; }
.hadith-detail dd, .hadith-detail code, .hadith-detail .citation a { overflow-wrap: anywhere; word-break: break-word; min-inline-size: 0; }
.hadith-detail .kv { grid-template-columns: max-content minmax(0, 1fr); }
@media (max-width: 640px) {
  .hadith-detail .kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .hadith-detail .kv dd { margin-block-end: .45rem; }
}
.hadith-card .card-header h3 { font-size: 1.05rem; }
.gradings { border-inline-start: 3px solid var(--accent); padding-inline-start: .8rem; margin-block: .5rem; }
.grading-list { list-style: none; padding: 0; margin: .3rem 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .9rem; }
.grading-list .grader { color: var(--text-muted); }
.edition-card h3 { font-size: 1.05rem; }
.edition-card .kv.stacked { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
.edition-card .kv.stacked dd { margin-block-end: .45rem; }
.edition-card dd { overflow-wrap: anywhere; font-weight: 500; }

/* matn reader: verse (nazm) shows the two hemistichs side by side, prose flows */
.matn { font-family: var(--font-display); }
.matn-section {
  text-align: center; font-size: 1.15rem; color: var(--gold-700); margin-block: 1.5rem .7rem;
  padding-block: .3rem; border-block: 1px solid var(--gold-300);
}
.matn-section:first-child { margin-block-start: 0; }
.matn-line { display: grid; grid-template-columns: 2.6rem 1fr; gap: .1rem 1.5rem; align-items: baseline;
  padding: .15rem .4rem; border-radius: 8px; transition: background .15s; }
.matn-line.bayt { grid-template-columns: 2.6rem 1fr 1fr; }
.matn-line .hemistich { text-align: center; text-wrap: balance; }
.matn-line:not(.bayt) .hemistich { text-wrap: pretty; }
.matn-line:not(.bayt) .hemistich { text-align: justify; }
.matn-no {
  justify-self: center; font-family: var(--font-ui); font-size: .78rem; color: var(--text-muted);
  min-inline-size: 2rem; text-align: center; border: 1px solid var(--border); border-radius: 999px; line-height: 1.6;
}
.matn-line:target, .matn-line.pointer { background: color-mix(in srgb, var(--gold-300) 40%, transparent); }
.matn-line .w { border-radius: 4px; }
@media (max-width: 640px) {
  .matn-line.bayt { grid-template-columns: 2.2rem 1fr; }
  .matn-line.bayt .hemistich { text-align: start; }
  .matn-line.bayt .hemistich + .hemistich { grid-column: 2; padding-inline-start: 1.5rem; }
}
.matn-result { font-family: var(--font-display); font-size: 1.2rem; line-height: 2; margin-block-end: .2rem; }
mark.hit { background: color-mix(in srgb, var(--gold-300) 75%, transparent); color: inherit; border-radius: 4px; padding-inline: .1em; }
:root[data-theme="dark"] .matn-section { color: var(--gold-300); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .matn-section { color: var(--gold-300); } }

/* ---- library of the prescribed texts: tiles, 44px buttons, QR boxes (decisions.md "Shape and finish", "Lists") ---- */
.lib-jump { gap: .6rem; }
.lib-links { align-items: start; }
.btn.lib-btn { min-block-size: 44px; padding-block: .55rem; text-align: center; }
.lib-btn svg { flex: none; }
.lib-group-title { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 1.9rem); margin-block-end: .6rem;
  padding-block-end: .4rem; border-block-end: 2px solid var(--gold-500); }
.lib-art { margin-block-end: 1.6rem; }
.lib-art h3 { font-size: 1.15rem; color: var(--text-muted); margin-block: 1rem .6rem; }
.lib-tile { display: flex; flex-direction: column; gap: .6rem; padding: 1rem 1.1rem; position: relative; }
.lib-tile:hover { border-color: var(--accent); }
.lib-tile:focus-within { outline: 3px solid var(--gold-500); outline-offset: 2px; }
.lib-tile-title { margin: 0; font-family: var(--font-display); font-size: 1.2rem; line-height: 1.7; }
.lib-tile-title a { color: var(--text); text-decoration: none; display: block; min-block-size: 44px; }
.lib-tile-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.lib-tile-title a:focus-visible { outline: none; }
.lib-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.lib-audio { inline-size: 100%; min-block-size: 44px; margin-block-end: .75rem; }
.lib-downloads { margin-block: .5rem 0; }
.lib-others { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.lib-others .btn { inline-size: 100%; justify-content: flex-start; text-align: start; }
.lib-qr { margin: 0; display: grid; justify-items: center; gap: .5rem; max-inline-size: 11rem; }
.lib-qr svg { inline-size: 100%; block-size: auto; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.lib-qr figcaption { text-align: center; }
.lib-entry { display: block; }
.lib-entry h2 { margin: 0 0 .35rem; font-size: 1.3rem; }
@media (max-width: 640px) { .lib-downloads .btn { inline-size: 100%; } }
.lib-read { position: relative; z-index: 1; display: inline-flex; align-items: center; min-block-size: 44px; font-weight: 600; }
