/* Translation view modes in the panel readers (js/view-mode.js, DISPLAY-RULES.md).
   Port of the public site's css/view-mode.css onto the panel tokens (--text, --brass, --font-display).
   Sizes are in em: the readers set their own size (--rsize, A−/A+). */

/* ---------- the switch: four buttons, Arabic labels ---------- */
.vm-switch {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  width: 100%; max-width: 60rem; margin: 0 auto .8rem; padding: 4px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
  font-family: var(--font-body); font-size: 16px; direction: rtl;
}
.vm-switch button {
  appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 6px 10px; border-radius: 10px; text-align: center;
}
.vm-switch button:hover { background: var(--accent-soft); color: var(--text); }
.vm-switch button:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
.vm-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.vm-l-ar { font-family: var(--font-body); direction: rtl; font-size: .92rem; font-weight: 600; line-height: 1.45; }
@media (max-width: 719px) {
  .vm-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vm-l-ar { font-size: .88rem; }
}

/* ---------- a passage as running prose ---------- */
.vm-passage { max-width: 46rem; margin: 0 auto; padding: .3rem 0 .6rem; }
.vm-ar .vm-p {
  font-family: var(--font-display); direction: rtl; text-align: justify; text-align-last: right;
  font-size: 1em; line-height: 2.05; margin: 0 0 .8em; overflow-wrap: break-word; color: var(--text);
}
.vm-no { direction: ltr; text-align: left; }
.vm-no .vm-p {
  font-family: var(--font-body); font-size: max(16px, .62em); line-height: 1.75; margin: 0 0 .9em;
  color: var(--text); hyphens: auto;
}
.vm-n {
  font-size: .58em; line-height: 0; vertical-align: super; color: var(--brass); font-weight: 700;
  margin-inline-end: .2em; font-variant-numeric: lining-nums; user-select: none;
}
.vm-ar .vm-n { font-family: var(--font-display); 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-family: var(--font-body); font-size: .8em; }
.vm-head { font-family: var(--font-display); color: var(--brass); text-align: center; font-size: .9em; margin: .4em 0 .6em; }

/* verse (and a Qur'an segment of a khutba) keeps its own line in every mode */
.vm-verse { padding: .3em 0; scroll-margin-top: 90px; font-family: var(--font-display); line-height: 2; }
.vm-verse + .vm-verse { border-top: 1px dashed var(--border); }
.vm-ar .vm-verse:last-child { margin-bottom: .8em; }
.vm-verse-no { margin: 0; padding: .25em 0; font-family: var(--font-body); font-size: max(16px, .6em); line-height: 1.7; scroll-margin-top: 90px; }
.vm-aya { color: var(--accent); }

/* block: the Norwegian passage under the Arabic one, set apart */
.vm-block .vm-no { margin-top: .5em; padding-top: 1em; border-top: 1px solid var(--border); position: relative; }
.vm-block .vm-no::before {
  content: "النرويجية"; position: absolute; top: -.75em; left: 50%; transform: translateX(-50%);
  padding: 0 .7rem; background: var(--bg); color: var(--muted); font-family: var(--font-body);
  font-size: 13px; font-weight: 600; line-height: 1.4;
}
.qd-bk-page.vm-block .vm-no::before, .ap-read-panel.vm-block .vm-no::before, .ap-slide-body.vm-block .vm-no::before { background: var(--surface); }

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

/* the Arbain hadith box: lines = each line with its Norwegian under it; no = the Norwegian alone */
.ar-hadith-lines { display: flex; flex-direction: column; gap: .15rem; }
.ar-hadith-lines .lbl-ar { font-family: var(--font-display); direction: rtl; }
.ar-hadith-lines .lbl-no { font-family: var(--font-body); font-size: .92rem; line-height: 1.5; color: var(--muted); direction: ltr; text-align: left; margin-bottom: .45rem; }
.ar-hadith-lines .lbl-ar { font-size: clamp(1.25rem, 2.6vw, 1.75rem); line-height: 1.85; color: var(--text); overflow-wrap: anywhere; }
.vm-box-no .ar-hadith-no { border-inline-start: 0; padding-inline-start: 0; font-size: 1.05rem; color: var(--text); }
@media (max-width: 760px) {
  .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;
}
/* the switch inside the Arbain presenter and lesson */
.ar-present-body > .vm-switch, .ar-lesson .vm-switch { margin-bottom: .2rem; }

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

/* the panel book pages (Tuhfa, Hikam, Qudoori): a bayt's Norwegian keeps its two lines */
.vm-vl { display: block; }
.qd-bk-page .vm-passage { max-width: none; }
.qd-bk-page .vm-no, .qd-bk-page .vm-extras { font-size: 1rem; }
.qd-bk-page .vm-no .vm-p, .qd-bk-page .vm-verse-no { font-size: max(16px, calc(var(--rsize, 28px) * .6)); }
.qd-bk-page .vm-extras { direction: rtl; text-align: right; }
