/* Print views of a lecture (dars.site.tafsir.printview): print-ur, print-ur-en, and the editor's marking copy.
   US Letter, black and white. Nastaliq for Urdu, Amiri for Arabic and the Quran, Source Serif 4 for English.
   On screen the page is shown as a sheet with a small toolbar; the toolbar never prints. */

@counter-style urdu-digits {
  system: numeric;
  symbols: "۰" "۱" "۲" "۳" "۴" "۵" "۶" "۷" "۸" "۹";
}

:root {
  --ur: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
  --ar: 'Amiri', 'Noto Naskh Arabic', serif;
  --en: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --ink: #000;
  --ink-2: #333;
  --ink-3: #6b6b6b;
  --rule: #000;
  --sheet-w: 8.5in;
  --pad-t: 0.8in; --pad-b: 0.8in; --pad-in: 0.55in; --pad-out: 0.95in;  /* screen sheet = @page margins */
  --gutter: 0.4in;  /* inside the text area at the start side: paragraph numbers (the page margin is clipped) */
  color-scheme: light;
}

@page {
  size: letter;
  margin: 0.8in 0.55in 0.8in 0.95in;  /* RTL: the right (start) margin is narrower; the number gutter is inside */
  @top-right { font-family: 'Noto Nastaliq Urdu', serif; font-size: 8.5pt; color: #444; vertical-align: bottom;
               padding-bottom: 0.12in; text-align: right; }
  @bottom-center { font-family: 'Noto Nastaliq Urdu', 'Source Serif 4', serif; font-size: 9pt; color: #444;
                   vertical-align: top; padding-top: 0.1in; }
}

html { background: #e9e9e6; }
body.print { margin: 0; color: var(--ink); background: #e9e9e6; font-family: var(--ur); }
.print-doc {
  box-sizing: border-box; width: var(--sheet-w); margin: 0 auto 40px; background: #fff;
  padding: var(--pad-t) var(--pad-in) var(--pad-b) var(--pad-out); box-shadow: 0 1px 6px rgba(0, 0, 0, .18);
}
[lang="en"] { font-family: var(--en); }
[lang="ar"], .script-arabic, .inline-arabic, .semantic-quran, .semantic-hadith, .semantic-dua { font-family: var(--ar); }
[lang="ur"], .script-urdu, .inline-urdu { font-family: var(--ur); }

/* ─── toolbar (screen only) ─── */
.print-toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  justify-content: center; padding: 10px 16px; background: #f7f7f4; border-bottom: 1px solid #ccc; margin-bottom: 18px;
}
.print-toolbar .tool {
  font: 500 15px/1.2 var(--en); color: #111; background: #fff; border: 1px solid #999; border-radius: 6px;
  padding: 6px 12px; text-decoration: none; cursor: pointer;
}
.print-toolbar .tool [lang="ur"] { font-family: var(--ur); font-size: 14px; }
.print-toolbar .tool-print { background: #111; color: #fff; border-color: #111; }
.print-toolbar .tool-note { font: 13px var(--en); color: #555; }

/* ─── title block ─── */
.title-block { text-align: center; margin: 0 0 0.32in; padding-bottom: 0.18in; border-bottom: 0.75pt solid var(--rule);
               break-after: avoid; }
.title-block p { margin: 0; }
.tb-series { font-size: 11pt; line-height: 2.1; color: var(--ink-2); letter-spacing: 0; }
.tb-surah { font-family: var(--ar); font-size: 28pt; font-weight: 700; line-height: 1.5; margin: 0; }
.tb-ayat { font-size: 15pt; line-height: 2.2; }
.tb-by { font-size: 13pt; line-height: 2.2; }
.tb-date { font-size: 11pt; line-height: 2.2; color: var(--ink-2); }
.tb-en { font-size: 10pt; line-height: 1.5; color: var(--ink-2); margin-top: 4pt !important; }
.tb-edition { font-size: 10pt; line-height: 2; color: var(--ink-3); }

/* ─── paragraphs ─── */
.text { padding-inline-start: var(--gutter); }
.title-block, .colophon { margin-inline-start: var(--gutter); }
.para { position: relative; margin: 0 0 0.85em; font-size: 13.5pt; line-height: 2.3; text-align: justify;
        orphans: 2; widows: 2; }
.para .pt { margin: 0; }
.para .pn {
  position: absolute; inset-inline-start: calc(-1 * var(--gutter)); top: 0.25em; width: 0.3in; text-align: center;
  font-family: var(--ur); font-size: 8pt; line-height: 2; color: var(--ink-3);
}
.para[dir="ltr"] { direction: rtl; }
.para[dir="ltr"] .pt { direction: ltr; }
.para.muted { color: var(--ink-2); font-size: 12pt; }
.para.listener .listener-label { font-weight: 700; }

/* the Quran recited as a block, hadith, poetry, dua: clean bordered boxes */
.para.box { break-inside: avoid; margin: 0.4em 0 0.75em; padding: 4pt 14pt; text-align: center; }
.para.box .pn { inset-inline-start: calc(-1 * var(--gutter) - 1pt); }
.para.verse { border: 0.8pt solid var(--rule); font-family: var(--ar); font-size: 16pt; line-height: 2.05;
              text-align: center; }
.para.verse:has(+ .para.verse) { margin-bottom: 0; }
.para.verse + .para.verse { margin-top: 0; border-top: 0.4pt dotted #555; }
.para.arabic-line { text-align: center; font-family: var(--ar); font-size: 15pt; line-height: 2.1; }
.para.hadith { border-top: 0.6pt solid var(--rule); border-bottom: 0.6pt solid var(--rule); font-size: 14.5pt;
               line-height: 2.1; }
.para.poetry, .para.dua-box { border-inline-start: 1.5pt solid var(--rule); text-align: start; font-size: 13.5pt; }
.para.verse.script-urdu, .para.hadith.script-urdu { font-family: var(--ur); font-size: 13.5pt; line-height: 2.3; }

/* inline semantic spans: no colours, Arabic in Amiri slightly larger, refs small */
.semantic-quran, .semantic-hadith { background: none !important; border: 0 !important; padding: 0 !important;
                                    color: inherit !important; font-size: 1.08em; }
.semantic-quran::before { content: "\FD3F"; font-family: var(--ar); padding-inline-end: 2px; }
.semantic-quran::after { content: "\FD3E"; font-family: var(--ar); padding-inline-start: 2px; }
.para.verse .semantic-quran::before, .para.verse .semantic-quran::after { content: none; }
.ref, .ayah-ref, .ayah-cite { font-family: var(--ur); font-size: 0.62em; color: var(--ink-3); unicode-bidi: isolate; }
.inline-arabic { font-size: 1.06em; }
.inline-quran-translation, .semantic-quran_translation { font-style: normal; }
.audio-extraneous, .audio-aside, .crowd-marker, .jump, .hid-label { display: none !important; }
.audio-unclear { color: var(--ink-3); }
.nl-mark { color: #999; margin: 0 4px; }
.salawat { font-family: var(--ar); font-size: 0.8em; }
q { quotes: "“" "”"; }

/* ─── Urdu + English: each passage, then its English ─── */
.print-ur-en .para { font-size: 13pt; line-height: 2.2; margin-bottom: 0.3em; }
.pair { margin: 0 0 0.5em; }
.pair-en {
  margin: 0.05in 0 0.22in; padding-inline-start: 9pt; border-inline-start: 0.6pt solid #888;
  font-family: var(--en); font-size: 10.2pt; line-height: 1.45; color: #1a1a1a; text-align: left; break-before: avoid;
  hyphens: auto;
}
.pair-en p { margin: 0 0 0.35em; }
.pair-en .inline-quran, .pair-en .semantic-quran { font-family: var(--en); font-size: 1em; }
.pair-en .semantic-quran::before, .pair-en .semantic-quran::after { content: none; }
.pair-en [lang="ar"], .pair-en .inline-arabic { font-family: var(--ar); }
.print-ur-en .para .pn { font-family: var(--en); font-size: 7.5pt; }

/* ─── colophon ─── */
.colophon { margin-top: 0.4in; padding-top: 0.12in; border-top: 0.5pt solid #999; text-align: center; color: var(--ink-3);
            break-before: avoid;
            break-inside: avoid; }
.colophon p { margin: 0; font-size: 9pt; line-height: 2; }
.colophon [lang="en"] { font-size: 8pt; line-height: 1.4; }

/* ─── editor copy: wide outer margin for notes, ¶ numbers + line numbers at the start side ─── */
.print-editor { --pad-in: 0.5in; --pad-out: 2.0in; --pad-t: 0.85in; --pad-b: 1.05in; --gutter: 1.0in; }
.print-editor .print-doc { padding: var(--pad-t) var(--pad-in) var(--pad-b) var(--pad-out); }
.print-editor .para { font-size: 13pt; line-height: 2.9; margin-bottom: 0.9em; text-align: start; }
.print-editor .para.box { text-align: start; }
.print-editor .para .pn {
  inset-inline-start: auto; right: calc(-1 * var(--gutter)); width: 0.5in; top: 0.2em; font: 700 10pt/1.6 var(--en);
  color: #000; direction: ltr; text-align: right; unicode-bidi: isolate;  /* physical: the editor copy is RTL */
}
.print-editor .ln { display: block; position: relative; white-space: nowrap; }
.print-editor .ln::before {
  content: attr(data-l); position: absolute; right: -0.4in; width: 0.25in; text-align: right;
  direction: ltr; font: 7pt/1 var(--en); color: #777; top: 50%; transform: translateY(-50%);
}
.print-editor .para.box .ln::before { right: calc(-0.4in - 14pt); }
.print-editor .para.verse, .print-editor .para.arabic-line { text-align: start; }
.print-editor .ed-box { display: flex; gap: 12pt; align-items: center; justify-content: center; margin-top: 8pt;
                        padding: 6pt 10pt; border: 0.6pt solid #000; text-align: left; }
.print-editor .ed-meta { font-size: 8.5pt; line-height: 1.45; }
.print-editor .ed-qr svg { display: block; width: 0.8in; height: 0.8in; }
.print-editor .edited .pt { text-decoration: none; }
.print-editor .para.edited::after { content: "edited"; position: absolute; right: calc(-1 * var(--gutter)); top: 1.9em;
                                    direction: ltr;
                                    font: italic 6.5pt var(--en); color: #555; width: 0.55in; text-align: right; }

@media print {
  html, body.print { background: #fff; }
  .no-print, .print-toolbar { display: none !important; }
  .print-doc { width: auto; margin: 0; padding: 0 !important; box-shadow: none; }
  .print-editor { margin: 0; }
}
