/* =====================================================================
   pages/article.css — la page de lecture d'un article
   (format « lecture longue » inspiré de lilianweng.github.io)
   ===================================================================== */

.post { max-width: 760px; margin: 0 auto; padding: 64px 0 96px; }

/* Fil d'Ariane : Blog › Tutoriel */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--faint); flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.crumbs a { color: var(--muted); min-height: 32px; display: inline-flex; align-items: center; }
.crumbs a:hover { color: var(--link); }

.post-title { font-size: 44px; line-height: 1.15; margin-top: 18px; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; font-size: 14px; color: var(--faint); }
.post-meta .sep { opacity: .5; }
.post-tags { margin-top: 18px; }
.post-cover { margin-top: 32px; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }

/* Avis « article disponible seulement en français / anglais » */
.lang-notice {
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-2);
  background: var(--accent-bg);
  border: 1px solid rgba(247, 102, 34, 0.35);
}

/* Sommaire repliable */
.toc { margin: 36px 0 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 0 22px; }
.toc summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary svg { transition: transform .25s ease; }
.toc[open] summary svg { transform: rotate(180deg); }
.toc ol { margin: 0 0 18px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.toc ol ol { margin: 6px 0 0; }
.toc a { font-size: 15px; color: var(--muted); line-height: 1.6; transition: color .15s ease; }
.toc a:hover { color: var(--link); }

/* ---------- Le texte de l'article ---------- */
.prose { color: var(--text-2); margin-top: 32px; }
.prose h2 { font-size: 28px; line-height: 1.3; margin: 56px 0 16px; }
.prose h3 { font-size: 21px; line-height: 1.35; margin: 36px 0 12px; }
.prose p { font-size: 17.5px; line-height: 1.85; margin: 0 0 20px; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 24px; font-size: 17px; line-height: 1.8; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text); }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: 14px; border: 1px solid var(--border); background: var(--surface); margin: 30px auto; }
/* Figures liées depuis arXiv : fond transparent et texte noir, illisibles en thème sombre sans fond blanc */
.prose img[src*="arxiv.org/"] { background: #FFFFFF; padding: 12px; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 48px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.prose th { color: var(--text); }

/* Lien « # » à côté des titres (ajouté par article.js) */
.anchor { margin-left: 10px; color: var(--faint) !important; text-decoration: none !important; opacity: 0; font-weight: 500; transition: opacity .15s ease; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }

/* Citation / encadré : en Markdown, une ligne qui commence par « > » */
.prose blockquote {
  margin: 30px 0;
  padding: 20px 24px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--link);
}
.prose blockquote p { margin: 0; font-size: 17px; }
.prose blockquote p + p { margin-top: 10px; }

/* Code dans une phrase : `print()` */
.prose :not(pre) > code {
  font-family: var(--font-code);
  font-size: .86em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Bloc de code (article.js ajoute la barre du haut et le bouton « Copier ») */
.code { margin: 30px 0; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.25); background: var(--code-bg); }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-code);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: border-color .15s ease, color .15s ease;
}
.copy-btn:hover { border-color: var(--blue-light); color: var(--white); }
.prose pre,
.cite pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 14px;
  line-height: 1.75;
  color: var(--code-fg);
  background: var(--code-bg);
  white-space: pre;
}
.prose > pre { margin: 30px 0; border-radius: 14px; }  /* si JavaScript est désactivé */
.prose pre code { font-family: inherit; background: none; border: none; padding: 0; color: inherit; }

/* Couleurs de la coloration syntaxique (aux couleurs DAH) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7C93B5; font-style: italic; }
.token.keyword, .token.boolean, .token.important, .token.atrule { color: #F99464; }
.token.string, .token.char, .token.attr-value, .token.regex { color: #9FD18B; }
.token.number, .token.constant, .token.symbol { color: #F7B267; }
.token.function, .token.class-name { color: #7FB6FF; }
.token.builtin, .token.decorator, .token.tag, .token.selector { color: #89B8F5; }
.token.operator, .token.punctuation { color: #B9C9E0; }
.token.property, .token.attr-name, .token.variable { color: #DCEAFC; }

/* Formule mathématique (bloc ```math```, affichée par KaTeX) */
.math-block {
  margin: 28px 0;
  padding: 22px;
  text-align: center;
  font-size: 20px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: "Times New Roman", Georgia, serif;
}

/* Figure avec légende : ![texte](image) suivi d'une ligne en italique */
.prose p > img + em, .prose figcaption { display: block; margin-top: -14px; font-size: 14px; line-height: 1.6; color: var(--faint); text-align: center; }

/* ---------- Bas de l'article ---------- */
.post-section { margin-top: 56px; }
.post-section h2 { font-size: 24px; }
.cite p { margin-top: 12px; font-size: 16px; line-height: 1.7; color: var(--muted); }
.cite pre { margin-top: 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.25); font-size: 13px; line-height: 1.7; }

.share { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px 0; margin-top: 56px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.share__buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.author-card { margin-top: 32px; padding: 26px; display: flex; gap: 18px; align-items: flex-start; }
.author-card strong { display: block; font-size: 17px; color: var(--text); margin-top: 2px; }
.author-card p { margin-top: 6px; }

.post-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 48px; }
.post-nav a { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.post-nav .is-next { text-align: right; align-items: flex-end; }
.post-nav strong { font-size: 15px; line-height: 1.4; color: var(--text); }

.back-link { margin-top: 40px; text-align: center; }

/* Dans la colonne de lecture, l'encart newsletter passe sur deux lignes */
.post .newsletter { flex-direction: column; align-items: stretch; }
.post .newsletter__fields .field { width: 100%; }
.post .newsletter__fields .form-group { flex-grow: 1; }

/* Formule affichée par KaTeX : on retire le style « texte brut » */
.math-block .katex-display { margin: 0; }
.math-block:has(.katex) { font-family: inherit; white-space: normal; }
/* KaTeX utilise lui aussi les classes « accent » (x̄, ŷ) et « tag » (\tag{1}) :
   on neutralise ici les styles du site qui portent le même nom. */
.math-block .accent { color: inherit; }
.math-block .tag { display: inline; padding: 0; border-radius: 0; background: none; font-size: inherit; font-weight: inherit; color: inherit; }

@media (max-width: 760px) {
  .post { padding: 40px 0 64px; }
  .post-title { font-size: 32px; }
  .prose h2 { font-size: 24px; }
  .prose p { font-size: 16.5px; }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav .is-next { text-align: left; align-items: flex-start; }
}
