/* Guide : une colonne de lecture et son sommaire. */

.page-guide {
  background: var(--surface);
  font-size: 1rem;
  line-height: 1.6;
}

.guide {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: 1240px;
  margin: 0 auto;
}

.sommaire {
  position: sticky;
  top: var(--entete);
  align-self: start;
  max-height: calc(100vh - var(--entete));
  overflow-y: auto;
  padding: 28px 16px 28px 24px;
  border-right: 1px solid var(--trait);
  font-size: 0.875rem;
  line-height: 1.4;
}

.sommaire-titre {
  margin: 0 0 10px;
  color: var(--texte-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sommaire ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sommaire > ol > li {
  margin-bottom: 10px;
}

.sommaire > ol > li > a {
  color: var(--texte);
  font-weight: 600;
}

.sommaire ol ol {
  margin: 4px 0 0;
  padding-left: 10px;
  border-left: 1px solid var(--trait);
}

.sommaire a {
  display: block;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--texte-2);
  text-decoration: none;
}

.sommaire a:hover {
  background: var(--bleu-fond);
  color: var(--bleu-800);
}

.sommaire a[aria-current="true"] {
  background: var(--bleu-fond);
  color: var(--bleu-800);
}

.sommaire-pied {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--trait);
}

.guide-texte {
  min-width: 0;
  max-width: 860px;
  padding: 32px 40px 96px;
}

.guide-texte h1 {
  margin: 0 0 16px;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.15;
}

.guide-texte h2 {
  margin: 56px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--trait);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.25;
}

.guide-texte h3 {
  margin: 36px 0 10px;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.guide-texte h4 {
  margin: 26px 0 8px;
  font-size: 1.0625rem;
  font-weight: 600;
}

.guide-texte p,
.guide-texte ul,
.guide-texte ol {
  margin: 0 0 14px;
}

.guide-texte li {
  margin-bottom: 4px;
}

.guide-texte li > p {
  margin-bottom: 6px;
}

.ancre {
  margin-left: 8px;
  color: var(--texte-3);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}

h1:hover .ancre,
h2:hover .ancre,
h3:hover .ancre,
h4:hover .ancre,
.ancre:focus-visible {
  opacity: 1;
}

.guide-texte code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #eef2f8;
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.guide-texte pre {
  position: relative;
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: var(--rayon);
  background: var(--bleu-nuit);
  color: #e6edf8;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.guide-texte pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
}

.copier-bloc {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 4px;
  background: var(--bleu-900);
  color: #fff;
  font: 500 0.75rem var(--police);
  cursor: pointer;
  opacity: 0;
}

pre:hover .copier-bloc,
.copier-bloc:focus-visible {
  opacity: 1;
}

.copier-bloc:focus-visible {
  outline-color: var(--or);
}

.tableau {
  margin: 0 0 18px;
  overflow-x: auto;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
}

.tableau table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.45;
}

.tableau th,
.tableau td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--trait);
  text-align: left;
  vertical-align: top;
}

.tableau th {
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}

.tableau tr:last-child td {
  border-bottom: 0;
}

/* Un code en tête de ligne (`clause_supprimee`) ne se coupe pas : le tableau défile s'il le faut. */
.tableau td:first-child code {
  overflow-wrap: normal;
  white-space: nowrap;
}

.guide-texte blockquote {
  margin: 0 0 14px;
  padding: 2px 16px;
  border-left: 3px solid var(--or);
  color: var(--texte-2);
}

.annexe {
  margin-top: 72px;
}

@media (max-width: 900px) {
  .guide {
    grid-template-columns: minmax(0, 1fr);
  }

  .sommaire {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--trait);
  }

  .guide-texte {
    padding: 24px 18px 72px;
  }

  .guide-texte h1 {
    font-size: 1.75rem;
  }
}

@media print {
  .entete,
  .sommaire,
  .copier-bloc {
    display: none;
  }

  .guide {
    display: block;
  }

  .guide-texte pre {
    border: 1px solid var(--trait);
    background: none;
    color: var(--texte);
    white-space: pre-wrap;
  }
}
