/* L'aide de Pyryx (wiki.pyryx.com) — l'accent orange de Pyryx Pro (#ba4e00), IBM Plex comme l'application.
   Clair par défaut, sombre si le système le demande ; une colonne sur téléphone, le sommaire derrière un bouton. */
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('/polices/IBMPlexSans-Regular-Latin1.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600 700; font-display: swap; src: url('/polices/IBMPlexSans-SemiBold-Latin1.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url('/polices/IBMPlexMono-Regular-Latin1.woff2') format('woff2'); }

:root {
  --accent: #ba4e00;
  --accent-fort: #9a3f00;
  --accent-voile: #fff6ef;
  --encre: #1f1b17;
  --texte: #3b3530;
  --doux: #6f6862;
  --trait: #e7e1da;
  --fond: #ffffff;
  --fond-doux: #f7f4f0;
  --ombre: 0 1px 2px rgba(60, 30, 0, .06), 0 6px 24px rgba(60, 30, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #ff8a3d;
    --accent-fort: #ffa466;
    --accent-voile: #2a1d14;
    --encre: #f4efe9;
    --texte: #d8d1ca;
    --doux: #a49c94;
    --trait: #3a332d;
    --fond: #171411;
    --fond-doux: #221e1a;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 400 16px/1.6 'IBM Plex Sans', system-ui, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-fort); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { color: var(--encre); line-height: 1.2; font-weight: 700; }
h1 { font-size: 2rem; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 2rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1.6rem 0 .5rem; }
b { color: var(--encre); font-weight: 600; }
img { max-width: 100%; height: auto; }
.evitement { position: absolute; left: -999px; }
.evitement:focus { left: 12px; top: 12px; z-index: 50; background: var(--fond); padding: 6px 10px; }

.ui {
  font-family: 'IBM Plex Mono', monospace; font-size: .86em;
  background: var(--fond-doux); border: 1px solid var(--trait); border-radius: 4px;
  padding: 0 4px; color: var(--encre); white-space: nowrap;
}

/* ── l'en-tête */
.haut {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; min-height: 60px;
  background: color-mix(in srgb, var(--fond) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--trait);
}
/* la recherche AU MILIEU : la marque et le côté droit prennent chacun la même part de ce qui reste */
.marque { display: flex; align-items: center; gap: 10px; color: var(--encre); text-decoration: none; font-size: 1.05rem; flex: 1 1 0; min-width: max-content; }
.marque b { color: var(--accent); }
.recherche { position: relative; flex: 0 1 520px; min-width: 200px; }
.recherche input {
  width: 100%; height: 38px; padding: 0 34px 0 12px;
  font: inherit; font-size: .95rem; color: var(--encre);
  background: var(--fond-doux); border: 1px solid var(--trait); border-radius: 8px;
}
.recherche input:focus { outline: none; border-color: var(--accent); background: var(--fond); }
.recherche kbd {
  position: absolute; right: 9px; top: 9px; font: 12px 'IBM Plex Mono', monospace; color: var(--doux);
  border: 1px solid var(--trait); border-radius: 4px; padding: 0 5px;
}
#resultats {
  position: absolute; left: 0; right: 0; top: 44px; margin: 0; padding: 6px; list-style: none;
  background: var(--fond); border: 1px solid var(--trait); border-radius: 10px; box-shadow: var(--ombre);
  max-height: 70vh; overflow: auto;
}
#resultats a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--texte); }
#resultats a b { display: block; }
#resultats a small { color: var(--doux); font-size: .8rem; }
#resultats li[aria-selected="true"] a, #resultats a:hover { background: var(--accent-voile); }
#resultats .vide { padding: 10px; color: var(--doux); font-size: .9rem; }
.haut-droite { flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end; gap: 18px; min-width: max-content; }
.haut-liens { display: flex; align-items: center; gap: 16px; font-size: .92rem; }
.langues { display: flex; gap: 2px; font: 12px 'IBM Plex Mono', monospace; }
.langues a, .langues b { padding: 3px 6px; border-radius: 5px; text-decoration: none; }
.langues a { color: var(--doux); }
.langues a:hover { color: var(--accent); background: var(--fond-doux); }
.langues b { color: var(--accent); background: var(--accent-voile); font-weight: 400; }
.langues--pied { justify-content: center; margin-bottom: 8px; }
.haut-liens a { text-decoration: none; }
.bouton {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: #fff !important; text-decoration: none; font-weight: 600;
}
.bouton:hover { background: var(--accent-fort); }
.bouton--doux { background: var(--fond-doux); color: var(--encre) !important; border: 1px solid var(--trait); }
.bouton--doux:hover { background: var(--accent-voile); }
.ouvrir-menu, .saut { display: none; }

/* ── la mise en page : le sommaire à gauche, le contenu au centre */
.corps { display: grid; grid-template-columns: 280px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
main { padding: 28px 40px 64px; max-width: 900px; min-width: 0; }
main.seul { margin: 0 auto; max-width: 980px; }
.menu {
  position: sticky; top: 61px; align-self: start; max-height: calc(100vh - 61px); overflow: auto;
  padding: 20px 12px 40px 24px; border-right: 1px solid var(--trait); font-size: .9rem;
}
.menu a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--texte); text-decoration: none; line-height: 1.35; }
.menu a:hover { background: var(--fond-doux); }
.menu a.actif { background: var(--accent-voile); color: var(--accent); font-weight: 600; }
.menu .m-accueil { font-weight: 600; color: var(--encre); }
.menu .m-titre {
  margin: 18px 8px 6px; font: 12px 'IBM Plex Mono', monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.menu details summary { cursor: pointer; padding: 4px 8px; border-radius: 6px; color: var(--encre); list-style: none; }
.menu details summary::-webkit-details-marker { display: none; }
.menu details summary::before { content: '▸'; display: inline-block; width: 14px; color: var(--doux); transition: transform .15s; }
.menu details[open] summary::before { transform: rotate(90deg); }
.menu details a { padding-left: 22px; }
.menu .m-pdf { margin-top: 14px; }

/* ── le contenu */
.fil ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; padding: 0; list-style: none; font-size: .85rem; color: var(--doux); }
.fil li + li::before { content: '›'; margin-right: 4px; }
.fil a { color: var(--doux); text-decoration: none; }
.fil a:hover { color: var(--accent); }
.surtitre { margin: 0; font: 13px 'IBM Plex Mono', monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.surtitre::before { content: '// '; }
.chapeau { font-size: 1.12rem; color: var(--encre); line-height: 1.55; }
.route { font: 13px 'IBM Plex Mono', monospace; color: var(--doux); margin: -.2rem 0 1rem; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.route .demo { font-family: 'IBM Plex Sans', sans-serif; font-size: .88rem; }
.route .demo::after { content: ' ↗'; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.2rem 0; }
.note { font-size: .9rem; color: var(--doux); }

.puces { margin: 0 0 1rem; padding: 0; list-style: none; }
.puces li { position: relative; padding-left: 20px; margin: 0 0 .45rem; }
.puces li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.etapes { counter-reset: e; list-style: none; margin: 0 0 1rem; padding: 0; }
.etapes li { counter-increment: e; position: relative; padding-left: 34px; margin: 0 0 .7rem; }
.etapes li::before {
  content: counter(e); position: absolute; left: 0; top: .1em; width: 23px; height: 23px; border-radius: 50%;
  background: var(--encre); color: var(--fond); font-size: .78rem; font-weight: 700; text-align: center; line-height: 23px;
}
.deux-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.deux-col h2, .astuces h2 { font: 600 .82rem 'IBM Plex Sans', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 1.4rem 0 .7rem; }
.astuces { background: var(--accent-voile); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 4px 20px 6px; margin: 1.6rem 0; }

/* les captures et leurs pastilles numérotées : la place de chaque pastille est calculée par construire_pdf.py, en % de
   l'image ; sa taille suit la largeur de l'image (5,4 % ; 9,5 % sur un téléphone), comme dans le PDF */
.capture { margin: 1.4rem 0; }
.capture .cadre {
  container-type: inline-size; position: relative; overflow: hidden;
  border: 1px solid var(--trait); border-radius: 10px; background: #fff; box-shadow: var(--ombre);
}
.capture img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.figure--mobile { max-width: 320px; margin-left: auto; margin-right: auto; }
.colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.pastille {
  position: absolute; width: 5.4cqw; height: 5.4cqw; min-width: 20px; min-height: 20px; border-radius: 50%;
  background: #ba4e00; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  font-weight: 700; font-size: max(11px, 2.9cqw); display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.figure--mobile .pastille { width: 9.5cqw; height: 9.5cqw; font-size: max(11px, 5cqw); }
.pastille.vise { transform: scale(1.35); }
figcaption { font-size: .88rem; color: var(--doux); margin-top: .5rem; }
.reperes { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: .92rem; }
.reperes li { display: flex; gap: 8px; align-items: baseline; cursor: default; }
.reperes .n {
  flex: none; width: 20px; height: 20px; border-radius: 50%; background: #ba4e00; color: #fff;
  font-size: .72rem; font-weight: 700; text-align: center; line-height: 20px;
}

.schema { margin: 1.4rem 0; overflow-x: auto; }
.schema svg { min-width: 640px; }
.schema .sb { fill: var(--fond); stroke: var(--accent); stroke-width: 1.4; }
.schema .sn { fill: var(--accent); }
.schema .snt { fill: #fff; font: 700 12px 'IBM Plex Sans', Arial; text-anchor: middle; }
.schema .st { fill: var(--encre); font: 700 12px 'IBM Plex Sans', Arial; }
.schema .sx { fill: var(--texte); font: 10px 'IBM Plex Sans', Arial; }
.schema .sf { stroke: var(--accent); stroke-width: 2; fill: none; }

.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 1rem 0; }
.cartes--grandes { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.carte {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px;
  border: 1px solid var(--trait); border-radius: 12px; background: var(--fond);
  color: var(--texte); text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
a.carte:hover { border-color: var(--accent); box-shadow: var(--ombre); color: var(--texte); }
.carte b { font-size: 1.02rem; }
.carte span { font-size: .9rem; color: var(--doux); }
.carte--bientot { opacity: .65; }
.liste-fiches { columns: 2; column-gap: 32px; padding-left: 1.1rem; margin: 0; }
.liste-fiches li { break-inside: avoid; margin-bottom: .25rem; }
.accueil { padding: 48px 0 24px; }
.accueil h1 { font-size: 2.4rem; }

.suite { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid var(--trait); }
.suite a { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--trait); border-radius: 10px; text-decoration: none; color: var(--encre); }
.suite a:hover { border-color: var(--accent); }
.suite a span { font-size: .8rem; color: var(--doux); }
.suite .suiv { text-align: right; }

.tableau { overflow-x: auto; }
table.formules { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
table.formules th, table.formules td { border-bottom: 1px solid var(--trait); padding: 10px 12px; text-align: left; vertical-align: top; }
table.formules thead th { background: var(--fond-doux); color: var(--encre); }
table.formules tbody th { font-weight: 400; color: var(--texte); }
table.formules td:nth-child(2) { white-space: nowrap; }
.glossaire dt { font-weight: 700; color: var(--encre); margin-top: 1rem; }
.glossaire dd { margin: .2rem 0 0; }
.question { border-bottom: 1px solid var(--trait); padding: 12px 0; }
.question summary { cursor: pointer; font-weight: 600; color: var(--encre); }
.question p { margin: .6rem 0 0; }

.pied { border-top: 1px solid var(--trait); padding: 22px 24px 32px; text-align: center; font-size: .88rem; color: var(--doux); }
.pied p { margin: .2rem 0; }
.pied .doux { font-size: .8rem; }

/* ── écran moyen : la recherche reste au milieu — le lien de la démo passe au pied, la recherche se resserre */
@media (max-width: 1180px) {
  .haut-liens a:not(.bouton) { display: none; }
  .recherche { flex-basis: 400px; }
}

/* ── tablette et téléphone : une colonne, le sommaire derrière « Sommaire » */
@media (max-width: 980px) {
  .corps { grid-template-columns: minmax(0, 1fr); }
  .menu {
    display: none; position: fixed; inset: 61px 0 0 0; max-height: none; z-index: 15;
    background: var(--fond); border-right: 0; padding: 16px 20px 40px;
  }
  .menu.ouvert { display: block; }
  .ouvrir-menu {
    display: block; margin-left: auto; height: 36px; padding: 0 12px; font: inherit; font-size: .9rem;
    color: var(--encre); background: var(--fond-doux); border: 1px solid var(--trait); border-radius: 8px; cursor: pointer;
  }
  .haut-liens a:not(.bouton) { display: none; }
  .haut-droite { flex: 0 0 auto; }
  .haut .langues { display: none; }
  .marque { flex: 0 0 auto; }
  .recherche { flex: 1 1 auto; }
}
@media (max-width: 720px) {
  .haut { flex-wrap: wrap; padding: 8px 16px; gap: 8px 12px; }
  /* deux rangées : la marque et « Ouvrir Pyryx Pro », puis « Sommaire » et la recherche */
  .haut-droite { order: 1; margin-left: auto; }
  .haut-liens .bouton { padding: 6px 10px; font-size: .85rem; }
  .saut { display: block; order: 2; flex-basis: 100%; height: 0; }
  .ouvrir-menu { order: 3; margin-left: 0; flex: none; }
  .recherche { order: 4; flex: 1 1 0; min-width: 0; max-width: none; }
  .recherche kbd { display: none; }
  html { scroll-padding-top: 116px; }
  main { padding: 18px 16px 48px; }
  h1 { font-size: 1.6rem; }
  .accueil h1 { font-size: 1.9rem; }
  .deux-col, .reperes, .suite { grid-template-columns: 1fr; }
  .suite .suiv { text-align: left; }
  .liste-fiches { columns: 1; }
  .colonnes { grid-template-columns: 1fr; }
  .ui { white-space: normal; }
}
