/* بحث القرآن — Mushaf paper theme */

@font-face { font-family: "Amiri Quran"; font-display: swap; src: url(fonts/amiri-quran-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Amiri Quran"; font-display: swap; src: url(fonts/amiri-quran-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Amiri"; font-display: swap; font-weight: 400; src: url(fonts/amiri-regular-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Amiri"; font-display: swap; font-weight: 400; src: url(fonts/amiri-regular-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Amiri"; font-display: swap; font-weight: 700; src: url(fonts/amiri-bold-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Amiri"; font-display: swap; font-weight: 700; src: url(fonts/amiri-bold-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --paper: #f6efdf; --paper-2: #eee3c8; --card: #fbf7ec; --ink: #2a2118; --muted: #76664f;
  --line: #d8c7a0; --green: #1f5f4a; --green-2: #2c7a60; --gold: #a8823a; --gold-2: #e2c77d;
  --hl-exact: #f3da8f; --hl-form: #dce8c4; --hl-root: #b08d4a; --red: #8a2c1a; --on-green: #fbf7ec;
  --d1: #d3e3d9; --d2: #a3c8b3; --d3: #66a386; --d4: #34805f; --d5: #1f5f4a;
  --ui: "Amiri", "Traditional Arabic", serif;
  --quran: "Amiri Quran", "Amiri", "Traditional Arabic", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120e; --paper-2: #1d1a14; --card: #1a1712; --ink: #ece2cc; --muted: #a6977c;
    --line: #3d3528; --green: #82c5a8; --green-2: #a3d8c0; --gold: #d2b06a; --gold-2: #7d6430;
    --hl-exact: #5c4b1b; --hl-form: #2e3d22; --hl-root: #c9a35a; --red: #e48a72; --on-green: #10120f;
    --d1: #20352c; --d2: #2c5242; --d3: #3f7660; --d4: #5f9e82; --d5: #8fd0b2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14120e; --paper-2: #1d1a14; --card: #1a1712; --ink: #ece2cc; --muted: #a6977c;
  --line: #3d3528; --green: #82c5a8; --green-2: #a3d8c0; --gold: #d2b06a; --gold-2: #7d6430;
  --hl-exact: #5c4b1b; --hl-form: #2e3d22; --hl-root: #c9a35a; --red: #e48a72; --on-green: #10120f;
  --d1: #20352c; --d2: #2c5242; --d3: #3f7660; --d4: #5f9e82; --d5: #8fd0b2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 18px/1.85 "Amiri", "Traditional Arabic", "Times New Roman", serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px 2rem; flex: 1; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
h1, h2, h3 { font-weight: 700; line-height: 1.5; margin: 1.2rem 0 .6rem; }
h1 { font-size: 1.9rem; color: var(--green); }
h2 { font-size: 1.35rem; }
h2::before { content: "❁ "; color: var(--gold); font-size: .9em; }
.muted { color: var(--muted); }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 8px; top: 8px; background: var(--card); padding: .3rem .8rem; z-index: 10; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* header */
header.site {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--paper-2), var(--paper));
  box-shadow: 0 3px 0 -1px var(--paper), 0 4px 0 -1px var(--line);
  margin-bottom: 1.2rem;
}
.bar { max-width: 880px; margin: 0 auto; padding: .4rem 16px; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.3rem; color: var(--green); white-space: nowrap; }
.brand .orn { color: var(--gold); margin-inline-end: .35rem; }
.bar nav { display: flex; gap: .2rem .9rem; flex-wrap: wrap; margin-inline-start: auto; align-items: center; font: 500 .99rem/1.6 var(--ui); }
.bar nav a { color: var(--ink); }
#theme { font: 1.13rem/1.35 var(--ui); background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 50%; width: 2rem; height: 2rem; cursor: pointer; }
header.site .search { max-width: 880px; margin: 0 auto; padding: .2rem 16px .8rem; }

/* search form */
.search { display: flex; gap: .5rem; position: relative; }
.search input {
  flex: 1; min-width: 0; font: 400 1.1rem/1.5 "Amiri", serif; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--gold); border-radius: 8px; padding: .45rem .9rem;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.search button {
  font: 700 1.13rem/1.35 var(--ui); background: var(--green); color: var(--on-green); border: 0;
  border-radius: 8px; padding: 0 1.3rem; cursor: pointer;
}
.search button:hover { background: var(--green-2); }
.search.hero input { font-size: 1.25rem; padding: .7rem 1.1rem; }
.search.hero button { font-size: 1.15rem; padding: 0 1.6rem; }
.layout-hint { position: absolute; top: 100%; inset-inline-start: 0; margin-top: .3rem; font: .97rem/1.6 var(--ui); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: .2rem .7rem; z-index: 5; cursor: pointer; }

/* home */
.hero { text-align: center; padding: .4rem 0 1rem; }
.basmala { font-family: var(--quran); font-size: 1.9rem; color: var(--green); text-align: center; margin: .2rem 0 .6rem; line-height: 2; }
.hero h1 { font-size: 2.4rem; margin: 0; }
.hero h1::before, .hero h1::after { content: " ۞ "; color: var(--gold); font-size: .7em; vertical-align: middle; }
.tagline { color: var(--muted); font-size: 1.15rem; margin: .2rem 0 1.1rem; }
.hero .search { max-width: 640px; margin: 0 auto; }
.examples { font-size: 1rem; color: var(--muted); margin-top: 1.1rem; }
.panel { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: .2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; margin: .6rem 0; }
.panel .chips { justify-content: flex-start; }
.chip {
  display: inline-block; font: 500 1.03rem/1.6 var(--ui); color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: .25rem .9rem;
}
.chip:hover { border-color: var(--gold); text-decoration: none; background: var(--paper-2); }
.chip.more { color: var(--green); }
#recent .chip { font-size: .85rem; }
.how ul { padding-inline-start: 1.2rem; }
.how li { margin: .35rem 0; }

/* surah index */
.surah-index { list-style: none; padding: 0; margin: .6rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .45rem; }
.surah-index a {
  display: grid; grid-template-columns: 2.2rem 1fr; grid-template-rows: auto auto; align-items: center; column-gap: .6rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; color: var(--ink);
}
.surah-index a:hover { border-color: var(--gold); text-decoration: none; }
.surah-index .num {
  grid-row: span 2; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; font: 600 .92rem/1.35 var(--ui);
  color: var(--green); border: 1.5px solid var(--gold); transform: rotate(45deg); border-radius: 4px;
}
.surah-index .num { text-indent: 0; }
.surah-index .name { font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.surah-index .info { font: .84rem/1.4 var(--ui); color: var(--muted); }

/* results */
.notice { background: var(--paper-2); border-inline-start: 3px solid var(--gold); padding: .45rem .9rem; border-radius: 4px; font-size: 1rem; }
.notice.warn { border-color: var(--red); }
.notice .fix { color: var(--muted); }
.consolation { text-align: center; font-size: 1.15rem; color: var(--green); margin: .6rem 0; }
.consolation .orn { color: var(--gold); }
.word-info { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .9rem; margin: .6rem 0; }
.word-info p { margin: .25rem 0; }
.summary { color: var(--muted); font-size: 1rem; margin: .6rem 0; }
.summary .kind { font-size: .9rem; }
.results-title { font-size: 1.6rem; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin: .4rem 0; font: .97rem/1.6 var(--ui); }
.controls nav { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.controls nav a { padding: .2rem .75rem; color: var(--ink); border-inline-end: 1px solid var(--line); }
.controls nav a:last-child { border-inline-end: 0; }
.controls nav a.on { background: var(--green); color: var(--on-green); text-decoration: none; }
.strip { display: flex; gap: 1px; height: 14px; margin: .6rem 0 .3rem; direction: rtl; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: var(--line); }
.strip > * { flex: 1; background: var(--paper-2); min-width: 1px; }
.strip .d1 { background: var(--d1); } .strip .d2 { background: var(--d2); } .strip .d3 { background: var(--d3); }
.strip .d4 { background: var(--d4); } .strip .d5 { background: var(--d5); }
.strip a.on { outline: 2px solid var(--gold); outline-offset: -2px; }
.filtering { font: .97rem/1.6 var(--ui); color: var(--muted); }
.surah-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; background: var(--card); border: 3px double var(--gold);
  border-radius: 6px; padding: .5rem 1rem; margin: .6rem 0; color: var(--ink);
}
.surah-card .name { font-weight: 700; font-size: 1.3rem; color: var(--green); }
.surah-card .info { color: var(--muted); font: .97rem var(--ui); }
.surah-card .go { margin-inline-start: auto; font: 600 1.03rem var(--ui); color: var(--green); }

/* ayah card */
.hit {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; margin: .8rem 0; padding: .55rem 1rem .5rem;
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px color-mix(in srgb, var(--line) 70%, transparent);
}
.hit > header { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; font: .95rem/1.7 var(--ui); }
.hit .ref { font: 700 1.05rem/1.6 "Amiri", serif; color: var(--green); }
.hit .meta { margin-inline-start: auto; color: var(--muted); }
.hit .meta a { color: var(--muted); }
.badge { font: 600 .8rem/1.35 var(--ui); padding: .28rem .5rem; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge.exact { background: var(--green); color: var(--on-green); border-color: var(--green); }
.badge.word { border-color: var(--gold); color: var(--gold); }
.badge.form { border-color: var(--green-2); color: var(--green-2); }
.badge.root { border-style: dashed; color: var(--muted); }
.badge.sem { background: color-mix(in srgb, var(--gold-2) 35%, transparent); border-color: var(--gold-2); color: var(--ink); }
p.ayah { font-family: var(--quran); font-size: 1.6rem; line-height: 2.3; margin: .35rem 0 .2rem; word-spacing: .05em; }
p.ayah span, p.ayah mark, .mushaf .aya span { cursor: pointer; border-radius: 4px; }
p.ayah span:hover, .mushaf .aya span:hover { background: color-mix(in srgb, var(--gold-2) 30%, transparent); }
mark { color: inherit; padding: 0 .08em; border-radius: 4px; }
mark.x { background: var(--hl-exact); }
mark.l { background: var(--hl-form); }
mark.r { background: none; text-decoration: underline dotted var(--hl-root) 2px; text-underline-offset: 10px; }
.n { color: var(--gold); white-space: nowrap; font-family: var(--quran); }
a.n:hover { text-decoration: none; color: var(--green); }
details.tafsir { font-size: 1rem; }
details.tafsir summary { cursor: pointer; color: var(--muted); font: 500 .92rem/1.8 var(--ui); width: max-content; }
details.tafsir p { margin: .2rem 0 .4rem; padding-inline-start: .8rem; border-inline-start: 2px solid var(--gold-2); }
.tools { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 .1rem; }
.tools a, .tools button {
  font: 500 .89rem/1.35 var(--ui); color: var(--green); background: none; border: 1px solid var(--line);
  border-radius: 6px; padding: .38rem .65rem; cursor: pointer; text-decoration: none;
}
.tools a:hover, .tools button:hover { border-color: var(--gold); }
.tools button.on { background: var(--green); color: var(--on-green); border-color: var(--green); }
.hit.playing, .aya.playing { background: color-mix(in srgb, var(--hl-form) 70%, var(--card)); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.2rem 0; font: 1.03rem var(--ui); }
.pager.top { margin-top: 0; }
.pager span { color: var(--muted); }
.empty { background: var(--card); border: 1px dashed var(--line); padding: .4rem 1rem; border-radius: 6px; }
.more { text-align: center; }

/* ayah page */
.crumbs { font: .92rem/1.6 var(--ui); color: var(--muted); margin-top: .4rem; }
.crumbs a { color: var(--muted); }
.ayah-page { padding: .6rem 1.2rem 1rem; }
.ayah-page h1 { font-size: 1.6rem; margin: .3rem 0 .6rem; text-align: center; }
.frame { border: 3px double var(--gold); border-radius: 4px; padding: .6rem 1rem; background: var(--paper); }
p.ayah.big { font-size: 2.1rem; line-height: 2.45; text-align: center; margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .1rem 1rem; font: .99rem/1.8 var(--ui); margin: .8rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.tafsir-text { font-size: 1.12rem; }
.plain { font-size: 1.25rem; user-select: all; }
.word-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.word-list li { display: inline-flex; flex-direction: column; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .55rem .25rem; }
.word-list .wu { font-family: var(--quran); font-size: 1.35rem; line-height: 2; }
.word-list a, .word-list .muted { font: .84rem/1.3 var(--ui); }
.ctx { margin: .4rem 0; }
.ctx > a { font: 600 .92rem var(--ui); white-space: nowrap; }
.ctx .ayah { font-family: var(--quran); font-size: 1.3rem; line-height: 2.2; }

/* surah page */
.surah-head { text-align: center; }
.surah-head h1 {
  display: inline-block; margin: .4rem auto .2rem; padding: .1rem 2.2rem; border: 3px double var(--gold);
  background: var(--card); border-radius: 4px;
}
.surah-head .meta { color: var(--muted); font: .97rem/1.7 var(--ui); margin: .3rem 0; }
.views { display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem; font: .97rem var(--ui); margin: .5rem 0; }
.views a, .views button { border: 1px solid var(--line); border-radius: 6px; padding: .25rem .8rem; color: var(--ink); background: var(--card); font: inherit; cursor: pointer; }
.views a.on { background: var(--green); color: var(--on-green); border-color: var(--green); }
.mushaf { font-family: var(--quran); font-size: 1.75rem; line-height: 2.45; text-align: justify; background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1.2rem;
  box-shadow: inset 0 0 0 4px var(--card), inset 0 0 0 5px var(--gold-2); }
.mushaf .aya { border-radius: 6px; transition: background .3s; }
.mushaf .aya:target { background: var(--hl-exact); }

/* mushaf page view */
.page-frame { max-width: 36rem; margin: 0 auto; border: 6px double var(--gold); border-radius: 6px; background: var(--card); padding: 1rem 1.1rem; }
.page { container-type: inline-size; }
.line { display: flex; justify-content: space-between; white-space: nowrap; font-family: var(--quran);
  font-size: clamp(.8rem, 4.2cqw, 1.6rem); line-height: 2.25; }
.line.center { justify-content: center; gap: .35em; }
.line .n { font-size: .95em; }
.sura-title { text-align: center; font-weight: 700; font-size: 1.15rem; color: var(--green); border: 1px solid var(--gold); background: var(--paper-2); border-radius: 4px; margin: .35rem 0; }
.goto { display: flex; justify-content: center; gap: .5rem; align-items: center; margin: 1rem 0; font: 1.03rem var(--ui); }
.goto input { width: 5rem; font: inherit; padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.goto button { font: inherit; background: var(--green); color: var(--on-green); border: 0; border-radius: 6px; padding: .3rem .9rem; cursor: pointer; }

/* root page */
.lemmas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.lemma { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .2rem .8rem .4rem; }
.lemma h3 { margin: .2rem 0; font-size: 1.2rem; display: flex; justify-content: space-between; }
.lemma .count { font: 600 .92rem var(--ui); color: var(--gold); }
.lemma p { margin: 0; line-height: 2; }
.lemma .k { font: .78rem var(--ui); color: var(--muted); margin-inline-start: .15rem; }

/* about */
.dedication-box { background: var(--card); border: 3px double var(--gold); border-radius: 6px; padding: .6rem 1rem; text-align: center; }

/* word popover */
.pop {
  position: absolute; z-index: 20; max-width: 300px; background: var(--card); color: var(--ink); border: 1px solid var(--gold);
  border-radius: 8px; padding: .5rem .8rem; box-shadow: 0 6px 24px rgba(0,0,0,.18); font: .95rem/1.7 var(--ui);
}
.pop .pw { font-family: var(--quran); font-size: 1.7rem; line-height: 1.8; text-align: center; color: var(--green); }
.pop a { display: inline-block; margin-top: .2rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translate(-50%, 1rem); opacity: 0; transition: .25s;
  background: var(--green); color: var(--on-green); font: 600 .97rem/1.35 var(--ui); padding: .6rem 1.1rem; border-radius: 999px; z-index: 30; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* footer */
footer.site { border-top: 1px solid var(--line); box-shadow: 0 -3px 0 -1px var(--paper), 0 -4px 0 -1px var(--line); background: var(--paper-2);
  padding: 1rem 16px 1.2rem; text-align: center; margin-top: 2rem; }
.dedication { max-width: 760px; margin: 0 auto .6rem; font-size: 1rem; color: var(--ink); }
.dedication .orn { color: var(--gold); }
.dedication a { font-weight: 700; }
.links { display: flex; justify-content: center; flex-wrap: wrap; gap: .2rem 1rem; font: .92rem/1.8 var(--ui); }
.sources { font: .81rem/1.8 var(--ui); color: var(--muted); max-width: 760px; margin: .5rem auto 0; }
.sources a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.85rem; }
  .basmala { font-size: 1.55rem; }
  .bar { gap: .3rem; }
  .bar nav { margin-inline-start: 0; width: 100%; justify-content: space-between; }
  .search button { padding: 0 .9rem; }
  p.ayah { font-size: 1.42rem; line-height: 2.2; }
  p.ayah.big { font-size: 1.7rem; }
  .mushaf { font-size: 1.45rem; padding: .6rem .8rem; }
  .hit { padding: .5rem .75rem .45rem; }
  .ayah-page { padding: .5rem .8rem .8rem; }
  .page-frame { padding: .6rem .5rem; border-width: 4px; }
}

@media print {
  header.site, footer.site .links, footer.site .sources, .tools, .controls, .strip, .pager, .search, #recent, .views, .goto { display: none !important; }
  body { background: #fff; color: #000; }
  .hit, .mushaf, .frame, .page-frame { box-shadow: none; background: #fff; break-inside: avoid; }
  details.tafsir { display: block; }
  a { color: #000; }
}
