/* Feuille de style commune aux trois pages du site « Al Coraane ».
   Aucune ressource distante : polices système, aucune requête réseau, aucun cookie.
   Palette reprise de la page « Installer Al Coran » du programme (installeur v2). */

:root {
  color-scheme: light dark;
  --fond: #f6f5f1; --carte: #ffffff; --encre: #1d1d1b; --sourdine: #5c5c57;
  --accent: #0b6e4f; --accent-clair: #e6f2ec;
  --or: #a8842f; --bord: #dedbd3; --erreur: #b3261e;
  --largeur: 68rem;
  --ombre: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05);
  --arabe: "Noto Naskh Arabic", "Traditional Arabic", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #151513; --carte: #1e1e1b; --encre: #f2f0ea; --sourdine: #b3b0a6;
    --accent: #57c99b; --accent-clair: #22352c;
    --or: #d9b861; --bord: #38372f; --erreur: #ff8a80;
    --ombre: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.65 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* L'arabe porte ses propres directions : il se lit de droite à gauche même dans une page latine. */
.arabe { font-family: var(--arabe); direction: rtl; unicode-bidi: isolate; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* --- En-tête et navigation ------------------------------------------------ */
.entete { background: var(--carte); border-bottom: 1px solid var(--bord); }
.entete-contenu {
  max-width: var(--largeur); margin: 0 auto; padding: .65rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
}
.marque { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; }
.marque img { width: 72px; height: 36px; object-fit: contain; }
.marque span { font-weight: 600; font-size: 1rem; line-height: 1.2; }
.marque small { display: block; font-weight: 400; font-size: .78rem; color: var(--sourdine); }
.navigation { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: .25rem; }
.navigation a {
  padding: .35rem .75rem; border: 1px solid transparent; border-radius: 999px;
  color: var(--sourdine); font-size: .94rem; text-decoration: none;
}
.navigation a:hover, .navigation a:focus-visible { color: var(--accent); border-color: var(--bord); }
.navigation a[aria-current="page"] {
  background: var(--accent-clair); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}

/* --- Conteneur et sections ------------------------------------------------ */
main { max-width: var(--largeur); margin: 0 auto; padding: 0 1rem 3.5rem; }
.intro-page { padding-top: clamp(1.5rem, 4vw, 2.5rem); }
.intro-page h1 { font-size: clamp(1.55rem, 4vw, 2.2rem); }
.intro-page .actions { margin-top: 1.1rem; }
section { padding-top: clamp(1.75rem, 5vw, 2.75rem); }
section > h2 { font-size: 1.3rem; }
.chapeau { color: var(--sourdine); margin-top: .4rem; }
.texte { margin-top: .75rem; }

/* --- Bannière de l'accueil ------------------------------------------------ */
.banniere {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 2.5rem); align-items: center;
  padding: clamp(1.5rem, 5vw, 3rem) 0 0;
}
.banniere-texte { display: grid; gap: 1rem; justify-items: start; }
.basmala { margin: 0; color: var(--or); font-size: clamp(1.4rem, 4.5vw, 2rem); line-height: 1.6; }
.banniere h1 { font-size: clamp(1.55rem, 4vw, 2.35rem); }
.sous-titre { display: block; margin-top: .3rem; color: var(--or); font-size: .62em; font-weight: 400; text-align: left; }
.banniere .chapeau { font-size: 1.02rem; }
figure.illustration { margin: 0; }
figure.illustration img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--bord); border-radius: 14px; box-shadow: var(--ombre);
}
figure.illustration figcaption { margin-top: .55rem; color: var(--sourdine); font-size: .88rem; }
/* Image « Une page, telle qu'on la lit » : pleine largeur du contenu (aucune
   limite de largeur). La capture fournie fait 2128 px : elle est réduite à
   l'écran, donc nette. */

/* --- Téléchargements PDF (page d'accueil) --------------------------------- */
.telechargements {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem; margin-top: 1rem;
}
.telechargement {
  padding: 1.1rem 1.2rem; background: var(--carte);
  border: 1px solid var(--bord); border-radius: 14px;
}
/* Aperçu du PDF : page A4 en portrait (560 × 792), centrée et bornée en hauteur
   pour que les deux cartes restent comparables sur grand écran. */
.telechargement img {
  display: block; width: auto; max-width: 100%; max-height: 24rem;
  margin: 0 auto .9rem;
  border: 1px solid var(--bord); border-radius: 10px;
  background: var(--fond);
}
.telechargement h3 { font-size: 1.05rem; }
.telechargement h3 .arabe { color: var(--or); font-weight: 400; }
.telechargement p { margin: .3rem 0 .85rem; color: var(--sourdine); font-size: .92rem; }

/* --- Boutons -------------------------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 0; }
.bouton {
  display: inline-block; padding: .8rem 1.3rem; border-radius: 10px;
  background: var(--accent); border: 1px solid var(--accent);
  color: #fff; font-weight: 600; text-decoration: none;
}
.bouton:hover, .bouton:focus-visible { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .bouton { color: #0d0d0c; } }
.bouton.discret { background: transparent; border-color: var(--bord); color: var(--accent); }
.bouton.discret:hover, .bouton.discret:focus-visible { background: var(--accent-clair); border-color: var(--accent); }
.note { min-height: 1.6rem; margin-top: .6rem; color: var(--sourdine); font-size: .94rem; }
.note.erreur { color: var(--erreur); }

/* --- Chiffres clés -------------------------------------------------------- */
.chiffres {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem;
}
.chiffres div { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: .9rem 1rem; }
.chiffres dt { color: var(--accent); font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.chiffres dd { margin: .2rem 0 0; color: var(--sourdine); font-size: .9rem; line-height: 1.45; }

/* --- Sommaire et cartes --------------------------------------------------- */
.sommaire {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem;
}
.carte {
  display: block; height: 100%; padding: 1.1rem 1.2rem;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 14px;
  color: inherit; text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.carte:hover, .carte:focus-visible { border-color: var(--accent); box-shadow: var(--ombre); }
.carte h3 { display: flex; align-items: center; gap: .4rem; font-size: 1.05rem; }
.carte h3::after { content: "→"; color: var(--accent); font-weight: 700; }
.carte p { margin-top: .35rem; color: var(--sourdine); font-size: .94rem; }

/* --- Listes --------------------------------------------------------------- */
.puces, .etapes { margin: .9rem 0 0; padding-inline-start: 1.25rem; }
.puces { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: .55rem 1.75rem; }
.puces li, .etapes li { line-height: 1.6; }
.etapes li + li { margin-top: .55rem; }
.puces strong { color: var(--encre); }

/* --- Ouverture animée (page d'accueil) ------------------------------------
   Trois vues en fondu enchaîné, sur 8 s : couverture (le programme y joue
   bismi!.MP3, 2 s), transition, puis choix de l'écriture. La classe « joue » est
   écrite dans le HTML : l'animation part seule au chargement de la page, sans
   bouton et sans JavaScript. */
.ouverture {
  position: relative; margin: 1.1rem 0 0; aspect-ratio: 635 / 444;
  overflow: hidden; border: 1px solid var(--bord); border-radius: 14px;
  background: #0b0b0a; box-shadow: var(--ombre);
}
.ouverture .vue { position: absolute; inset: 0; margin: 0; opacity: 0; }
.ouverture .vue img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ouverture .vue figcaption {
  position: absolute; inset: auto 0 0 0; padding: 1.8rem .9rem .7rem;
  color: #fff; font-size: .86rem; line-height: 1.45;
  background: linear-gradient(to top, rgba(0, 0, 0, .82), rgba(0, 0, 0, 0));
}
.ouverture .vue figcaption strong { display: block; font-size: .92rem; }
.ouverture .vue figcaption code { color: #eae4d2; }
.ouverture.joue .vue-1 { animation: ouverture-1 8s ease-in-out both; }
.ouverture.joue .vue-2 { animation: ouverture-2 8s ease-in-out both; }
.ouverture.joue .vue-3 { animation: ouverture-3 8s ease-in-out both; }
@keyframes ouverture-1 { 0%, 32% { opacity: 1; } 40%, 100% { opacity: 0; } }
@keyframes ouverture-2 { 0%, 32% { opacity: 0; } 40%, 58% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes ouverture-3 { 0%, 58% { opacity: 0; } 66%, 100% { opacity: 1; } }

.lecteur-audio { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin-top: .9rem; }
.lecteur-audio audio { width: min(100%, 21rem); }
.lecteur-audio span { color: var(--sourdine); font-size: .86rem; }

/* --- Langues : trois versions du même texte, une seule est rendue ----------
   Chaque texte visible existe trois fois, en trois <span> successifs
   (.texte-fr, puis .texte-ar, puis .texte-en) à l'intérieur d'un même élément.
   Le CSS n'en affiche qu'un, selon lang posé sur <html> : aucun JavaScript
   n'est nécessaire pour le rendu, et sans script la page reste en français. */
.texte-fr, .texte-ar, .texte-en { display: none; }
html[lang="fr"] .texte-fr,
html[lang="ar"] .texte-ar,
html[lang="en"] .texte-en { display: inline; }
html[lang="ar"] body {
  font-family: "Segoe UI", "Noto Naskh Arabic", "Traditional Arabic", system-ui, sans-serif;
  line-height: 1.85;
}
html[lang="ar"] .sur-titre { letter-spacing: 0; text-transform: none; }

/* Sélecteur de langue, dans l'en-tête. */
.langues { display: flex; flex-wrap: wrap; gap: .3rem; margin-inline-start: .4rem; }
.langues button {
  padding: .25rem .7rem; border: 1px solid var(--bord); border-radius: 999px;
  background: transparent; color: var(--sourdine); font: inherit; font-size: .85rem; cursor: pointer;
}
.langues button:hover, .langues button:focus-visible { border-color: var(--accent); color: var(--accent); }
.langues button[aria-pressed="true"] {
  background: var(--accent-clair); border-color: var(--accent); color: var(--accent); font-weight: 600;
}
.langues button[lang="ar"] { font-size: .95rem; line-height: 1.5; }

/* --- En-tête de page ------------------------------------------------------ */
.sur-titre {
  margin: 0 0 .25rem; color: var(--accent); font-size: .8rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
}
.sous-chapeau { color: var(--sourdine); margin-top: .5rem; font-size: .95rem; }

/* --- Tableaux ------------------------------------------------------------- */
.tableau { margin-top: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--bord); text-align: start; vertical-align: top; }
th { color: var(--sourdine); font-weight: 600; }
td.fichier, th.fichier { width: 10.5rem; }
td.fichier { color: var(--sourdine); font-family: "Cascadia Mono", Consolas, monospace; font-size: .84rem; }

/* --- Empreinte, lien, commandes ------------------------------------------- */
code, pre, input { font-family: "Cascadia Mono", Consolas, monospace; font-size: .88rem; }
pre {
  margin: .6rem 0 0; padding: .8rem 1rem; overflow-x: auto;
  background: var(--accent-clair); border-radius: 8px;
  direction: ltr; text-align: left;
}
pre code { white-space: pre; }
.copie { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .9rem; }
.copie label { flex-basis: 100%; color: var(--sourdine); font-size: .9rem; }
.copie input {
  flex: 1 1 20rem; min-width: 0; padding: .5rem .6rem;
  border: 1px solid var(--bord); border-radius: 8px;
  background: var(--fond); color: var(--encre);
  direction: ltr; text-align: left;
}
.copie button {
  padding: .5rem .9rem; border: 1px solid var(--accent); border-radius: 8px;
  background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
}
.copie button:hover, .copie button:focus-visible { background: var(--accent-clair); }
table.commandes td:first-child {
  width: 1%; padding-inline-end: 1rem;
  direction: ltr; text-align: left; white-space: nowrap;
}

/* --- Blocs repliables et pied de page ------------------------------------- */
details { margin-top: 2rem; border-top: 1px solid var(--bord); padding-top: 1rem; }
summary { cursor: pointer; font-weight: 600; }
details > * + * { margin-top: .75rem; }

.pied { margin-top: 3rem; background: var(--carte); border-top: 1px solid var(--bord); }
.pied-contenu {
  max-width: var(--largeur); margin: 0 auto; padding: 1.25rem 1rem 2rem;
  display: grid; gap: .6rem; color: var(--sourdine); font-size: .88rem;
}
.pied nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }

/* --- Petits écrans -------------------------------------------------------- */
@media (max-width: 46rem) {
  .banniere { grid-template-columns: 1fr; }
  figure.illustration { order: -1; }
  .banniere-texte { justify-items: stretch; }
  table.commandes td, table.commandes td:first-child { display: block; border-bottom: none; }
  table.commandes td:first-child { width: auto; white-space: normal; padding-bottom: 0; }
  td.fichier, th.fichier { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .carte { transition: none; }
  /* Mouvement refusé : les trois vues de l'ouverture s'affichent côte à côte,
     sans animation. */
  .ouverture {
    aspect-ratio: auto; display: grid; padding: .5rem;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .5rem;
  }
  .ouverture .vue { position: static; opacity: 1; border-radius: 8px; overflow: hidden; }
  /* Les trois sélecteurs sont écrits en entier : ils doivent l'emporter sur
     « .ouverture.joue .vue-N », plus spécifique que « .ouverture .vue ». */
  .ouverture.joue .vue-1,
  .ouverture.joue .vue-2,
  .ouverture.joue .vue-3 { animation: none; }
  .ouverture .vue img { height: auto; aspect-ratio: 635 / 444; }
  .ouverture .vue figcaption {
    position: static; padding: .45rem .55rem .25rem;
    background: none; color: var(--sourdine);
  }
  .ouverture .vue figcaption code { color: var(--sourdine); }
}

