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

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

body.search-page a:focus-visible,
body.search-page button:focus-visible,
body.search-page input:focus-visible,
body.search-page select:focus-visible {
  outline: 3px solid #d9bd6d;
  outline-offset: 3px;
}

.search-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:visited,
.reader-menu__link:focus,
.reader-menu__link:active {
  color: #173f35;
}

.reader-menu__link.is-current,
.reader-menu__link.is-current:visited,
.reader-menu__link.is-current:focus,
.reader-menu__link.is-current:active,
.reader-menu__link:hover {
  color: #fff8e7;
  background: #164d3f;
  border-color: #b9913d;
}

.reader-menu__link.is-current span:not(.reader-menu__mark),
.reader-menu__link:hover span:not(.reader-menu__mark),
.reader-menu__link:focus-visible span:not(.reader-menu__mark) {
  color: #fff8e7;
}

.reader-menu__mark {
  color: #b9913d;
}

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

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

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

.search-hero__kicker,
.section-kicker {
  margin: 0;
  color: #d9bd6d;
  font-weight: 700;
  line-height: 1.5;
}

.search-hero h1 {
  margin: 10px 0 0;
  color: #fff8e7;
  font: 700 clamp(2.35rem, 7vw, 4rem) "qpc-hafs", "Alyamama", "Traditional Arabic", serif;
  line-height: 1.35;
}

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

main {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.search-ad {
  min-height: 96px;
  margin-top: 18px;
  margin-bottom: 18px;
  overflow: hidden;
  padding: 12px;
  background: #fffaf0;
  text-align: center;
}

.search-ad--top {
  min-height: 74px;
  margin-top: 0;
  margin-bottom: 18px;
  padding-block: 8px;
}

.search-ad--bottom {
  margin-top: 18px;
  margin-bottom: 0;
}

.search-ad ins {
  max-width: 100%;
  min-height: 90px;
}

.search-ad--top ins {
  min-height: 58px;
}

.search-ad iframe {
  max-width: 100% !important;
}

.search-card,
.recent-panel {
  background: #fffaf0;
}

.search-card {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 3vw, 28px);
}

.query-section {
  display: grid;
  grid-template-columns: minmax(190px, 300px) minmax(0, 1fr);
  gap: 20px;
  align-items: end;
}

.query-section h2,
.range-section h2,
.option-grid h2,
.recent-panel h2 {
  margin: 4px 0 0;
  color: #123e36;
  font: 700 clamp(1.45rem, 3.6vw, 2rem) "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
  line-height: 1.35;
}

.query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 10px;
}

input,
select,
button {
  font-family: "Alyamama", "Traditional Arabic", "Noto Naskh Arabic", serif;
}

input[type="search"],
input[type="number"],
select {
  width: 100%;
  min-height: 54px;
  padding: 8px 14px;
  color: #123e36;
  background: #fffdf8;
  border: 1px solid #d9c28a;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
}

button[type="submit"] {
  min-height: 54px;
  color: #fff8e7;
  cursor: pointer;
  background: #123e36;
  border: 1px solid #b9913d;
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

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

.option-grid h2 {
  grid-column: 1 / -1;
}

.option-card,
.toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  color: #173f35;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
}

.option-card--word,
.option-card--root {
  display: grid;
  gap: 10px;
}

.option-card__main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}

.option-card input,
.toggle-card input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 6px;
  accent-color: #123e36;
}

.option-card strong,
.toggle-card strong,
.option-card small,
.toggle-card small {
  display: block;
}

.option-card strong,
.toggle-card strong {
  font-size: 1.1rem;
}

.option-card small,
.toggle-card small {
  margin-top: 2px;
  color: #8a6c2b;
  line-height: 1.6;
}

.sub-match-options[hidden] {
  display: none;
}

.sub-match-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid #e3cf99;
}

.sub-match-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  color: #173f35;
  background: #f8eed3;
  border: 1px solid #dbc48b;
  border-radius: 6px;
  cursor: pointer;
}

.sub-match-option input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  accent-color: #123e36;
}

.sub-match-option strong,
.sub-match-option small {
  display: block;
}

.sub-match-option strong {
  font-size: 0.92rem;
  line-height: 1.45;
}

.sub-match-option small {
  margin-top: 1px;
  color: #8a6c2b;
  font-size: 0.82rem;
  line-height: 1.45;
}

.range-section,
.toggle-section {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: grid;
  gap: 0;
}

.range-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(96px, 0.6fr) minmax(0, 1.4fr) minmax(96px, 0.6fr);
  gap: 12px;
}

.range-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #6f5b2a;
  font-weight: 700;
}

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

.toggle-card a {
  color: #123e36;
  font-weight: 700;
}

.recent-panel {
  padding: clamp(16px, 3vw, 24px);
}

.results-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 28px);
  background: #fffaf0;
  border: 1px solid #d9c28a;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(67, 49, 15, 0.13);
}

.results-panel::before {
  content: "";
  position: absolute;
  inset-inline: clamp(36px, 10vw, 120px);
  top: 0;
  height: 3px;
  background: #b9913d;
}

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

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

.results-action,
.next-results {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 18px;
  color: #fff8e7;
  background: #123e36;
  border: 1px solid #b9913d;
  border-radius: 8px;
  font-weight: 700;
}

body.search-page .results-action,
body.search-page .results-action:visited,
body.search-page .results-action:hover,
body.search-page .results-action:focus,
body.search-page .results-action:active,
body.search-page .next-results,
body.search-page .next-results:visited,
body.search-page .next-results:hover,
body.search-page .next-results:focus,
body.search-page .next-results:active {
  color: #fff8e7;
}

.results-list {
  display: grid;
  gap: 12px;
}

.surah-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  color: #123e36;
  background: #f3e6c5;
  border: 1px solid #d9c28a;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.surah-suggestion:hover,
.surah-suggestion:focus-visible {
  color: #123e36;
  background: #fff3d2;
  border-color: #b9913d;
  transform: translateY(-1px);
}

.surah-suggestion__kicker {
  display: block;
  color: #8a6c2b;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.surah-suggestion strong {
  display: block;
  color: #123e36;
  font-size: 1.25rem;
  line-height: 1.5;
}

.surah-suggestion__action {
  flex: 0 0 auto;
  padding: 7px 14px;
  color: #fff8e7;
  background: #123e36;
  border: 1px solid #b9913d;
  border-radius: 999px;
  font-weight: 700;
}

html[data-reader-theme="sepia"] body.search-page .surah-suggestion {
  color: var(--site-theme-text);
  background: var(--site-theme-surface-soft);
  border-color: var(--site-theme-border);
}

html[data-reader-theme="sepia"] body.search-page .surah-suggestion:hover,
html[data-reader-theme="sepia"] body.search-page .surah-suggestion:focus-visible {
  background: #f8e8c6;
}

html[data-reader-theme="night"] body.search-page .surah-suggestion {
  color: var(--site-theme-text);
  background: var(--site-theme-surface-soft);
  border-color: var(--site-theme-border);
}

html[data-reader-theme="night"] body.search-page .surah-suggestion:hover,
html[data-reader-theme="night"] body.search-page .surah-suggestion:focus-visible {
  background: #223a32;
  border-color: #d9bd6d;
}

html[data-reader-theme="sepia"] body.search-page .surah-suggestion strong,
html[data-reader-theme="night"] body.search-page .surah-suggestion strong {
  color: var(--site-theme-heading);
}

html[data-reader-theme="sepia"] body.search-page .surah-suggestion__kicker,
html[data-reader-theme="night"] body.search-page .surah-suggestion__kicker {
  color: var(--site-theme-muted);
}

html[data-reader-theme="sepia"] body.search-page .surah-suggestion__action,
html[data-reader-theme="night"] body.search-page .surah-suggestion__action {
  color: var(--site-theme-primary-text);
  background: var(--site-theme-primary);
  border-color: var(--site-theme-border);
}

.result-card {
  display: grid;
  gap: 10px;
  padding: clamp(16px, 3vw, 24px);
  color: #123e36;
  background: #fffdf8;
  border: 1px solid #dbc48b;
  border-bottom: 3px solid #b9913d;
  border-radius: 8px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.result-card:hover,
.result-card:focus-visible {
  border-color: #b9913d;
  box-shadow: 0 12px 24px rgba(67, 49, 15, 0.12);
  transform: translateY(-2px);
}

.result-card__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8a6c2b;
  font-weight: 700;
}

.result-card__title span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff8e7;
  background: #164d3f;
  border: 1px solid #b9913d;
  border-radius: 50%;
}

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

.search-highlight {
  display: inline;
  padding: 0 0.12em;
  color: #102f2a;
  background: #fff2b8;
  border: 1px solid #c79b38;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.result-card__meta,
.empty-results {
  margin: 0;
  color: #705a25;
  font-weight: 700;
}

.root-options {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: #f3e6c5;
  border: 1px solid #d9c28a;
  border-radius: 8px;
}

.root-options div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.root-options a {
  padding: 6px 12px;
  color: #123e36;
  background: #fffdf8;
  border: 1px solid #d9c28a;
  border-radius: 999px;
  font-weight: 700;
}

.root-options a.is-current {
  color: #fff8e7;
  background: #123e36;
}

.next-results {
  justify-self: center;
  margin-top: 4px;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.recent-list a {
  padding: 6px 12px;
  color: #123e36;
  background: #f3e6c5;
  border: 1px solid #d9c28a;
  border-radius: 999px;
  font-weight: 700;
}

.recent-list a:visited,
.recent-list a:focus,
.recent-list a:active {
  color: #123e36;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .query-section,
  .option-grid,
  .toggle-section {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .search-ad--top,
  .search-ad--bottom {
    margin-bottom: 12px;
  }
}

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

  .reader-menu,
  .query-row,
  .range-grid {
    grid-template-columns: 1fr;
  }

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

  .search-hero,
  .search-card,
  .recent-panel,
  .results-panel,
  .search-ad {
    border-inline: 0;
    border-radius: 0;
  }

  .search-ad {
    padding: 5px 8px;
  }

  .results-panel__head {
    align-items: stretch;
    flex-direction: column;
  }

  .surah-suggestion {
    align-items: stretch;
    flex-direction: column;
  }

  .surah-suggestion__action {
    text-align: center;
  }

  main {
    margin-top: 0;
  }
}
