@font-face {
  font-family: "Alyamama";
  src: url("/fonts/Alyamama-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Alyamama";
  src: url("/fonts/Alyamama-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "qpc-hafs";
  src: url("fonts/UthmanicHafs_V22.ttf") format("truetype");
  font-display: swap;
}

html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body.quran-chapter {
  margin: 0;
  background: #f6f2e9;
  color: #151515;
  direction: rtl;
  font-family: "Alyamama", "Traditional Arabic", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  line-height: 1.9;
}

body.quran-chapter div[align="center"],
body.quran-chapter center {
  width: 100%;
}

body.quran-chapter .quran-reader {
  width: min(100% - 24px, 1080px);
  margin: clamp(18px, 4vw, 48px) auto;
}

body.quran-chapter .reader-nav-panel {
  position: relative;
  width: min(100%, 980px);
  margin: clamp(14px, 3vw, 32px) auto;
  padding: clamp(16px, 3vw, 28px);
  overflow: hidden;
  background: #fffaf0;
  border: 1px solid #d9c28a;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(67, 49, 15, 0.13);
}

body.quran-chapter .reader-nav-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(185, 145, 61, 0.36);
  border-radius: 6px;
  pointer-events: none;
}

body.quran-chapter .reader-nav-panel::after {
  content: "";
  position: absolute;
  inset-inline: clamp(28px, 8vw, 92px);
  top: 0;
  height: 3px;
  background: #b9913d;
  pointer-events: none;
}

body.quran-chapter .reader-nav-panel--bottom {
  margin-top: clamp(20px, 4vw, 40px);
}

body.quran-chapter .reader-nav-panel--bottom::after {
  top: auto;
  bottom: 0;
}

body.quran-chapter .reader-nav-panel--bottom .reader-menu {
  margin-top: clamp(12px, 2.4vw, 20px);
}

body.quran-chapter .reader-menu,
body.quran-chapter .chapter-nav {
  position: relative;
  z-index: 1;
}

body.quran-chapter .reader-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 16px);
}

body.quran-chapter .reader-menu__link,
body.quran-chapter .chapter-nav__link {
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

body.quran-chapter .reader-menu__link {
  min-height: clamp(64px, 8vw, 82px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  color: #173f35;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75), 0 8px 18px rgba(74, 52, 15, 0.08);
  font: 700 clamp(1.1rem, 3vw, 1.5rem) "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  line-height: 1.45;
}

body.quran-chapter .reader-menu__mark {
  color: #b9913d;
  font-size: 0.95em;
}

body.quran-chapter .reader-menu__link:hover,
body.quran-chapter .chapter-nav a:hover .chapter-nav__link {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85), 0 14px 24px rgba(49, 39, 14, 0.14);
}

body.quran-chapter .reader-menu__link.is-current {
  color: #fdf7e6;
  background: #164d3f;
  border-color: #b9913d;
}

body.quran-chapter .chapter-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2.4vw, 18px);
  margin-top: clamp(12px, 2.4vw, 20px);
}

body.quran-chapter .chapter-nav a {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

body.quran-chapter .chapter-nav__link {
  min-height: clamp(78px, 9vw, 98px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2.8vw, 20px);
  color: #fff8e7;
  background: #123e36;
  border: 1px solid #b9913d;
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(20, 48, 42, 0.18);
}

body.quran-chapter .chapter-nav__text {
  min-width: 0;
  max-width: calc(100% - 80px);
  display: grid;
  place-items: center;
}

body.quran-chapter .chapter-nav__eyebrow {
  color: #d9bd6d;
  text-align: center;
  font: 700 clamp(0.85rem, 2.4vw, 1rem) "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  line-height: 1.4;
}

body.quran-chapter .chapter-nav__surah {
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
  font: 700 clamp(1.1rem, 3.2vw, 1.45rem) "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  line-height: 1.6;
}

body.quran-chapter .chapter-nav__arrow {
  position: absolute;
  top: 50%;
  right: clamp(18px, 3vw, 30px);
  left: auto;
  transform: translateY(-50%);
  color: #d9bd6d;
  direction: ltr;
  unicode-bidi: isolate;
  font: 700 clamp(2.2rem, 5vw, 3rem) "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  line-height: 1;
  text-align: center;
}

body.quran-chapter .chapter-nav__link--next .chapter-nav__arrow {
  right: auto;
  left: clamp(18px, 3vw, 30px);
}

body.quran-chapter .chapter-nav__link.is-disabled {
  color: #746b58;
  background: #f1eadb;
  border-color: #d6c598;
  border-style: dashed;
  box-shadow: none;
}

body.quran-chapter .chapter-nav__link.is-disabled .chapter-nav__eyebrow,
body.quran-chapter .chapter-nav__link.is-disabled .chapter-nav__arrow {
  color: #9b8350;
}

body.quran-chapter table[dir="rtl"] {
  width: min(100% - 24px, 980px) !important;
  margin: clamp(12px, 3vw, 34px) auto;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: #fffdf8;
  border: 1px solid #dfd2b8;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(70, 54, 25, 0.14);
}

body.quran-chapter td {
  padding-inline: clamp(14px, 4vw, 56px);
}

body.quran-chapter td[bgcolor] {
  padding: clamp(10px, 2.4vw, 18px) clamp(14px, 4vw, 40px);
  background: #138c70 !important;
}

body.quran-chapter td[bgcolor] p {
  margin: 0;
  color: #fff;
  font-family: "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  line-height: 1.6;
}

body.quran-chapter td[bgcolor] a {
  color: #fff;
  font-weight: 700;
}

body.quran-chapter ol {
  margin: 0;
  padding-block: clamp(12px, 2vw, 24px);
  padding-inline: 0;
  list-style: none;
}

body.quran-chapter li {
  list-style: none;
  padding: clamp(10px, 2.8vw, 18px) 0;
  border-bottom: 1px solid #eee4cf;
  font-family: "qpc-hafs", "Amiri Quran", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif !important;
  font-size: clamp(1.55rem, 6.2vw, 2.35rem) !important;
  line-height: 2.05 !important;
}

body.quran-chapter li::marker {
  content: "";
}

body.quran-chapter li:last-child {
  border-bottom: 0;
}

body.quran-chapter .selected-ayah-anchor {
  position: relative;
  top: -18px;
  display: block;
}

body.quran-chapter .selected-ayah {
  position: relative;
  display: block;
  margin: clamp(4px, 1.4vw, 10px) clamp(-8px, -1vw, -4px);
  padding: clamp(14px, 3vw, 22px) clamp(18px, 4vw, 34px);
  color: #102f2a;
  background: #fff7df;
  border: 1px solid #c79b38;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 12px 28px rgba(90, 66, 16, 0.16);
}

body.quran-chapter .selected-ayah::before {
  content: "";
  position: absolute;
  inset-inline: clamp(18px, 6vw, 60px);
  top: 0;
  height: 3px;
  background: #b9913d;
}

body.quran-chapter .selected-ayah::after {
  content: "۞";
  position: absolute;
  top: 50%;
  inset-inline-start: clamp(10px, 2.4vw, 18px);
  transform: translateY(-50%);
  color: #b9913d;
  font-size: clamp(1rem, 3vw, 1.35rem);
  line-height: 1;
}

body.quran-chapter .ayah-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: clamp(6px, 1.8vw, 12px);
  font-family: "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  font-size: clamp(0.9rem, 2.6vw, 1.05rem);
  line-height: 1.5;
}

body.quran-chapter .ayah-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 16px;
  color: #fff8e7 !important;
  background: #123e36;
  border: 1px solid #d9bd6d;
  border-bottom: 3px solid #b9913d;
  border-radius: 999px;
  box-shadow: 0 9px 20px rgba(20, 48, 42, 0.16);
  font-weight: 700;
  text-decoration: none !important;
}

body.quran-chapter .ayah-actions a::before {
  content: "۞";
  color: #d9bd6d;
  font-family: "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  font-size: 0.9em;
}

body.quran-chapter .ayah-actions a:hover,
body.quran-chapter .ayah-actions a:focus {
  color: #fff8e7;
  background: #164d3f;
  box-shadow: 0 12px 24px rgba(20, 48, 42, 0.22);
}

body.quran-chapter p {
  margin: 0;
}

body.quran-chapter li p,
body.quran-chapter td > p {
  text-align: right !important;
}

body.quran-chapter td > p[align="center"] {
  padding: clamp(16px, 4vw, 28px) 0 0;
  text-align: center !important;
  font-family: "qpc-hafs", "Amiri Quran", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(1.4rem, 5.4vw, 2.1rem);
  line-height: 2;
}

body.quran-chapter td[bgcolor] > p[align="center"] {
  padding: 0;
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  line-height: 1.6;
}

body.quran-chapter font {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

body.quran-chapter a,
body.quran-chapter a:visited,
body.quran-chapter a:hover,
body.quran-chapter a:focus,
body.quran-chapter a:active {
  color: inherit;
  text-decoration: none;
}

body.quran-chapter a * {
  text-decoration: none;
}

body.quran-chapter button {
  max-width: 100%;
  padding: 0 8px;
  white-space: normal;
  font: 700 clamp(0.85rem, 3vw, 1.15rem) "Alyamama", Tahoma, Arial, sans-serif;
  line-height: 1.4;
}

body.quran-chapter img {
  max-width: 100%;
  height: auto;
}

body.quran-chapter .quran-source {
  margin: 24px auto 0;
  padding: 0 16px;
  max-width: 980px;
  color: #6f6655;
  text-align: center;
  font: 400 0.9rem "Alyamama", Tahoma, Arial, sans-serif;
}

@media (min-width: 900px) {
  body.quran-chapter {
    padding-block: 12px;
  }

  body.quran-chapter li {
    font-size: 2rem;
  }
}

@media (max-width: 520px) {
  body.quran-chapter .quran-reader {
    width: 100%;
    margin: 0 auto;
  }

  body.quran-chapter .reader-nav-panel {
    width: 100%;
    margin: 0;
    border-inline: 0;
    border-radius: 0;
    padding: 14px 12px 16px;
  }

  body.quran-chapter .reader-menu,
  body.quran-chapter .chapter-nav {
    grid-template-columns: 1fr;
  }

  body.quran-chapter .reader-menu__link,
  body.quran-chapter .chapter-nav__link {
    min-height: 62px;
  }

  body.quran-chapter table[dir="rtl"] {
    width: 100% !important;
    margin: 0;
    border-inline: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.quran-chapter ol {
    padding-inline: 0;
  }
}
