/* Charte des cours — Institut Ihsân
   Feuille unique pour l'aperçu navigateur et le PDF (moteur d'impression de Chrome).
   Ne pas modifier cours par cours : toute évolution du style se fait ici et s'applique à tous les cours. */

/* Polices livrées avec la charte (dossier polices/) : rendu identique sur toutes les machines.
   Fichiers statiques et non variables : Chrome embarque une police variable en Type 3 dans le PDF.
   Noto Sans et Josefin Sans sont allégées (latin, ponctuation, translittérations) ; l'arabe est complet. */
@font-face {
  font-family: "Noto Sans";
  src: local("Noto Sans Regular"), local("NotoSans-Regular"), url("polices/NotoSans-Regular.ttf");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Noto Sans";
  src: local("Noto Sans Bold"), local("NotoSans-Bold"), url("polices/NotoSans-Bold.ttf");
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: "Noto Sans";
  src: local("Noto Sans Italic"), local("NotoSans-Italic"), url("polices/NotoSans-Italic.ttf");
  font-weight: 400;
  font-style: italic;
}
@font-face {
  font-family: "Josefin Sans";
  src: local("Josefin Sans Regular"), local("JosefinSans-Regular"), url("polices/JosefinSans-Regular.ttf");
  font-weight: 400;
}
@font-face {
  font-family: "Josefin Sans";
  src: local("Josefin Sans SemiBold"), local("JosefinSans-SemiBold"), url("polices/JosefinSans-SemiBold.ttf");
  font-weight: 600;
}
@font-face {
  font-family: "Josefin Sans";
  src: local("Josefin Sans Bold"), local("JosefinSans-Bold"), url("polices/JosefinSans-Bold.ttf");
  font-weight: 700;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: local("Noto Naskh Arabic"), url("polices/NotoNaskhArabic-Regular.ttf");
  font-weight: 400;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: local("Noto Naskh Arabic Bold"), local("NotoNaskhArabic-Bold"), url("polices/NotoNaskhArabic-Bold.ttf");
  font-weight: 700;
}

@page {
  size: A4;
  margin: 14mm 16mm;
}

/* Type par défaut : « noms-allah ». Un autre type ne surcharge que les couleurs, par exemple :
   [data-type="xxx"] { --accent: …; --accent-strong: …; --accent-text: …; --accent-soft: …; } */
:root {
  --accent: #237c68;
  --accent-strong: #173f35;
  --accent-text: #176b59;
  --accent-muted: #355e54;
  --accent-soft: #eff8f5;
  --accent-border: #91d4c3;
  --border: #d8e6e1;
  --text: #302d28;
  --text-muted: #6b6a65;
  --key-bg: #fff7dc;
  --key-border: #e5b529;
  --key-title: #8a6400; /* 5,02:1 sur --key-bg (minimum WCAG AA : 4,5:1) */

  /* Naskh en secours : glyphes arabes isolés dans le texte français, comme « ﷺ » */
  --font-text: "Noto Sans", "Noto Naskh Arabic", sans-serif;
  /* Josefin Sans pour les titres, bandeaux, étiquettes et boutons ; elle paraît plus petite
     à taille égale, d'où des tailles de titre environ 10 % plus grandes qu'avec l'ancienne police */
  --font-title: "Josefin Sans", "Noto Serif", serif;
  /* Noto Sans en secours : ponctuation que le Naskh n'a pas, comme le « • » des titres */
  --font-arabic: "Noto Naskh Arabic", "Noto Sans", serif;
}

/* 1rem = 16px à l'écran, 12.2px sur la page A4 */
html {
  font-size: 16px;
}
@media print {
  html {
    font-size: 12.2px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Imprime les fonds même si « graphiques d'arrière-plan » est décoché */
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

body {
  font-family: var(--font-text);
  color: var(--text);
  line-height: 1.45;
  background: #ffffff;
}

h1,
h2,
h3 {
  font-family: var(--font-title);
  line-height: 1.25;
}

:lang(ar) {
  font-family: var(--font-arabic);
  unicode-bidi: isolate;
}
/* À taille égale, le Naskh paraît plus petit que le latin */
span:lang(ar) {
  font-size: 1.1em;
}

/* Parties : une par page A4, espacées à l'écran */
@media screen {
  main {
    max-width: 48rem;
    margin: 2rem auto;
    padding: 0 1rem;
  }
  .part + .part {
    margin-top: 3rem;
  }
}
@media print {
  .part + .part {
    break-before: page;
  }
}

.quote,
.term,
.box,
.key-point,
.story,
.cards li,
.questions li {
  break-inside: avoid;
}

/* Texte courant */
.part > p {
  margin-bottom: 0.82rem;
  line-height: 1.44;
}

.part > h2 {
  font-size: 1.57rem;
  margin-bottom: 0.66rem;
}

ul:not([class]) {
  margin: 0.5rem 0 0.82rem 1.4rem;
}
ul:not([class]) li {
  margin-bottom: 0.3rem;
}
ul:not([class]) li::marker {
  color: var(--accent);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* Bandeaux */
.banner {
  background: var(--accent);
  color: #ffffff;
  border-radius: 12px;
  padding: 1.23rem 1.64rem;
  margin-bottom: 1.15rem;
  text-align: center;
}
.banner h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}
/* Le titre arabe (Naskh) garde sa taille : seul Josefin est agrandi */
.banner h1:lang(ar) {
  font-size: 2.3rem;
}
.banner h2 {
  font-size: 2.35rem;
  margin-bottom: 0.16rem;
}
.banner .subtitle {
  font-family: var(--font-title);
  font-size: 1.25rem;
}

.banner--part {
  text-align: left;
  padding: 1.15rem 1.48rem;
  margin-bottom: 0.98rem;
}
.banner--part h2 {
  font-size: 1.53rem;
  margin-bottom: 0.25rem;
}
.banner--part .subtitle {
  font-size: 1rem;
}

/* Étiquette de section (majuscules faites ici : écrire le texte en casse normale) */
.tag,
.box > h3 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.33rem;
}

/* Citation (verset, hadith) et mot de vocabulaire */
.quote,
.term {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.66rem 1.15rem;
  margin: 0.66rem 0 0.82rem;
  text-align: center;
}
.quote p:lang(ar) {
  font-size: 1.39rem;
  font-weight: bold;
  color: var(--accent-strong);
  margin-bottom: 0.16rem;
}
.quote .translation {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--accent-muted);
}
.quote figcaption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.16rem;
}
.term dt {
  font-size: 1.31rem;
  font-weight: bold;
  color: var(--accent-strong);
  margin-bottom: 0.16rem;
}
.term dd {
  font-size: 0.95rem;
  color: var(--accent-muted);
}

/* Encadré */
.box {
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  padding: 0.98rem 1.31rem;
  margin-bottom: 0.82rem;
  background: #ffffff;
}
.box > h3 {
  font-size: 0.86rem;
  margin-bottom: 0.66rem;
}
.box p {
  font-size: 0.98rem;
  line-height: 1.42;
}
.box p + p {
  margin-top: 0.57rem;
}
.box strong {
  color: var(--accent-strong);
}

/* À retenir / La leçon / Le rappel */
.key-point {
  background: var(--key-bg);
  border: 1.5px solid var(--key-border);
  border-radius: 12px;
  padding: 0.82rem 1.23rem;
  margin: 0.82rem 0;
}
.key-point h3 {
  font-size: 1.15rem;
  color: var(--key-title);
  margin-bottom: 0.25rem;
}
.key-point h3::before {
  content: "✦ ";
  /* Ni Josefin ni Noto Sans n'ont ce symbole : sans police explicite, Chrome en prend une de secours
     qu'il embarque en Type 3 dans le PDF ; avec DejaVu Sans, il reste en TrueType */
  font-family: "DejaVu Sans", sans-serif;
}
.key-point p {
  font-size: 0.97rem;
  line-height: 1.4;
}

/* Récit */
.story {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.82rem 1.15rem;
  margin-bottom: 0.74rem;
  background: #ffffff;
}
.story h3 {
  font-size: 1.13rem;
  color: var(--accent-text);
  margin-bottom: 0.33rem;
}
.story p {
  font-size: 0.96rem;
  line-height: 1.4;
}
.story p + p {
  margin-top: 0.33rem;
}

/* Cartes */
.cards {
  list-style: none;
  margin: 0.66rem 0 0.82rem;
}
.cards li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.74rem 1.07rem;
  margin-bottom: 0.57rem;
  background: #ffffff;
}
.cards h3 {
  font-size: 1.12rem;
  color: var(--accent-text);
  margin-bottom: 0.16rem;
}
.cards p {
  font-size: 0.96rem;
  line-height: 1.38;
}

/* Mini-quiz : numéros ajoutés ici, ne pas les écrire dans le texte */
.quiz {
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}
.quiz > .banner {
  border-radius: 0;
  margin-bottom: 0;
}
.questions {
  list-style: none;
  counter-reset: question;
}
.questions li {
  counter-increment: question;
  position: relative;
  padding: 1.31rem 1.48rem 1.31rem 4.68rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.02rem;
  font-weight: bold;
  line-height: 1.42;
  color: var(--accent-text);
}
.questions li:last-child {
  border-bottom: 0;
}
.questions li::before {
  content: counter(question);
  position: absolute;
  left: 1.48rem;
  top: 1.2rem;
  width: 2.05rem;
  height: 2.05rem;
  line-height: 2.05rem;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  text-align: center;
  font-size: 1rem;
}
