/* Feuille de style optimisée pour l'impression - Style revue scientifique */

@media print {
  /* Configuration générale de la page */
  @page {
    margin-top: 2cm;
    margin-right: 2cm;
    margin-bottom: 3cm; /* Marge plus grande pour masquer l'URL du navigateur */
    margin-left: 2cm;
    size: A4 portrait;
  }

  /* Réinitialisation des couleurs pour économiser l'encre */
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Corps du document */
  body {
    font-family: 'Times New Roman', 'Georgia', serif;
    font-size: 10pt;
    line-height: 1.5;
    color: #333;
    background: white;
  }

  /* Masquer les éléments de navigation et d'interface */
  header,
  nav,
  footer,
  .no-print,
  button,
  input,
  select,
  textarea,
  [role="navigation"],
  [role="banner"],
  [role="contentinfo"],
  .comment-section,
  [class*="comment"],
  #comments,
  [class*="share"],
  [class*="social"],
  .action-buttons,
  audio,
  video {
    display: none !important;
  }

  /* Masquer spécifiquement la section commentaires */
  div:has(> h2:first-child) h2:first-child:is(:contains("Commentaires")),
  div:has(> h2:first-child:contains("Commentaires")),
  article > div.border-t:has(h2),
  article div.mt-16:has(h2:contains("Commentaires")),
  div.border-t.border-slate-200.pt-16 {
    display: none !important;
  }

  /* Afficher uniquement le contenu principal */
  main,
  article {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  /* Conteneur principal */
  .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* En-tête du site hostier.be */
  article::before {
    content: "hostier.be";
    display: block;
    font-family: sans-serif;
    font-size: 14pt;
    font-weight: bold;
    border-bottom: 1px solid #000;
    padding-bottom: 0.3cm;
    margin-bottom: 0.2cm;
  }

  /* Sous-titre de l'en-tête */
  article > header::before {
    content: "Article rédigé sur base d'une revue de la littérature scientifique";
    display: block;
    font-family: sans-serif;
    font-size: 10pt;
    font-style: italic;
    color: #666 !important;
    margin-bottom: 0.8cm;
  }

  /* En-tête de l'article */
  article > header {
    display: block !important;
    position: relative;
    margin-bottom: 1cm;
    padding-bottom: 0;
    border-bottom: none !important;
  }

  /* Titre de l'article */
  article > header > h1 {
    font-family: sans-serif !important;
    font-size: 18pt !important;
    font-weight: bold !important;
    margin-bottom: 0.6cm !important;
    margin-top: 0 !important;
    line-height: 1.3 !important;
    page-break-after: avoid;
    color: black !important;
  }

  /* Phrase d'accroche */
  article > header .hook-phrase {
    font-size: 11pt !important;
    font-style: italic !important;
    color: #333 !important;
    margin-bottom: 0.6cm !important;
    line-height: 1.4 !important;
    text-align: justify !important;
  }

  /* Résumé (Abstract) */
  article > header .summary {
    background: white !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 0.8cm !important;
    font-size: 10pt !important;
    text-align: justify !important;
  }

  article > header .summary strong {
    display: none !important;
  }

  article > header .summary p {
    margin: 0 !important;
  }

  /* Métadonnées (date, catégorie, vues) */
  article > header > div:last-child {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.2cm !important;
    font-family: sans-serif;
    font-size: 9pt !important;
    color: #666 !important;
    margin-top: 0.5cm !important;
    padding-top: 0.3cm !important;
    border-top: 1px solid #ccc !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  /* Masquer les icônes dans les métadonnées */
  article > header > div:last-child svg {
    display: none !important;
  }

  /* Catégorie */
  article > header > div:last-child > span:first-child {
    font-size: 9pt !important;
    text-transform: none !important;
    font-weight: normal !important;
    letter-spacing: normal !important;
    margin-bottom: 0 !important;
  }

  /* Afficher "Date de création :" avant la date */
  article > header > div:last-child > div:first-of-type::before {
    content: "Date de création : ";
    font-weight: bold;
  }

  /* Afficher "Catégorie du site :" avant la catégorie */
  article > header > div:last-child > span:first-child::before {
    content: "Catégorie du site : ";
    font-weight: bold;
  }

  /* Masquer le compteur de vues */
  article > header > div:last-child > div:last-child {
    display: none !important;
  }

  /* Image de bannière - masquée complètement */
  div.aspect-\[16\/9\],
  div[class*="aspect-"],
  article > div:first-of-type img,
  article img[class*="aspect"] {
    display: none !important;
  }

  /* Lecteur audio */
  article > div:has(audio) {
    display: none !important;
  }

  /* Corps du texte */
  article > div:not(header):not(:first-of-type) {
    width: 100%;
    text-align: justify;
  }

  /* Titres */
  h2 {
    font-size: 14pt;
    font-weight: bold;
    margin-top: 0.8cm;
    margin-bottom: 0.4cm;
    page-break-after: avoid;
    color: black;
  }

  h3 {
    font-size: 12pt;
    font-weight: bold;
    margin-top: 0.6cm;
    margin-bottom: 0.3cm;
    page-break-after: avoid;
    color: black;
  }

  h4 {
    font-size: 11pt;
    font-weight: bold;
    margin-top: 0.5cm;
    margin-bottom: 0.2cm;
    page-break-after: avoid;
    color: black;
  }

  /* Paragraphes */
  p {
    text-align: justify;
    margin-bottom: 0.4cm;
    orphans: 3;
    widows: 3;
    font-size: 10pt;
    line-height: 1.5;
  }

  /* Listes */
  ul, ol {
    margin-left: 1cm;
    margin-bottom: 0.4cm;
  }

  li {
    margin-bottom: 0.2cm;
    text-align: justify;
  }

  /* Citations */
  blockquote {
    margin: 0.5cm 1cm;
    padding-left: 0.5cm;
    border-left: 3pt solid #ccc;
    font-style: italic;
    page-break-inside: avoid;
  }

  /* Images dans le contenu */
  img {
    max-width: 100%;
    height: auto;
    page-break-inside: avoid;
    page-break-after: auto;
    display: block;
    margin: 0.5cm auto;
  }

  /* Tableaux */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.5cm;
    page-break-inside: avoid;
    font-size: 9pt;
  }

  th, td {
    border: 1pt solid #000;
    padding: 0.2cm;
    text-align: left;
  }

  th {
    font-weight: bold;
    background: #f0f0f0 !important;
  }

  /* Liens */
  a {
    color: black;
    text-decoration: none;
  }

  /* Afficher "hostier.be" après les liens externes (sauf DOI) */
  a[href^="http"]:not([href*="doi.org"]):after {
    content: " (hostier.be)";
    font-size: 8pt;
    color: #666;
  }

  /* Masquer l'URL complète et afficher uniquement hostier.be */
  a[href^="http"] {
    text-decoration: none;
  }
  
  a[href^="http"]:not([href*="doi.org"]) {
    font-size: 0;
  }
  
  a[href^="http"]:not([href*="doi.org"]):after {
    content: "hostier.be";
    font-size: 8pt;
    color: #333;
  }

  /* Ne pas afficher les URLs pour les liens internes */
  a[href^="#"]:after,
  a[href^="/"]:after {
    content: "";
  }

  /* Style spécial pour les références DOI */
  a[href*="doi.org"] {
    font-size: 8pt;
    line-height: 1.1;
  }

  /* Paragraphes contenant des références bibliographiques */
  p:has(a[href*="doi.org"]) {
    font-size: 8pt !important;
    line-height: 1.2 !important;
    margin-bottom: 0.2cm !important;
  }

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

  p, blockquote, ul, ol, dl, tr, img {
    page-break-inside: avoid;
  }

  /* Contenu de l'article avec prose */
  .prose,
  [class*="prose-"] {
    max-width: 100%;
  }

  /* Masquer les éléments décoratifs */
  .shadow,
  .shadow-lg,
  .shadow-xl,
  [class*="shadow-"] {
    box-shadow: none !important;
  }

  /* Bordures simples pour l'impression */
  .border,
  [class*="border-"] {
    border-color: #ccc !important;
  }

  /* Espacement des sections */
  section {
    margin-bottom: 0.8cm;
  }

  /* Masquer les articles similaires */
  [class*="similar"],
  [class*="related"] {
    display: none !important;
  }

  /* Note : Les pieds de page (auteur, date, numérotation) doivent être ajoutés via les paramètres d'impression du navigateur */
  /* car les éléments en position fixed peuvent se superposer au contenu */
}
