@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("../quran/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.tafseer-page {
  min-height: 100vh;
  margin: 0;
  color: #123e36;
  background: #f6f2e9;
  direction: rtl;
  font-family: "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  line-height: 1.9;
}

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

body.tafseer-page a:focus-visible {
  outline: 3px solid #d9bd6d;
  outline-offset: 3px;
}

.tafseer-shell {
  width: min(100% - 24px, 1120px);
  margin: 28px auto 56px;
}

.reader-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.reader-menu__link {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  color: #173f35;
  text-align: center;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(74, 52, 15, 0.08);
  font-weight: 700;
}

.reader-menu__link,
.reader-menu__link:visited {
  color: #173f35 !important;
}

.reader-menu__link:hover,
.reader-menu__link:focus {
  color: #fff8e7 !important;
  background: #164d3f;
}

.reader-menu__mark,
.section-kicker {
  color: #d9bd6d;
}

.section-kicker {
  margin: 0;
  font-weight: 700;
  line-height: 1.5;
}

.tafseer-hero,
.tafseer-tabs,
.tafseer-card,
.tafseer-nav,
.tafseer-ad {
  position: relative;
  overflow: hidden;
  border: 1px solid #d9c28a;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(67, 49, 15, 0.13);
}

.tafseer-hero::before,
.tafseer-tabs::before,
.tafseer-card::before,
.tafseer-nav::before,
.tafseer-ad::before {
  content: "";
  position: absolute;
  inset-inline: clamp(36px, 10vw, 120px);
  top: 0;
  height: 3px;
  background: #b9913d;
}

.tafseer-hero {
  margin-top: 18px;
  padding: clamp(28px, 6vw, 54px) clamp(18px, 5vw, 42px);
  color: #fff8e7;
  text-align: center;
  background: #123e36;
}

.tafseer-hero h1 {
  margin: 10px 0 0;
  color: #fff8e7;
  font: 700 clamp(2.1rem, 6vw, 3.5rem) "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  line-height: 1.35;
}

.tafseer-hero p:last-child {
  margin: 12px auto 0;
  color: #f7efd9;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
}

.tafseer-ad {
  min-height: 96px;
  margin-top: 18px;
  padding: 12px;
  background: #fffaf0;
}

.tafseer-ad ins {
  min-height: 90px;
}

.tafseer-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding: clamp(14px, 3vw, 22px);
  background: #fffaf0;
}

.tafseer-tabs a,
.tafseer-tabs span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 10px 12px;
  text-align: center;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
  font-weight: 700;
}

.tafseer-tabs a,
.tafseer-tabs a:visited {
  color: #123e36 !important;
}

.tafseer-tabs a.is-current,
.tafseer-tabs a.is-current:visited,
.tafseer-tabs a:hover,
.tafseer-tabs a:focus {
  color: #fff8e7 !important;
  background: #123e36;
}

.tafseer-tabs .is-disabled {
  color: #8a7b5d;
  background: #f1eadb;
  border-style: dashed;
}

.tafseer-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.tafseer-card {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 28px);
  background: #fffaf0;
}

.tafseer-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tafseer-card__head h2 {
  margin: 4px 0 0;
  color: #123e36;
  font: 700 clamp(1.4rem, 3.6vw, 2rem) "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  line-height: 1.35;
}

.tafseer-card__head a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 16px;
  color: #fff8e7;
  background: #123e36;
  border: 1px solid #b9913d;
  border-radius: 8px;
  font-weight: 700;
}

.tafseer-card__head a,
.tafseer-card__head a:visited {
  color: #fff8e7 !important;
}

.quran-ayah {
  margin: 0;
  color: #111;
  font: 400 clamp(1.55rem, 6.2vw, 2.35rem) "qpc-hafs", "Amiri Quran", "Amiri", "Scheherazade New", serif;
  line-height: 2.05;
  text-align: right;
}

.quran-ayah__part,
.quran-ayah__selected {
  display: inline;
}

.quran-ayah__selected {
  position: relative;
  margin-inline: 0.12em;
  padding: 0.08em 0.22em 0.14em;
  color: #092f28;
  background:
    linear-gradient(180deg, rgba(255, 251, 235, 0.88), rgba(240, 219, 157, 0.58));
  border: 1px solid rgba(185, 145, 61, 0.78);
  border-radius: 8px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow:
    0 0 0 3px rgba(217, 189, 109, 0.18),
    0 10px 24px rgba(67, 49, 15, 0.12);
}

.tafseer-text {
  display: grid;
  gap: 12px;
  color: #173f35;
  font-family: "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
}

.tafseer-text p {
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee4cf;
}

.tafseer-text p:last-child {
  border-bottom: 0;
}

.tafseer-quote {
  color: #0e6f5a;
  font-weight: 700;
}

.tafseer-hadith {
  color: #8a6c2b;
  font-weight: 700;
}

.tafseer-footnote,
.notice-message,
.empty-message {
  color: #705a25;
  font-weight: 700;
}

.tafseer-footnote {
  padding: 12px 14px;
  background: #f3e6c5;
  border: 1px solid #d9c28a;
  border-radius: 8px;
}

.tafseer-text--noor {
  gap: 14px;
  color: #153d34;
  font-size: clamp(1.08rem, 2.35vw, 1.24rem);
  line-height: 2;
}

.tafseer-text--noor p {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.noor-heading,
.noor-opening,
.noor-paragraph {
  padding: 10px clamp(10px, 2.6vw, 18px);
}

.noor-heading {
  color: #8a6c2b;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(217, 189, 109, 0.22), transparent);
}

.noor-opening {
  color: #123e36;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 700;
  text-align: center;
}

.noor-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(10px, 2vw, 16px);
  align-items: start;
  padding: clamp(13px, 2.7vw, 19px);
  color: #153d34;
  background: #fffdf8;
  border: 1px solid #e0c990;
  border-right: 4px solid #b9913d;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(67, 49, 15, 0.08);
}

.noor-entry__number {
  min-width: 2.25em;
  height: 2.25em;
  display: inline-grid;
  place-items: center;
  color: #fff8e7;
  background: #123e36;
  border: 1px solid #d9bd6d;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(217, 189, 109, 0.18);
  font-weight: 700;
  line-height: 1;
}

.noor-entry p {
  color: #153d34;
}

.noor-footnote {
  padding: 11px 14px;
  color: #705a25;
  background: #f4ead3;
  border: 1px solid #dac48d;
  border-right: 4px solid #d9bd6d;
  border-radius: 8px;
  font-size: clamp(0.98rem, 2vw, 1.08rem);
  font-weight: 700;
}

.noor-footnote__number {
  color: #123e36;
}

.tafseer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding: clamp(14px, 3vw, 22px);
  background: #fffaf0;
}

.tafseer-ad--bottom {
  margin-bottom: 18px;
}

.tafseer-nav a,
.tafseer-nav .is-disabled {
  min-height: 76px;
  display: grid;
  place-items: center;
  padding: 12px 16px;
  color: #fff8e7;
  text-align: center;
  background: #123e36;
  border: 1px solid #b9913d;
  border-radius: 8px;
}

.tafseer-nav span {
  color: #d9bd6d;
  font-weight: 700;
}

.tafseer-nav strong {
  color: #fff8e7;
  font-size: 1.1rem;
}

.tafseer-nav .is-disabled {
  background: #f1eadb;
  border-color: #d6c598;
  border-style: dashed;
}

.tafseer-index-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  margin-top: 18px;
}

.tafseer-form,
.tafseer-book-list {
  display: grid;
  gap: 12px;
}

.tafseer-form label {
  display: grid;
  gap: 6px;
  color: #705a25;
  font-weight: 700;
}

.tafseer-form select,
.tafseer-form input,
.tafseer-form button {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  color: #123e36;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-radius: 8px;
  font: 700 1rem "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
}

.tafseer-form select:focus,
.tafseer-form input:focus {
  outline: 3px solid rgba(217, 189, 109, 0.55);
  outline-offset: 2px;
}

.tafseer-form button {
  margin-top: 6px;
  color: #fff8e7;
  background: #123e36;
  border-color: #b9913d;
  border-bottom: 3px solid #b9913d;
  cursor: pointer;
}

.tafseer-form button:hover {
  background: #164d3f;
}

.tafseer-book-list a {
  display: grid;
  gap: 3px;
  min-height: 70px;
  padding: 12px 14px;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
}

.tafseer-book-list a,
.tafseer-book-list a:visited {
  color: #123e36 !important;
}

.tafseer-book-list a:hover,
.tafseer-book-list a:focus {
  color: #fff8e7 !important;
  background: #123e36;
}

.tafseer-book-list strong {
  font: 700 clamp(1.2rem, 3vw, 1.5rem) "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  line-height: 1.35;
}

.tafseer-book-list span {
  color: #705a25;
  font-size: 0.95rem;
  font-weight: 700;
}

.tafseer-book-list a:hover span {
  color: #d9bd6d;
}

@media (max-width: 760px) {
  .tafseer-index-grid {
    grid-template-columns: 1fr;
  }

  .tafseer-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tafseer-card__head,
  .tafseer-nav {
    grid-template-columns: 1fr;
  }

  .tafseer-card__head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .tafseer-shell {
    width: 100%;
    margin: 0 auto 32px;
  }

  .reader-menu,
  .tafseer-tabs {
    grid-template-columns: 1fr;
  }

  .reader-menu {
    gap: 8px;
    padding: 12px;
    background: #fffaf0;
    border-bottom: 1px solid #d9c28a;
  }

  .tafseer-hero,
  .tafseer-tabs,
  .tafseer-card,
  .tafseer-nav,
  .tafseer-ad {
    border-inline: 0;
    border-radius: 0;
  }

  .tafseer-layout,
  .tafseer-nav {
    margin-top: 0;
  }

  .noor-entry {
    grid-template-columns: 1fr;
  }

  .noor-entry__number {
    justify-self: start;
  }
}
