/* Charte des supports Dawan — générateur statique */
:root {
  --fond: #faf8f8;
  --fond-2: #ffffff;
  --texte: #2b2b2b;
  --texte-doux: #5b6873;
  --bordure: #e2e5e9;
  --accent: #1f4f82;
  --accent-2: #284b63;
  --lien: #1f4f82;
  --code-fond: #f3f4f6;
  --actif: #e8f1fe;
  --info: #3b82f6;
  --astuce: #16a34a;
  --attention: #d97706;
  --danger: #dc2626;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --fond: #161618;
  --fond-2: #1f1f22;
  --texte: #e6e6e6;
  --texte-doux: #a3adb6;
  --bordure: #34363b;
  --accent: #8ab4f8;
  --accent-2: #9fc3e6;
  --lien: #8ab4f8;
  --code-fond: #26272b;
  --actif: #23324a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #161618; --fond-2: #1f1f22; --texte: #e6e6e6; --texte-doux: #a3adb6;
    --bordure: #34363b; --accent: #8ab4f8; --accent-2: #9fc3e6; --lien: #8ab4f8;
    --code-fond: #26272b; --actif: #23324a; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.65 "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}
a { color: var(--lien); }
img { max-width: 100%; height: auto; }

/* Barre du haut */
.barre {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.2rem;
  background: var(--fond-2);
  border-bottom: 1px solid var(--bordure);
}
.marque { font-weight: 700; font-size: 1.15rem; color: var(--accent-2); text-decoration: none; white-space: nowrap; }
.recherche { position: relative; flex: 1; max-width: 32rem; margin-left: auto; }
.recherche input {
  width: 100%; padding: .45rem .8rem; border-radius: .5rem;
  border: 1px solid var(--bordure); background: var(--fond); color: var(--texte); font: inherit;
}
.resultats {
  position: absolute; left: 0; right: 0; top: 2.6rem; margin: 0; padding: .4rem;
  list-style: none; max-height: 70vh; overflow: auto;
  background: var(--fond-2); border: 1px solid var(--bordure); border-radius: .5rem;
  box-shadow: 0 .8rem 2rem rgb(0 0 0 / 18%);
}
.resultats li a { display: block; padding: .45rem .6rem; border-radius: .4rem; text-decoration: none; color: var(--texte); }
.resultats li a:hover, .resultats li a:focus { background: var(--actif); }
.resultats small { display: block; color: var(--texte-doux); }
.bouton-theme, .bouton-menu {
  border: 1px solid var(--bordure); background: var(--fond); color: var(--texte);
  border-radius: .5rem; padding: .3rem .6rem; font-size: 1.1rem; cursor: pointer;
}
.bouton-menu { display: none; }

/* Mise en page : menu, contenu, sommaire */
.cadre {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 15rem;
  gap: 2rem;
  max-width: 1500px; margin: 0 auto; padding: 0 1.2rem;
}
.lateral, .sommaire {
  position: sticky; top: 4rem; align-self: start;
  max-height: calc(100vh - 4.5rem); overflow: auto; padding: 1.2rem 0; font-size: .92rem;
}
.menu, .menu ul { list-style: none; margin: 0; padding: 0; }
.menu ul { padding-left: .9rem; border-left: 1px solid var(--bordure); margin: .2rem 0 .6rem .4rem; }
.menu summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
.menu li summary a { display: inline; padding: 0; color: var(--accent-2); text-decoration: none; }
.menu li a { display: block; padding: .15rem .4rem; border-radius: .3rem; text-decoration: none; color: var(--texte-doux); }
.menu li a:hover { color: var(--lien); }
.menu li summary > a { display: inline; padding: 0; }
.menu li a.actif { background: var(--actif); color: var(--lien); font-weight: 600; }
.sommaire .toc ul { list-style: none; padding-left: .8rem; margin: 0; }
.sommaire .toc > ul { padding-left: 0; }
.sommaire .toc a { display: block; padding: .12rem 0; color: var(--texte-doux); text-decoration: none; }
.sommaire .toc a:hover { color: var(--lien); }
.sommaire::before { content: "Sur cette page"; display: block; font-weight: 700; margin-bottom: .4rem; }
.sommaire:empty::before { content: none; }

main { min-width: 0; padding: 1.2rem 0 3rem; }
.fil { margin: 0 0 .4rem; font-size: .9rem; color: var(--texte-doux); }
.fil:empty { display: none; }
article h1 { font-size: 2rem; line-height: 1.25; color: var(--accent-2); margin: .2rem 0 1.2rem; }
article h2 { font-size: 1.5rem; color: var(--accent-2); margin-top: 2.4rem; border-bottom: 1px solid var(--bordure); padding-bottom: .2rem; }
article h3 { font-size: 1.22rem; margin-top: 2rem; }
article h4 { font-size: 1.05rem; margin-top: 1.6rem; }
article table { border-collapse: collapse; width: 100%; margin: 1rem 0; display: block; overflow-x: auto; }
article th, article td { border: 1px solid var(--bordure); padding: .4rem .6rem; text-align: left; vertical-align: top; }
article th { background: var(--code-fond); }
article blockquote { margin: 1rem 0; padding: .4rem 1rem; border-left: 4px solid var(--accent); background: var(--fond-2); }
article hr { border: 0; border-top: 1px solid var(--bordure); margin: 2rem 0; }
article details { border: 1px solid var(--bordure) !important; border-radius: .6rem !important; padding: .6rem 1rem !important; margin: 1rem 0; background: var(--fond-2); }
article summary { cursor: pointer; font-weight: 700; }

/* Code */
code { font-family: "IBM Plex Mono", Consolas, monospace; font-size: .9em; background: var(--code-fond); padding: .1em .35em; border-radius: .3em; }
.code { position: relative; margin: 1rem 0; }
.code pre, article pre {
  background: var(--code-fond); padding: .9rem 1rem; border-radius: .6rem;
  overflow-x: auto; border: 1px solid var(--bordure); line-height: 1.5;
}
.code pre code, article pre code { background: none; padding: 0; font-size: .88rem; }
.copier {
  position: absolute; top: .4rem; right: .4rem; opacity: 0; transition: opacity .15s;
  border: 1px solid var(--bordure); background: var(--fond-2); color: var(--texte);
  border-radius: .4rem; font-size: .8rem; padding: .15rem .5rem; cursor: pointer;
}
.code:hover .copier { opacity: 1; }

/* Encadrés */
.encadre { margin: 1.2rem 0; padding: .7rem 1rem; border-left: 4px solid var(--info); border-radius: .5rem; background: color-mix(in srgb, var(--info) 8%, var(--fond-2)); }
.encadre > :first-child { margin-top: 0; }
.encadre > :last-child { margin-bottom: 0; }
.encadre-astuce { border-color: var(--astuce); background: color-mix(in srgb, var(--astuce) 8%, var(--fond-2)); }
.encadre-attention { border-color: var(--attention); background: color-mix(in srgb, var(--attention) 9%, var(--fond-2)); }
.encadre-danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--fond-2)); }

/* Schémas : survol puis clic pour le plein écran */
/* Le cadre reste transparent : chaque schéma porte son propre fond (plus de bandes blanches
   autour d'un schéma moins large que la colonne), l'ombre est portée par le schéma lui-même. */
.schema-zoom { display: block; margin: 1.5rem auto; cursor: zoom-in; line-height: 0; background: none; }
.schema-zoom img, .schema-zoom object {
  display: block; margin: auto; border-radius: .6rem;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.schema-zoom:hover > object, .schema-zoom:hover > img, .schema-zoom:focus-visible img,
.schema-zoom:hover > a > img { box-shadow: 0 1rem 2.2rem rgb(0 0 0 / 30%); transform: translateY(-3px); }

/* Accueil */
.entete-accueil { display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; margin: 1rem 0 1.5rem; }
.entete-accueil img { width: 7rem; max-height: 5rem; object-fit: contain; }
.entete-accueil h1 { margin: 0; }
.entete-accueil p { margin: .2rem 0 0; color: var(--texte-doux); }
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.carte {
  display: flex; flex-direction: column; gap: .3rem; padding: 1rem; text-decoration: none; color: var(--texte);
  background: var(--fond-2); border: 1px solid var(--bordure); border-radius: .8rem;
  transition: transform .15s, box-shadow .15s;
}
.carte:hover { transform: translateY(-3px); box-shadow: 0 .6rem 1.4rem rgb(0 0 0 / 12%); }
.carte .num { font-weight: 700; color: var(--accent); }
.carte small { color: var(--texte-doux); }
/* Bas de l'accueil : annexes et téléchargements */
.bas-accueil { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--bordure); }
.bas-accueil h2 { margin-top: 1.6rem; }
.bas-accueil h2:first-child { margin-top: 0; }
.chapitres { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; margin-bottom: 1rem; }
/* Branches (site.yaml « branches ») : titre de branche sur toute la largeur, niveau de menu au-dessus des dossiers */
.chapitres h3.branche { grid-column: 1 / -1; margin: 1rem 0 .1rem; font-size: 1.05rem; color: var(--accent-2); }
.menu li.branche > details > summary { font-size: 1rem; color: var(--texte); text-transform: none; }
.bouton.bouton-chapitre, .bouton.bouton-annexe { justify-content: flex-start; gap: .7rem; text-align: left; }
.bouton .texte { display: flex; flex-direction: column; gap: .15rem; }
.bouton .texte strong { font-weight: 600; }
.bouton .texte small { color: var(--texte-doux); font-size: .82rem; line-height: 1.35; }
.bouton:hover .texte small { color: var(--texte-doux); }
.bouton-chapitre .num {
  flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .45rem;
  font-size: .8rem; color: var(--fond); background: var(--accent);
}
/* Plan du chapitre : titre encadré puis cartes numérotées (numéro, titre, description) */
.plan-chapitre-bloc { margin: 2rem 0 1.5rem; }
.titre-plan {
  margin: 0 0 1rem; padding: .7rem 1rem; font-size: 1.2rem; font-weight: 700; color: var(--texte);
  border: 1px solid var(--bordure); border-left: 4px solid var(--accent); border-radius: .7rem; background: var(--fond-2);
}
.plan-chapitre-bloc .plan-chapitre { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .8rem; }
.carte-plan {
  display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; border-radius: .8rem; text-decoration: none;
  color: var(--texte); background: var(--fond-2); border: 1px solid var(--bordure);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.carte-plan:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 .5rem 1.2rem rgb(0 0 0 / 15%); }
.carte-plan .num { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 1.15rem; color: var(--accent); }
.carte-plan strong { font-weight: 600; line-height: 1.3; }
.carte-plan small { color: var(--texte-doux); font-size: .85rem; line-height: 1.45; }
@media print { .carte-plan { break-inside: avoid; } }
.annexes, .plan-chapitre { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.bouton {
  display: flex; align-items: center; justify-content: center; min-height: 2.8rem; padding: .5rem .9rem;
  border-radius: .6rem; text-decoration: none; text-align: center; font-size: .92rem; line-height: 1.3;
  color: var(--texte); background: var(--fond-2); border: 1px solid var(--bordure);
  transition: border-color .15s, color .15s, transform .15s;
}
.bouton:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.telechargements { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .8rem; }
.telecharger {
  display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; border-radius: .8rem; text-decoration: none;
  color: var(--texte); background: var(--fond-2); border: 1px solid var(--bordure); border-left: 4px solid var(--accent);
  transition: transform .15s, box-shadow .15s;
}
.telecharger:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1.2rem rgb(0 0 0 / 15%); }
.telecharger .icone {
  flex: none; display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: .5rem;
  font-weight: 700; font-size: .8rem; color: var(--fond); background: var(--accent);
}
.telecharger strong { display: block; }
.telecharger small { color: var(--texte-doux); }

/* Version PDF */
.impression { max-width: none; margin: 0; padding: 0; background: #fff; }
.impression .couverture { height: 90vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.impression .couverture img { width: 8rem; }
.impression .page-imp { break-before: page; }
.impression .entree-chapitre > h1 { font-size: 2.2rem; border-bottom: 3px solid var(--accent); padding-bottom: .3rem; }
.impression .schema-objet object { width: 100% !important; }
@page { size: A4; margin: 15mm 14mm 22mm; }

/* Navigation bas de page */
.suite { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--bordure); }
.suite a { text-decoration: none; max-width: 48%; }
.suite .suiv { margin-left: auto; text-align: right; }

/* Écrans étroits */
@media (max-width: 1100px) {
  .cadre { grid-template-columns: 15rem minmax(0, 1fr); }
  .sommaire { display: none; }
}
@media (max-width: 760px) {
  .cadre { grid-template-columns: minmax(0, 1fr); padding: 0 1rem; }
  .bouton-menu { display: inline-block; }
  .lateral { display: none; position: static; max-height: none; }
  body.menu-ouvert .lateral { display: block; }
  .marque { display: none; }
}

/* Impression */
@media print {
  .barre, .lateral, .sommaire, .suite, .copier { display: none !important; }
  .cadre { display: block; }
  details { break-inside: avoid-page; }
  .schema-zoom, article img { break-inside: avoid-page; box-shadow: none !important; }
  pre { white-space: pre-wrap; word-break: break-word; }
}

/* Part d une section découpée : sous-titre décalé sous sa section */
.menu li.suite-section > a { padding-left: 1.1rem; font-size: .88rem; }
.menu li.suite-section > a::before { content: "↳ "; opacity: .6; }

/* Logo de la formation sous le titre de l accueil */
.entete-accueil img.logo-formation { align-self: center; width: min(15rem, 70%); max-height: none; margin: 1.2rem auto .4rem; border-radius: .8rem; }

/* Titres d'ouverture de chapitre (Introduction, Objectifs) : même encadré que le plan */
article > .titre-plan, article .encadre > .titre-plan { margin: 1.8rem 0 1rem; }
article > .titre-plan:first-child, article > h1 + .titre-plan { margin-top: .6rem; }

/* Logos de technologie : leur dessin est noir sur fond transparent, donc invisible
   en thème sombre. On les pose sur un médaillon clair, valable dans les deux thèmes. */
article img[alt^="logo"] {
  background: #fff;
  padding: .9rem 1.2rem;
  border-radius: .9rem;
  box-shadow: 0 .2rem .8rem rgb(0 0 0 / 18%);
}

/* Logo et mention de propriété Dawan (21/09/2026) */
.logo-dawan { height: 42px; width: auto; border-radius: 4px; background: #fff; flex: none; }
.pied { display: flex; align-items: center; justify-content: center; gap: .8rem; padding: 1.2rem 1rem 1.6rem; border-top: 1px solid var(--bordure); font-size: .9rem; color: var(--texte-doux); }
.pied img { height: 56px; width: auto; border-radius: 4px; background: #fff; }
.couverture .propriete { margin-top: 2rem; font-size: 1rem; }
.couverture .propriete img { height: 70px; width: auto; display: block; margin: 0 auto .6rem; }
.logos-accueil { display: flex; justify-content: center; align-items: center; gap: 2.5rem; flex-wrap: wrap; margin: 1.2rem 0 1.6rem; }
.logos-accueil img.logo-accueil { height: 150px; width: auto; max-width: 45%; object-fit: contain; background: #fff; border-radius: .8rem; padding: .6rem; }

/* Version PDF : logos de la couverture (outil + Dawan, même hauteur) et pied Dawan sur chaque page (22/09/2026) */
.impression .couverture .logos-couverture { display: flex; justify-content: center; align-items: center; gap: 2.5rem; margin-bottom: 1.5rem; }
.impression .couverture img.logo-couverture { width: auto; height: 110px; max-width: 45%; object-fit: contain; }
