/* Mushaf page layout, ayah/page switch, and the «التفسير» panel. Tokens from app.css. */

/* ── ayahs | page switch in the session bar ─────────── */
.field--range { gap: 6px; }
.seg-ctl--xs { align-self: flex-start; }
.seg-ctl--xs button { padding: 1px 10px; font-size: 12px; }
#page-ctl input { width: 76px; text-align: center; }
#page-ctl .icon-btn--sm { font-size: 18px; line-height: 1; }

/* ── page layout: one div per mushaf line ───────────── */
.mushaf.mushaf--page {
  max-width: 100%;
  width: var(--page-w, auto);
  font-size: var(--page-font, 26px);
  line-height: 2.1;
  word-spacing: 0;
}
.mushaf--page .line { white-space: nowrap; text-align: justify; text-align-last: justify; }
.mushaf--page .line--short, .page--opening .line { text-align-last: center; }
.mushaf--page.is-measuring { width: auto; }
.mushaf--page.page--reflow { font-size: var(--q-size); line-height: 2.25; text-align: justify; text-align-last: center; }
.page--reflow .line { display: inline; white-space: normal; }
.mushaf--page.is-measuring .line { width: max-content; }

.page-head {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.page-head span:first-child { color: var(--ink); font-weight: 600; }

.page-surah {
  margin: .35em 0 .15em; text-align: center; line-height: 1.9;
  border-block: 3px double color-mix(in srgb, var(--lapis) 55%, transparent);
  background: color-mix(in srgb, var(--lapis-tint) 55%, transparent);
}
.page-surah span { font-size: .92em; color: var(--lapis); }
.page-surah:first-child { margin-top: 0; }
.basmala--page { font-size: .95em; margin: .1em 0 0; line-height: 2.1; }

.page-nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px;
}
.page-nav > * { white-space: nowrap; }

/* ── side tabs ──────────────────────────────────────── */
.layout.is-tafsir { grid-template-columns: minmax(0, 1fr) 410px; }
.side-tabs {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.side-tabs button {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 7px 10px;
  border-radius: 999px; font-weight: 600; color: var(--ink-2);
}
.side-tabs button:hover { color: var(--ink); }
.side-tabs button[aria-selected="true"] { background: var(--lapis); color: var(--lapis-ink); }
.side-group { display: flex; flex-direction: column; gap: 14px; }

/* ── tafsir ─────────────────────────────────────────── */
.tf-pick select {
  width: 100%; height: 42px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper);
  font-weight: 600; cursor: pointer;
}
.tf-about { margin: 8px 0 4px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.tf-level {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 0 8px; border-radius: 999px;
  color: var(--lapis); background: var(--lapis-tint);
}
.tf-body { min-height: 120px; }
.tf-body[aria-busy="true"] { opacity: .7; }
.tf-block { padding: 14px 0 4px; border-top: 1px solid var(--line); margin-top: 10px; }
.tf-block:first-child { border-top: 0; margin-top: 4px; padding-top: 6px; }
.tf-block.is-current {
  background: color-mix(in srgb, var(--lapis-tint) 60%, transparent);
  border-radius: var(--r-sm); border-top-color: transparent;
  margin-inline: -10px; padding-inline: 10px;
}
.tf-head {
  display: block; margin: 0 0 4px; padding: 0; border: 0; background: none;
  font-size: 13px; font-weight: 600; color: var(--lapis); text-align: start;
}
button.tf-head { cursor: pointer; }
button.tf-head:hover { text-decoration: underline; }
.tf-text {
  font-family: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif;
  font-size: 17.5px; line-height: 2; color: var(--ink);
}
.tf-text p { margin: 0 0 .75em; }
.tf-text .tf-h { font-weight: 600; }
.tf-text.is-folded {
  max-height: 15em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent);
}
.tf-more {
  margin: 2px 0 8px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--lapis); font-weight: 600; font-size: 13.5px;
}
.tf-more:hover { text-decoration: underline; }
.tf-q { font-family: var(--font-q); color: var(--lapis); font-size: 1.06em; }
.tf-error { color: var(--danger); }
.tf-credit { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.tf-credit a { color: inherit; }

@media (max-width: 1180px) { .layout.is-tafsir { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 920px) { .layout.is-tafsir { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .tf-text { font-size: 17px; }
  .page-head { font-size: 12px; }
  .page-nav { gap: 8px; }
  .page-nav .btn { padding: 0 10px; }
}
