/* تدبّر — public platform. Warm, calm, Arabic-first.
   Brand colours follow the Tadabur dataset identity: brown a27b5c, deep green
   374440, gold dfc49a, ink 1c1f1e. */
/* Thmanyah type family, self-hosted. Sans carries the interface, Serif Display
   the headings, Serif Text the long prose (tafsir, asbab). Ayah text stays in a
   Quranic face: Thmanyah has no Uthmani glyph set and must not be used for it. */
@font-face { font-family: "Thmanyah Sans"; font-weight: 300; font-display: swap; src: url("/static/fonts/thmanyahsans-Light.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Sans"; font-weight: 400; font-display: swap; src: url("/static/fonts/thmanyahsans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Sans"; font-weight: 500; font-display: swap; src: url("/static/fonts/thmanyahsans-Medium.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Sans"; font-weight: 700; font-display: swap; src: url("/static/fonts/thmanyahsans-Bold.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Sans"; font-weight: 900; font-display: swap; src: url("/static/fonts/thmanyahsans-Black.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Display"; font-weight: 400; font-display: swap; src: url("/static/fonts/thmanyahserifdisplay-Regular.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Display"; font-weight: 500; font-display: swap; src: url("/static/fonts/thmanyahserifdisplay-Medium.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Display"; font-weight: 700; font-display: swap; src: url("/static/fonts/thmanyahserifdisplay-Bold.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Display"; font-weight: 900; font-display: swap; src: url("/static/fonts/thmanyahserifdisplay-Black.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Text"; font-weight: 300; font-display: swap; src: url("/static/fonts/thmanyahseriftext-Light.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Text"; font-weight: 400; font-display: swap; src: url("/static/fonts/thmanyahseriftext-Regular.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Text"; font-weight: 500; font-display: swap; src: url("/static/fonts/thmanyahseriftext-Medium.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Serif Text"; font-weight: 700; font-display: swap; src: url("/static/fonts/thmanyahseriftext-Bold.woff2") format("woff2"); }

:root {
  --bg: #f6f1e9; --surface: #fffdf9; --surface-2: #f1e9dc;
  --ink: #1c1f1e; --ink-2: #4a423b; --muted: #8a7f74; --line: #e6dccd;
  --brand: #a27b5c; --brand-ink: #7e5c40; --green: #374440; --gold: #dfc49a;
  --radius: 16px; --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px -12px rgba(60, 40, 20, .18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Thmanyah Sans", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: 16px; line-height: 1.7;
}
h1, h2, h3, .brand, .suggest .grp { font-family: "Thmanyah Serif Display", "Thmanyah Sans", serif; }
h1 { font-weight: 700; } h2, h3 { font-weight: 500; }
.panel p, .panel .asbab, .hero p.lead, table.words td:not(.w) { font-family: "Thmanyah Serif Text", "Thmanyah Sans", serif; }
.panel .asbab .qv, .q, .quran, table.words td.w { font-family: "Amiri Quran", "KFGQPC Uthmanic Script HAFS", "Scheherazade New", serif; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.q, .quran {
  font-family: "Amiri Quran", "KFGQPC Uthmanic Script HAFS", "Scheherazade New", serif;
  line-height: 2.25; font-size: 1.65rem; color: var(--ink);
}
.q.small { font-size: 1.25rem; line-height: 2; }
.q.big { font-size: 2.1rem; line-height: 2.4; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { padding: 5px 10px; border-radius: 10px; color: var(--ink-2); font-size: .84rem; }
.nav a:hover, .nav a.on { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.admin { color: var(--muted); font-size: .85rem; }
.topsearch { flex: 1; max-width: 360px; margin: 0 8px 0 0; position: relative; }
.topsearch input { width: 100%; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font: inherit; font-size: .95rem; box-shadow: none; }
.topsearch input:focus { background: var(--surface); border-color: var(--brand); outline: none; }
.topsearch .suggest { min-width: 420px; max-width: 90vw; }

/* hero */
.hero { text-align: center; padding: 96px 0 40px; }
.hero .bas { color: var(--brand-ink); opacity: .9; margin-bottom: 26px; }
.hero h1 { font-size: 2.4rem; margin: 0 0 6px; letter-spacing: -.5px; }
.hero p.lead { color: var(--muted); margin: 0 0 26px; font-size: 1.05rem; }
.search { position: relative; max-width: 640px; margin: 0 auto; }
.search input {
  width: 100%; padding: 16px 52px 16px 20px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); font: inherit; font-size: 1.15rem; box-shadow: var(--shadow); outline: none;
}
.search input:focus { border-color: var(--brand); }
.search .go {
  position: absolute; inset-inline-end: 8px; top: 8px; bottom: 8px; width: 42px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 1.2rem; cursor: pointer;
}
.hints { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hint {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 14px 7px 16px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font: inherit; color: var(--ink); font-size: .95rem;
  transition: border-color .15s, background .15s;
}
.hint:hover { border-color: var(--brand); background: #fff; }
.hint .k { color: var(--brand-ink); font-size: .78rem; font-weight: 500; }
.hint .k::after { content: ":"; }
.hint .v { color: var(--ink-2); }
.suggest {
  position: absolute; inset-inline: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); text-align: start; overflow: hidden; display: none; z-index: 30;
}
.suggest.show { display: block; }
.suggest .grp { padding: 8px 14px 4px; font-size: .78rem; color: var(--muted); letter-spacing: .3px; border-top: 1px solid var(--line); }
.suggest .grp:first-child { border-top: 0; }
.suggest a { display: flex; gap: 12px; align-items: baseline; padding: 8px 14px; color: var(--ink); }
.suggest a:hover { background: var(--surface-2); text-decoration: none; }
.suggest .ref { color: var(--muted); font-size: .85rem; white-space: nowrap; min-width: 64px; }
.suggest .q { font-size: 1.1rem; line-height: 1.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* stats + cards */
.stats { display: flex; justify-content: center; gap: 28px; color: var(--muted); font-size: .9rem; margin: 22px 0 8px; flex-wrap: wrap; }
.stats b { color: var(--ink); font-size: 1.1rem; margin-inline-end: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card .meta { color: var(--muted); font-size: .88rem; }
.card.tool { display: flex; gap: 14px; align-items: flex-start; }
.card.tool .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.3rem; color: var(--brand-ink); flex: none; }
.card.pick { display: flex; flex-direction: column; gap: 10px; }
.card.pick .q.small { font-size: 1.25rem; line-height: 1.95; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card.pick .pick-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.grid114 .nomatch, .chips .nomatch { grid-column: 1 / -1; width: 100%; }
.panel .filter { margin: 0 0 12px; }
.badge { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: #5a4523; vertical-align: middle; margin-inline-start: 6px; }
.badge.live { background: #d9e7dc; color: #27432f; }
.badge.quiet { background: var(--surface-2); color: var(--muted); }
section.block { margin: 34px 0; }
section.block h2 { font-size: 1.15rem; margin: 0 0 12px; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
section.block h2 a.more { margin-inline-start: auto; font-size: .85rem; font-weight: 400; }

/* page header */
.ph { padding: 30px 0 10px; }
.ph .crumbs { color: var(--muted); font-size: .88rem; margin-bottom: 6px; }
.ph h1 { margin: 0; font-size: 2rem; }
.ph .sub { color: var(--muted); margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .88rem; color: var(--ink-2); }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.chip a { color: inherit; }

/* ayah list */
.ayahs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.ayah-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-top: 1px solid var(--line); }
.ayah-row:first-child { border-top: 0; }
.ayah-row.playing { background: #f9f3e8; }
.ayah-row .num { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--brand-ink); font-size: .85rem; background: var(--bg); margin-top: 6px; }
.ayah-row .txt { flex: 1; }
.ayah-row .txt .q { font-size: 1.3rem; line-height: 2.05; }   /* list view: smaller than the single-ayah page */
.ayah-row .txt a { color: inherit; }
.ayah-row .act { flex: none; display: flex; gap: 6px; margin-top: 6px; }
.bas-line { text-align: center; padding: 18px 10px 4px; color: var(--brand-ink); }
.ayahs.only-rec .ayah-row.norec, .ayahs.only-rec .bas-line.norec { display: none; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 400; color: var(--ink-2); cursor: pointer; user-select: none; font-family: "Thmanyah Sans", sans-serif; }
.toggle input { width: 16px; height: 16px; accent-color: var(--green); margin: 0; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 10px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.play { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: .9rem; display: grid; place-items: center; }
.btn.play.playing, .btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.primary:hover { background: #2a3531; }
.btn[disabled] { opacity: .35; cursor: default; }

/* ayah page */
.verse { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 28px 22px; box-shadow: var(--shadow); text-align: center; }
.verse .ref { color: var(--muted); font-size: .9rem; margin-top: 10px; }
/* inline glosses: the explained word carries its own meaning */
/* a border, not text-decoration: an underline sits at the Latin baseline and
   cuts through Arabic descenders; the border sits under the whole glyph box */
.gl { text-decoration: none; border-bottom: 2px dotted var(--brand); padding-bottom: .06em; cursor: pointer; border-radius: 2px; transition: background .15s; outline: none; }
.gl:hover, .gl:focus, .gl.open { background: #f3e6d2; border-bottom-style: solid; }
.gloss-hint { color: var(--muted); font-size: .78rem; margin-top: 6px; }
.gloss-line { margin-top: 10px; font-size: .95rem; color: var(--ink-2); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.gloss-line b { font-family: "Amiri Quran", serif; font-weight: 400; font-size: 1.15rem; color: var(--ink); }
.gloss-pop { position: absolute; z-index: 50; max-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; text-align: start; display: none; }
.gloss-pop.show { display: block; }
.gloss-pop .w { font-family: "Amiri Quran", serif; font-size: 1.3rem; color: var(--brand-ink); line-height: 1.6; }
.gloss-pop .m { font-family: "Thmanyah Serif Text", serif; font-size: 1.05rem; color: var(--ink); line-height: 1.8; margin-top: 2px; }
.gloss-pop .b { color: var(--muted); font-size: .74rem; margin-top: 6px; }
.pn { display: flex; justify-content: space-between; margin: 12px 0 0; font-size: .9rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-top: 16px; }
.panel h2 { margin: 0 0 10px; font-size: 1.05rem; color: var(--brand-ink); }
.panel .src { color: var(--muted); font-size: .8rem; margin-top: 10px; }
.panel.about { padding: 26px 30px; }
.panel.about p { font-size: 1.15rem; line-height: 2.1; margin: 0 0 14px; }
.panel.about p:last-child { margin-bottom: 0; color: var(--brand-ink); }
.panel p { margin: 0; color: var(--ink-2); font-size: 1.05rem; line-height: 1.95; }
.panel .asbab { color: var(--ink-2); line-height: 2; }
.panel .asbab .qv { font-family: "Amiri Quran", serif; color: var(--brand-ink); }
table.words { width: 100%; border-collapse: collapse; }
table.words td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
table.words tr:first-child td { border-top: 0; }
table.words td.w { font-family: "Amiri Quran", serif; font-size: 1.25rem; white-space: nowrap; color: var(--ink); width: 34%; }
.recs .rec { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.recs .rec:first-child { border-top: 0; }
.recs .rec .nm { flex: 1; }
.recs .rec .nm small { display: block; color: var(--muted); font-size: .8rem; }
.empty { color: var(--muted); text-align: center; padding: 22px; }

/* reciter page */
.rec-head { display: flex; gap: 18px; align-items: center; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 14px; }
.kv div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 500; }
.kv small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; margin-bottom: 2px; }
.kv .na { color: var(--muted); font-style: italic; }
.panel.map { padding-bottom: 14px; }
.mapframe { position: relative; width: 100%; max-width: 640px; height: 260px; margin: 0 auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.panel.map .src { text-align: center; }
.mapframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.group { margin-top: 16px; }
.group .gh { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.group .gh h3 { margin: 0; font-size: 1.05rem; }
.group .gh .range { color: var(--muted); font-size: .9rem; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills .btn.play { width: auto; height: auto; border-radius: 999px; padding: 3px 11px; font-size: .85rem; }

/* list pages */
.grid114 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.sur { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; color: var(--ink); }
.sur:hover { text-decoration: none; border-color: var(--brand); }
.sur .n { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: .8rem; color: var(--brand-ink); flex: none; }
.sur .nm { font-weight: 600; }
.sur small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.sur .n.ic-reciter {
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e5c40' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4.5 20c0-4.1 3.4-6.5 7.5-6.5s7.5 2.4 7.5 6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 18px 18px;
}
.sur .nm:only-of-type, .sur .nm:last-child { align-self: center; }
.sur .cov { margin-inline-start: auto; font-size: .75rem; color: #27432f; background: #d9e7dc; padding: 1px 8px; border-radius: 999px; }
.filter { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; margin: 10px 0 14px; background: var(--surface); }
.namelist { columns: 3; column-gap: 24px; font-size: .95rem; }
.namelist a { display: block; padding: 3px 0; color: var(--ink-2); break-inside: avoid; }
.namelist a small { color: var(--muted); }

/* search results */
.res h2 { font-size: 1rem; color: var(--muted); margin: 26px 0 8px; }
.res .ayah-row .txt .q { font-size: 1.3rem; line-height: 2; }
.res .ayah-row .ref { color: var(--muted); font-size: .85rem; }

footer { color: var(--muted); font-size: .82rem; text-align: center; padding: 40px 16px 30px; line-height: 1.9; }
footer a { color: var(--muted); }

@media (max-width: 640px) {
  .topsearch { display: none; }
  .nav a { padding: 6px 8px; font-size: .9rem; }
  .hero { padding-top: 34px; }
  .hero h1 { font-size: 2rem; }
  .q { font-size: 1.45rem; line-height: 2.1; }
  .q.big { font-size: 1.75rem; }
  .verse { padding: 20px 16px; }
  .namelist { columns: 1; }
}
