/*
 * Scheherazade New (SIL Global, SIL OFL 1.1 — see
 * assets/fonts/ScheherazadeNew-OFL.txt) — a purpose-built, actively
 * maintained Qur'anic-tashkil typeface. Verified against every codepoint
 * used in the bundled Uthmani text (100% glyph coverage) and stress-
 * tested against real ayahs sampled from across the whole mushaf.
 *
 * NOTE — this font has been swapped twice; both prior fonts had real,
 * separate glyph defects found by inspecting their font files directly:
 *  1) "KFGQPC Uthmanic Script HAFS v09" — U+06DF and ~21 other small
 *     marks (used ~4,000 times, mostly hamzat-wasl) rendered as a large
 *     black circle instead of the correct small mark. Confirmed present
 *     in the font's original upstream copy, not introduced by this build.
 *  2) "Amiri Quran" v1.003 — U+0650 (kasra) is built as a raw copy of
 *     the fatha glyph shifted down by a fixed offset, with no proper
 *     mark-attachment anchor. It rendered invisibly in multiple shaping
 *     tests (including the simplest case: a single letter + kasra, no
 *     other marks). That fragile construction is also the likely reason
 *     it was reported as mobile-only: different text-shaping engines
 *     (CoreText vs FreeType/HarfBuzz) can resolve a malformed composite
 *     glyph like that differently.
 * Scheherazade New's kasra is an independently drawn, properly anchored
 * glyph, confirmed correct in both isolation and in-context.
 */
@font-face {
  font-family: 'SQQP Uthmani Hafs';
  src: url('../fonts/ScheherazadeNew-Regular.woff2') format('woff2'),
       url('../fonts/ScheherazadeNew-Regular.woff') format('woff');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

/*
 * Official IndoPak Nastaleeq (waqf-lazim) webfont, also bundled locally.
 * The bundled indopak text (419 distinct characters) has 100% glyph
 * coverage in this font — no tofu boxes for waqf/stop marks.
 */
@font-face {
  font-family: 'SQQP IndoPak Nastaleeq';
  src: url('../fonts/indopak-nastaleeq-waqf-lazim-v4.2.1.woff2') format('woff2'),
       url('../fonts/indopak-nastaleeq-waqf-lazim-v4.2.1.woff') format('woff');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

.sqqp {
  --sqqp-accent: #0e7c66;
  --sqqp-accent-dark: #0a5e4d;
  --sqqp-bg: #ffffff;
  --sqqp-bg-soft: #f6f8f7;
  --sqqp-border: #e3e7e5;
  --sqqp-text: #1c2624;
  --sqqp-text-muted: #667370;
  --sqqp-radius: 12px;
  box-sizing: border-box;
  max-width: 820px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--sqqp-text);
  background: var(--sqqp-bg);
  border: 1px solid var(--sqqp-border);
  border-radius: var(--sqqp-radius);
  overflow: hidden;
}
.sqqp * { box-sizing: border-box; }

.sqqp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--sqqp-border);
  background: var(--sqqp-bg-soft);
}
.sqqp-title { margin: 0 0 4px; font-size: 1.15rem; }
.sqqp-sub { margin: 0; font-size: 0.85rem; color: var(--sqqp-text-muted); }
.sqqp-head-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.sqqp-field { display: flex; flex-direction: column; font-size: 0.75rem; color: var(--sqqp-text-muted); gap: 3px; }
.sqqp-field select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--sqqp-border);
  background: #fff;
  font-size: 0.85rem;
  min-width: 170px;
}
.sqqp-field-volume { min-width: 110px; }
.sqqp-field-volume input[type="range"] {
  accent-color: var(--sqqp-accent);
  width: 100%;
  margin-top: 4px;
}

.sqqp-toolbar { padding: 12px 20px 0; }
.sqqp-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.sqqp-page-jump { position: relative; margin-inline-start: auto; }
.sqqp-tabs-page {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  color: var(--sqqp-accent);
  background: #fff;
  border: 1px solid var(--sqqp-accent);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  cursor: pointer;
}
.sqqp-tabs-page:hover { background: color-mix(in srgb, var(--sqqp-accent) 10%, #fff); }
.sqqp-page-jump-form {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--sqqp-border);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.sqqp-page-jump-input {
  width: 72px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--sqqp-border);
  font-size: 0.82rem;
}
.sqqp-page-jump-go { padding: 6px 12px; font-size: 0.78rem; }
.sqqp-page-jump-error {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: #c0392b;
}
.sqqp-page-jump-error:empty { display: none; }
.sqqp-tab {
  border: 1px solid var(--sqqp-border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--sqqp-text-muted);
}
.sqqp-tab.is-active { background: var(--sqqp-accent); border-color: var(--sqqp-accent); color: #fff; }
.sqqp-toolbar-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sqqp-search {
  flex: 1 1 200px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--sqqp-border);
  font-size: 0.85rem;
}
.sqqp-btn {
  border: 1px solid var(--sqqp-accent);
  background: var(--sqqp-accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.sqqp-btn:hover { background: var(--sqqp-accent-dark); }

.sqqp-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
  max-height: 320px;
  overflow-y: auto;
  border-bottom: 1px solid var(--sqqp-border);
}
.sqqp-item { border-bottom: 1px solid var(--sqqp-border); }
.sqqp-item:last-child { border-bottom: none; }
.sqqp-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 10px 8px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-size: 0.9rem;
  border-radius: 8px;
}
.sqqp-item-btn:hover { background: var(--sqqp-bg-soft); }
.sqqp-item.is-playing .sqqp-item-btn { background: #e7f4f0; }
.sqqp-num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sqqp-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--sqqp-text-muted);
}
.sqqp-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sqqp-name { font-weight: 600; }
.sqqp-ayahs { font-size: 0.75rem; color: var(--sqqp-text-muted); }
.sqqp-ar { font-family: 'SQQP Uthmani Hafs', "Scheherazade New", "Traditional Arabic", serif; font-size: 1.1rem; direction: rtl; }
.sqqp-icon { flex: 0 0 auto; color: var(--sqqp-accent); }
.sqqp-item[hidden], .sqqp-list[hidden] { display: none; }

.sqqp-reading { border-bottom: 1px solid var(--sqqp-border); }
.sqqp-reading-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--sqqp-bg-soft);
  font-size: 0.85rem;
}
.sqqp-reading-title { flex: 1; }
.sqqp-status { font-size: 0.75rem; color: var(--sqqp-text-muted); }
.sqqp-reading-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--sqqp-text-muted);
}
.sqqp-reading-body {
  max-height: 340px;
  overflow-y: auto;
  padding: 16px 20px;
  direction: rtl;
  font-family: 'SQQP Uthmani Hafs', "Scheherazade New", "Traditional Arabic", serif;
  font-size: 1.6rem;
  line-height: 2.8;
}
.sqqp-reading-body.sqqp-script-indopak {
  font-family: 'SQQP IndoPak Nastaleeq', "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  font-size: 1.7rem;
  line-height: 3;
}
.sqqp-reading[hidden] .sqqp-reading-body { display: none; }
.sqqp-ayah-span {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  transition: background 0.15s ease;
}
.sqqp-ayah-span:hover { background: #eef6f4; }
.sqqp-ayah-span.is-active { background: #cdeee3; }
.sqqp-ayah-marker {
  display: inline-block;
  font-family: -apple-system, sans-serif;
  font-size: 0.9rem;
  color: var(--sqqp-accent);
  margin: 0 4px;
  direction: ltr;
}
.sqqp-reading-loading { text-align: center; color: var(--sqqp-text-muted); font-family: inherit; direction: ltr; }

/* Mushaf page separators inside the reading pane (604-page Madani mushaf). */
.sqqp-page-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
  margin: 14px 0 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sqqp-text-muted);
}
.sqqp-page-sep::before,
.sqqp-page-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sqqp-border, #e3e3e3);
}
.sqqp-page-sep-label {
  border: 1px solid var(--sqqp-border, #e3e3e3);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  background: #fff;
}
/* Live page/juz indicator in the player bar. */
.sqqp-now-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  color: var(--sqqp-accent);
  border: 1px solid var(--sqqp-accent);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.sqqp-player {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px 20px 18px;
  position: sticky;
  bottom: 0;
  background: var(--sqqp-bg);
}
.sqqp-now { display: flex; align-items: center; gap: 10px; }
.sqqp-now-num {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sqqp-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.sqqp-now-text { display: flex; flex-direction: column; min-width: 0; }
.sqqp-now-name { font-size: 0.95rem; }
.sqqp-now-reciter { color: var(--sqqp-text-muted); font-size: 0.75rem; }

.sqqp-controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.sqqp-ctl {
  border: none;
  background: var(--sqqp-bg-soft);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sqqp-text);
}
.sqqp-ctl.sqqp-toggle { width: 52px; height: 52px; background: var(--sqqp-accent); color: #fff; font-size: 1.2rem; }
.sqqp-ctl.sqqp-toggle:hover { background: var(--sqqp-accent-dark); }
.sqqp-ctl.is-active { background: #cdeee3; color: var(--sqqp-accent-dark); }
.sqqp-ctl svg { display: block; color: inherit; }
.sqqp-icon-slot { display: flex; align-items: center; justify-content: center; }

.sqqp-seek { display: flex; align-items: center; gap: 8px; }
.sqqp-time { font-size: 0.72rem; color: var(--sqqp-text-muted); min-width: 34px; text-align: center; }
.sqqp-range, .sqqp-volume { flex: 1; accent-color: var(--sqqp-accent); }
.sqqp-progress-row { display: flex; align-items: center; gap: 10px; }
.sqqp-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--sqqp-bg-soft);
  overflow: hidden;
}
.sqqp-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--sqqp-accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.sqqp-progress-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--sqqp-text-muted);
  white-space: nowrap;
}

.sqqp-error {
  padding: 20px;
  border: 1px dashed #d66;
  border-radius: 10px;
  color: #a33;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .sqqp-head { flex-direction: column; }
  .sqqp-head-controls { width: 100%; }
  .sqqp-field select { min-width: 0; width: 100%; }
  .sqqp-reading-body { font-size: 1.3rem; line-height: 2.3; }
}

/* -------------------------------------------------------------------------
 * Theme-hardening for the transport controls.
 *
 * Many WordPress themes style every <button> globally (full-width blocks,
 * heavy padding, min-width, text-transform, box-shadows). On a round button
 * that padding stretches the box horizontally, so `border-radius: 50%`
 * renders as a flattened oval instead of a circle. These rules pin an exact
 * square box and reset the theme's inherited button styling.
 * ---------------------------------------------------------------------- */
.sqqp .sqqp-ctl,
.sqqp .sqqp-ctl:hover,
.sqqp .sqqp-ctl:focus,
.sqqp .sqqp-ctl:active {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 42px;
  min-height: 42px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--sqqp-border);
  border-radius: 999px;
  line-height: 1;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  box-shadow: none;
  text-shadow: none;
  outline: none;
  overflow: hidden;
  transition: background 0.15s ease, transform 0.1s ease;
}
.sqqp .sqqp-ctl { background: var(--sqqp-bg-soft); color: var(--sqqp-text); }
.sqqp .sqqp-ctl:hover { background: #eaefed; }
.sqqp .sqqp-ctl:focus-visible { box-shadow: 0 0 0 3px rgba(14, 124, 102, 0.25); }
.sqqp .sqqp-ctl:active { transform: scale(0.96); }

.sqqp .sqqp-ctl.sqqp-toggle,
.sqqp .sqqp-ctl.sqqp-toggle:hover,
.sqqp .sqqp-ctl.sqqp-toggle:focus,
.sqqp .sqqp-ctl.sqqp-toggle:active {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  height: 56px;
  min-height: 56px;
  font-size: 1.15rem;
  border-color: var(--sqqp-accent);
  background: var(--sqqp-accent);
  color: #fff;
}
.sqqp .sqqp-ctl.sqqp-toggle:hover { background: var(--sqqp-accent-dark); }
.sqqp .sqqp-ctl.is-active {
  background: #cdeee3;
  border-color: #a9dfd0;
  color: var(--sqqp-accent-dark);
}
.sqqp .sqqp-ctl .sqqp-icon-slot,
.sqqp .sqqp-ctl svg { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sqqp .sqqp-controls { gap: 12px; padding: 2px 0; }

/* Same reset for the pill buttons / tabs so themes can't reshape them. */
.sqqp .sqqp-tab,
.sqqp .sqqp-btn {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  width: auto;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
  text-shadow: none;
  margin: 0;
}
.sqqp .sqqp-item-btn {
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  min-height: 0;
  line-height: 1.35;
}

@media (max-width: 560px) {
  .sqqp .sqqp-ctl,
  .sqqp .sqqp-ctl:hover { width: 38px; min-width: 38px; max-width: 38px; height: 38px; min-height: 38px; }
  .sqqp .sqqp-ctl.sqqp-toggle,
  .sqqp .sqqp-ctl.sqqp-toggle:hover { width: 50px; min-width: 50px; max-width: 50px; height: 50px; min-height: 50px; }
  .sqqp .sqqp-controls { gap: 6px; }
}
