/* ==========================================================================
   Bibliothèque — feuille de style unique (mobile first)
   Inspiration : manuscrits, parchemin, encre, vert profond et or.
   ========================================================================== */

:root {
  --parch: #f6f1e7;
  --paper: #fffdf8;
  --ink: #1d1a16;
  --ink-2: #5d554a;
  --ink-3: #8a8174;
  --green: #1e5a47;
  --green-2: #2c7a61;
  --gold: #a8742a;
  --gold-soft: #e9d6b0;
  --line: #e4d9c3;
  --mark: #f4dc9d;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 24px -12px rgba(60, 40, 10, .18);

  --f-ar: "Amiri", "Traditional Arabic", "Scheherazade New", serif;
  --f-kufi: "Noto Kufi Arabic", "Amiri", sans-serif;
  --f-title: "Fraunces", Georgia, serif;
  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Kufi Arabic", sans-serif;

  --r: 14px;
  --wrap: 72rem;
}

/* Mode sombre : automatique (système) sauf choix manuel via le bouton (data-theme). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --parch: #15130f;
  --paper: #1e1b16;
  --ink: #ece4d4;
  --ink-2: #bdb3a2;
  --ink-3: #8c8475;
  --green: #74b9a0;
  --green-2: #8fd0b7;
  --gold: #d6a85e;
  --gold-soft: #4a3b22;
  --line: #34302a;
  --mark: #6b5420;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --parch: #15130f;
    --paper: #1e1b16;
    --ink: #ece4d4;
    --ink-2: #bdb3a2;
    --ink-3: #8c8475;
    --green: #74b9a0;
    --green-2: #8fd0b7;
    --gold: #d6a85e;
    --gold-soft: #4a3b22;
    --line: #34302a;
    --mark: #6b5420;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: var(--parch);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(168, 116, 42, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(30, 90, 71, .06), transparent 60%);
  background-attachment: fixed;
  font: 16px/1.6 var(--f-ui);
  text-rendering: optimizeLegibility;
}
main { flex: 1; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: .25em; }
a:hover { color: var(--gold); }
img { max-width: 100%; height: auto; }
svg { width: 1em; height: 1em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; z-index: 10; background: var(--paper); padding: .4rem .8rem; }

/* --- En-tête -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--parch) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font: 700 1.15rem/1.3 var(--f-kufi); color: var(--ink); text-decoration: none;
}
.brand-mark { width: 1.6rem; height: 1.6rem; color: var(--gold); flex: none; }
.brand-logo { display: block; line-height: 0; }
.brand-logo img { display: block; height: 2.5rem; width: auto; }
.brand:hover .brand-logo img { opacity: .85; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Sélecteur de langue */
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); flex: none; }
.langs a { padding: .3rem .6rem; font: 600 .82rem/1.4 var(--f-ui); color: var(--ink-2); text-decoration: none; }
.langs a[lang="ar"] { font-family: var(--f-kufi); }
.langs a[aria-current] { background: var(--green); color: #fff; }
.langs a:not([aria-current]):hover { color: var(--gold); }

/* Logo : version claire / sombre selon le thème effectif */
.logo-d { display: none !important; }
:root[data-theme="dark"] .logo-l { display: none !important; }
:root[data-theme="dark"] .logo-d { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-l { display: none !important; }
  :root:not([data-theme="light"]) .logo-d { display: block !important; }
}
.hero-logo .logo-d, .hero-logo .logo-l { margin-inline: auto; }

/* Bouton clair / sombre */
.theme-btn {
  flex: none; display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink-2); cursor: pointer;
}
.theme-btn:hover { color: var(--gold); border-color: var(--gold); }
.theme-btn svg { width: 1.1rem; height: 1.1rem; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
/* Site traduit (fr, en, es, de) : Literata pour la lecture, Inter pour l'interface */
.is-tr { --f-read: "Literata", Georgia, "Times New Roman", serif; }
.is-tr .prose, .is-tr .toc li a, .is-tr .files li a, .is-tr .card-title, .is-tr .pager a,
.is-tr .result-excerpt, .is-tr .hero-tag, .is-tr .group-intro, .is-tr .notfound p, .is-tr .suggest li a { font-family: var(--f-read); }
.is-tr .prose { font-size: calc(18px * var(--fs, 1)); line-height: 1.75; }
.is-tr .prose h1, .is-tr .prose h2, .is-tr .prose h3, .is-tr .prose h4 { font-family: var(--f-read); font-weight: 600; line-height: 1.35; }
.is-tr .title, .is-tr .title.title-amiri, .is-tr .hero-title, .is-tr .result-title {
  font-family: var(--f-read); font-weight: 600; line-height: 1.3; letter-spacing: -.01em;
}
.is-tr .title.title-amiri { font-size: clamp(1.7rem, 4vw, 2.6rem); }
.is-tr .card-title { font-weight: 600; font-size: 1.05rem; line-height: 1.45; }
.is-tr .toc li a { font-size: 1.05rem; line-height: 1.55; }
.is-tr .toc-section .toc-label { font-weight: 600; }
.is-tr .brand, .is-tr .crumbs ol, .is-tr .kicker, .is-tr .topics a, .is-tr .badge, .is-tr .pager small,
.is-tr .toc-title, .is-tr .count-line, .is-tr .site-footer, .is-tr .source-note, .is-tr .btn-link { font-family: var(--f-ui); }
.is-tr .kicker { font-weight: 600; letter-spacing: .02em; }
.is-tr .crumbs li + li::before { content: "›"; }
.is-tr .search.big input { font-family: var(--f-ui); font-size: 1.1rem; }

/* --- Champs de recherche -------------------------------------------------- */
.search { position: relative; display: flex; align-items: stretch; }
.search input {
  flex: 1; min-width: 0; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: .55rem 1rem; padding-inline-end: 2.8rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04);
  transition: border-color .2s, box-shadow .2s;
}
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent); }
.search input::-webkit-search-cancel-button { display: none; }
.search button {
  position: absolute; inset-inline-end: .3rem; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: .4rem;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--green); color: #fff; padding: .45rem .6rem; font: 600 .95rem var(--f-ui);
}
.search button:hover { background: var(--green-2); }
.search button svg { width: 1.1rem; height: 1.1rem; }
.search button span { display: none; }
.search.mini { flex: 1 1 14rem; max-width: 26rem; margin-inline-start: auto; }
.search.mini input { font-size: .95rem; }
.search.big { max-width: 40rem; margin: 0 auto; }
.search.big input { font: 1.15rem/1.4 var(--f-ar); padding: 1rem 1.4rem; padding-inline-end: 3.5rem; box-shadow: var(--shadow); }
.search.big button { padding: .7rem .8rem; }
@media (min-width: 40em) {
  .search.big input { padding-inline-end: 8rem; font-size: 1.3rem; }
  .search.big button { padding: .7rem 1.2rem; }
  .search.big button span { display: inline; }
}

/* Mode de recherche */
.search { flex-wrap: wrap; }
.search-mode { flex-basis: 100%; display: flex; justify-content: center; gap: .4rem; margin-top: .7rem; }
.search-mode label { cursor: pointer; }
.search-mode input { position: absolute; opacity: 0; pointer-events: none; }
.search-mode span {
  display: inline-block; padding: .3rem .95rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink-2); font: 600 .88rem/1.5 var(--f-kufi); transition: all .15s;
}
.search-mode input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.search-mode input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.search.big button { top: 1.75rem; }

/* Suggestions en direct */
.suggest {
  position: absolute; top: calc(100% + .4rem); inset-inline: 0; z-index: 30;
  list-style: none; margin: 0; padding: .35rem; text-align: start;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}
.suggest[hidden] { display: none; }
.suggest li a {
  display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border-radius: 10px;
  color: var(--ink); text-decoration: none; font: 1.05rem/1.5 var(--f-ar);
}
.suggest li a svg { color: var(--gold); flex: none; }
.suggest li[aria-selected="true"] a, .suggest li a:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); }

/* --- Accueil --------------------------------------------------------------- */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero-star { width: 3.2rem; height: 3.2rem; color: var(--gold); opacity: .9; }
.hero-title { font: 700 clamp(1.9rem, 6vw, 3.1rem)/1.5 var(--f-kufi); margin: .6rem 0 .2rem; letter-spacing: 0; }
.hero-logo { margin: 0 0 .4rem; line-height: 0; }
.hero-logo img { width: min(100%, 27rem); height: auto; }
.hero-tag { color: var(--ink-2); margin: 0 0 1.6rem; font: 1.15rem/1.8 var(--f-ar); }
.hint { color: var(--ink-3); font-size: .9rem; text-align: center; margin: .9rem 0 0; }
.kicker {
  display: flex; align-items: center; justify-content: center; gap: .9rem;
  margin: 2.6rem 0 1.2rem; font: 600 1.1rem var(--f-kufi); color: var(--gold);
}
.kicker .orn { width: 5rem; height: .6rem; flex: none; }
.cards { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.card {
  position: relative; height: 100%; display: flex; flex-direction: column; gap: .6rem;
  padding: 1.15rem 1.2rem 1rem; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); transition: transform .2s ease, border-color .2s ease;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .55;
}
.card:hover { transform: translateY(-2px); border-color: var(--gold); color: var(--ink); }
.card-num { font: 600 .8rem var(--f-ui); color: var(--gold); }
.card-title { font: 600 1.15rem/1.7 var(--f-kufi); }
.card[dir="ltr"] .card-title, .card:lang(fr) .card-title { font-family: var(--f-title); }
.card-meta { margin-top: auto; display: flex; align-items: center; gap: .4rem; color: var(--ink-3); font-size: .85rem; }
.card-meta svg { color: var(--green); }
/* Navigation rapide par thème */
.topics { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 2rem auto .5rem; max-width: 56rem; }
.topics a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem 1rem; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  font: 600 .95rem/1.5 var(--f-kufi); transition: border-color .2s, color .2s;
}
.topics a:hover { border-color: var(--gold); color: var(--green); }
.topics a span { font: 600 .72rem var(--f-ui); color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); border-radius: 999px; padding: .05rem .5rem; }
.group { scroll-margin-top: 5rem; }
.group .kicker { margin-top: 2.4rem; font-size: 1.25rem; }
.group-intro { text-align: center; color: var(--ink-3); font: 1.05rem/1.8 var(--f-ar); margin: -.6rem 0 1.1rem; }
.group .cards { margin-bottom: 1rem; }
.intro { max-width: var(--wrap); margin: 1rem auto 0; }
.empty { text-align: center; color: var(--ink-3); padding: 2rem 0; }

/* --- Fil d'Ariane ---------------------------------------------------------- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 1.2rem 0 .8rem; padding: 0; font: .95rem/1.7 var(--f-kufi); }
.crumbs li { color: var(--ink-3); }
.crumbs li + li::before { content: "‹"; margin-inline: .35rem; color: var(--gold); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--green); }

/* --- Feuille (page intérieure) -------------------------------------------- */
.sheet {
  max-width: var(--wrap); margin: 0 auto 1.5rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px);
  box-shadow: var(--shadow); padding: 1.6rem 1.2rem 2rem;
  position: relative;
}
.sheet::after {
  content: ""; position: absolute; inset: 6px; border: 1px solid color-mix(in srgb, var(--gold) 25%, transparent);
  border-radius: var(--r); pointer-events: none;
}
@media (min-width: 40em) { .sheet { padding: 2.4rem 3rem 2.8rem; } }
.sheet-head { text-align: center; margin-bottom: 1.6rem; }
.sheet-head .orn { width: 7rem; height: .7rem; color: var(--gold); }
.badge { display: inline-block; font: 600 .75rem var(--f-kufi); color: var(--green); border: 1px solid currentColor; border-radius: 999px; padding: .05rem .7rem; }
.title { margin: .4rem 0 .5rem; font: 700 clamp(1.5rem, 4.5vw, 2.2rem)/1.6 var(--f-kufi); color: var(--ink); }
[dir="ltr"] .title { font-family: var(--f-title); font-weight: 600; line-height: 1.25; }
/* Titres des articles de waadallami : même rendu que le site d'origine (Amiri, 60 px, regular) */
.title.title-amiri { font-family: var(--f-ar); font-weight: 400; font-size: clamp(2rem, 5.2vw, 3.75rem); line-height: 1.4; color: var(--ink); max-width: 46rem; margin-inline: auto; }

/* Texte : Amiri 20 px, interligne 2 */
.prose { font: calc(20px * var(--fs, 1))/2 var(--f-ar); color: var(--ink); overflow-wrap: break-word; }
.prose[dir="ltr"], [dir="ltr"] > .prose { font-size: calc(19px * var(--fs, 1)); line-height: 1.8; hyphens: auto; }
.prose p { margin: 0 0 1em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { font-family: var(--f-kufi); line-height: 1.7; margin: 1.6em 0 .5em; color: var(--green); }
[dir="ltr"] .prose h1, [dir="ltr"] .prose h2, [dir="ltr"] .prose h3, [dir="ltr"] .prose h4 { font-family: var(--f-title); line-height: 1.3; }
.prose h1 { font-size: 1.45em; } .prose h2 { font-size: 1.3em; } .prose h3 { font-size: 1.15em; } .prose h4, .prose h5, .prose h6 { font-size: 1.05em; }
.prose blockquote { margin: 1.2em 0; padding: .4em 1.1em; border-inline-start: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 7%, transparent); border-radius: 4px; }
.prose ul, .prose ol { padding-inline-start: 1.6em; }
.prose hr { border: 0; height: 12px; margin: 1.8em auto; width: 8rem; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cg fill='none' stroke='%23a8742a' stroke-width='1.2'%3E%3Cpath d='M0 6h48M72 6h48'/%3E%3Cpath d='M60 0l6 6-6 6-6-6z'/%3E%3C/g%3E%3C/svg%3E"); }
.prose img { border-radius: 8px; margin: .5em auto; display: block; }
.prose .c { text-align: center; }
.prose div + div { margin-top: .4em; }
.prose strong { color: var(--green); font-weight: 700; }
.prose sup, .prose sub { font-size: .65em; }
.prose a[target="_blank"]::after { content: "↗"; font-size: .7em; margin-inline-start: .15em; }

/* --- Traduction (widget Google, chargé au clic) ---------------------------- */
.translate { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; margin: .4rem 0 0; font-family: var(--f-ui); }
.tr-btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  font: 600 .85rem var(--f-kufi); color: var(--green); background: transparent;
  border: 1px solid color-mix(in srgb, var(--green) 45%, transparent); border-radius: 999px; padding: .3rem .9rem;
}
.translate [hidden] { display: none !important; }
.tr-btn:hover { border-color: var(--gold); color: var(--gold); }
.tr-btn svg { width: 1rem; height: 1rem; }
#google_translate_element select.goog-te-combo {
  font: 500 .9rem var(--f-ui); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem; margin: 0;
}
#google_translate_element .goog-te-gadget { font-size: 0; color: transparent; }
#google_translate_element .goog-te-gadget > span, #google_translate_element .goog-logo-link { display: none !important; }
/* Bandeau, infobulles et surlignage ajoutés par Google : masqués (le bouton « النص الأصلي » les remplace) */
body > .skiptranslate, .goog-te-banner-frame, iframe.skiptranslate { display: none !important; }
body { top: 0 !important; }
#goog-gt-tt, .goog-te-balloon-frame, .VIpgJd-yAWNEb-L7lbkb { display: none !important; }
.goog-text-highlight, font[style*="background-color"] { background: none !important; box-shadow: none !important; }

.source-note { margin: 1.6rem 0 0; text-align: center; font: .9rem var(--f-kufi); color: var(--ink-3); }
.source-note a { color: var(--gold); }

/* --- Sommaire --------------------------------------------------------------- */
.toc { margin-top: 1.2rem; }
.toc-title { font: 600 1.05rem var(--f-kufi); color: var(--gold); text-align: center; margin: 2rem 0 1rem; }
.toc ol, .files ul { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc li a, .files li a {
  display: flex; align-items: center; gap: .7rem; padding: .7rem .5rem;
  border-bottom: 1px dashed var(--line); color: var(--ink); text-decoration: none;
  font: 1.15rem/1.7 var(--f-ar); transition: background .15s, padding .15s;
}
.toc li a::before { content: counter(toc); min-width: 1.6rem; font: 600 .8rem var(--f-ui); color: var(--gold); text-align: center; }
.toc li a svg, .files li a svg { color: var(--green); flex: none; width: 1.1rem; height: 1.1rem; }
.toc li a:hover, .files li a:hover { background: color-mix(in srgb, var(--gold) 9%, transparent); color: var(--green); padding-inline-start: .8rem; }
.toc-label { flex: 1; }
.toc-section .toc-label { font-weight: 700; }
.count { font: 600 .75rem var(--f-ui); color: var(--ink-2); background: color-mix(in srgb, var(--green) 12%, transparent); border-radius: 999px; padding: .1rem .55rem; }
.files .ext { margin-inline-start: auto; font: 600 .75rem var(--f-ui); color: var(--ink-3); }

/* --- Précédent / suivant --------------------------------------------------- */
.pager { max-width: var(--wrap); margin: 0 auto 3rem; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pager a {
  display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); font: 1.05rem/1.6 var(--f-ar);
}
.pager a:hover { border-color: var(--gold); }
.pager small { font: 600 .78rem var(--f-kufi); color: var(--gold); }
.pager .next { text-align: end; grid-column: 2; }

/* --- Résultats de recherche ------------------------------------------------ */
.search-head { padding: 1.8rem 0 .6rem; }
.count-line { text-align: center; color: var(--ink-2); font: .95rem var(--f-kufi); margin: 1rem 0 0; }
.results { list-style: none; max-width: var(--wrap); margin: 1rem auto 2rem; padding: 0; }
.result { padding: 1.1rem 1.2rem; margin-bottom: .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.result-parent { font: .85rem var(--f-kufi); color: var(--ink-3); margin-bottom: .2rem; }
.result-title { font: 700 1.2rem/1.7 var(--f-kufi); text-decoration: none; }
.result[dir="ltr"] .result-title { font-family: var(--f-title); }
.result-excerpt { margin: .4rem 0 0; font: 1.1rem/1.95 var(--f-ar); color: var(--ink-2); }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: 0 0 3rem; }
.pagination a, .pagination span { min-width: 2.4rem; text-align: center; padding: .4rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); text-decoration: none; }
.pagination .current { background: var(--green); color: #fff; border-color: var(--green); }

/* --- 404 ------------------------------------------------------------------- */
.notfound { text-align: center; padding: 3rem 0 4rem; }
.nf-code { font: 700 4.5rem/1 var(--f-kufi); color: var(--gold); opacity: .8; }
.notfound .orn { width: 8rem; height: .8rem; color: var(--gold); margin: 1rem 0; }
.notfound p { color: var(--ink-2); font: 1.15rem/1.9 var(--f-ar); }
.btn-link { display: inline-block; margin-top: 1rem; padding: .5rem 1.4rem; border-radius: 999px; border: 1px solid var(--green); text-decoration: none; font-family: var(--f-kufi); }

/* --- Pied de page ---------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding: 1.6rem 0 2rem; text-align: center; color: var(--ink-3); font: .9rem var(--f-kufi); }
.site-footer .orn { width: 6rem; height: .6rem; color: var(--gold); }
.site-footer p { margin: .5rem 0 0; }
.site-footer a { color: var(--ink-2); text-decoration: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .pager, .crumbs { display: none; }
  body { background: #fff; } .sheet { box-shadow: none; border: 0; } .sheet::after { display: none; }
}

/* Accueil sur mobile : deux cartes par ligne, ornements plus courts */
@media (max-width: 40em) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .card { padding: .85rem .8rem .75rem; gap: .4rem; }
  .card-title { font-size: 1rem; line-height: 1.6; }
  .card-meta { font-size: .78rem; }
  .kicker { gap: .5rem; }
  .kicker .orn { width: 2.2rem; }
  .group .kicker { font-size: 1.1rem; }
  .topics a { font-size: .85rem; padding: .35rem .8rem; }
}
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6, .title { hyphens: manual; }


/* --- En-tête coloré des pages : couleur et icône du thème --------------------- */
.post-hero {
  --hero: #14463a;
  position: relative; overflow: hidden; z-index: 1;
  margin: -1.6rem -1.2rem 1.8rem; padding: 1.8rem 1.4rem 1.5rem;
  border-radius: calc(var(--r) + 3px) calc(var(--r) + 3px) 0 0;
  color: #fff;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--hero) 55%, #ffffff 0%) 0%, transparent 60%),
    linear-gradient(120deg, color-mix(in srgb, var(--hero) 92%, #000) 0%, var(--hero) 45%, color-mix(in srgb, var(--hero) 70%, #6b6f9a) 100%);
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, #8a5a1c, #e4c27a, #a8742a) 1;
}
@media (min-width: 40em) { .post-hero { margin: -2.4rem -3rem 2.2rem; padding: 2.6rem 3rem 2rem; } }
.post-hero-bg { position: absolute; inset-inline-end: 1.5rem; bottom: -3rem; width: 13rem; height: 13rem; color: #fff; opacity: .07; pointer-events: none; }
.post-hero-row { display: flex; align-items: flex-start; gap: 1rem; }
.post-hero-icon {
  flex: none; display: grid; place-items: center; width: 3.2rem; height: 3.2rem; margin-top: .35rem;
  border-radius: 14px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .5);
}
.post-hero-icon svg { width: 1.6rem; height: 1.6rem; color: #fff; }
.post-hero .title { margin: 0; text-align: start; color: #fff; font-size: clamp(1.45rem, 4.2vw, 2.35rem); line-height: 1.7; }
.post-hero .title.title-amiri { color: #fff; margin: 0; max-width: none; font-size: clamp(1.8rem, 4.8vw, 3rem); }
.post-hero-meta { display: flex; flex-wrap: wrap; gap: .5rem .6rem; margin-top: 1.1rem; padding-inline-start: 4.2rem; }
@media (max-width: 40em) { .post-hero-meta { padding-inline-start: 0; } .post-hero-icon { width: 2.6rem; height: 2.6rem; } }
.chip {
  display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .85rem; border-radius: 999px;
  font: 600 .85rem/1.5 var(--f-kufi); color: #fff; text-decoration: none;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .32);
}
.chip svg { width: 1rem; height: 1rem; flex: none; }
a.chip:hover { background: rgba(255, 255, 255, .22); }
.chip-soft { background: transparent; color: rgba(255, 255, 255, .85); }
.is-tr .chip { font-family: var(--f-ui); }

/* --- Barre de partage ---------------------------------------------------------- */
.share-bar {
  display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin: 2rem 0 0; padding: .9rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(120deg, color-mix(in srgb, var(--paper) 80%, var(--parch)), var(--parch));
}
.share-btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 700 .95rem/1.3 var(--f-kufi); text-decoration: none; transition: border-color .15s, color .15s, transform .15s;
}
.share-btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
.share-btn:hover { border-color: var(--gold); color: var(--green); transform: translateY(-1px); }
.share-main { color: #a23b2a; border-color: color-mix(in srgb, #a23b2a 45%, var(--line)); }
.share-copy { padding-inline: .8rem; }
.share-main.is-done { color: var(--green); border-color: var(--green); }
.share-done { display: none; font-size: .8rem; color: var(--green); }
.share-copy.is-done .share-done { display: inline; }


/* --- Barre de navigation unique ---------------------------------------------
   [logo] [thèmes avec sous-menus au survol] ........ [recherche · langue · thème · ☰]
   ≤ 1080 px : les thèmes passent dans un panneau latéral (accordéon). */
.hdr { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.brand { flex: none; }
.mnav { flex: 1 1 auto; min-width: 0; font-family: var(--f-kufi); }
.mnav-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .1rem; }
.mnav-item { position: relative; }
.mnav-row { display: flex; align-items: center; }
.mnav-top {
  display: inline-flex; align-items: center; gap: .35rem; padding: .55rem .6rem; border-radius: 10px;
  color: var(--ink); text-decoration: none; font: 600 .93rem/1.4 var(--f-kufi); white-space: nowrap;
}
.mnav-ico { width: 1.05rem; height: 1.05rem; color: var(--hero); opacity: .9; }
:root[data-theme="dark"] .mnav-ico { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mnav-ico { color: var(--gold); } }
.mn-caret { width: .85rem; height: .85rem; opacity: .6; transition: transform .15s; }
.mnav-exp { display: none; }
.mnav-item:hover > .mnav-row .mnav-top, .mnav-item:focus-within > .mnav-row .mnav-top { background: color-mix(in srgb, var(--green) 8%, transparent); color: var(--green); }
.mnav-item.is-current > .mnav-row .mnav-top { color: var(--green); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 10px 10px 0 0; }

.mnav-drop {
  position: absolute; top: 100%; inset-inline-start: 0; z-index: 50; min-width: 17rem; max-width: min(92vw, 30rem);
  padding: .8rem; margin-top: .35rem;
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--hero); border-radius: 0 0 var(--r) var(--r);
  box-shadow: 0 18px 40px -18px rgba(30, 20, 5, .35);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s;
  max-height: min(72vh, 36rem); overflow: auto;
}
.mnav-drop::before { content: ""; position: absolute; inset-inline: 0; top: -.6rem; height: .6rem; } /* pont de survol */
.mnav-item.drop-end .mnav-drop { inset-inline-start: auto; inset-inline-end: 0; }
.mnav-drop.is-wide { min-width: min(92vw, 40rem); max-width: min(92vw, 44rem); }
.mnav-drop.is-wide ul { columns: 2; column-gap: 1rem; }
.mnav-item:hover > .mnav-drop, .mnav-item:focus-within > .mnav-drop { opacity: 1; visibility: visible; transform: none; }
.mnav-item:hover .mn-caret, .mnav-item:focus-within .mn-caret { transform: rotate(180deg); }
.mnav-drop-title { margin: 0 0 .45rem; padding: 0 .55rem .5rem; border-bottom: 1px solid var(--line); font: 700 .95rem/1.5 var(--f-kufi); color: var(--ink); }
.mnav-drop-title small { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-3); }
.mnav-drop ul { list-style: none; margin: 0; padding: 0; }
.mnav-drop li { break-inside: avoid; }
.mnav-drop a {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; padding: .42rem .55rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font: 500 .9rem/1.6 var(--f-kufi);
}
.mnav-drop a:hover, .mnav-drop a:focus-visible { background: color-mix(in srgb, var(--gold) 13%, transparent); color: var(--green); }
.mnav-drop a[aria-current] { color: var(--green); font-weight: 700; }
.mnav-drop small { flex: none; color: var(--ink-3); font: 600 .7rem/1 var(--f-ui); background: var(--parch); border-radius: 999px; padding: .22rem .45rem; }

.hdr-tools { flex: none; display: flex; align-items: center; gap: .35rem; margin-inline-start: auto; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; height: 2.3rem; min-width: 2.3rem; padding: 0 .5rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink-2); cursor: pointer;
  font: 700 .8rem/1 var(--f-ui);
}
.tool-btn:hover, .tool-btn[aria-expanded="true"] { color: var(--green); border-color: var(--gold); }
.tool-btn svg { width: 1.1rem; height: 1.1rem; }
.theme-btn { width: 2.3rem; height: 2.3rem; }
.burger { display: none; }

.lang-menu { position: relative; }
.lang-drop {
  position: absolute; top: calc(100% + .4rem); inset-inline-end: 0; z-index: 50; min-width: 9rem; padding: .35rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 30px -14px rgba(30, 20, 5, .35);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s;
}
.lang-drop::before { content: ""; position: absolute; inset-inline: 0; top: -.5rem; height: .5rem; }
.lang-menu:hover .lang-drop, .lang-menu:focus-within .lang-drop, .lang-menu.is-open .lang-drop { opacity: 1; visibility: visible; transform: none; }
.lang-drop a { display: block; padding: .45rem .7rem; border-radius: 8px; color: var(--ink); text-decoration: none; font: 500 .9rem/1.4 var(--f-ui); }
.lang-drop a[lang="ar"] { font-family: var(--f-kufi); }
.lang-drop a:hover { background: color-mix(in srgb, var(--gold) 13%, transparent); }
.lang-drop a[aria-current] { background: var(--green); color: #fff; }

.hdr-search { display: none; border-top: 1px solid var(--line); padding-block: .6rem; }
.site-header.search-open .hdr-search { display: block; }
.hdr-search .search.mini { max-width: 40rem; margin: 0 auto; }
.is-tr .mnav, .is-tr .mnav-top, .is-tr .mnav-drop a, .is-tr .mnav-drop-title { font-family: var(--f-ui); }

/* Écrans moyens : icônes de thème masquées pour gagner de la place */
@media (max-width: 1240px) { .mnav-ico { display: none; } .mnav-top { padding-inline: .45rem; font-size: .88rem; } }

/* Mobile / tablette : panneau latéral */
@media (max-width: 1080px) {
  .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--parch); }
  body.nav-open .site-header { z-index: 70; }
  .burger { display: inline-flex; }
  .mnav {
    position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 60; width: min(88vw, 23rem);
    background: var(--paper); border-inline-start: 1px solid var(--line); box-shadow: -20px 0 50px -20px rgba(0, 0, 0, .45);
    overflow-y: auto; padding: 4.2rem .8rem 1.5rem;
    transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility .22s;
  }
  [dir="ltr"] .mnav { transform: translateX(105%); }
  body.nav-open .mnav { transform: none; visibility: visible; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(10, 8, 4, .45); }
  body.nav-open .burger { position: relative; z-index: 61; }
  .mnav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .mnav-item { border-bottom: 1px solid var(--line); }
  .mnav-row { justify-content: space-between; }
  .mnav-top { flex: 1; padding: .8rem .3rem; font-size: 1rem; }
  .mnav-top .mn-caret { display: none; }
  .mnav-ico { display: inline; width: 1.2rem; height: 1.2rem; }
  .mnav-exp {
    display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 0; border-radius: 10px;
    background: transparent; color: var(--ink-2); cursor: pointer;
  }
  .mnav-exp .mn-caret { width: 1.1rem; height: 1.1rem; opacity: .8; }
  .mnav-item.is-open .mnav-exp .mn-caret { transform: rotate(180deg); }
  .mnav-item:hover > .mnav-row .mnav-top, .mnav-item:focus-within > .mnav-row .mnav-top { background: transparent; }
  .mnav-item.is-current > .mnav-row .mnav-top { box-shadow: none; }
  .mnav-drop, .mnav-drop.is-wide {
    position: static; display: none; opacity: 1; visibility: visible; transform: none; min-width: 0; max-width: none; max-height: none;
    margin: 0 0 .6rem; padding: .3rem; border: 0; border-inline-start: 3px solid var(--hero); border-radius: 0; box-shadow: none; background: transparent;
  }
  .mnav-drop.is-wide ul { columns: 1; }
  .mnav-item.is-open > .mnav-drop { display: block; }
  .mnav-drop-title { display: none; }
}
@media (max-width: 420px) { .brand-logo img { height: 2.1rem; } .hdr { gap: .5rem; } .tool-btn { min-width: 2.1rem; height: 2.1rem; } .theme-btn { width: 2.1rem; height: 2.1rem; } }


/* --- Passages en couleur dans les textes : gras + surligneur doré --------------- */
mark.hl {
  font-weight: 700; color: inherit; padding: 0 .18em; border-radius: 3px;
  background: linear-gradient(transparent 14%, #f4dc9d 14%, #f4dc9d 90%, transparent 90%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
:root[data-theme="dark"] mark.hl { background: linear-gradient(transparent 14%, #6b5420 14%, #6b5420 90%, transparent 90%); color: #fff3d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) mark.hl { background: linear-gradient(transparent 14%, #6b5420 14%, #6b5420 90%, transparent 90%); color: #fff3d6; } }
mark.hl strong { font-weight: 700; }


/* --- Liens de retour du texte d'origine (« العودة لـ… ») : boutons côte à côte -------- */
.prose .back-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin: 2rem 0; }
.prose .back-btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1.15rem; border-radius: 999px;
  background: var(--paper); border: 1.5px solid color-mix(in srgb, var(--gold) 60%, var(--line));
  color: var(--green); text-decoration: none; font: 700 .95rem/1.5 var(--f-kufi);
  box-shadow: 0 4px 12px -8px rgba(60, 40, 10, .45); transition: background .15s, color .15s, transform .15s;
}
.prose .back-btn::before { /* flèche « retour » : vers la droite en arabe, vers la gauche en LTR */
  content: ""; width: 1rem; height: 1rem; flex: none; background: currentColor; transform: scaleX(-1);
  -webkit-mask: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M5 12h13M13 6l6 6-6 6'/%3E%3C/svg%3E");
          mask: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M5 12h13M13 6l6 6-6 6'/%3E%3C/svg%3E");
}
[dir="rtl"] .prose .back-btn::before { transform: none; }
.prose .back-btn:hover { background: var(--green); border-color: var(--green); color: #fff; transform: translateY(-1px); }
.is-tr .prose .back-btn { font-family: var(--f-ui); }


/* --- Taille du texte (au-dessus de chaque texte) --------------------------------- */
.text-tools { display: flex; justify-content: flex-end; gap: .35rem; margin: -.6rem 0 1.2rem; }
.fs-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; height: 2.2rem; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink-2); cursor: pointer;
  font: 700 1rem/1 var(--f-kufi);
}
.fs-btn.fs-big { font-size: 1.25rem; }
.fs-btn sub, .fs-btn sup { font: 700 .8rem/1 var(--f-ui); }
.fs-btn svg { width: 1rem; height: 1rem; }
.fs-btn:hover { color: var(--green); border-color: var(--gold); }
.fs-btn:disabled { opacity: .4; cursor: default; }
.tt-sep { width: 1px; align-self: stretch; margin: .25rem .2rem; background: var(--line); }
.print-btn { gap: .4rem; font: 600 .85rem/1 var(--f-kufi); }
.is-tr .print-btn { font-family: var(--f-ui); }

/* Impression / PDF : seulement le titre, le texte et la référence */
@media print {
  @page { margin: 16mm 14mm; }
  html { --fs: 1 !important; }
  html, body { width: auto !important; min-width: 0 !important; background: #fff !important; }
  main, .wrap, .page-wrap, .sheet { width: auto !important; max-width: none !important; min-width: 0 !important; padding-inline: 0 !important; margin-inline: 0 !important; display: block !important; overflow: visible !important; }
  .prose { overflow-wrap: anywhere; }
  .skip, .text-tools, .share-bar, .mainnav, .mnav, .hdr-tools, .hdr-search, .toc, .pager, .files, .back-links, .post-hero-bg, .post-hero-icon { display: none !important; }
  .sheet { padding: 0 !important; margin: 0 !important; background: #fff !important; }
  .post-hero { margin: 0 0 1.2rem !important; padding: 0 0 .8rem !important; background: none !important; color: #000 !important; border-radius: 0 !important; border-bottom: 2px solid #a8742a !important; }
  .post-hero .title, .post-hero .title.title-amiri { color: #000 !important; }
  .post-hero-meta { padding: 0 !important; }
  .chip { color: #444 !important; border-color: #bbb !important; background: none !important; }
  .prose { color: #000 !important; font-size: 13.5pt !important; }
  .prose a { color: #000 !important; text-decoration: none; }
  .prose a[target="_blank"]::after { content: none; }
  mark.hl { background: #f4dc9d !important; color: #000 !important; text-decoration: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .source-note { color: #333 !important; }
  .source-note a::after { content: " (" attr(href) ")"; font-size: .85em; }
}


/* Photo d'une publication manuelle */
.prose .pub-photo { margin: 0 0 1.4rem; text-align: center; }
.prose .pub-photo img { max-width: 100%; height: auto; border-radius: 10px; box-shadow: 0 8px 24px -14px rgba(40, 25, 5, .45); }
