/* ==========================================================================
   Impression
   ========================================================================== */

@media print {
  /* --- Masquer les éléments non pertinents --- */
  .site-header,
  .site-nav,
  .site-footer,
  .skip-link,
  .theme-toggle,
  .nav-toggle-label,
  .partage-social,
  .table-des-matieres,
  .fil-ariane {
    display: none !important;
  }

  /* --- Forcer les couleurs --- */
  body {
    color: #000 !important;
    background: #fff !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }

  /* --- Afficher les URL des liens --- */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    font-weight: 400;
    color: #555;
  }

  /* Ne pas afficher l'URL pour les liens internes et les ancres */
  a[href^="#"]::after,
  a[href^="/"]::after,
  .note-ref::after,
  .note-retour::after {
    content: none;
  }

  /* --- Mise en page --- */
  main {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* --- Éviter les coupures --- */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }

  p, li, blockquote {
    orphans: 3;
    widows: 3;
  }

  .encart,
  .bibliographie,
  .glossaire,
  .ressource-externe,
  .depliable,
  blockquote,
  pre,
  figure,
  table {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* --- Ouvrir tous les dépliables --- */
  details {
    display: block !important;
  }

  details[open] summary ~ * {
    display: block !important;
  }

  /* --- Encarts : simplifier les bordures --- */
  .encart {
    border: 1px solid #ccc !important;
    border-left-width: 4px !important;
    background: none !important;
  }

  /* --- Images --- */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* --- Code --- */
  pre {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  code {
    background: #f5f5f5 !important;
  }

  /* --- Carte d'article --- */
  .carte-article {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* --- Tags --- */
  .tag {
    border: 1px solid #ccc !important;
    background: none !important;
    color: #000 !important;
  }
}
