/* Madrassah Ibn Al Jazari — feuille de style commune FR / AR */

:root {
  --red: #7f0505;
  --red-dark: #5e0303;
  --gold: #da9e1b;
  --gold-soft: #f3e3bd;
  --ink: #22323d;
  --ink-soft: #4b5a66;
  --sand: #f7f1e6;
  --paper: #ffffff;
  --line: #e4dccb;
  --ok: #1d6b3a;
  --err: #b3261e;

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --arabic: "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Traditional Arabic", "Geeza Pro", serif;

  --maxw: 72rem;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

[dir="rtl"] body, body[dir="rtl"] {
  font-family: var(--arabic);
  font-size: 1.2rem;
  line-height: 1.9;
}

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 .5em;
  font-weight: 600;
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { font-family: var(--arabic); font-weight: 700; }

h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-top: 0; }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }
ul, ol { padding-inline-start: 1.4em; margin: 0 0 1em; }
li { margin-bottom: .35em; }

a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red-dark); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 48rem; }

.skip {
  position: absolute; inset-inline-start: 0; top: -100px;
  background: var(--red); color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip:focus { top: 0; }

/* ---------- En-tête ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4.25rem; flex-wrap: wrap;
}
.brand img { display: block; height: 44px; width: auto; }

.site-nav { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem;
  padding: .25rem 0; border-bottom: 2px solid transparent;
}
[dir="rtl"] .site-nav a { font-size: 1.1rem; }
[lang="ur"] body { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", var(--arabic); line-height: 1.9; }
[lang="ur"] h1, [lang="ur"] h2, [lang="ur"] h3, [lang="ur"] .site-footer h3, [lang="ur"] .btn { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", var(--arabic); }
/* Le nastaliq monte et descend bien au-delà de la ligne : on aère titres, kickers et boutons. */
[lang="ur"] h1, [lang="ur"] h2, [lang="ur"] h3 { line-height: 1.8; margin-bottom: .35em; }
[lang="ur"] .kicker { display: block; line-height: 2; margin-bottom: .5rem; }
[lang="ur"] .btn, [lang="ur"] .site-nav a, [lang="ur"] .lang-menu summary { line-height: 2; padding-block: .35rem; }
[lang="ur"] input[type="text"], [lang="ur"] input[type="email"], [lang="ur"] input[type="tel"], [lang="ur"] textarea { line-height: 2; min-height: 3.3rem; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--gold); }
.site-nav a:hover { color: var(--red); }

.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem; border-radius: 8px; font-size: .9rem; font-weight: 600; color: var(--ink);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary svg { width: 1.1rem; height: 1.1rem; color: var(--red); flex: none; }
.lang-menu summary .chev { width: .7rem; height: .7rem; color: var(--ink-soft); }
.lang-menu[open] summary, .lang-menu summary:hover { background: var(--sand); }
.lang-menu[open] summary .chev { transform: rotate(180deg); }
.lang-menu ul {
  position: absolute; inset-inline-start: 0; top: calc(100% + .5rem); z-index: 60;
  margin: 0; padding: .35rem; list-style: none; min-width: 11rem;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(34, 50, 61, .12);
}
.lang-menu li a {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem .75rem; border-radius: 6px; border-bottom: 0; font-weight: 500;
}
.lang-menu li a:hover { background: var(--sand); color: var(--ink); }
.lang-menu li a[aria-current] { color: var(--red); font-weight: 600; }
@media (min-width: 56rem) { .lang-menu ul { inset-inline-start: auto; inset-inline-end: 0; } }
.lang-menu li a::after { content: ""; width: .9rem; height: .9rem; flex: none; }
.lang-menu li a[aria-current]::after {
  background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Bandeau ---------- */
.hero {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff; padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}
.hero h1 { color: #fff; }
.hero .lead { font-size: 1.2rem; max-width: 44rem; opacity: .95; }
[dir="rtl"] .hero .lead { font-size: 1.35rem; }
.hero .eyebrow {
  display: inline-block; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: .75rem;
}
[dir="rtl"] .hero .eyebrow { letter-spacing: 0; font-size: 1rem; }

.btn {
  display: inline-block; padding: .85rem 1.6rem; border-radius: var(--radius);
  background: var(--gold); color: var(--ink); font-weight: 700; text-decoration: none;
  border: 0; cursor: pointer; font-family: inherit; font-size: 1rem;
}
.btn:hover { background: #c58d14; color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.hero .btn { margin-top: 1rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(2.5rem, 5vw, 4rem) 0; }
.section.alt { background: var(--sand); }
.section-title { margin-bottom: 1.5rem; }
.section-title .kicker { color: var(--red); font-weight: 700; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
[dir="rtl"] .section-title .kicker { letter-spacing: 0; font-size: 1.05rem; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}
.card h3 { margin-top: 0; color: var(--red); }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

details:not(.lang-menu) {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  margin-bottom: .75rem; padding: 0 1.25rem;
}
details:not(.lang-menu) summary {
  cursor: pointer; padding: 1rem 0; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
details:not(.lang-menu) summary::-webkit-details-marker { display: none; }
details:not(.lang-menu) summary::after { content: "+"; color: var(--gold); font-size: 1.5rem; line-height: 1; }
details:not(.lang-menu)[open] summary::after { content: "–"; }
details:not(.lang-menu) > :not(summary) { margin-top: 0; }
details:not(.lang-menu) .body { padding-bottom: 1rem; }

/* ---------- Appel à candidature (page Ijaza) ---------- */
.cta-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; gap: 1.5rem;
  grid-template-columns: 1fr auto; align-items: center;
}
.cta-box p { margin: 0; }
.cta-box p + p { margin-top: .4rem; }
@media (max-width: 48rem) { .cta-box { grid-template-columns: 1fr; } }

/* ---------- Formulaire ---------- */
.form-intro { max-width: 48rem; }
form.ijaza, form.contact {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.fields { display: grid; gap: 1.1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 500; }
.hint { font-size: .9em; color: var(--ink-soft); }

input[type="text"], input[type="email"], input[type="tel"], textarea {
  font: inherit; width: 100%; padding: .7rem .85rem; border: 1px solid #c9c1b1;
  border-radius: 8px; background: #fff; color: var(--ink); min-height: 2.9rem;
}
textarea { min-height: 9rem; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #9a9385; opacity: 1; }
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); outline: none; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }

.notice {
  margin: 1.5rem 0 0; padding: .9rem 1.1rem; border-inline-start: 3px solid var(--gold);
  background: var(--gold-soft); border-radius: 0 8px 8px 0; font-size: .95em;
}
[dir="rtl"] .notice { border-radius: 8px 0 0 8px; }
.consent { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0 1.5rem; font-weight: 500; }
.consent input { width: 1.15rem; height: 1.15rem; margin-top: .3rem; accent-color: var(--red); flex: none; }

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.form-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.form-status { margin-top: 1rem; padding: 1rem 1.2rem; border-radius: 8px; display: none; }
.form-status.ok { display: block; background: #e6f4ea; color: var(--ok); border: 1px solid #b7dfc3; }
.form-status.err { display: block; background: #fdecea; color: var(--err); border: 1px solid #f2b8b5; }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--ink); color: #d9dee2; padding: 2.5rem 0 1.5rem; margin-top: 2rem; }
.site-footer a { color: #fff; }
.site-footer .cols { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.site-footer h3 { color: var(--gold); font-size: 1.1rem; margin-bottom: .5rem; font-family: var(--sans); }
[dir="rtl"] .site-footer h3 { font-family: var(--arabic); }
.site-footer ul { list-style: none; padding: 0; }
.site-footer .legal {
  border-top: 1px solid #3a4a56; margin-top: 1.5rem; padding-top: 1rem; font-size: .85rem;
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between;
}
.site-footer .legal p { margin: 0; }
.lang-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.lang-list a {
  text-decoration: none; font-size: .85rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid #3a4a56; color: #d9dee2;
}
.lang-list a:hover { border-color: var(--gold); color: #fff; }
.lang-list a[aria-current] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.site-footer .contact { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; padding: .15rem 0; }
.site-footer .contact svg { width: 1.2rem; height: 1.2rem; color: var(--gold); flex: none; }
.site-footer .contact span { text-decoration: underline; text-underline-offset: 2px; }
.site-footer .contact:hover span { color: var(--gold); }
.site-footer .email { overflow-wrap: anywhere; }
.footer-logo { display: block; background: #fff; padding: 6px; border-radius: 6px; width: 140px; height: auto; }
.footer-tagline { margin-top: .75rem; }
.mt-xl { margin-top: 2.5rem; }

/* ---------- Page Ijaza : système éducatif ---------- */
.intro { max-width: 48rem; margin-bottom: 1.5rem; color: var(--ink-soft); }
.mt-l { margin-top: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }
.card .ordinal {
  display: inline-block; font-family: var(--sans); font-weight: 700; font-size: .8rem; letter-spacing: .08em;
  color: var(--ink); background: var(--gold-soft); border-radius: 999px; padding: .15rem .7rem; margin-bottom: .6rem;
}
[dir="rtl"] .card .ordinal { font-family: var(--arabic); font-size: 1rem; letter-spacing: 0; }
.card .sub { font-weight: 700; color: var(--ink); margin: .75rem 0 .25rem; }
.card ol, .card ul { padding-inline-start: 1.25em; margin-bottom: 0; }
.card li { margin-bottom: .3em; }
.card ol + p, .card ul + p { margin-top: .75rem; }

.quote {
  margin: 0 0 1.25rem; padding: 1rem 1.25rem; background: var(--paper);
  border-inline-start: 3px solid var(--gold); border-radius: 0 8px 8px 0; color: var(--ink);
}
[dir="rtl"] .quote { border-radius: 8px 0 0 8px; }
.quote p:last-child { margin-bottom: 0; }

.steps { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; counter-reset: step; }
.steps li {
  counter-increment: step; position: relative; margin: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1.1rem; padding-inline-start: 3.9rem;
}
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 1rem; top: .9rem;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--gold); color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: .95rem;
  display: grid; place-items: center;
}
.section.alt .steps li, .section.alt .quote { background: var(--paper); }
.section:not(.alt) .quote { background: var(--sand); }

.group-title {
  display: flex; align-items: center; gap: .9rem; margin: 1.75rem 0 1rem; font-size: 1.2rem; color: var(--red);
}
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title + .group-title { margin-top: 0; }

.readers { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.readers li { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.readers b { display: block; color: var(--red); }
.readers span { color: var(--ink-soft); font-size: .95em; }

/* Sous-navigation des pages Ijaza */
.hero.compact { padding: clamp(2rem, 4vw, 3rem) 0; }
.hero.compact h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.subnav { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 4.25rem; z-index: 40; }
.subnav .wrap { display: flex; gap: .25rem; overflow-x: auto; padding-block: .5rem; scrollbar-width: none; }
.subnav .wrap::-webkit-scrollbar { display: none; }
.subnav a {
  flex: none; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem;
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid transparent;
}
[dir="rtl"] .subnav a { font-size: 1.05rem; }
.subnav a:hover { background: var(--sand); color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
@media (max-width: 40rem) { .subnav { top: 0; position: static; } }

/* Sommaire des ijazat (page de présentation) */
.toc { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.toc li { margin: 0; }
.toc a {
  display: flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--ink); font-weight: 600;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1.1rem; height: 100%;
}
.toc a:hover { border-color: var(--gold); color: var(--red); }
.toc a .ordinal {
  flex: none; font-family: var(--sans); font-size: .75rem; font-weight: 700; letter-spacing: .08em;
  background: var(--gold-soft); border-radius: 999px; padding: .15rem .6rem; color: var(--ink);
}
[dir="rtl"] .toc a .ordinal { font-family: var(--arabic); font-size: .95rem; letter-spacing: 0; }

/* ---------- Prose (pages Association / Confidentialité) ---------- */
.prose h2 { margin-top: 2.25rem; }
.prose h3 { margin-top: 1.5rem; color: var(--red); }
.prose p.lead { font-size: 1.15em; color: var(--ink-soft); }

@media (max-width: 40rem) {
  .site-header .wrap { padding-block: .6rem; }
  .site-nav { gap: .8rem; }
  .site-nav a { font-size: .85rem; }
}

@media print {
  .site-header, .site-footer, .hero .btn, form.ijaza, form.contact { display: none; }
}
