/* Essence of Islam viewer chrome — the top bar, the contents drawer (right) and the text-size
   control. Injected into every book at request time (src/lib/site.ts) together with viewer.js; the
   master store in the collection project never references it (docs/viewer.md).
   Chrome sizes are px on purpose: A− / A+ change the ROOT font size so the em-based kit rules
   scale, and the bar and drawer must not grow with the text. */
/* same palette as the search page: grey backdrop, white sheet, grey hairlines */
:root { --mv-bar-h: 56px; --mv-paper: #ffffff; --mv-desk: #f4f5f6; --mv-rule: #e5e7eb; --mv-ink: #1a1a1a; --mv-muted: #6b6b6b; --mv-accent: #0b5c2e; }
html { scroll-padding-top: calc(var(--mv-bar-h) + 16px); }
/* Paper: the webbook kit already draws the page (.wb-stage backdrop + .wb-content sheet); the
   viewer only clears the body and pushes the stage below the fixed bar. */
html { background: var(--mv-desk); }
body.book { margin: 0; }
body.book .wb-stage { padding-top: calc(var(--mv-bar-h) + 20px); --wb-stage-bg: var(--mv-desk); }

/* ---------- top bar ---------- */
.mv-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--mv-bar-h); box-sizing: border-box;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: rgba(244,245,246,.85); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--mv-rule); font-family: Roboto, system-ui, sans-serif; font-size: 14px; line-height: 1.2;
  color: var(--mv-ink); text-align: start; text-indent: 0; }
.mv-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.mv-brand img { width: 28px; height: 28px; display: block; }
.mv-brand .mv-urdu { font-family: "Jameel Noori Nastaleeq", serif; font-weight: 400; font-size: 20px; line-height: 1; direction: rtl; }
.mv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mv-muted); font-size: 14px; padding: 0 6px; }
body.ur .mv-title { font-family: "Jameel Noori Nastaleeq", serif; font-size: 18px; line-height: 1.2; }
.mv-search { display: flex; align-items: center; height: 36px; border: 1px solid var(--mv-rule); border-radius: 999px; background: #fff; overflow: hidden; }
.mv-search input { border: 0; outline: 0; background: transparent; height: 100%; width: 180px; padding: 0 12px; font: inherit; color: inherit; transition: width .15s; }
.mv-search input::-webkit-search-decoration, .mv-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
body.ur .mv-search input { font-family: "Jameel Noori Nastaleeq", Roboto, serif; font-size: 16px; }
.mv-search input:focus { width: 260px; }
.mv-search button { border: 0; background: transparent; height: 100%; padding: 0 10px 0 4px; cursor: pointer; color: var(--mv-muted); display: flex; align-items: center; }
.mv-search button:hover { color: var(--mv-ink); }
.mv-search-link { display: none; }
.mv-btn { height: 36px; min-width: 36px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--mv-rule); background: #fff; border-radius: 999px;
  font: inherit; font-weight: 600; color: var(--mv-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.mv-btn:hover { border-color: var(--mv-muted); }
.mv-btn svg { width: 18px; height: 18px; flex: none; }
body.ur .mv-btn { font-family: "Jameel Noori Nastaleeq", Roboto, serif; font-size: 16px; }
.mv-text { display: inline-flex; border: 1px solid var(--mv-rule); border-radius: 999px; background: #fff; overflow: hidden; height: 36px; direction: ltr; }
.mv-text .mv-btn { border: 0; border-radius: 0; height: 100%; font-family: Roboto, system-ui, sans-serif; }
.mv-text .mv-btn + .mv-btn { border-left: 1px solid var(--mv-rule); }
.mv-text .mv-btn:hover { background: rgba(0,0,0,.05); }
.mv-text .mv-scale { font-weight: 400; color: var(--mv-muted); font-variant-numeric: tabular-nums; min-width: 54px; font-size: 13px; }
.mv-text .mv-scale.on { color: var(--mv-accent); font-weight: 600; }
.mv-text .mv-a-small { font-size: 12px; }
.mv-text .mv-a-large { font-size: 17px; }

/* ---------- translation markers (paired reader): a rule along the aligned paragraph's outer edge and a
   vertical tab in the margin that opens the counterpart paragraph; body.mv-pairs-off hides them ---------- */
/* rem, not em, on purpose: the tab's offset must match this padding, and an em inside the tab would resolve
   against the tab's own 8 px font (the Urdu page's em is 25 px, the English 17 px) */
.wb-content .mv-paired { position: relative; border-inline-start: 3px solid var(--mv-rule); padding-inline-start: .6rem; margin-inline-start: calc(-0.6rem - 3px); }
.wb-content .mv-paired:has(> .mv-tab:hover), .wb-content .mv-paired:has(> .mv-tab:focus-visible) { border-inline-start-color: var(--mv-accent); }
/* physical offsets on purpose: on a vertical-rl box the inline axis is vertical, so inset-inline-start would
   set the TOP edge — the tab sits in the outer margin, left of an English block, right of an Urdu one */
.wb-content .mv-tab { position: absolute; top: .15em; width: 1.15rem; box-sizing: border-box;
  writing-mode: vertical-rl; text-orientation: upright; unicode-bidi: isolate; text-indent: 0;
  font: 600 8.5px/1.15rem Roboto, system-ui, sans-serif; letter-spacing: .14em; text-align: center; color: var(--mv-muted);
  padding: .3rem 0; border-radius: 4px; text-decoration: none !important; white-space: nowrap; user-select: none; }
.wb-content:not([dir="rtl"]) .mv-tab { left: calc(-3px - .6rem - 1.45rem); }
.wb-content[dir="rtl"] .mv-tab { right: calc(-3px - .6rem - 1.45rem); }
.wb-content .mv-tab:hover, .wb-content .mv-tab:focus-visible { color: var(--mv-accent); background: rgba(11,92,46,.08); }
/* the tab sits on the couplet's row axis: keep it out of the flex flow */
.wb-content div.couplet > .mv-tab, .wb-content div.couplet-arabic > .mv-tab { flex: none; }
body.mv-pairs-off .wb-content .mv-tab { display: none; }
body.mv-pairs-off .wb-content .mv-paired { border-inline-start-color: transparent; }
/* the show/hide checkbox in the bar, dressed as a pill like the other controls */
.mv-check { cursor: pointer; gap: 7px; }
.mv-check-input { appearance: none; -webkit-appearance: none; width: 15px; height: 15px; margin: 0; flex: none; border: 1.5px solid var(--mv-muted); border-radius: 4px; background: #fff; display: inline-grid; place-content: center; cursor: pointer; }
.mv-check-input::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--mv-accent); transform: scale(0); transition: transform .12s; }
.mv-check-input:checked { border-color: var(--mv-accent); }
.mv-check-input:checked::before { transform: scale(1); }
.mv-check-input:focus-visible { outline: 2px solid var(--mv-accent); outline-offset: 2px; }
.mv-check:has(.mv-check-input:checked) { color: var(--mv-accent); border-color: var(--mv-accent); }
.mv-check svg { color: inherit; }
/* phones: the sheet is full-bleed with a 1.25rem gutter, so the tab lives inside that gutter, between the
   screen edge and the paragraph's rule */
@media (max-width: 720px) {
  /* the paragraph box starts (1.25rem gutter − .6rem − 3px) in from the screen edge: put the tab's outer edge on the edge */
  .wb-content .mv-tab { width: .6rem; font-size: 6.5px; line-height: .6rem; letter-spacing: .08em; padding: .2rem 0; border-radius: 3px; }
  .wb-content:not([dir="rtl"]) .mv-tab { left: calc(.6rem + 3px - 1.25rem); }
  .wb-content[dir="rtl"] .mv-tab { right: calc(.6rem + 3px - 1.25rem); }
}
@media print { .mv-tab { display: none; } .wb-content .mv-paired { border-inline-start: none; padding-inline-start: 0; margin-inline-start: 0; } }

/* ---------- contents drawer, on the right ---------- */
.mv-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(26,26,26,.28); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.mv-toc { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(380px, 92vw); box-sizing: border-box; display: flex; flex-direction: column;
  background: var(--mv-paper); border-left: 1px solid var(--mv-rule); box-shadow: -12px 0 40px rgba(0,0,0,.12);
  transform: translateX(105%); transition: transform .25s ease; }
body.mv-toc-open .mv-backdrop { opacity: 1; visibility: visible; }
body.mv-toc-open .mv-toc { transform: none; }
.mv-toc-head { display: flex; align-items: center; justify-content: space-between; flex: none; height: var(--mv-bar-h); padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--mv-rule); font-family: Roboto, system-ui, sans-serif; font-weight: 600; font-size: 15px; }
body.ur .mv-toc-head { font-family: "Jameel Noori Nastaleeq", serif; font-size: 20px; padding: 0 18px 0 12px; }
.mv-close { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--mv-muted); display: flex; align-items: center; justify-content: center; }
.mv-close svg { width: 20px; height: 20px; }
.mv-close:hover { background: rgba(0,0,0,.06); color: var(--mv-ink); }
.mv-toc-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 10px 0 40px; -webkit-overflow-scrolling: touch; }
.mv-toc-list ul { list-style: none; margin: 0; padding: 0; }
.mv-toc-list li { display: flex; align-items: baseline; gap: 8px; padding: 4px 18px; margin: 0; }
.mv-toc-list li a { flex: 1; color: inherit; text-decoration: none; }
.mv-toc-list li a:hover { text-decoration: underline; }
.mv-toc-list li.mv-active { background: rgba(11,92,46,.08); box-shadow: inset 3px 0 0 var(--mv-accent); }
body.ur .mv-toc-list li.mv-active { box-shadow: inset -3px 0 0 var(--mv-accent); }
.mv-toc-list .tocpage { font-family: Roboto, system-ui, sans-serif; font-size: 12px; color: var(--mv-muted); direction: ltr; }
body.ur .mv-toc-list { font-family: "Jameel Noori Nastaleeq", serif; font-size: 18px; line-height: 2; }
body.ur .mv-toc-list li.l3 { padding-inline-start: 34px; font-size: 17px; }
body.ur .mv-toc-list li.l2 { margin-top: 6px; font-weight: 600; }
body.en .mv-toc-list { font-family: Roboto, system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
body.en .mv-toc-list li.l3 { padding-left: 34px; }
body.en .mv-toc-list li.l4 { padding-left: 50px; font-size: 13px; }
body.en .mv-toc-list li.l2 { margin-top: 6px; font-weight: 500; }
/* on screen the drawer replaces the inline contents block; it still prints */
@media screen { body.mv-ready details.toc { display: none; } }

@media (max-width: 760px) { .mv-title { display: none; } .mv-brand .mv-name { display: none; } }
@media (max-width: 600px) {
  .mv-bar { gap: 6px; padding: 0 10px; }
  .mv-pairs-btn .mv-btn-label { display: none; }
  .mv-search { display: none; } .mv-search-link { display: inline-flex; }
  .mv-btn-label { display: none; } .mv-btn { padding: 0 9px; }
  .mv-text .mv-scale { min-width: 46px; }
}
@media print { .mv-bar, .mv-toc, .mv-backdrop { display: none !important; } html { background: #fff; } body.book { margin: 0 auto; } body.book .wb-stage { padding-top: 0; } }
