/* ============================================================
   DCP — Rendu du Markdown dans la visionneuse

   Ne style que ce que outil-markdown.js sait produire : titres h2 a
   h6 (les niveaux du document sont abaisses d'un cran), paragraphes,
   listes simples, citations, tableaux, regles, gras, italique et code
   en ligne.
   ============================================================ */

/* La mesure de lecture reste bornee meme si le cadre est large : un
   document technique se lit mal en lignes de 150 caracteres. Les
   tableaux, eux, echappent a cette limite plus bas. */
.markdown {
  max-width: 78ch;
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.75;
}

/* --- Titres ------------------------------------------------------------ */

.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.markdown > :first-child { margin-top: 0; }

.markdown h2 {
  font-size: 1.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
}

.markdown h3 { font-size: 1.1875rem; }
.markdown h4 { font-size: 1.0625rem; }

.markdown h5,
.markdown h6 {
  font-size: 0.9375rem;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* --- Texte courant ----------------------------------------------------- */

.markdown p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Le gras doit ressortir du gris du paragraphe, sinon il passe inapercu
   sur une couleur deja attenuee. */
.markdown strong { color: var(--text-primary); }

.markdown em { font-style: italic; }

.markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background-color: var(--surface-alt);
  color: var(--text-primary);
}

.markdown hr {
  height: 1px;
  border: 0;
  background-color: var(--border);
  margin-block: 2rem;
}

/* --- Listes ------------------------------------------------------------ */

.markdown ul,
.markdown ol {
  margin: 0 0 1rem 1.25rem;
  color: var(--text-secondary);
}

.markdown li { margin-bottom: 0.375rem; }

.markdown li::marker { color: var(--accent-gold); }

/* --- Citations --------------------------------------------------------- */

.markdown blockquote {
  margin: 1.5rem 0;
  padding: 0.875rem 1.25rem;
  border-left: 3px solid var(--accent-gold);
  background-color: var(--surface);
  border-radius: 0 8px 8px 0;
}

.markdown blockquote p {
  margin: 0;
  color: var(--text-primary);
  font-family: 'Source Serif Pro', Georgia, serif;
  font-size: 1.0625rem;
}

/* --- Tableaux ---------------------------------------------------------- */

/* Le pack va jusqu'a sept colonnes : le tableau sort de la mesure de
   lecture et defile horizontalement dans son propre conteneur, plutot
   que de pousser toute la page. */
.markdown-tableau {
  max-width: none;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.markdown th,
.markdown td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.markdown th {
  background-color: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
}

.markdown td { color: var(--text-secondary); }

.markdown tbody tr:last-child th,
.markdown tbody tr:last-child td { border-bottom: 0; }

/* --- Etat de chargement ------------------------------------------------ */

.markdown-attente {
  color: var(--text-secondary);
  font-style: italic;
}
