@font-face{font-family:"Thmanyah Sans";font-style:normal;font-weight:300;font-display:swap;src:url("/fonts/thmanyahsans-Light.otf") format("opentype");}
@font-face{font-family:"Thmanyah Sans";font-style:normal;font-weight:400;font-display:swap;src:url("/fonts/thmanyahsans-Regular.otf") format("opentype");}
@font-face{font-family:"Thmanyah Sans";font-style:normal;font-weight:500;font-display:swap;src:url("/fonts/thmanyahsans-Medium.otf") format("opentype");}
@font-face{font-family:"Thmanyah Sans";font-style:normal;font-weight:700;font-display:swap;src:url("/fonts/thmanyahsans-Bold.otf") format("opentype");}
@font-face{font-family:"Thmanyah Sans";font-style:normal;font-weight:900;font-display:swap;src:url("/fonts/thmanyahsans-Black.otf") format("opentype");}
/* ==========================================================================
   ويكيبيديا السير الذاتية: ورقة الأنماط
   لوحة الألوان مأخوذة من روح ويكيبيديا (Vector): أبيض، رماديات هادئة، أزرق كلاسيكي للروابط.
   الخطوط: خط ثمانية (يُضاف تعريف @font-face تلقائيًا في أعلى هذا الملف عند البناء إذا وُجدت ملفاته)،
   وخطوط النظام العربية احتياطًا.
   ========================================================================== */

/* السمة الفاتحة هي الأصل؛ والداكنة (فحمية أحادية هادئة) تحت data-theme="dark" */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #202122;
  --text-soft: #333333;
  --muted: #54595d;
  --link: #0645ad;
  --link-visited: #0b0080;
  --link-external: #36b;
  --border: #a2a9b1;
  --border-light: #c8ccd1;
  --border-faint: #eaecf0;
  --box: #f8f9fa;
  --box-head: #eaecf0;
  --surface: #ffffff;
  --input-bg: #ffffff;
  /* الخط الأساسي: ثمانية Sans (ملفاته في static/fonts)؛ وبعده خطوط النظام احتياطًا */
  --font-body: "Thmanyah Sans", "Thmanyah Serif Text", "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", "Droid Arabic Naskh", sans-serif;
  --font-heading: "Thmanyah Sans", "Thmanyah Serif Display", "Thmanyah Serif Text", "Segoe UI", Tahoma, "Geeza Pro", sans-serif;
  --font-ui: "Thmanyah Sans", "Segoe UI", Tahoma, Arial, sans-serif;
  --content-width: 1180px;
  --sidebar-width: 190px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --text: #e2e2e2;
  --text-soft: #bdbdbd;
  --muted: #969696;
  --link: #f0f0f0;
  --link-visited: #c4c4c4;
  --link-external: #d6d6d6;
  --border: #4a4a4a;
  --border-light: #363636;
  --border-faint: #262626;
  --box: #181818;
  --box-head: #202020;
  --surface: #121212;
  --input-bg: #151515;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.5rem; /* 24 بكسل: اختيار صاحب الموقع؛ خط ثمانية يبدو أصغر من حجمه الاسمي */
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
a:visited { color: var(--link-visited); }
a.external { color: var(--link-external); }
a.external:visited { color: #636; }
:root[data-theme="dark"] a.external:visited { color: var(--link-visited); }

a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid var(--link); outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

code { font-family: Consolas, "Courier New", monospace; font-size: 0.9em; background: var(--box); padding: 0 0.2em; }

hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }

blockquote {
  margin: 1em 0;
  padding: 0.5em 1.25em;
  border-inline-start: 3px solid var(--border-light);
  background: var(--box);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* رابط «انتقل إلى المحتوى»: مخفي تمامًا فوق الصفحة، ولا يظهر إلا عند الوصول إليه بلوحة المفاتيح */
.skip {
  position: absolute; top: 0; right: 0; z-index: 10;
  background: var(--box); padding: 0.5em 1em; border: 1px solid var(--border);
  transform: translateY(-110%);
}
.skip:focus { transform: none; }

.wrap { max-width: var(--content-width); margin: 0 auto; padding: 0 1rem; }

.muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   الترويسة
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  font-family: var(--font-ui);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: 0.6rem; padding-bottom: 0.6rem; flex-wrap: wrap;
}

.logo { display: flex; align-items: center; gap: 0.6rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark { flex: 0 0 auto; }
.logo-text { display: flex; flex-direction: column; line-height: 1.3; }
.logo-name { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 700; }
.logo-tagline { font-size: 0.8rem; color: var(--muted); }

.header-tools { display: flex; align-items: center; gap: 0.6rem; max-width: 100%; }

/* أدوات الهاتف مخفية على الشاشات الواسعة، وتظهر داخل نقطة التحول أدناه */
.mobile-search-link, .mobile-menu { display: none; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 50%;
  background: var(--box); color: var(--muted); cursor: pointer; padding: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.search { display: flex; gap: 0; max-width: 100%; }
.search input {
  font: inherit; font-size: 0.95rem; padding: 0.45em 0.7em; width: 16rem; max-width: 100%;
  border: 1px solid var(--border); border-radius: 0 6px 6px 0; background: var(--input-bg); color: var(--text);
}
.search input:focus { outline: 0; border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.search button {
  font: inherit; font-size: 0.95rem; padding: 0.45em 0.9em; cursor: pointer;
  border: 1px solid var(--border); border-inline-start: 0; border-radius: 6px 0 0 6px;
  background: var(--box); color: var(--text);
}
.search button:hover { background: var(--box-head); }
.search-page { margin: 1em 0; }
.search-page input { width: 24rem; }

/* --------------------------------------------------------------------------
   الهيكل: شريط جانبي يمين + محتوى
   -------------------------------------------------------------------------- */

.page {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 2rem;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

.sidebar { font-family: var(--font-ui); font-size: 0.95rem; }
.portal { margin-bottom: 1.25rem; }
.portal h3 {
  font-size: 0.78rem; font-weight: normal; color: var(--muted); margin: 0 0 0.3em;
  padding-bottom: 0.25em; border-bottom: 1px solid var(--border-light);
}
.portal ul { list-style: none; margin: 0; padding: 0; }
.portal li { padding: 0.2em 0; line-height: 1.5; }
.portal .count { color: var(--muted); font-size: 0.9em; }

.content { min-width: 0; max-width: 900px; }

/* --------------------------------------------------------------------------
   العناوين بأسلوب ويكيبيديا
   -------------------------------------------------------------------------- */

h1, h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
  margin: 0 0 0.3em;
  padding: 0 0 0.22em; /* مسافة تحت الحروف النازلة (ع، ج، ي) قبل الخط */
}
h1 { font-size: 1.9em; }
h2 { font-size: 1.5em; margin-top: 1.2em; }
h3 { font-size: 1.2em; font-weight: 700; margin: 1em 0 0.3em; }
h4 { font-size: 1.05em; font-weight: 700; margin: 0.8em 0 0.3em; }

.firstHeading { margin-bottom: 0.1em; }
.bio > .firstHeading { font-size: 1.35em; }
.category-heading { font-size: 1.6em; }
.siteSub { font-size: 1rem; color: var(--muted); margin-bottom: 0.8em; font-family: var(--font-ui); }
.shortdesc { color: var(--muted); margin: -0.3em 0 1em; font-size: 1.02em; }
/* الخط بلا وزن مائل، والميل الاصطناعي لا يليق بالعربية: التأكيد بالوزن لا بالميل */
em, i { font-style: normal; font-weight: 700; }

.bodyContent p { margin: 0.5em 0 0.9em; text-align: start; }
/* متن السيرة أخف بدرجة واحدة، مع إبقاء العناوين وصندوق التعريف بوزنهما الواضح. */
.bio > .bodyContent > p,
.bio > .bodyContent > ul,
.bio > .bodyContent > ol,
.bio > .bodyContent > blockquote { font-weight: 300; }
.bodyContent ul, .bodyContent ol { margin: 0.3em 1.6em 0.8em 0; padding: 0; }
.bodyContent li { margin-bottom: 0.2em; }

/* سجل المصادر بخط أصغر كقائمة المراجع */
.sources { font-size: 0.88em; line-height: 1.7; }
.sources p { margin: 0.4em 0; }

/* أبيات الشعر: صدر وعجز متقابلان، ويتراصّان عموديًا على الشاشات الضيقة */
.poem { margin: 1em auto; max-width: 40em; }
.verse { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2em 2.5em; margin: 0.2em 0; }
.verse span { flex: 1 1 14em; text-align: center; }

.dating-note {
  font-size: 0.92em; color: var(--muted); border-top: 1px solid var(--border-faint);
  padding-top: 0.8em; margin-top: 1.5em;
}

/* --------------------------------------------------------------------------
   صندوق المعلومات
   -------------------------------------------------------------------------- */

.infobox {
  width: 21rem;
  max-width: 100%;
  border: 1px solid var(--border);
  border-spacing: 3px;
  background: var(--box);
  font-size: 1.1rem; /* مستقل عن حجم المتن حتى لا يتضخم الصندوق ويزاحم النص */
  line-height: 1.6;
  font-family: var(--font-ui);
}
/* في RTL الطرف البادئ هو اليمين؛ نريد الصندوق على اليسار كما في ويكيبيديا العربية */
.infobox { float: left; clear: left; margin: 0.5em 1.25em 1em 0; }
.infobox th.infobox-title {
  padding: 0.45em 0.4em; font-size: 1em; font-weight: 700; text-align: center;
  background: var(--box-head);
}
.infobox th, .infobox td { padding: 0.25em 0.5em; vertical-align: top; text-align: start; }
.infobox th[scope="row"] { font-weight: 700; width: 36%; }
.infobox .infobox-image { text-align: center; padding: 0.4em; }
.infobox .infobox-image img { max-width: 100%; height: auto; }
.infobox-label {
  display: inline-flex; align-items: flex-start; gap: 0.38em;
}
.infobox-icon {
  display: block; flex: 0 0 auto; width: 0.92em; height: 0.92em;
  margin-block-start: 0.22em; color: var(--muted);
}
.infobox-value-with-flags {
  display: inline-flex; align-items: flex-start; gap: 0.45em; max-width: 100%;
}
.infobox-flags {
  display: inline-flex; align-items: center; gap: 0.18em; flex: 0 0 auto;
  margin-block-start: 0.27em;
}
.infobox-flag {
  display: block; width: 1.4em; height: 0.92em; overflow: hidden;
  border-radius: 2px; box-shadow: 0 0 0 1px var(--border-light);
}
.infobox-category-value {
  display: inline-flex; align-items: center; gap: 0.45em; max-width: 100%;
}
.infobox-category-dot {
  display: inline-block; flex: 0 0 auto; width: 0.62em; height: 0.62em;
  border-radius: 50%; box-shadow: 0 0 0 1px rgb(32 33 34 / 18%);
}
.infobox-category-dot-positive { background: #2f9e58; }
.infobox-category-dot-negative { background: #d43c3c; }
:root[data-theme="dark"] .infobox-category-dot-positive { background: #49c979; }
:root[data-theme="dark"] .infobox-category-dot-negative { background: #f06464; }
.infobox a.external { overflow-wrap: anywhere; }
.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { margin: 0 0 0.15em; }

/* --------------------------------------------------------------------------
   جدول المحتويات
   -------------------------------------------------------------------------- */

.toc {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--box);
  padding: 0.5em 1em 0.6em;
  margin: 0.5em 0 1em;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 100%;
}
.toc summary { font-weight: 700; text-align: center; cursor: pointer; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: " [إخفاء]"; font-weight: normal; font-size: 0.85em; color: var(--link); }
.toc:not([open]) summary::after { content: " [إظهار]"; }
.toc ol { list-style: none; margin: 0.3em 0 0; padding: 0; }
.toc ol ol { margin: 0 1.5em 0 0; }
.toc li { margin: 0.15em 0; }
.toc a { display: inline-block; }
.tocnumber { color: var(--text); margin-inline-end: 0.4em; }

/* --------------------------------------------------------------------------
   مشاركة السيرة، سير ذات صلة، التصنيفات، بيانات الصفحة
   -------------------------------------------------------------------------- */

.bio-share {
  clear: both;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.5em 0 1em;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border-light);
  background: var(--box);
  font-family: var(--font-ui);
}
.bio-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0.55rem 1.05rem;
  border: 1px solid #3366cc;
  border-radius: 999px;
  background: #3366cc;
  color: #ffffff;
  font: 700 1rem/1.2 var(--font-ui);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.bio-share-button:hover { background: #2a4f9e; border-color: #2a4f9e; transform: translateY(-1px); }
.bio-share-button:active { transform: translateY(0); }
.bio-share-button:disabled { cursor: wait; opacity: 0.72; transform: none; }
.bio-share-button.is-success { background: #14866d; border-color: #14866d; }
.bio-share-button.is-error { background: #b32424; border-color: #b32424; }
.bio-share-icon { flex: 0 0 auto; }
.bio-share-icon-success { display: none; }
.bio-share-button.is-success .bio-share-icon-default { display: none; }
.bio-share-button.is-success .bio-share-icon-success { display: block; }
.bio-share-hint { color: var(--muted); font-size: 0.95rem; }
:root[data-theme="dark"] .bio-share-button {
  background: #e2e2e2;
  border-color: #e2e2e2;
  color: #111111;
}
:root[data-theme="dark"] .bio-share-button:hover { background: #ffffff; border-color: #ffffff; }
:root[data-theme="dark"] .bio-share-button.is-success { background: #b9ded3; border-color: #b9ded3; }
:root[data-theme="dark"] .bio-share-button.is-error { background: #efb1b1; border-color: #efb1b1; }

.related ul { margin: 0.5em 1.6em 0.8em 0; padding: 0; }

.catlinks {
  clear: both;
  border: 1px solid var(--border);
  background: var(--box);
  padding: 0.5em 0.8em;
  margin-top: 1.5em;
  font-size: 1.05rem;
  font-family: var(--font-ui);
}

.page-meta { color: var(--muted); font-size: 1rem; margin-top: 1em; font-family: var(--font-ui); }

/* --------------------------------------------------------------------------
   القوائم (أحدث السير، التصنيفات، الفهرس، البحث)
   -------------------------------------------------------------------------- */

.bio-list, .cat-list { list-style: none; margin: 0; padding: 0; }
.bio-item { padding: 0.6em 0; border-bottom: 1px solid var(--border-faint); }
.bio-item:last-child { border-bottom: 0; }
.item-name { font-size: 1.08em; font-weight: 700; }
.item-cat { font-size: 0.85em; color: var(--muted); margin-inline-start: 0.5em; font-family: var(--font-ui); }
.item-date { font-size: 0.8em; color: var(--muted); margin-inline-start: 0.3em; font-family: var(--font-ui); white-space: nowrap; }
.item-summary { margin: 0.2em 0 0; font-size: 0.93em; color: var(--text-soft); }
.cat-list li { padding: 0.5em 0; border-bottom: 1px solid var(--border-faint); }
.cat-list li:last-child { border-bottom: 0; }
.cat-list .count { color: var(--muted); font-size: 0.9em; }
.cat-list .muted { margin: 0.1em 0 0; font-size: 0.9em; }
.cat-description { font-size: 1.02em; }
.letter { font-size: 1.3em; margin-top: 1em; }
.more { font-family: var(--font-ui); font-size: 0.9em; }

/* --------------------------------------------------------------------------
   الصفحة الرئيسية: عرض كامل بلا شريط جانبي، والسير هي الصدارة
   -------------------------------------------------------------------------- */

.page-home .sidebar { display: none; }
.page-home .page { display: block; }
.page-home .content { max-width: none; }

.mp-welcome {
  border: 1px solid var(--border-light);
  background: var(--box);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.mp-welcome-logo {
  display: block; width: 118px; height: 118px; object-fit: contain;
  margin: 0.45rem auto 0.35rem;
}
.mp-title {
  border: 0; font-size: clamp(1.15rem, 6.2vw, 2rem); line-height: 1.35;
  margin: 0;
}
.mp-title-line { display: block; white-space: nowrap; }
.mp-intro { margin: 0 auto 0.5em; max-width: 46em; color: var(--text-soft); }
.mp-links { margin: 0; font-family: var(--font-ui); font-size: 0.92em; }

.mp-box { border: 1px solid var(--border-light); background: var(--surface); }
.mp-featured { margin-bottom: 1.5rem; }
.mp-h2 {
  font-size: 1.15em; margin: 0; padding: 0.5em 0.9em; border: 0;
  background: var(--box-head); border-bottom: 1px solid var(--border-light);
}
.mp-body { padding: 0.6em 1rem 0.9em; }
.mp-body h3 { margin: 0.2em 0 0.2em; font-size: 1.3em; font-family: var(--font-heading); }
.mp-body .shortdesc { margin: 0 0 0.6em; }
.mp-featured .mp-body {
  display: flow-root;
  padding: 1rem 1.25rem 1.2rem;
}
.featured-image {
  float: left; display: block;
  width: clamp(260px, 28vw, 340px); max-width: 38%; height: auto;
  object-fit: contain; margin: 0.25rem 1.25rem 0.9rem 0;
  border: 1px solid var(--border-light); border-radius: 8px;
  padding: 3px; background: var(--surface);
}

/* أقسام الصفحة الرئيسية ذات العناوين المسطّرة */
.mp-showcase { margin: 0 0 1.6rem; }
.mp-strip {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem; padding-bottom: 0.22em;
}
.mp-strip-title { border: 0; margin: 0; padding: 0; font-size: 1.35em; }
.mp-strip-note { color: var(--muted); font-size: 0.82rem; font-family: var(--font-ui); }

/* شبكة بطاقات السير */
.bc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.bc-card {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border-light); border-radius: 10px;
  background: var(--surface); color: var(--text);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.bc-card:hover, .bc-card:focus {
  text-decoration: none; border-color: var(--border);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}
.bc-card:visited { color: var(--text); }
.bc-imgwrap {
  display: block; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--box); border-bottom: 1px solid var(--border-faint);
}
.bc-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.bc-noimg {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 3.5em; color: var(--muted);
}
.bc-body { display: flex; flex-direction: column; flex: 1; gap: 0.3em; padding: 0.7em 0.9em 0.9em; }
.bc-cat {
  align-self: flex-start; font-family: var(--font-ui); font-size: 0.72rem;
  color: var(--muted); background: var(--box);
  border: 1px solid var(--border-light); border-radius: 999px; padding: 0.05em 0.7em;
}
.bc-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.08em; line-height: 1.5; }
.bc-sum {
  font-size: 0.8em; color: var(--text-soft); line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bc-more { margin-top: auto; padding-top: 0.45em; font-family: var(--font-ui); font-size: 0.8rem; color: var(--link); }

/* صف بطاقات التصنيفات */
.cat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.cat-card {
  display: block; border: 1px solid var(--border-light); border-radius: 10px;
  background: var(--box); color: var(--text); padding: 0.7em 1em 0.8em;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.cat-card:hover, .cat-card:focus { text-decoration: none; border-color: var(--border); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
.cat-card:visited { color: var(--text); }
.cat-card-head { display: block; }
.cat-card-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.05em; color: var(--link); }
.cat-card .count { color: var(--muted); font-size: 0.85em; }
.cat-card-desc { display: block; color: var(--muted); font-size: 0.8em; line-height: 1.7; margin-top: 0.15em; font-family: var(--font-ui); }

/* قائمة أحدث السير المضغوطة: سطر لكل سيرة على عمودين */
.mp-latest { margin-bottom: 1.6rem; }
.bio-list-compact { columns: 2; column-gap: 2.5rem; }
.bio-list-compact .bio-item { break-inside: avoid; padding: 0.45em 0; }

/* --------------------------------------------------------------------------
   التذييل
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border-light);
  background: var(--box);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--muted);
  padding: 1rem 0 1.5rem;
}
.footer-links { list-style: none; margin: 0 0 0.5em; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4em 1.2em; }
.footer-note { margin: 0; }

/* --------------------------------------------------------------------------
   الهاتف
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  body { font-size: clamp(1.125rem, 2.2vw, 1.25rem); line-height: 1.8; }
  .wrap { padding-inline: clamp(0.75rem, 4vw, 1rem); }

  /* ترويسة من سطر واحد: العلامة أولًا، والأدوات الثانوية عند الطلب */
  .site-header { position: relative; }
  .header-inner {
    position: relative; flex-direction: row; flex-wrap: nowrap; align-items: center;
    gap: 0.5rem; min-height: 58px; padding-top: 0.45rem; padding-bottom: 0.45rem;
  }
  .logo { flex: 1 1 auto; min-width: 0; overflow: hidden; gap: 0.45rem; }
  .logo-mark { width: 40px; height: 40px; }
  .logo-text { min-width: 0; }
  .logo-name, .logo-tagline { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logo-name { font-size: 1rem; line-height: 1.25; }
  .logo-tagline { font-size: 0.7rem; line-height: 1.35; }
  .header-tools { flex: 0 0 auto; gap: 0.25rem; }
  .header-tools > .search, .theme-toggle-desktop { display: none; }

  .mobile-search-link, .mobile-menu > summary {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 1px solid var(--border-light); border-radius: 9px;
    background: var(--box); color: var(--text); cursor: pointer;
  }
  .mobile-search-link:visited { color: var(--text); }
  .mobile-search-link:hover, .mobile-search-link:focus { text-decoration: none; border-color: var(--border); }
  .mobile-menu { display: block; position: relative; }
  .mobile-menu > summary { list-style: none; }
  .mobile-menu > summary::-webkit-details-marker { display: none; }
  .mobile-menu .icon-close { display: none; }
  .mobile-menu[open] .icon-menu { display: none; }
  .mobile-menu[open] .icon-close { display: block; }
  .mobile-menu[open] > summary { border-color: var(--link); color: var(--link); }

  .mobile-menu-panel {
    position: absolute; z-index: 50; inset-inline-end: 0; top: calc(100% + 0.55rem);
    width: min(19rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 5rem); overflow-y: auto;
    padding: 0.65rem; border: 1px solid var(--border-light); border-radius: 10px;
    background: var(--surface); color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    font-family: var(--font-ui); font-size: 1rem; line-height: 1.5;
  }
  .mobile-menu-section + .mobile-menu-section { margin-top: 0.65rem; }
  .mobile-menu-heading {
    display: block; padding: 0.15rem 0.55rem 0.4rem; color: var(--muted);
    font-size: 0.78rem; font-weight: 700;
  }
  .mobile-menu-panel ul { list-style: none; margin: 0; padding: 0; }
  .mobile-menu-panel a {
    display: flex; align-items: center; min-height: 44px; padding: 0.4rem 0.55rem;
    border-radius: 7px; color: var(--text);
  }
  .mobile-menu-panel a:visited { color: var(--text); }
  .mobile-menu-panel a:hover, .mobile-menu-panel a:focus { background: var(--box); text-decoration: none; }
  .mobile-category-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem; }
  .mobile-category-list .count { margin-inline-start: 0.25rem; color: var(--muted); font-size: 0.82em; }
  .mobile-theme-toggle {
    display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 44px;
    margin-top: 0.65rem; padding: 0.45rem 0.55rem; border: 0; border-top: 1px solid var(--border-faint);
    border-radius: 7px; background: transparent; color: var(--text); font: inherit; cursor: pointer;
  }
  .mobile-theme-toggle:hover, .mobile-theme-toggle:focus { background: var(--box); }

  /* المحتوى هو الأول على الهاتف؛ التنقل الكامل متاح من زر القائمة */
  .page { display: block; padding-top: 0.7rem; padding-bottom: 1.5rem; }
  .sidebar { display: none; }
  .content { max-width: none; }

  h1 { font-size: 1.55em; line-height: 1.4; }
  h2 { font-size: 1.3em; line-height: 1.5; }
  .category-heading { font-size: 1.4em; }
  .bio > .firstHeading {
    font-size: clamp(1.25rem, 5vw, 1.55rem); line-height: 1.35;
    margin-bottom: 0.2rem; padding-bottom: 0.25rem; text-wrap: balance;
  }
  .bio > .siteSub { display: none; }
  .bio > .shortdesc { margin: 0 0 0.75rem; font-size: 1.05em; line-height: 1.65; }
  .infobox {
    float: none; clear: both; width: 100%; margin: 0.3rem 0 1rem;
    border-spacing: 0; border-radius: 8px; overflow: hidden;
  }
  .infobox th.infobox-title { font-size: 0.94em; }
  .search-page { width: 100%; }
  .search-page input { width: 100%; min-width: 0; flex: 1; }
  .search-page input, .search-page button { min-height: 44px; font-size: 1rem; }
  .mp-featured .mp-body { padding: 0.85rem; }
  .featured-image {
    float: none; display: block;
    width: min(100%, 400px); max-width: 100%; height: auto;
    margin: 0 auto 0.9rem;
  }
  .toc { display: block; }
  .bio-list-compact { columns: 1; }
  .bc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .mp-welcome { padding-inline: 0.65rem; }
  .mp-welcome-logo { width: 96px; height: 96px; }
  .bc-grid { grid-template-columns: 1fr; }
  .bc-imgwrap { aspect-ratio: 16 / 10; }
  .mp-featured .mp-body { padding: 0.75rem; }
  .featured-image { width: 100%; max-width: 100%; }
}

@media (max-width: 380px) {
  .logo-mark { width: 36px; height: 36px; }
  .logo-name { font-size: 0.95rem; }
  .logo-tagline { display: none; }
  .bio > .firstHeading { font-size: 1.25rem; }
  .mobile-category-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .bio-share { display: block; }
  .bio-share-button { width: 100%; }
  .bio-share-hint { display: block; margin-top: 0.55rem; text-align: center; }
}

/* --------------------------------------------------------------------------
   الطباعة
   -------------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #ffffff; --text: #202122; --text-soft: #333333; --muted: #54595d;
    --link: #0645ad; --link-visited: #0b0080; --link-external: #36b;
    --border: #a2a9b1; --border-light: #c8ccd1; --border-faint: #eaecf0;
    --box: #f8f9fa; --box-head: #eaecf0; --surface: #ffffff; --input-bg: #ffffff;
  }
  .site-header, .sidebar, .site-footer, .search, .related, .bio-share, .skip, .theme-toggle,
  .mobile-search-link, .mobile-menu { display: none !important; }
  .page { display: block; }
  body { font-size: 12pt; line-height: 1.6; }
  a { color: inherit; }
  .infobox { float: none; width: auto; }
}

/* آيات قرآنية إن وُجدت في النص داخل <span class="ayah"> */
.ayah::before { content: "﴿"; }
.ayah::after { content: "﴾"; }
