/* ------------------------------------------------------------------
   Documentation back-office — Québec le Mag
   Feuille de style unique. Volontairement simple : pas de framework,
   pas de dépendance externe, tout s'ouvre en double-cliquant un .html.
   ------------------------------------------------------------------ */

:root {
  --fond:          #ffffff;
  --fond-menu:     #f6f6f4;
  --fond-doux:     #f3f4f6;
  --texte:         #1c1c1c;
  --texte-doux:    #5b6067;
  --trait:         #e2e3e0;
  --accent:        #0b5c8a;
  --accent-doux:   #e8f1f7;
  --attention:     #b45309;
  --attention-fond:#fdf5e6;
  --largeur-menu:  17rem;
  --rayon:         6px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Lien d'évitement (accessibilité clavier) --------------- */

.evitement {
  position: absolute; left: -999px;
  background: var(--accent); color: #fff;
  padding: .6rem 1rem; z-index: 10;
}
.evitement:focus { left: .5rem; top: .5rem; }

/* ---------- Menu fixe, colonne de gauche --------------------------- */

.menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--largeur-menu);
  overflow-y: auto;
  background: var(--fond-menu);
  border-right: 1px solid var(--trait);
  padding: 1.75rem 0 3rem;
}

a.menu__titre {
  display: block;
  border-left: 3px solid transparent;
  padding: 0 1.5rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--texte);
  text-decoration: none;
}
a.menu__titre span {
  display: block;
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--texte-doux);
  margin-top: .2rem;
}

.menu ul { list-style: none; margin: 0; padding: 0; }

.menu a {
  display: block;
  padding: .45rem 1.5rem;
  color: var(--texte);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.menu a:hover { background: #ececea; }

.menu__section > a { font-weight: 600; }
.menu__section.est-ouverte > a { color: var(--accent); }

/* La page ouverte, section ou sous-page. */
.menu a.est-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-doux);
}

/* Pages de la section ouverte — seule celle-là est dépliée. */
.menu__sous { padding: .2rem 0 .6rem; }
.menu__sous a {
  padding: .28rem 1.5rem .28rem 2.4rem;
  font-size: .9rem;
  color: var(--texte-doux);
}
.menu__sous a.est-active { font-weight: 500; }

.menu__pied {
  margin-top: 2rem;
  padding: 1rem 1.5rem 0;
  border-top: 1px solid var(--trait);
  font-size: .82rem;
  color: var(--texte-doux);
}
.menu__pied a { display: inline; padding: 0; color: var(--texte-doux); text-decoration: underline; }

/* ---------- Colonne de droite, scrollable -------------------------- */

.contenu {
  margin-left: var(--largeur-menu);
  padding: 3rem 3rem 6rem;
  max-width: calc(var(--largeur-menu) + 52rem);
}

.entete { border-bottom: 1px solid var(--trait); padding-bottom: 1.5rem; margin-bottom: 2.5rem; }

.surtitre {
  margin: 0 0 .4rem;
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--texte-doux);
}

h1 { margin: 0; font-size: 2rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { margin: 3rem 0 .9rem; font-size: 1.35rem; line-height: 1.3; }
h3 { margin: 2rem 0 .6rem; font-size: 1.05rem; }
h2 + h3 { margin-top: 1.2rem; }

.chapeau { margin: .9rem 0 0; font-size: 1.05rem; color: var(--texte-doux); max-width: 46rem; }

p, ul, ol { max-width: 46rem; }
p { margin: 0 0 1rem; }

a { color: var(--accent); }

/* ---------- Composants réutilisables ------------------------------- */

/* Lien vers un écran du back-office :
   <a class="chemin" href="…/wp-admin/edit.php" target="_blank" rel="noopener">
     Articles <b>›</b> Ajouter</a> */
.chemin {
  display: inline-block;
  background: var(--fond-doux);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: .35rem .7rem;
  font-size: .9rem;
  color: var(--texte-doux);
}
.chemin b { color: var(--texte); font-weight: 600; }

a.chemin { text-decoration: none; }
a.chemin::after { content: " \2197"; opacity: .55; }
a.chemin:hover {
  border-color: var(--accent);
  background: var(--accent-doux);
  color: var(--accent);
}
a.chemin:hover b { color: var(--accent); }

/* Retour vers le sommaire de la section, au-dessus du titre. */
.surtitre a { color: var(--texte-doux); text-decoration: none; }
.surtitre a::before { content: "\2039\00a0"; }
.surtitre a:hover { color: var(--accent); text-decoration: underline; }

/* Marche à suivre numérotée */
ol.etapes { counter-reset: etape; list-style: none; padding: 0; margin: 1.2rem 0; }
ol.etapes > li {
  counter-increment: etape;
  position: relative;
  padding: 0 0 1.1rem 2.6rem;
  border-left: 1px solid var(--trait);
  margin-left: .85rem;
}
ol.etapes > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.etapes > li::before {
  content: counter(etape);
  position: absolute; left: -.85rem; top: 0;
  width: 1.7rem; height: 1.7rem;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* Encadrés */
.note, .attention {
  border: 1px solid var(--trait);
  border-left: 3px solid var(--accent);
  background: var(--accent-doux);
  border-radius: var(--rayon);
  padding: .9rem 1.1rem;
  margin: 1.4rem 0;
  max-width: 46rem;
}
.attention { border-left-color: var(--attention); background: var(--attention-fond); }
.note > :last-child, .attention > :last-child { margin-bottom: 0; }
.note strong, .attention strong { display: block; margin-bottom: .25rem; }
.attention strong { color: var(--attention); }

/* Tableau de champs */
table { border-collapse: collapse; width: 100%; max-width: 46rem; margin: 1.4rem 0; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .6rem .8rem; border-bottom: 1px solid var(--trait); }
thead th { background: var(--fond-doux); border-bottom: 1px solid var(--trait); font-size: .85rem; letter-spacing: .02em; }
tbody tr:last-child td { border-bottom: none; }

/* Capture d'écran du back-office */
figure.capture { margin: 1.6rem 0; max-width: 46rem; }
figure.capture img { display: block; width: 100%; height: auto; border: 1px solid var(--trait); border-radius: var(--rayon); }
figure.capture figcaption { margin-top: .5rem; font-size: .87rem; color: var(--texte-doux); }

code {
  background: var(--fond-doux);
  border: 1px solid var(--trait);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
}

/* Cartes de l'accueil */
.cartes { list-style: none; padding: 0; margin: 1.8rem 0 0; max-width: 52rem;
          display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.cartes a {
  display: block; height: 100%;
  border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 1rem 1.1rem; text-decoration: none; color: var(--texte);
  background: var(--fond);
}
.cartes a:hover { border-color: var(--accent); background: var(--accent-doux); }
.cartes strong { display: block; margin-bottom: .2rem; }
.cartes span { font-size: .9rem; color: var(--texte-doux); }

/* Marqueur des zones encore à écrire — supprimer au fur et à mesure */
.a-completer {
  color: var(--texte-doux);
  font-style: italic;
  border: 1px dashed var(--trait);
  border-radius: var(--rayon);
  padding: .8rem 1rem;
  max-width: 46rem;
}

/* ---------- Écrans étroits ----------------------------------------- */

@media (max-width: 60rem) {
  .menu {
    position: static;
    width: auto; height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--trait);
    padding: 1.25rem 0 1rem;
  }
  /* Le menu se replie en pastilles : sinon il occupe tout l'écran
     avant le premier mot du contenu. */
  .menu > ul {
    display: flex; flex-wrap: wrap; gap: .4rem;
    padding: 0 1.25rem;
  }
  .menu a {
    padding: .3rem .7rem;
    border: 1px solid var(--trait);
    border-left-width: 1px;
    border-radius: 999px;
    font-size: .9rem;
    background: var(--fond);
  }
  .menu a.est-active {
    border-color: var(--accent);
    border-left-color: var(--accent);
  }
  /* La section ouverte prend toute la largeur : ses pages se rangent
     sous elle au lieu de s'intercaler entre les autres pastilles. */
  .menu__section.est-ouverte { flex-basis: 100%; }
  .menu__section.est-ouverte > a { display: inline-block; margin-bottom: .45rem; }
  /* le titre est un lien lui aussi : il ne prend pas la forme d'une pastille */
  a.menu__titre {
    border: none; border-radius: 0; background: none;
    font-size: 1.05rem;
    padding: 0 1.25rem .9rem;
  }
  .menu__sous {
    display: flex; flex-wrap: wrap; gap: .4rem;
    padding: 0 0 .3rem .9rem;
    margin-left: .2rem;
    border-left: 2px solid var(--trait);
  }
  .menu__sous a { padding: .25rem .65rem; font-size: .85rem; }
  .menu__pied { display: none; }

  .contenu { margin-left: 0; padding: 2rem 1.25rem 4rem; }
}

/* ---------- Impression --------------------------------------------- */

@media print {
  .menu, .evitement { display: none; }
  .contenu { margin: 0; max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Blocs de code du gabarit -------------------------------- */

pre {
  background: var(--fond-doux);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: .9rem 1rem;
  margin: .8rem 0 2rem;
  max-width: 46rem;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.5;
}
pre code { background: none; border: none; padding: 0; }
