/*tvfb2*//*tvfb*//* Translation view modes in the book readers (js/view-mode.js, DISPLAY-RULES.md).
   Loaded after qudoori.css (and tuhfa.css / hikam.css); reuses their tokens. */

/* ---------- the switch (the Sheikh 2026-10-04): one quiet row of four segments, picture + short label ---------- */
.vm-switch { width: 100%; max-width: 40rem; margin: 0 auto; }
.vm-seg {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-gap: 3px; gap: 3px; padding: 3px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
@supports not (color: color-mix(in srgb, red 50%, blue)) { .vm-seg { background: var(--surface); } }
.vm-seg button {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted); font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; grid-gap: 3px; gap: 3px;
  min-height: 64px; padding: 8px 4px 7px; border-radius: 12px; text-align: center;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.vm-seg button:hover { color: var(--ink); background: transparent; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.vm-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vm-seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--accent); border-color: var(--border); border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 3px 10px transparent; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 3px 10px color-mix(in srgb, var(--accent) 14%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) { .vm-seg button[aria-pressed="true"] { border-color: var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 3px 10px transparent; } }
.vm-ico { width: 28px; height: 22px; flex: none; margin-bottom: 1px; }
.vm-ico-a { fill: currentColor; }
.vm-ico-n { fill: currentColor; opacity: .45; }
.vm-seg button[aria-pressed="true"] .vm-ico-n { fill: var(--gold); opacity: 1; }
.vm-l-ar { font-family: var(--font-ar); direction: rtl; font-size: .95rem; line-height: 1.5; font-weight: 700; margin-top: 2px; }
.vm-l-no { font-size: .74rem; line-height: 1.2; font-weight: 600; letter-spacing: .01em; }
@media (max-width: 480px) {
  .vm-seg button { min-height: 60px; padding: 7px 2px 6px; }
  .vm-l-ar { font-size: .9rem; }
  .vm-l-no { font-size: .68rem; }
}

/* ---------- a fasl as running prose ---------- */
.vm-passage { max-width: 46rem; margin: 0 auto; padding: .4rem 0 .6rem; }
.vm-ar .vm-p {
  font-family: var(--font-ar); direction: rtl; text-align: justify; text-align-last: right;
  font-size: var(--qd-ar, 1.45rem); line-height: 2.15; margin: 0 0 .9rem; overflow-wrap: break-word; color: var(--ink);
}
.vm-no .vm-p { font-size: 1.04rem; line-height: 1.8; margin: 0 0 .9rem; color: var(--ink); hyphens: auto; }
.vm-n {
  font-size: .58em; line-height: 0; vertical-align: super; color: var(--gold); font-weight: 700;
  -webkit-margin-end: .2em; margin-inline-end: .2em; font-variant-numeric: lining-nums; user-select: none;
}
.vm-ar .vm-n { font-family: var(--font-ar); font-size: .55em; }
.vm-u { scroll-margin-top: 90px; border-radius: 4px; transition: background-color .4s; }
.vm-u:target, .vm-verse:target, .vm-verse-no:target { background: var(--accent-soft); box-shadow: 0 0 0 .2em var(--accent-soft); }
.vm-missing { color: var(--muted); font-style: italic; font-size: .9em; }

/* verse keeps its lines in every mode */
.vm-verse { padding: .3rem 0; scroll-margin-top: 90px; }
.vm-verse + .vm-verse { border-top: 1px dashed var(--border); }
.vm-verse .qd-ar { text-align: initial; text-align-last: auto; }
.vm-ar .vm-verse:last-child { margin-bottom: .9rem; }
.vm-verse-no { margin: 0; padding: .25rem 0; font-size: 1.02rem; line-height: 1.7; scroll-margin-top: 90px; }

/* block: the Norwegian passage under the Arabic one, set apart */
.vm-block .vm-no { margin-top: .6rem; padding-top: 1.1rem; border-top: 1px solid var(--border); position: relative; }
.vm-block .vm-no::before {
  content: "Norsk"; position: absolute; top: -.7em; left: 50%; transform: translateX(-50%);
  padding: 0 .7rem; background: var(--paper, var(--surface)); color: var(--muted);
  font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}

/* per-unit extras after the passage, keyed by unit number */
.vm-extras { margin-top: 1.2rem; padding-top: .9rem; border-top: 1px dashed var(--border-strong, var(--border)); display: grid; grid-gap: .9rem; gap: .9rem; }
.vm-extra-n { margin: 0 0 .3rem; font-size: .82rem; font-weight: 700; font-variant-numeric: lining-nums; }
.vm-extra-n a { color: var(--em-d, var(--accent)); text-decoration: none; }
.vm-extra-n a:hover { text-decoration: underline; }
.vm-extra .tf-sh { margin-top: 0; }

@media print {
  .vm-switch { display: none !important; }
  .vm-u:target { background: none; box-shadow: none; }
}

/* ---------- other readers (00-2003): Arbain cards, Ayyuha al-Walad, al-Ajurrumiyya ---------- */
.ar-present-body > .vm-switch, .aw-vm, .aj-vm { margin-bottom: .2rem; }
.aw-vm:empty { display: none; }
/* Arbain: the lesson lines are not numbered, so no inline numbers in the prose */
.vm-nonum .vm-n { display: none; }
.ap-read-panel.vm-prose .vm-passage { max-width: none; }
/* Arbain lines mode with a translation: every line shows its Norwegian, no fold pills */
.reader-inner.m-all .rd-seg .seg-no { display: block; }
/* Arbain hadith box: lines = each line with its Norwegian under it; no = the Norwegian alone at reading size */
.ar-hadith-lines { display: flex; flex-direction: column; grid-gap: .15rem; gap: .15rem; }
.ar-hadith-lines .lbl-ar { font-family: var(--font-ar); font-size: 1.6rem; font-size: clamp(1.2rem, 2.4vw, 1.6rem); line-height: 1.85; }
.ar-hadith-lines .lbl-no { font-size: .92rem; line-height: 1.5; color: var(--muted); direction: ltr; margin-bottom: .45rem; }
.vm-box-no .ar-hadith-no { border-top: 0; padding-top: 0; font-size: 1.05rem; color: var(--ink); }
@media (max-width: 720px) {
  .ar-hadith-box-inner.vm-box-lines:not(.expanded) .ar-hadith-lines { max-height: 12.5rem; overflow: hidden; }
  .ar-hadith-box-inner.vm-box-no:not(.expanded) .ar-hadith-no {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden;
  }
}
.ar-hadith-box.is-intro .ar-hadith-box-inner.vm-box-lines:not(.expanded) .ar-hadith-lines { max-height: 10rem; overflow: hidden; }
.ar-hadith-box.is-intro .ar-hadith-box-inner.vm-box-no:not(.expanded) .ar-hadith-no {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
/* Ayyuha al-Walad and al-Ajurrumiyya, lines mode: the Norwegian under its Arabic */
.aw-no, .aj-mno { direction: ltr; text-align: left; font-family: var(--font-body, inherit); color: var(--ink); }
.aw-no, .hk-intro-p p.aw-no { margin: -.3rem 0 .9rem; font-family: var(--font-body, inherit); font-size: 1rem; line-height: 1.7; text-align: left; }
.aw-md .aw-no p, .aw-md .aw-no li, .aw-md .aw-no .aw-list { font-family: var(--font-body, inherit); font-size: 1rem; line-height: 1.7; text-align: left; }
.aw-md-no { direction: ltr; text-align: left; }
.aw-md.aw-md-no, .aw-md-no p, .aw-md-no .aw-list { font-family: var(--font-body, inherit); line-height: 1.75; text-align: left; }
.aw-verse { text-align: center; text-align-last: center; }
.aj-masail li.has-no { flex-wrap: wrap; }
.aj-mno { flex: 1 0 100%; margin: .2rem 0 0; font-size: 1rem; line-height: 1.65; }
.aj-prose { padding: .4rem 1rem 1rem; }
/* verse lines inside the prose of these readers: Arabic verse size, centred */
.aw-matn .vm-verse, .ap-read-panel .vm-verse { font-family: var(--font-ar); font-size: 1.3rem; line-height: 2; text-align: center; }
/* Arbain, the next hadith page: the switch above the matn */
.matn-modes > .vm-switch { margin-bottom: .6rem; }
.matn-modes > .matn-no:first-child, .matn-modes > .vm-switch + .matn-no { border-right: 0; border-inline-start: 0; -webkit-padding-start: 0; padding-inline-start: 0; color: var(--ink); }

/* tvfb: flex gap fallback (html.no-flexgap set by compat.js) */
.no-flexgap .vm-seg button > * + * { margin-top: 3px; }
.no-flexgap /* Arbain hadith box: lines = each line with its Norwegian under it; no = the Norwegian alone at reading size */
.ar-hadith-lines > * + * { margin-top: .15rem; }
