/* ============================================================================
   02 — OFFICIEL
   ----------------------------------------------------------------------------
   Style institutionnel sérieux : police serif Times-like, couleurs sombres,
   numérotation automatique des sections, marges étroites, paragraphes avec
   indentation classique française. Pour courriers DASEN/IEN, conventions,
   demandes formelles.
   ============================================================================ */

/* ============================================================================
   CORRECTIF — Neutralisation des puces de liste générées par l'extension
   ----------------------------------------------------------------------------
   L'extension logseq-pdf-export-plugin transforme CHAQUE bloc LogSeq en un
   élément <li> d'une liste HTML. Les "cercles" visibles dans le PDF sont donc
   les puces standard des <li>. On les masque ici pour avoir un rendu lisse.
   Conséquence : les listes Markdown explicites n'auront pas non plus de puces
   dans le PDF — c'est un compromis nécessaire puisque tout est rendu en liste.
   Si tu veux RESTAURER les puces, supprime ce bloc.
   ============================================================================ */

/* Neutralisation totale des puces de liste */
ul, ol {
  list-style: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

li {
  list-style: none !important;
}

li::marker {
  content: "" !important;
}

/* Au cas où LogSeq préserverait aussi ses classes internes : on les masque */
.bullet,
.bullet-container,
.bullet-link-wrap,
.block-control,
.rotating-arrow,
.control-hide,
.block-control-wrap {
  display: none !important;
}

/* Annule le décalage négatif que LogSeq applique au conteneur de blocs */
.page-blocks-inner {
  margin-left: 0 !important;
}

:root {
  --couleur-titre: #1A1A1A;
  --couleur-lien: #003366;
  --couleur-texte: #000000;
  --couleur-filet: #888888;
  --couleur-encadre: #F0F0F0;

  --police-titre: 'Liberation Serif', 'Times New Roman', 'TeX Gyre Termes', serif;
  --police-texte: 'Liberation Serif', 'Times New Roman', 'TeX Gyre Termes', serif;
  --police-code:  'Liberation Mono', 'Courier New', monospace;

  --taille-base: 11pt;
  --interligne: 1.4;
}

/* === 2. MISE EN PAGE & PAGINATION === */
@page {
  size: A4;
  margin: 2cm 2cm 2.5cm 2cm;               /* Marges étroites pour densité */

  /* Pied de page : mention du type de document à gauche, pagination à droite */
  @bottom-left {
    content: "Document officiel";          /* Modifie ce texte si besoin */
    font-family: 'Liberation Serif', serif;
    font-size: 9pt;
    font-style: italic;
    color: #555555;
    padding-top: 0.5cm;
  }

  @bottom-right {
    content: "Page " counter(page) " / " counter(pages);
    font-family: 'Liberation Serif', serif;
    font-size: 9pt;
    color: #555555;
    padding-top: 0.5cm;
  }
}

@page :first { margin-top: 3cm; }

/* === 3. STRUCTURE DE BASE === */
body {
  font-family: var(--police-texte);
  font-size: var(--taille-base);
  line-height: var(--interligne);
  color: var(--couleur-texte);
  text-align: justify;                     /* Justification active */
  hyphens: auto;
}

/* === 4. TITRES + NUMÉROTATION AUTOMATIQUE === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--police-titre);
  color: var(--couleur-titre);
  font-weight: bold;
  page-break-after: avoid;
  break-after: avoid;
  text-align: left;
  hyphens: none;
}

/* Titre principal centré avec filet de séparation */
h1 {
  font-size: 1.8em;
  margin: 0 0 0.5em 0;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--couleur-titre);
  text-align: center;
}

h2 { font-size: 1.3em; margin: 1.2em 0 0.4em 0; }
h3 { font-size: 1.15em; margin: 1em 0 0.3em 0; }
h4 { font-size: 1.05em; margin: 0.8em 0 0.2em 0; }
h5, h6 { font-size: 1em; font-style: italic; margin: 0.6em 0 0.2em 0; }

/* --- NUMÉROTATION AUTOMATIQUE DES SECTIONS ---
   Pour DÉSACTIVER : supprimer ou commenter le bloc suivant */
body { counter-reset: section; }
h2 { counter-reset: subsection; }
h2::before { counter-increment: section; content: counter(section) ". "; }
h3 { counter-reset: subsubsection; }
h3::before { counter-increment: subsection;
             content: counter(section) "." counter(subsection) " "; }
h4::before { counter-increment: subsubsection;
             content: counter(section) "." counter(subsection) "." counter(subsubsection) " "; }

/* === 5. PARAGRAPHES === */
/* Style français classique : indentation à la première ligne, peu d'espacement */
p {
  margin: 0 0 0.4em 0;
  text-indent: 1.2em;
  orphans: 3;
  widows: 3;
}
h1 + p, h2 + p, h3 + p, h4 + p { text-indent: 0; }   /* Pas d'indent après titre */
strong, b { font-weight: bold; }
em, i { font-style: italic; }

/* === 6. LIENS === */
a, a:link, a:visited { color: var(--couleur-lien); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === 7. LISTES === */
ul, ol { margin: 0.4em 0 0.6em 0; padding-left: 1.5em; }
li { margin-bottom: 0.1em; text-align: left; text-indent: 0; }
li > ul, li > ol { margin: 0.1em 0; }

/* === 8. TABLEAUX === */
/* Style formel avec bordures complètes */
table { width: 100%; border-collapse: collapse; margin: 0.8em 0 1em;
        page-break-inside: avoid; }
th, td { padding: 0.4em 0.6em; text-align: left; vertical-align: top;
         border: 1px solid var(--couleur-filet); text-indent: 0; }
thead th { background-color: var(--couleur-encadre); font-weight: bold;
           color: var(--couleur-titre); border-bottom: 2px solid var(--couleur-titre); }

/* === 9. CITATIONS === */
/* Style sobre, sans encadré coloré */
blockquote { margin: 0.8em 2em; padding: 0; border: none;
             font-style: italic; page-break-inside: avoid; }
blockquote p { text-indent: 0; }

/* === 10. CODE === */
code { font-family: var(--police-code); font-size: 0.9em;
       background-color: var(--couleur-encadre); padding: 0.1em 0.3em; }
pre { font-family: var(--police-code); font-size: 0.85em;
      background-color: var(--couleur-encadre); padding: 0.6em;
      border: 1px solid var(--couleur-filet); margin: 0.8em 0;
      overflow-x: auto; white-space: pre-wrap; }
pre code { background: none; padding: 0; }

/* === 11. IMAGES & HR === */
img { max-width: 100%; height: auto; display: block; margin: 0.8em auto; }
hr { border: none; border-top: 1px solid var(--couleur-filet); margin: 1.5em 0; }

/* === 12. IMPRESSION === */
@media print {
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h1, h2, h3, h4, h5, h6 { page-break-after: avoid; break-after: avoid; }
}
