/* Site de Khnoum : couleurs de la marque (celles de l'AGL) ; thème sombre par défaut,
   clair au choix du visiteur (<html data-theme>) ; aucune ressource extérieure.

   Mise en page : une seule grille (--largeur, marges --gouttiere) pour l'en-tête, le contenu
   et le pied, afin que tout parte du même bord. Paliers : téléphone (< 640 px), tablette
   (640-1099 px : menu repliable), ordinateur (≥ 1100 px), grand écran (≥ 1320 px). */

:root {
  --fond: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --texte: #e6e8ec;
  --doux: #9aa3b2;
  --bord: #2a2f3a;
  --accent: #6ea8ff;
  --accent-doux: #1b2a42;
  --action: #f5b04a;
  --sur-action: #1a1d23;
  --code: #1e222b;
  --avertissement: #2a2111;
  --avertissement-bord: #f5b04a;
  --ombre: 0 10px 30px rgba(0, 0, 0, 0.45);
  --rayon: 12px;
  --largeur: 1480px;
  --gouttiere: clamp(16px, 4vw, 56px);
  --entete: 68px;
  --police: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

:root[data-theme="clair"] {
  --fond: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --texte: #1a1d23;
  --doux: #5b6270;
  --bord: #dde1e8;
  --accent: #1f4e8c;
  --accent-doux: #e3ebf6;
  --action: #f29c1f;
  --sur-action: #1a1d23;
  --code: #eef1f5;
  --avertissement: #fff4e0;
  --avertissement-bord: #f29c1f;
  --ombre: 0 10px 30px rgba(20, 30, 50, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--entete) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.6 var(--police);
}
main { flex: 1; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem); margin: 0 0 16px; }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 2rem); margin: 48px 0 12px; }
h3 { font-size: 1.15rem; margin: 28px 0 8px; }
p { margin: 0 0 16px; }

.largeur { width: 100%; max-width: var(--largeur); margin: 0 auto; padding-left: var(--gouttiere); padding-right: var(--gouttiere); }
/* Texte courant : lignes d'une longueur confortable, toujours alignées à gauche. */
.lisible { max-width: 72ch; }

.evitement { position: absolute; left: -9999px; }
.evitement:focus { left: 16px; top: 8px; z-index: 20; background: var(--surface); padding: 8px 12px; }

/* En-tête */
.entete {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bord);
}
.entete-ligne { display: flex; align-items: center; gap: 12px; height: var(--entete); }
.logo { display: flex; align-items: center; gap: 10px; color: var(--texte); text-decoration: none; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; flex: none; }
.logo img { height: 34px; width: 34px; display: block; }
.badge {
  flex: none; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
  color: var(--accent); background: var(--accent-doux); border-radius: 999px; padding: 3px 10px;
}
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a, .menu-liens a { color: var(--texte); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.nav a:hover, .menu-liens a:hover { background: var(--surface-2); }
.nav a[aria-current="page"], .menu-liens a[aria-current="page"] { color: var(--accent); background: var(--accent-doux); }

/* Outils : langue (drapeaux), thème, menu repliable */
.outils { display: flex; align-items: center; gap: 8px; margin-left: 8px; flex: none; }
.langues, .menu { position: relative; }
.langues summary, .menu summary, .bouton-theme {
  list-style: none; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  height: 40px; min-width: 40px; padding: 0 10px; border: 1px solid var(--bord); border-radius: 8px; color: var(--texte);
}
.bouton-theme { padding: 0; width: 40px; }
.langues summary::-webkit-details-marker, .menu summary::-webkit-details-marker { display: none; }
.langues summary:hover, .menu summary:hover, .bouton-theme:hover { background: var(--surface-2); }
.langues[open] summary, .menu[open] summary { border-color: var(--accent); }
.langues img { display: block; width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(128, 128, 128, 0.35); }
.langues ul, .menu-liens {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; margin: 0; padding: 6px;
  list-style: none; background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre);
}
.langues ul { min-width: 170px; }
.langues li a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--texte); text-decoration: none; }
.langues li a:hover { background: var(--surface-2); }
.langues li a[aria-current] { color: var(--accent); font-weight: 600; }
.menu { display: none; }
.menu-liens { display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.menu-liens a { padding: 10px 12px; }

@media (max-width: 1099px) {
  .nav { display: none; }
  .menu { display: block; }
  .outils { margin-left: auto; }
}
@media (max-width: 520px) {
  .badge { display: none; }
  .outils { gap: 6px; }
}

/* Boutons */
.boutons { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: 0 22px; border-radius: 10px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--bord); background: var(--surface); color: var(--texte);
}
.bouton:hover { border-color: var(--accent); }
.bouton.action { background: var(--action); border-color: var(--action); color: var(--sur-action); }
.bouton.action:hover { filter: brightness(1.05); }

/* Héros */
.heros {
  background:
    radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(180deg, var(--accent-doux), var(--fond));
  border-bottom: 1px solid var(--bord);
  overflow: hidden;
}
.heros-grille { display: grid; gap: 40px; padding-top: clamp(40px, 6vw, 88px); padding-bottom: clamp(40px, 6vw, 88px); align-items: center; }
@media (min-width: 1100px) { .heros-grille { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; } }
.surtitre { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; margin: 0 0 12px; }
.chapeau { font-size: 1.15rem; color: var(--doux); max-width: 62ch; }
.capture img { display: block; width: 100%; border-radius: var(--rayon); border: 1px solid var(--bord); box-shadow: var(--ombre); }

/* Sections de la page d'accueil : même bord gauche, même rythme vertical */
.section { padding: clamp(40px, 5vw, 72px) 0; border-bottom: 1px solid var(--bord); }
.section:last-child { border-bottom: none; }
.section > h2:first-child, .entete-section h2 { margin-top: 0; }
.entete-section { margin-bottom: 28px; }
.entete-section p { color: var(--doux); margin: 0; max-width: 72ch; }

/* Valeurs */
.bandeau-valeurs { display: grid; gap: 16px; }
@media (min-width: 760px) { .bandeau-valeurs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 22px 24px; }
.bandeau-valeurs h3 { margin-top: 0; color: var(--accent); }
.bandeau-valeurs p { margin: 0; color: var(--doux); }

/* Atouts */
.atout { display: grid; gap: 28px; align-items: center; }
@media (min-width: 1100px) {
  .atout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; }
  .atout.inverse { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .atout.inverse .atout-texte { order: 2; }
}
.atout h2 { margin-top: 0; }
.coches { list-style: none; padding: 0; margin: 16px 0; }
.coches li { position: relative; padding-left: 28px; margin: 8px 0; }
.coches li::before {
  content: ""; position: absolute; left: 4px; top: 0.5em; width: 12px; height: 7px;
  border-left: 2.5px solid var(--action); border-bottom: 2.5px solid var(--action); transform: rotate(-45deg);
}
.suite { font-weight: 600; text-decoration: none; }
.suite:hover { text-decoration: underline; }

/* Cibles */
.grille-cibles { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .grille-cibles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grille-cibles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.grille-cibles strong { display: block; font-size: 1.1rem; margin-bottom: 4px; }
.grille-cibles span { color: var(--doux); font-size: 0.92rem; }

/* Appel final */
.final { display: grid; gap: 20px 48px; align-items: center; }
@media (min-width: 1100px) { .final { grid-template-columns: minmax(0, 1fr) auto; } }
.final h2 { margin: 0 0 8px; }
.final p { color: var(--doux); margin: 0; max-width: 72ch; }
.final .boutons { margin-top: 0; }

/* Pages simples (téléchargement, abonnement, comptes) : même bord gauche que l'en-tête */
.page { padding-top: clamp(32px, 4vw, 56px); padding-bottom: clamp(48px, 6vw, 88px); }
.page > h1, .page > .chapeau { max-width: 72ch; }
.etroite > * { max-width: 760px; }
/* Deux colonnes : contenu, et encart à droite (grands écrans) */
.page-deux { display: grid; gap: 32px; align-items: start; }
@media (min-width: 1100px) { .page-deux { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 72px; } }
.aparte h2 { font-size: 1.2rem; margin: 0 0 12px; }
.aparte p:last-child { margin-bottom: 0; }
@media (min-width: 1100px) { .aparte { position: sticky; top: calc(var(--entete) + 24px); } }
.phases { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.phases li { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--bord); border-radius: 10px; }
.phases li.actuelle { border-color: var(--accent); background: var(--accent-doux); }
.phases em { font-style: normal; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.phases span { color: var(--doux); font-size: 0.92rem; }
.colonnes-compte { display: grid; gap: 8px 72px; align-items: start; }
@media (min-width: 1100px) {
  .colonnes-compte { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .colonnes-compte h2.premier { margin-top: 0; }
}
.colonnes-compte .fiche { margin: 0 0 16px; }
.avertissement { background: var(--avertissement); border-left: 4px solid var(--avertissement-bord); padding: 14px 18px; border-radius: 8px; }
.etapes li { margin: 8px 0; }

/* Cartes des systèmes : chaque carte occupe cinq rangées partagées (sous-grille), donc
   titres, étapes, commandes et notes s'alignent d'une carte à l'autre. */
.systemes { display: grid; gap: 16px; margin-top: 32px; }
@media (min-width: 760px) { .systemes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1320px) { .systemes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.systeme {
  display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 10px; align-content: start;
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 22px 24px; min-width: 0;
}
.systeme > * { margin: 0; min-width: 0; }
.systeme h2 { font-size: 1.25rem; }
.etape { display: flex; gap: 10px; align-items: baseline; }
.numero-etape {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent-doux); color: var(--accent); font-size: 0.8rem; font-weight: 700;
}
.systeme .note { color: var(--doux); font-size: 0.92rem; }

/* Commande d'installation et son bouton de copie : le cadre du bloc de code contient la
   commande (qui défile seule si elle est trop longue) et, à droite, un bouton carré de la
   hauteur d'une ligne (police du bloc × interligne), jamais recouvert. */
.commande {
  display: flex; align-items: flex-start; gap: 10px; font-size: 0.9em; line-height: 1.5;
  background: var(--code); border: 1px solid var(--bord); border-radius: 10px; padding: 14px 14px 14px 16px;
}
.commande pre { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 1em; overflow-x: auto; }
.commande pre code { font-size: 1em; }
.copier {
  flex: none; width: 1.5em; height: 1.5em; padding: 0; font-size: 1em;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--doux); background: var(--surface); border: 1px solid var(--bord); border-radius: 5px;
}
.copier[hidden] { display: none; }
.copier:hover { color: var(--accent); border-color: var(--accent); }
.copier svg { width: 70%; height: 70%; }
.copier .icone-copie { display: none; }
.copier.copie { color: #2e9d63; border-color: #2e9d63; }
.copier.copie .icone-copier { display: none; }
.copier.copie .icone-copie { display: block; }
.prerequis { margin-top: 56px; }
.prerequis ul { padding-left: 20px; }
.prerequis li { margin: 6px 0; }

/* Documentation : sommaire | article | « sur cette page » */
.cartes-doc { list-style: none; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 32px; }
.cartes-doc a {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 20px 22px; text-decoration: none;
  color: var(--texte); background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
}
.cartes-doc a:hover { border-color: var(--accent); }
.cartes-doc .numero { color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.cartes-doc strong { font-size: 1.1rem; }
.cartes-doc span:last-child { color: var(--doux); font-size: 0.92rem; }

.doc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 32px; padding-bottom: 72px; align-items: start; }
.doc-nav, .sur-la-page-cote { display: none; }
.doc-nav-mobile { border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--surface); }
.doc-nav-mobile summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.doc-nav-mobile summary::-webkit-details-marker { display: none; }
.doc-nav-mobile[open] summary { border-bottom: 1px solid var(--bord); }
.doc-nav-mobile ol { list-style: none; margin: 0; padding: 8px; }
@media (min-width: 1100px) {
  .doc { grid-template-columns: 250px minmax(0, 1fr); gap: 56px; }
  .doc-nav-mobile { display: none; }
  .doc-nav { display: block; position: sticky; top: calc(var(--entete) + 24px); max-height: calc(100vh - var(--entete) - 48px); overflow-y: auto; }
}
@media (min-width: 1320px) {
  .doc { grid-template-columns: 250px minmax(0, 1fr) 230px; }
  .sur-la-page-cote { display: block; position: sticky; top: calc(var(--entete) + 24px); max-height: calc(100vh - var(--entete) - 48px); overflow-y: auto; }
  .sur-la-page { display: none; }
}
.doc-nav { font-size: 0.95rem; }
.doc-nav-titre { font-weight: 700; margin: 0 0 8px; padding-left: 10px; }
.doc-nav ol { list-style: none; padding: 0; margin: 0; }
.doc-nav a, .doc-nav-mobile a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--texte); text-decoration: none; }
.doc-nav a:hover, .doc-nav-mobile a:hover { background: var(--surface-2); }
.doc-nav a[aria-current="page"], .doc-nav-mobile a[aria-current="page"] { color: var(--accent); background: var(--accent-doux); font-weight: 600; }

.doc-article { min-width: 0; }
.doc-article > * { max-width: 860px; }
.fil { margin: 0 0 8px; font-size: 0.9rem; }
.fil a { color: var(--doux); }
.doc-article h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); }
.doc-article h2 { padding-top: 16px; border-top: 1px solid var(--bord); }
.doc-article h2 + p, .doc-article h3 + p { margin-top: 4px; }
.sur-la-page { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 18px; margin: 16px 0 24px; font-size: 0.95rem; }
.sur-la-page p, .sur-la-page-cote p { margin: 0 0 6px; font-weight: 600; }
.sur-la-page ul { margin: 0; padding-left: 18px; columns: 2 220px; }
.sur-la-page-cote { font-size: 0.9rem; border-left: 1px solid var(--bord); padding-left: 16px; }
.sur-la-page-cote ul { list-style: none; margin: 0; padding: 0; }
.sur-la-page-cote li { margin: 6px 0; }
.sur-la-page-cote a { color: var(--doux); text-decoration: none; }
.sur-la-page-cote a:hover { color: var(--accent); }
.doc-suite { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-top: 56px; }
.doc-suite a {
  flex: 1 1 240px; display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--bord);
  border-radius: var(--rayon); background: var(--surface); text-decoration: none; font-weight: 600;
}
.doc-suite a span { color: var(--doux); font-weight: 400; font-size: 0.85rem; }
.doc-suite .suivante { text-align: right; }
.doc-suite a:hover { border-color: var(--accent); }

code, pre { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--code); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
pre { background: var(--code); border: 1px solid var(--bord); border-radius: 10px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; }
.tableau { overflow-x: auto; margin: 16px 0; border: 1px solid var(--bord); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: none; }
blockquote { margin: 16px 0; padding: 10px 18px; border-left: 4px solid var(--accent); background: var(--accent-doux); border-radius: 0 8px 8px 0; }
blockquote p { margin: 6px 0; }

/* Pied */
.pied { border-top: 1px solid var(--bord); background: var(--surface); }
.pied-ligne { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; align-items: baseline; padding-top: 24px; padding-bottom: 24px; color: var(--doux); font-size: 0.9rem; }
.pied-ligne span:last-child { max-width: 90ch; }
@media (min-width: 1100px) { .pied-ligne span:last-child { text-align: right; } }

/* Comptes : formulaires, messages, fiche */
.formulaire { display: grid; gap: 6px; max-width: 460px; margin: 24px 0; }
.formulaire label { font-weight: 600; margin-top: 10px; }
.formulaire input {
  font: inherit; color: var(--texte); background: var(--surface); border: 1px solid var(--bord);
  border-radius: 10px; padding: 11px 14px; min-height: 46px; width: 100%;
}
.formulaire input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.formulaire input[readonly] { background: var(--surface-2); color: var(--doux); }
.formulaire .bouton { margin-top: 18px; justify-self: start; cursor: pointer; font: inherit; font-weight: 600; }
form .bouton { cursor: pointer; font: inherit; font-weight: 600; }
.aide { color: var(--doux); font-size: 0.9rem; margin: 4px 0 0; }
.liens-formulaire { color: var(--doux); }
.alerte { padding: 12px 16px; border-radius: 8px; border-left: 4px solid; margin: 16px 0; }
.alerte.erreur { background: color-mix(in srgb, #d64545 12%, var(--surface)); border-color: #d64545; }
.alerte.succes { background: color-mix(in srgb, #2e9d63 12%, var(--surface)); border-color: #2e9d63; }
.fiche { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px 20px; }
.fiche dt { color: var(--doux); }
.fiche dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.postes { padding-left: 18px; }
