@import url("er-fonts.css");

@font-face {
  font-family: "UthmanicHafs";
  src: url("../fonts/vendor/UthmanicHafs.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.br-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 45% at 80% 0%, rgba(196, 163, 90, 0.1), transparent 50%),
    linear-gradient(165deg, #08120e 0%, #0e1a14 50%, #0a1510 100%);
  color: var(--sp-text);
  font-family: var(--sp-font);
}

.br-topbar .sp-title-inline h1 {
  font-size: 1rem;
}

.br-controls {
  position: sticky;
  top: calc(var(--sp-top) + 0.45rem);
  z-index: 15;
  box-sizing: border-box;
  max-width: 52rem;
  width: calc(100% - 2.3rem);
  margin: 0.75rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem 0.85rem;
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  background: rgba(14, 26, 20, 0.92);
  backdrop-filter: blur(10px);
}

.br-controls .tj-tools {
  flex: none;
  width: 100%;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(196, 163, 90, 0.22);
  gap: 0.35rem;
}

.br-ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
}

.br-ctrl-status {
  flex: 1 1 100%;
  margin-left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}

.br-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sp-muted);
}

.br-field select,
.br-field input[type="number"] {
  min-width: 7rem;
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  background: rgba(14, 26, 20, 0.9);
  color: var(--sp-text);
  padding: 0.35rem 0.5rem;
  font-family: var(--sp-font);
  font-size: 0.88rem;
}

#brScript {
  min-width: 11rem;
}

.br-field--font {
  min-width: 8rem;
}

.br-field input[type="range"] {
  width: 100%;
  accent-color: var(--sp-gold);
}

.br-status {
  margin-left: 0;
  font-family: var(--sp-mono);
  font-size: 0.72rem;
  color: var(--sp-muted);
  align-self: center;
}

.br-controls .sp-btn.is-on {
  background: rgba(196, 163, 90, 0.18);
  border-color: rgba(196, 163, 90, 0.5);
  color: #e8d5a3;
}

.br-audio-btns {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.br-pager {
  display: inline-flex;
  align-items: end;
  gap: 0.35rem;
}

.br-pager[hidden] {
  display: none !important;
}

.br-page-of {
  align-self: center;
  font-family: var(--sp-mono);
  font-size: 0.78rem;
  color: var(--sp-muted);
  padding-bottom: 0.2rem;
}

.br-pager .br-field input[type="number"] {
  min-width: 4.2rem;
  width: 4.2rem;
}

.br-page.is-page-mode .br-load-more {
  display: none;
}

.br-aya.is-audio-active {
  background: rgba(196, 163, 90, 0.2);
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.br-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--sp-muted);
  align-self: center;
}

.br-flow--blocks {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.br-aya-block .br-aya {
  display: block;
  margin: 0;
  font-family: var(--sp-arabic);
  font-size: var(--br-font-size, 1.5rem);
  line-height: 2.55;
}

.br-trans {
  margin: 0.35rem 0 0;
  font-family: var(--sp-font);
  font-size: 0.95rem;
  line-height: 1.5;
  color: #c5d4cb;
}

.br-trans--solo {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #e8efe8;
}

.br-trans-ref {
  font-family: var(--sp-mono);
  font-size: 0.72rem;
  color: var(--sp-gold);
  margin-inline-end: 0.35rem;
}

.br-flow--trans {
  text-align: left;
}

.br-book.is-trans-only .br-section-ar {
  display: none;
}

.br-aya-block.is-focus {
  outline: 1px solid rgba(196, 163, 90, 0.45);
  border-radius: 8px;
  background: rgba(196, 163, 90, 0.06);
}

.br-main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.1rem 1.15rem 3.5rem;
}

.br-book {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.br-section {
  animation: br-rise 0.4s ease both;
}

.br-section-head {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(196, 163, 90, 0.2);
}

.br-section-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--sp-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-muted);
  direction: ltr;
}

.br-section-ar {
  margin: 0;
  font-family: var(--sp-arabic);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--sp-gold);
  line-height: 1.5;
  font-weight: 400;
}

.br-section-en {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--sp-muted);
  direction: ltr;
}

.br-section-link {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--sp-moss);
  text-decoration: none;
  direction: ltr;
}

.br-section-link:hover {
  color: var(--sp-gold);
}

.br-bismillah {
  text-align: center;
  margin: 0 0 1rem;
  padding: 0.2rem 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(196, 163, 90, 0.28);
  font-family: var(--sp-arabic);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 2.15;
  color: var(--sp-gold);
}

.br-flow {
  font-family: var(--sp-arabic);
  font-size: var(--br-font-size, 1.5rem);
  line-height: 2.55;
  text-align: justify;
  text-align-last: right;
  color: var(--sp-text);
  padding: 0.25rem 0.15rem;
}

.br-aya {
  display: inline;
}

.br-aya-num {
  display: inline-block;
  min-width: 1.55em;
  margin: 0 0.15em;
  padding: 0 0.2em;
  border: 1px solid rgba(196, 163, 90, 0.45);
  border-radius: 999px;
  font-family: var(--sp-mono);
  font-size: 0.55em;
  line-height: 1.55;
  color: var(--sp-gold);
  vertical-align: middle;
  text-align: center;
  direction: ltr;
}

.br-aya.is-focus .br-aya-num {
  background: rgba(196, 163, 90, 0.2);
  border-color: var(--sp-gold);
}

.br-load-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
}

.br-end {
  margin: 0;
  color: var(--sp-gold);
  font-size: 0.9rem;
}

@keyframes br-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .br-ctrl-status { width: 100%; margin-left: 0; }
  .br-controls { align-items: stretch; }
  .br-field select { min-width: 0; width: 100%; }
}

.br-ayah-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.15rem 0.35rem;
  row-gap: 0.35rem;
}

.br-aya-block .br-aya.br-ayah-words {
  display: flex;
}

.br-wbw {
  appearance: none;
  margin: 0;
  padding: 0.05rem 0.2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.br-wbw:hover,
.br-wbw:focus-visible {
  background: rgba(196, 163, 90, 0.16);
  outline: none;
}

.br-wbw.is-on {
  background: rgba(196, 120, 90, 0.28);
  color: #e8a878;
}

.br-word-pop {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
  max-width: min(90vw, 18rem);
}

.br-word-pop[hidden] {
  display: none !important;
}

.br-word-pop-tip,
.br-word-pop-bar,
.br-word-pop-extra {
  pointer-events: auto;
}

.br-word-pop-tip {
  position: relative;
  padding: 0.38rem 0.7rem;
  border-radius: 8px;
  background: #c4785a;
  color: #fff8f2;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  direction: ltr;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  white-space: normal;
  max-width: min(90vw, 16rem);
}

.br-word-pop-tip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: #c4785a;
  transform: translateX(-50%) rotate(45deg);
}

.br-word-pop-gap {
  width: 1px;
  flex: 0 0 auto;
}

.br-word-pop-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  background: #f7f3ec;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.br-word-pop-bar::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -5px;
  width: 10px;
  height: 10px;
  background: #f7f3ec;
  transform: translateX(-50%) rotate(45deg);
}

.br-word-pop-btn {
  appearance: none;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: #c4785a;
  color: #fff8f2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--sp-font);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.br-word-pop-btn:hover,
.br-word-pop-btn:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.br-word-pop-btn--close {
  background: #5c4038;
}

.br-word-pop-extra {
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(14, 26, 20, 0.96);
  border: 1px solid rgba(196, 163, 90, 0.35);
  color: #e8dfc8;
  font-size: 0.72rem;
  line-height: 1.4;
  direction: ltr;
  text-align: left;
  max-width: min(92vw, 18rem);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.br-freq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-weight: 700;
  color: #e8d5a3;
  margin-bottom: 0.3rem;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.br-freq-note-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid rgba(196, 163, 90, 0.55);
  border-radius: 999px;
  background: rgba(196, 163, 90, 0.18);
  color: #e8d5a3;
  font-family: var(--sp-font);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.br-freq-note-btn:hover,
.br-freq-note-btn:focus-visible,
.br-freq-note-btn.is-on {
  background: rgba(196, 163, 90, 0.35);
  outline: none;
}

.br-freq-note[hidden] {
  display: none !important;
}

.br-freq-row {
  margin: 0.2rem 0;
}

.br-freq-row.muted {
  color: rgba(243, 239, 230, 0.55);
}

.br-freq-k {
  display: inline-block;
  min-width: 3.4rem;
  color: rgba(243, 239, 230, 0.55);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.br-freq-note {
  margin: 0.45rem 0 0.2rem;
  padding: 0.4rem 0.45rem;
  border-radius: 6px;
  background: rgba(196, 120, 90, 0.18);
  border: 1px solid rgba(196, 120, 90, 0.35);
  color: #f0d2c0;
  font-size: 0.68rem;
  line-height: 1.35;
}

.br-freq-source {
  margin: 0.25rem 0 0;
  font-size: 0.64rem;
}

.br-freq-source a {
  color: #c4a35a;
}

.br-freq-loading {
  margin: 0;
  color: rgba(243, 239, 230, 0.55);
}

.br-tj-legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  align-self: center;
  max-width: 28rem;
}

.br-tj-legend[hidden] {
  display: none !important;
}

.br-tj-swatch {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.br-book tajweed {
  font: inherit;
  font-weight: 650;
}

.br-book tajweed.ham_wasl,
.br-book tajweed.laam_shamsiyah,
.br-tj-swatch.ham_wasl { color: #9aa3ad; }

.br-book tajweed.madda_normal,
.br-tj-swatch.madda_normal { color: #7eb0ff; }

.br-book tajweed.madda_permissible { color: #9bb0ff; }
.br-book tajweed.madda_necessary,
.br-book tajweed.madda_obligatory { color: #6b8cff; }

.br-book tajweed.qalaqah,
.br-tj-swatch.qalaqah { color: #ff6b6b; }

.br-book tajweed.ikhafa,
.br-tj-swatch.ikhafa { color: #d07aee; }

.br-book tajweed.ikhafa_shafawi { color: #e85ad8; }

.br-book tajweed.idgham_shafawi,
.br-book tajweed.idgham_with_ghunnah,
.br-tj-swatch.idgham_with_ghunnah { color: #62d46a; }

.br-book tajweed.idgham_without_ghunnah { color: #a8e0a8; }
.br-book tajweed.idgham_mutajanisayn,
.br-book tajweed.idgham_mutaqaribayn { color: #5ecf8a; }

.br-book tajweed.iqlab,
.br-tj-swatch.iqlab { color: #5ad4ff; }

.br-book tajweed.ghunnah,
.br-tj-swatch.ghunnah { color: #ff9a3c; }

.br-book[data-script="tanzil"] .br-aya,
.br-book[data-script="uthmani"] .br-aya,
.br-book[data-script="qpc_hafs"] .br-aya,
.br-book[data-script="tanzil"] .br-bismillah,
.br-book[data-script="uthmani"] .br-bismillah,
.br-book[data-script="qpc_hafs"] .br-bismillah {
  font-family: "UthmanicHafs", "Noto Naskh Arabic", var(--sp-arabic);
}

.br-book[data-script="imlaei"] .br-aya,
.br-book[data-script="imlaei"] .br-bismillah {
  font-family: "Noto Naskh Arabic", "Amiri Quran", "Amiri", var(--sp-arabic);
}

.br-book[data-script="indopak"] .br-aya,
.br-book[data-script="indopak_nastaleeq"] .br-aya,
.br-book[data-script="qpc_nastaleeq"] .br-aya,
.br-book[data-script="indopak"] .br-bismillah,
.br-book[data-script="indopak_nastaleeq"] .br-bismillah,
.br-book[data-script="qpc_nastaleeq"] .br-bismillah {
  font-family: "IndoPak Nastaleeq", "Digital Khatt Indopak", "Noto Nastaliq Urdu", serif;
}

@media (prefers-reduced-motion: reduce) {
  .br-section { animation: none; }
}

@media print {
  .br-topbar,
  .br-controls,
  .br-load-more,
  .br-word-pop,
  .sp-footer,
  .br-audio-btns {
    display: none !important;
  }

  .br-page {
    background: #fff;
    color: #111;
  }

  .br-main {
    padding: 0;
  }

  .br-book {
    color: #111;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .br-trans,
  .br-aya-block .br-trans {
    color: #333;
  }
}
