/* base.css — the one shared stylesheet for every page of the archive (landing, tafsir, books).

   The design tokens live in tokens.css (colour light + sage night, type scale, space, fonts); this file holds the
   shared components that every page wears: header, footer, skip link, focus, layout + rail, panels, buttons,
   chips, rows, script typography, inline tags, print. Section stylesheets (tafsir.css, books.css, pages.css,
   flip.css) only add what is specific to them and may override a token on their body class.
   Candidate palettes: static/themes/*.css (review mockups, `python -m dars.site.mockups themes`). */

/* ─── 1. Design tokens: static/tokens.css (linked before this file on every page) ────────────────── */

/* ─── 2. Base ────────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-en);
  color: var(--fg); background: var(--bg);
  line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;  /* footer at the bottom of short pages */
}
body > * { flex: 0 0 auto; }
input, select, button { color: inherit; }
.ur { font-family: var(--font-ur); }
.hidden, [hidden] { display: none !important; }

/* ─── 3. Site header + footer ───────────────────────────────────────────────────────────── */
/* Smart sticky header (header.js): slides away while reading down, back on scroll up / top edge / focus. */
.site-header {
  position: sticky; top: 0; z-index: 40;  /* below the fixed audio bar (z 50), which lives at the bottom */
  transition: transform 150ms ease;
  background: var(--bg-3); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--space-2);
  padding-inline-end: var(--space-3);  /* dir="rtl": the toggle sits at the left end */
}
.site-header .site-nav { flex: 1 1 auto; }
.site-header.is-hidden { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { .site-header, .sidebar { transition: none !important; } }
@media print { .site-header { position: static; transform: none; } }
/* Colour-scheme toggle: an icon button at the end of the header (scheme.js sets the glyph and label). */
.scheme-toggle {
  flex: 0 0 auto; width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 16px/1 var(--font-en); cursor: pointer;
  color: var(--accent-2); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.scheme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.scheme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-nav {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 2px var(--space-2);
  padding: var(--space-1) var(--space-4);
}
.site-nav-item {
  display: inline-flex; align-items: baseline; gap: var(--space-2);
  padding: 2px var(--space-3); border-radius: var(--radius-pill);
  color: var(--accent-2); text-decoration: none;
  font-size: var(--fs-m); font-weight: 600; line-height: 2;
  border: 1px solid transparent;
}
.site-nav-item .ur { font-weight: 400; font-size: 15px; line-height: 2; }
.site-nav-item:hover { border-color: var(--accent); }
.site-nav-item.active { background: var(--accent); color: var(--on-accent); }
.site-nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-nav-item.nav-search { gap: 6px; }
.nav-icon { width: 14px; height: 14px; align-self: center; flex: 0 0 auto; }
@media (max-width: 720px) {
  /* Phones: stacked bilingual labels (Urdu over English), so English readers keep their labels. */
  .site-nav { padding: 2px var(--space-1); gap: 0; justify-content: space-around; flex-wrap: nowrap; }
  .site-nav-item { flex-direction: column; align-items: center; gap: 0; padding: 2px 6px; line-height: 1.2; border-radius: var(--radius-s); }
  .site-nav-item .ur { font-size: 14px; line-height: 1.9; }
  .site-nav-item .en { font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
  .site-nav-item.nav-search .nav-icon { display: none; }
  .site-header { padding-inline-end: var(--space-1); }
  .scheme-toggle { width: 30px; height: 30px; font-size: 14px; }
}
@media (max-width: 360px) { .site-nav-item .en { display: none; } }

/* Skip link: the first focusable thing on every page. */
.skip-link {
  position: absolute; inset-inline-start: var(--space-2); top: -60px; z-index: 100;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-s);
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-size: var(--fs-small);
}
.skip-link:focus { top: var(--space-2); }
.skip-target { display: block; height: 0; outline: none; }
/* One focus style everywhere. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--accent); }
[lang="ur"] { font-family: var(--font-ur); }
[lang="en"] { font-family: var(--font-en); }
[lang="ar"] { font-family: var(--font-ar); }

.site-footer {
  margin-top: auto;
  text-align: center; color: var(--fg-2); font-size: var(--fs-small);
  border-top: 1px solid var(--border); background: var(--bg-3);
  padding: var(--space-5) var(--gutter);
}
.site-footer p { margin: 0 auto var(--space-1); max-width: 720px; }
.site-footer p[lang="ur"] { font-size: var(--fs-ur-caption); line-height: 2; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-5); margin-bottom: var(--space-3); }
.footer-links a { color: var(--accent-2); text-decoration: none; font-size: var(--fs-small); }
.footer-links a [lang="ur"] { font-size: var(--fs-ur-caption); }
.footer-links a:hover { text-decoration: underline; }
.site-updated { font-size: var(--fs-caption); opacity: 0.8; }

/* ─── 4. Layout: content + sidebar on the RIGHT ─────────────────────────────────────────────
   The content (Urdu/Arabic) reads RTL, so the nav rail sits on its natural side. DOM order is
   <main> then <nav class="sidebar"> (content first); grid auto-placement does the rest. */
.layout {
  direction: ltr;  /* <html dir="rtl">; the grid (and the English it holds) is authored LTR, content declares its own dir */
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  min-height: 100vh;
  align-items: start;
}
.main { min-width: 0; max-width: var(--content-max); padding-bottom: var(--space-6); }

.sidebar {
  position: sticky; top: var(--header-offset, 0px); height: calc(100vh - var(--header-offset, 0px));
  transition: top 150ms ease, height 150ms ease;
  background: var(--bg-2); border-left: 1px solid var(--border);
  padding: var(--space-2) var(--space-3) var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-1);
  overflow: hidden;  /* only .sb-list scrolls; the title block stays put */
}
.sidebar > :not(.sb-list) { flex: 0 0 auto; }
.sb-home { display: block; text-decoration: none; color: inherit; }
.sb-home:hover .sb-title { opacity: 0.85; }
.sidebar .sb-title {
  font-family: var(--font-ur); font-weight: 400;
  font-size: 28px; line-height: 1.9; margin: 0; color: var(--accent-2); text-align: center;
}
.sidebar .sb-title .subtitle {
  display: block; font-family: var(--font-en);
  font-size: var(--fs-s); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-2); margin-top: 2px;
}
.sidebar .sb-title .author-line { display: block; margin-top: 2px; line-height: 1.5; text-align: center; }
.sidebar .sb-title .author-name-ur {
  font-family: var(--font-ur); font-size: var(--fs-m);
  color: var(--accent-2); font-weight: 500; letter-spacing: 0.01em;
}
.sidebar .sb-title .author-sep {
  display: inline-block; font-size: 13px; line-height: 1;
  color: var(--accent); font-weight: 700; margin: 0 var(--space-2); vertical-align: middle;
}
.sb-search {
  width: 100%; padding: 6px var(--space-2); border: 1px solid var(--border);
  border-radius: 6px; font-size: var(--fs-s); background: var(--bg); font-family: inherit;
}
.sb-list {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 auto; min-height: 0;
  overflow-y: scroll;  /* always show the track: the affordance that the rail scrolls */
  padding-right: var(--space-1); padding-top: 14px;
  /* soft fade at both ends, a hint that there is more beyond */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-3);
}
.sb-list::-webkit-scrollbar { width: 10px; }
.sb-list::-webkit-scrollbar-track { background: var(--bg-3); border-radius: 5px; margin: 4px 0; }
.sb-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 5px; border: 2px solid var(--bg-3); }
.sb-list::-webkit-scrollbar-thumb:hover { background: var(--accent-2); }
.sb-item {
  display: flex; align-items: baseline; gap: 6px;
  padding: var(--space-1) 6px; border-radius: var(--radius-s); font-size: var(--fs-s);
  text-decoration: none; color: var(--fg);
}
.sb-item:hover { background: var(--bg-3); }
.sb-item.active { background: var(--accent); color: var(--on-accent); }
.sb-item[data-current="true"] {
  border-left: 4px solid var(--accent); font-weight: 700; color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent); padding-left: 6px;
}
.sb-dot { font-size: 9px; }
/* Sidebar footer: collapsed stats (tokens, rebuilt time). */
.book-meta-details {
  margin-top: auto; border-top: 1px solid var(--rule); padding-top: var(--space-2);
  font-size: var(--fs-s); color: var(--fg-2);
}
.book-meta-details > summary {
  cursor: pointer; user-select: none; padding: var(--space-1) 0;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
}
.book-meta { padding-top: 6px; line-height: 1.5; }
.book-meta .stat { display: flex; justify-content: space-between; }
.book-meta .stat strong { color: var(--fg); font-weight: 600; }
.rebuilt-at { margin-top: 6px; font-size: var(--fs-xs); }

@media screen and (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-left: none; border-top: 1px solid var(--border); }
  .sb-list { max-height: 70vh; }
}

/* ─── 5. Panels, buttons, pills, callouts, disclosures ──────────────────────────────────── */
/* A raised surface: one recording, one book page, one landing card. */
.panel {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}
/* A whole-surface link that lifts on hover. */
.lift { color: inherit; text-decoration: none; transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease; }
.lift:hover, .lift:focus-visible { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-hover); }
.lift:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Small boxed button (back links, "open" calls to action, download). */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  font-family: var(--font-en); font-size: var(--fs-small); font-weight: 600;
  color: var(--accent-2); text-decoration: none; white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--bg-3);
}
.btn:hover, .lift:hover .btn { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* Rounded toggle button (e.g. Urdu-only). */
.toggle-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 6px var(--space-3); border-radius: var(--radius-pill);
  background: var(--bg-2); color: var(--accent-2); border: 1px solid var(--rule);
  font-size: 13px; font-family: var(--font-en);
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.toggle-btn.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Pills: references, themes, flags, types, confidence. */
.pill {
  display: inline-block; font-size: 11px; line-height: 1.5;
  padding: 1px 7px; border-radius: var(--radius-pill);
  background: var(--bg-3); color: var(--accent-2);
}
.pill, .btn { unicode-bidi: isolate; }  /* English islands inside RTL rows keep their own order */
.pill.caps { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; padding: 2px 8px; }
.tone-quran  { background: var(--quran-bg); color: var(--green); }
.tone-hadith { background: var(--hadith-bg); color: var(--hadith-fg); }
.tone-theme  { background: var(--theme-bg); color: var(--theme-fg); }
.tone-ok     { background: var(--ok-bg); color: var(--green); }
.tone-warn   { background: var(--warn-bg); color: var(--yellow); }
.tone-danger { background: var(--danger-bg); color: var(--red); }
.pills { display: flex; gap: var(--space-1); flex-wrap: wrap; }

/* ﷺ inside Urdu labels: Naskh, small, on the line (the `hs` filter wraps it). */
.salawat { font-family: var(--font-ar); font-size: 0.8em; line-height: 1; font-weight: 400; }

/* Chips: topics (lecture pages, topic index), facets, search kinds. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); direction: rtl; }
.chip {
  display: inline-flex; align-items: baseline; gap: var(--space-2);
  padding: 2px var(--space-3); border-radius: var(--radius-pill);
  background: var(--bg-3); color: var(--accent-2); border: 1px solid var(--border);
  text-decoration: none; font-size: var(--fs-small); line-height: 1.9;
}
.chip .ur { font-size: var(--fs-ur-caption); }
.chip .en { font-size: var(--fs-caption); color: var(--fg-2); }
.chip .n { font-size: var(--fs-caption); color: var(--fg-2); font-variant-numeric: tabular-nums; }
a.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip.on .en, .chip.on .n { color: inherit; opacity: 0.85; }

/* Callouts: notes, reading order, warnings. */
.callout {
  background: var(--note-bg); border-left: 3px solid var(--yellow);
  padding: var(--space-2) var(--space-3); font-size: 13px; color: var(--fg-2);
  border-radius: 0 6px 6px 0;
}
.callout.danger { background: var(--danger-bg); border-left-color: var(--red); color: var(--fg); }
.callout.danger strong { color: var(--red); }

/* <details> disclosures (provenance, scans). */
.disclosure > summary {
  cursor: pointer; user-select: none; padding: 6px 0;
  font-size: var(--fs-s); color: var(--fg-2);
  display: flex; align-items: center; gap: 10px;
}
.disclosure > summary::-webkit-details-marker { color: var(--accent); }
.disclosure-label { font-weight: 500; color: var(--fg); }
.disclosure-aside { color: var(--fg-2); margin-left: auto; font-variant-numeric: tabular-nums; }

/* The mode bar of an OCR'd book (study view: books/templates/book.html; flip-book: templates/flip.html): one row
   under the site header, the same in both views. Right: back to Books + title; centre: the Study ⇄ Flip-book
   segmented control (templates/_modeswitch.html); left: the page in view. Sticky in the study view. */
body { --modebar-h: 0px; }
body.has-modebar { --modebar-h: 52px; }
.mode-bar {
  box-sizing: border-box; height: 52px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: var(--space-3); padding: 0 var(--gutter);
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
body.book .mode-bar { position: sticky; top: var(--header-offset, 0px); z-index: 20; transition: top 150ms ease; }
.mb-side { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.mb-start { grid-column: 1; } .mode-switch { grid-column: 2; } .mb-end { grid-column: 3; justify-content: flex-end; }
.mb-title { min-width: 0; margin: 0; display: flex; align-items: baseline; gap: var(--space-2); font-weight: 400; font-size: inherit; overflow: hidden; }
.mb-title .ur { font-family: var(--font-ur); font-size: var(--fs-ur-small); font-weight: 600; color: var(--accent-2); line-height: 1.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-title .en { font-size: var(--fs-small); color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-bar .sep { white-space: pre; }
.mb-back [lang="ur"] { font-size: var(--fs-ur-caption); line-height: 1.6; }
.mb-page { font-size: var(--fs-small); color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mode-switch {
  display: inline-flex; gap: 3px; padding: 3px; border: 1.5px solid var(--accent); border-radius: var(--radius-pill);
  background: var(--bg-3); unicode-bidi: isolate;
}
.ms-opt {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 14px; min-height: 36px; box-sizing: border-box;
  border-radius: var(--radius-pill); color: var(--accent-2); text-decoration: none; white-space: nowrap;
  font-family: var(--font-en); font-size: var(--fs-small); font-weight: 600; transition: background 0.12s, color 0.12s;
}
.ms-opt .ur { font-family: var(--font-ur); font-size: var(--fs-ur-caption); line-height: 1.7; }
.ms-opt .sep { white-space: pre; opacity: 0.7; padding-inline: 2px; }
.ms-ico { width: 18px; height: 18px; flex: 0 0 auto; }
a.ms-opt:not(.on):hover { background: var(--bg-2); color: var(--accent); }
.ms-opt.on { background: var(--accent); color: var(--on-accent); cursor: default; }
.ms-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 900px) {
  .mb-title .en, .ms-x { display: none; }
}
@media (max-width: 640px) {
  body.has-modebar { --modebar-h: 48px; }
  .mode-bar { height: 48px; gap: var(--space-2); padding: 0 var(--space-2); }
  .mode-bar:not(:has(.mode-switch)) .mb-title { display: flex; }  /* flip-only books: room for the title */
  .mode-bar:not(:has(.mode-switch)) .mb-title .en { display: none; }
  .mb-title, .mb-back [lang="en"], .mb-back .sep, .ms-ico { display: none; }
  .ms-opt { padding: 3px 10px; min-height: 34px; gap: 0; font-size: var(--fs-caption); }
  .ms-opt .ur { font-size: 14px; }
}
@media (max-width: 440px) {
  .ms-opt { padding: 3px 8px; }
  .mode-switch { gap: 2px; padding: 2px; }
  .mb-back { padding: 5px 9px; }
  .mb-page { font-size: var(--fs-caption); }
}
@media print { .mode-bar { display: none !important; } }

/* ─── 6. Two-column original/translation rows ────────────────────────────────────────────
   Each .row holds [translation | original]; display:contents flows both cells into the grid so a
   segment sits level with the blocks it translates. `stretch` gives both cells the same height so
   the dashed dividers line up (Nastaliq lines are much taller than the English serif). */
.aligned {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--space-3) 28px;
  align-items: stretch;
  margin-top: 14px;
}
.aligned .row { display: contents; }
.aligned .col-header {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-2); font-weight: 600;
  padding-bottom: var(--space-1); border-bottom: 1px solid var(--rule);
}
.aligned .orig-col-header { text-align: right; }
.aligned .trans-cell, .aligned .orig-cell { padding-bottom: var(--space-2); border-bottom: 1px dashed var(--rule); }
.aligned > .row:last-child .trans-cell,
.aligned > .row:last-child .orig-cell { border-bottom: none; padding-bottom: 0; }
.aligned .trans-cell.empty { color: var(--rule); font-size: 13px; }
.aligned .trans-cell.continued { color: var(--fg-2); font-size: 11px; font-style: italic; }
.aligned .trans-cell p { margin: var(--space-1) 0 0; font-size: var(--fs-trans); line-height: 1.65; }
.trans-refs { font-size: var(--fs-xs); color: var(--fg-2); font-family: var(--font-mono); }
.trans-seg { margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px dashed var(--rule); }
.trans-seg:last-child { border-bottom: none; }
.aligned .orig-cell.stack { display: flex; flex-direction: column; gap: 6px; }
.aligned .orig-cell.stack .block { padding: var(--space-1) 0; border-bottom: 1px dotted var(--rule); }
.aligned .orig-cell.stack .block:last-child { border-bottom: none; }
/* Narrow screens: one column, each row stacked original-then-translation. The row becomes a real
   box here (not display:contents), so the reordering stays inside the row. */
@media screen and (max-width: 1100px) {  /* screen only: A4 landscape is ~1017px wide */
  .aligned { display: block; }
  .aligned .col-header { display: none; }
  .aligned .row { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-2) 0; border-bottom: 1px dashed var(--rule); }
  .aligned > .row:last-child { border-bottom: none; }
  .aligned .trans-cell, .aligned .orig-cell { border-bottom: none; padding-bottom: 0; }
  .aligned .orig-cell { order: 1; }
  .aligned .trans-cell { order: 2; }
}

/* ─── 7. Blocks and script typography ───────────────────────────────────────────────────── */
.block { margin: 0 0 var(--space-3) 0; }
.block-body { line-height: 1.7; }
.block-note {
  display: block; font-size: 11px; color: var(--fg-2); font-style: italic;
  margin-top: var(--space-1); text-align: left;
}
.script-urdu, .script-arabic, .script-persian, .block.script-mixed[dir="rtl"] { text-align: right; }
.script-urdu { font-family: var(--font-ur); font-size: var(--fs-urdu); line-height: var(--lh-urdu); }
.script-arabic { font-family: var(--font-ar); font-size: var(--fs-arabic); line-height: var(--lh-arabic); }
.script-persian { font-family: var(--font-ur); font-size: var(--fs-persian); line-height: 2; }
.block.script-mixed[dir="rtl"] { font-family: var(--font-ur); font-size: var(--fs-urdu); line-height: var(--lh-urdu); }
.block.script-english, .block.script-unknown, .block.script-mixed[dir="ltr"] { font-family: var(--font-en); font-size: var(--fs-latin-block); }

/* ─── 8. Inline tags inside a block ─────────────────────────────────────────────────────── */
/* Script switches */
.inline-arabic { font-family: var(--font-ar); font-size: 0.95em; padding: 0 2px; }
.inline-persian, .inline-urdu { font-family: var(--font-ur); }
.inline-english { font-family: var(--font-en); font-size: 0.92em; direction: ltr; display: inline-block; }
/* Semantic spans. Quran/hadith/dua imply Arabic typography. */
.semantic-quran, .semantic-hadith {
  padding: 1px var(--space-2); border-radius: 3px; font-family: var(--font-ar);
  border-right: 2px solid var(--green);
}
.semantic-quran { background: var(--quran-bg); color: var(--quran-fg); }
.semantic-hadith { background: var(--hadith-bg); color: var(--hadith-fg); border-right-color: var(--yellow); }
[dir="ltr"] .semantic-quran, [dir="ltr"] .semantic-hadith { border-right: none; border-left: 2px solid var(--green); }
[dir="ltr"] .semantic-hadith { border-left-color: var(--yellow); }
.semantic-quran .ref, .semantic-hadith .ref {
  font-family: var(--font-en); font-size: 0.7em; font-weight: 600;
  color: var(--green); margin-right: var(--space-1); vertical-align: super;
}
.semantic-hadith .ref { color: var(--yellow); }
.semantic-poetry { display: inline-block; font-style: italic; padding: 0 var(--space-1); white-space: pre-wrap; }
.semantic-dua { background: var(--dua-bg); font-family: var(--font-ar); padding: 0 var(--space-1); border-radius: 3px; }
/* Audio-transcript annotations. Greyed, never italic: Nastaliq has no italic and would fall back. */
.audio-extraneous, .audio-aside, .audio-unclear { color: var(--fg-2); font-size: 0.92em; }
.audio-unclear { border-bottom: 1px dotted var(--red); cursor: help; }
.mode-public .audio-unclear { border-bottom-color: var(--border); cursor: auto; }
/* An ayah reference (`21:93-100`) keeps its LTR order inside RTL text. */
.ayah-ref { direction: ltr; unicode-bidi: isolate; }
/* The English column: quotations of Quran / hadith (rendered from the translation's inline tags). */
.inline-quran-en { color: var(--quran-fg); }
.inline-hadith-en { color: var(--hadith-fg); }
.inline-dua-en { font-style: italic; }
.ayah-cite { font-size: 0.88em; color: var(--fg-2); white-space: nowrap; }
.inline-poetry { font-style: italic; }
/* A `\n` in the source, kept as a faint divider so a Nastaliq run flows as one paragraph. */
.nl-mark { color: var(--nl-mark); margin: 0 6px; font-weight: 300; user-select: none; }

/* ─── 9. Print ──────────────────────────────────────────────────────────────────────────────
   A4 landscape, two columns locked regardless of paper width (sections can set --print-cols). */
@media print {
  @page { size: A4 landscape; margin: 12mm 14mm; }
  :root { color-scheme: light; }
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .sidebar, .no-print { display: none !important; }
  .layout { display: block !important; }
  .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; border: none; padding: 0 !important; margin: 0 0 8mm 0 !important; }
  .aligned {
    display: grid !important;
    grid-template-columns: var(--print-cols, 1fr 1.05fr) !important;
    gap: 10pt 22pt !important;
  }
  .aligned .row { display: contents !important; }
  .aligned .col-header { display: block !important; border-bottom: 0.5pt solid #555 !important; color: #333 !important; }
  .aligned .trans-cell, .aligned .orig-cell {
    order: unset !important;
    padding-top: 0 !important; padding-bottom: 8pt !important;
    border-top: none !important; border-bottom: 0.3pt dashed #bbb !important;
  }
  .script-urdu, .script-arabic, .script-persian, .block.script-mixed[dir="rtl"] { font-size: 14pt; line-height: 1.7; }
  .block.script-english, .block.script-mixed[dir="ltr"] { font-size: 10.5pt; }
  .pill { font-size: 9pt; }
  .block, .trans-seg { break-inside: avoid; page-break-inside: avoid; }
  .callout { background: transparent; border-left-color: #888; }
  a { color: inherit; text-decoration: none; }
}
