/* ==========================================================================
   Documentation (templates/documentation.html) : barre latérale + texte.
   Jetons de styles.css uniquement (thème sombre ou clair). La version
   imprimée (PDF, voir docs_pdf.py) repasse en noir sur blanc.
   ========================================================================== */

.page-hero--compact .doc-version {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.page-hero--compact .doc-version .icon {
  width: 18px;
  height: 18px;
  color: var(--green);
}

.docs-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.docs-side {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  padding-right: 4px;
}

.docs-side-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-nav,
.docs-toc {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-nav > li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
}

.docs-nav > li > a .icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--solar);
}

.docs-nav > li > a:hover,
.docs-nav > li > a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text);
}

.docs-toc {
  margin: 4px 0 10px 18px;
  padding-left: 12px;
  border-left: 2px solid var(--line-2);
}

.docs-toc a {
  display: block;
  padding: 5px 8px;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
}

.docs-toc a:hover {
  color: var(--text);
}

.docs-soon span {
  display: block;
  padding: 7px 12px 7px 40px;
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 0.7;
}

.docs-tools {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.docs-tools .muted {
  margin: 6px 0 0;
}

.docs-side-link {
  margin: 10px 0 0;
  font-size: 0.92rem;
}

.docs-main {
  max-width: 78ch;
}

.docs-main h2 {
  margin-top: 2.2rem;
}

.docs-main > .doc-section:first-child h2,
.docs-main > .docs-cards:first-child {
  margin-top: 0;
}

.doc-section {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.doc-steps {
  padding-left: 1.4em;
}

.doc-steps li + li {
  margin-top: 0.7em;
}

.docs-main code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 1.6rem;
}

.docs-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
}

.docs-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.docs-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.97rem;
}

.docs-planned {
  padding-left: 1.2em;
  color: var(--muted);
}

.docs-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.docs-pager a {
  font-weight: 600;
  text-decoration: none;
}

.doc-summary {
  font-size: 1.05rem;
  color: var(--text-2);
}

.doc-chapter + .doc-chapter {
  margin-top: 3.2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

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

  .docs-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .docs-soon {
    display: none;
  }
}

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

@media print {
  :root,
  :root[data-theme] {
    --bg: #fff;
    --bg-2: #fff;
    --surface: #fff;
    --surface-2: #f2f4f8;
    --surface-3: #e8ecf3;
    --line: #d5dbe6;
    --line-2: #b8c2d4;
    --text: #10151f;
    --text-2: #1f2735;
    --muted: #4a5567;
    color-scheme: light;
  }

  body {
    background: #fff !important;
    color: #10151f !important;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .docs-side,
  .docs-pager,
  .cta-band,
  .page-hero::before,
  .page-hero::after,
  .docs-cards ~ .callout,
  main > section:last-of-type {
    display: none !important;
  }

  .docs-layout {
    display: block;
  }

  .docs-main {
    max-width: none;
  }

  .page-hero {
    padding: 0 0 12pt;
    background: none;
  }

  .doc-chapter {
    break-before: page;
  }

  .doc-chapter:first-of-type {
    break-before: auto;
  }

  .faq-item,
  .callout {
    break-inside: avoid;
  }

  .docs-main h2,
  .docs-main h3 {
    break-after: avoid;
  }

  .docs-main li {
    break-inside: avoid;
  }

  .faq-item .faq-answer {
    display: block !important;
  }

  a {
    color: #0a4fa8 !important;
    text-decoration: none;
  }
}

/* Même rendu à l'écran avec ?print=1 (aperçu du PDF). */
.docs-print .site-header,
.docs-print .site-footer,
.docs-print .docs-side,
.docs-print .docs-pager,
.docs-print .cta-band {
  display: none !important;
}

.docs-print .docs-layout {
  display: block;
}
