/* The mushaf page (/mushaf/), drawn as the app's MushafPageView draws it
   (lib/screens/mushaf.dart, the approved MUSHAF board): the paper and its
   gold-leaf frame, the jade surah band, the bismillah line, the printed lines
   justified to the margin, the juz and hizb marks in the outer margin, the
   page number in its khatam at the foot. Colours are the app's Mk palette
   (lib/design/mihrab.dart), light and night. Sizes are set by mushaf.js
   through --fs (the type), --slot (one printed line), --k (the board's
   scale) and --keep (the overhang allowance); the values here are the
   no-JS page's. */
:root{
  --mpaper:#FDFAF2; --mink:#13201A; --mgold:#C99A45; --mgoldL:#E9C97A;
  --mgoldInk:#7A5A1C; --ma1:#1A7059; --ma2:#0A3A2D; --mline:#DCCFB5;
  --msaid:rgba(31,107,85,.16);
}
html[data-theme=dark]{
  --mpaper:#0F1813; --mink:#EEF2EA; --mgold:#D6B466; --mgoldL:#E8CB85;
  --mgoldInk:#E2C47F; --mline:#2C3D33; --msaid:rgba(93,181,148,.24);
}
.page.lib.mushafpg{max-width:1000px}

/* ── controls ── */
.mctl{display:flex;flex-wrap:wrap;gap:12px 18px;align-items:center;justify-content:center;margin:18px 0 6px}
.mlay{display:flex;background:var(--sunk);border-radius:18px;padding:4px;gap:4px;flex-wrap:wrap;justify-content:center}
.mlay button{font:inherit;border:0;background:none;color:var(--ink);border-radius:14px;padding:7px 14px;
  font-size:.88rem;font-weight:600;cursor:pointer;line-height:1.25;text-align:center}
.mlay button small{display:block;font-weight:400;font-size:.72rem;color:var(--muted)}
.mlay button.on{background:var(--accent);color:var(--onAccent)}
.mlay button.on small{color:var(--onAccent);opacity:.85}
.mlay button:focus-visible,.mturn:focus-visible,.mnav input:focus-visible,.mnav select:focus-visible{
  outline:2px solid var(--accentInk);outline-offset:2px}
.mnav{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:center;font-size:.9rem;color:var(--muted)}
.mnav input[type=number]{width:4.6em;font:inherit;color:var(--ink);background:var(--card);border:1px solid var(--line);
  border-radius:10px;padding:6px 8px;text-align:center}
.mnav select{font:inherit;color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:10px;
  padding:6px 8px;max-width:13em}
.mtj{display:inline-flex;align-items:center;gap:6px;cursor:pointer;color:var(--ink)}
.mtj input{width:18px;height:18px;accent-color:var(--accent)}
html:not(.js) .mctl{display:none}

/* ── the book ── */
.mbook{margin-top:8px;--fs:14px;--slot:36px;--k:.82;--keep:0px}
@media (min-width:600px){.mbook{--fs:20px;--slot:51px;--k:1.18}}
.mhead{text-align:center;margin:8px 0 6px}
.mhead .mt{font-weight:600;font-size:15px;color:var(--ink)}
.mhead .ms{font-size:12.5px;color:var(--muted);margin-top:1px}
.mrow{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px}
.mstage{min-width:0;display:flex;justify-content:center;touch-action:pan-y}
.mturn{width:46px;height:46px;border-radius:50%;border:1px solid var(--line);background:var(--card);color:var(--ink);
  font-size:28px;line-height:1;cursor:pointer;display:grid;place-items:center;box-shadow:var(--shadow)}
.mturn span{margin-top:-3px}
.mturn:disabled{opacity:.35;cursor:default}
@media (max-width:699px){
  .mrow{grid-template-columns:1fr 1fr;grid-template-areas:"stage stage" "next prev"}
  .mstage{grid-area:stage}
  .mnext{grid-area:next;justify-self:start}
  .mprev{grid-area:prev;justify-self:end}
}

/* The leaf: the paper, its outer margin (the rail, on the left of an even
   page and the right of an odd one, as a bound mushaf opens) and its inner
   one. */
.mleaf{position:relative;display:flex;justify-content:center;padding:4px 38px 0 10px;max-width:100%}
.mleaf.even{padding:4px 10px 0 38px}
.mrail{position:absolute;top:0;bottom:0;width:38px;right:0}
.mleaf.even .mrail{right:auto;left:0}
.mm{position:absolute;left:0;width:38px;display:flex;flex-direction:column;align-items:center;
  color:var(--mgoldInk);text-align:center}
.mmv{display:flex;flex-direction:column;align-items:center}
.mmj{width:30px;height:30px;display:grid;place-items:center;background:var(--khBadge) center/contain no-repeat;
  font-size:11px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}
.mml{font-size:10.5px;font-weight:600;line-height:1.4}
.mmgap{height:8px}
.mmq{font-size:12px;font-weight:700;line-height:1.1}
.mmh{font-family:QuranIndoPak,serif;font-size:13px;line-height:1.3}
.mmn{font-size:11px;font-weight:600;line-height:1.2}

.mpaper{position:relative;background:var(--mpaper);color:var(--mink);border-radius:8px;
  padding:20px 16px 16px;box-shadow:0 14px 32px rgba(21,32,26,.10),0 1px 0 var(--mline);
  font-family:QuranIndoPak,serif;font-size:var(--fs);font-weight:400;max-width:100%;
  direction:rtl;letter-spacing:0;font-kerning:normal;outline:none}
/* The spine: the last 26px toward the bound edge, darkening. */
.mpaper:after{content:"";position:absolute;top:0;right:0;bottom:0;width:26px;border-radius:0 8px 8px 0;
  background:linear-gradient(90deg,rgba(21,32,26,0),rgba(21,32,26,.06));pointer-events:none}
/* Without the drawn frame (no JS): the two rules alone. */
.mpaper:not(.framed){outline:1px solid var(--mgold);outline-offset:-10.5px}
.mpframe{position:absolute;left:0;top:0;pointer-events:none}
.mpframe .g{stroke:var(--mgold)}
.mpframe .g7{stroke:var(--mgold);opacity:.7}
.mpframe .gf{fill:var(--mgold)}
.mpframe .pp{fill:var(--mpaper)}

/* A printed line: one line box of the board's 43.6 per 17, never wrapping,
   stretched to the measure by the gaps between its words. */
.ml{position:relative;height:var(--slot);line-height:var(--slot);white-space:nowrap;
  text-align:justify;text-align-last:justify;padding-right:var(--keep)}
.ml.c{text-align:center;text-align-last:center;padding-right:0}
.meas .ml{text-align:right!important;text-align-last:auto!important;padding-right:0}
/* A pause mark or a rosette's sign keeps its place beside its word: the
   justification opens only the gaps between words (mushafShown()). */
.ml .bd{display:inline-block}
.ml w{cursor:pointer;border-radius:6px}
.ml w.mk{cursor:default}
.ml w.on{background:var(--msaid)}

/* .band: the surah's name in a jade capsule with a gold edge, its ruku and
   ayah counts at the two ends. */
.mpband{position:relative;height:calc(54px * var(--k));margin:calc(2px * var(--k)) 0 calc(8px * var(--k));
  border-radius:calc(27px * var(--k));background:linear-gradient(172deg,var(--ma1),var(--ma2));
  border:max(1px,calc(1.6px * var(--k))) solid var(--mgold);display:flex;align-items:center;
  justify-content:space-between;gap:calc(12px * var(--k));padding:0 calc(20px * var(--k));
  color:var(--mgoldL);white-space:nowrap;overflow:hidden;line-height:1}
.mpband:before{content:"";position:absolute;inset:calc(4px * var(--k));border:1px solid rgba(233,201,122,.45);
  border-radius:calc(23px * var(--k));pointer-events:none}
.mpband .mb-n{font-size:calc(26px * var(--k))}
.mpband .mb-r,.mpband .mb-a{font-size:calc(14px * var(--k));opacity:.92}
.mpband.tight{justify-content:center}
.mpband.tight .mb-r,.mpband.tight .mb-a{display:none}
.mbism{height:calc(50px * var(--k));line-height:calc(50px * var(--k));text-align:center;white-space:nowrap;
  font-size:calc(var(--fs) * 20 / 17)}

/* .pgf: the juz, the page's khatam, the surah. */
.mfoot{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:10px;
  margin:12px auto 0;max-width:520px;padding:0 22px;font-size:12.5px;font-weight:500;color:var(--muted)}
.mfoot .mfj{text-align:left}
.mfoot .mfs{text-align:right}
.mmed{width:40px;height:40px;display:grid;place-items:center;background:var(--khBadge) center/contain no-repeat;
  color:var(--goldInk);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}
.mrec{text-align:center;margin-top:10px;font-size:.9rem}
.mrec a{color:var(--accentInk);font-weight:600}
.mhint{text-align:center;font-size:.8rem;color:var(--muted);margin-top:8px}
html:not(.js) .mhint,html:not(.js) .mturn{display:none}
.mabout{margin-top:26px}
.mabout p{margin-top:10px;color:var(--text2);line-height:1.65}
.mabout h2{font-size:1.2rem}
@media print{.mctl,.mturn,.mhint,.mrec{display:none}}
/* A phone gives the page its whole width, as the app does: the book steps
   out of the page's 16px gutter (the paper keeps its own margins). */
@media (max-width:600px){.mbook{margin-left:-16px;margin-right:-16px}}
.mbook > .note,.mbook noscript .note{padding:0 16px;margin-top:8px}
