/* ════════════════════════════════════════════════════════════
   Blog — style clair, sobre, lisibilité d'abord.
   Inspiré des carnets de chercheurs (Karpathy, Chip Huyen, Lil'Log).
   ════════════════════════════════════════════════════════════ */

:root {
  --bg:      #fcfbf8;
  --ink:     #1b1b19;
  --soft:    #56544e;
  --muted:   #908d85;
  --rule:    #e7e2d6;
  --accent:  #1f5fa8;
  --accent-d:#164a85;
  --code-bg: #f5f3ec;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --measure: 42rem;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(var(--measure), 100% - 2.5rem);
  margin-inline: auto;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }

a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-d); }

::selection { background: #d8e4f2; }

/* ─── En-tête ─────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--rule); padding-block: 1.5rem; }
.site-header .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
}
.brand { text-decoration: none; color: var(--ink); line-height: 1.15; }
.brand .name { font-weight: 600; font-size: 1.3rem; }
.brand .sub {
  display: block; font-family: var(--mono); font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  margin-top: 0.25rem;
}
.site-nav { display: flex; gap: 1.4rem; font-family: var(--mono); font-size: 0.8rem; }
.site-nav a { color: var(--soft); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* ─── Accueil ─────────────────────────────────────────────── */
.hero { padding-block: clamp(2.5rem, 7vw, 4.5rem) 1.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); font-weight: 600; }
.hero h1 em { font-style: italic; color: var(--accent); }
.lede { margin-top: 1.1rem; font-size: 1.2rem; color: var(--soft); }

.section-label, .year-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule);
  margin-top: 2.5rem;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.year-label { color: var(--soft); }

/* Liste d'articles */
.post-list { list-style: none; padding: 0; }
.post-list li { padding-block: 1.15rem; border-bottom: 1px solid var(--rule); }
.post-list a {
  display: flex; gap: 1.5rem; align-items: baseline;
  text-decoration: none; color: var(--ink);
}
.post-list .date {
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  white-space: nowrap; flex: 0 0 8.5rem;
}
.post-list .title { font-size: 1.18rem; font-weight: 500; }
.post-list a:hover .title { color: var(--accent); text-decoration: underline; }
.post-list .excerpt { color: var(--soft); font-size: 1rem; margin-top: 0.3rem; padding-left: 10rem; }

@media (max-width: 600px) {
  .post-list a { flex-direction: column; gap: 0.15rem; }
  .post-list .excerpt { padding-left: 0; }
}

/* ─── Page / Article ──────────────────────────────────────── */
.page, .post { padding-block: clamp(2rem, 5vw, 3.5rem); }
.page-title { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin-bottom: 1.5rem; }

.back {
  display: inline-block; font-family: var(--mono); font-size: 0.78rem;
  color: var(--muted); text-decoration: none; margin-bottom: 1.8rem;
}
.back:hover { color: var(--accent); }

.post-header { margin-bottom: 2.2rem; }
.post-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 0.7rem; }
.post-header h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.post-desc { margin-top: 0.8rem; font-size: 1.22rem; font-style: italic; color: var(--soft); line-height: 1.45; }

/* Corps de texte */
.prose > * + * { margin-top: 1.3rem; }
.prose h2 { font-size: 1.55rem; margin-top: 2.6rem; }
.prose h3 { font-size: 1.25rem; margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.4rem; }
.prose blockquote {
  border-left: 3px solid var(--rule); padding-left: 1.2rem;
  color: var(--soft); font-style: italic;
}
.prose img { max-width: 100%; height: auto; border-radius: 4px; }
.prose figure { margin-block: 2rem; }
.prose figure img { display: block; margin-inline: auto; border: 1px solid var(--rule); }
.prose figcaption {
  margin-top: 0.6rem; text-align: center;
  font-size: 0.88rem; color: var(--soft); font-style: italic;
}
.prose hr { border: none; border-top: 1px solid var(--rule); margin-block: 2.2rem; }

/* Code en ligne */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: 0.85em;
  background: var(--code-bg); padding: 0.1em 0.4em; border-radius: 3px;
}

/* Blocs de code */
.prose pre, .prose .highlight {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}
.prose pre code { font-family: var(--mono); background: none; padding: 0; }
.prose .highlight pre { border: none; padding: 0; margin: 0; background: none; }

/* Tableaux */
.prose table { width: 100%; border-collapse: collapse; font-size: 0.98rem; margin-block: 0.5rem; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); }
.prose th {
  font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); font-weight: 500;
}
/* Un tableau large déborde dans son propre conteneur, jamais dans la page. */
.prose .table-scroll { overflow-x: auto; }
.prose .table-scroll table { min-width: 34rem; }

/* Lecteurs audio */
.prose audio { width: 100%; margin-top: 0.35rem; }
.prose .audio-row { margin-top: 1.1rem; }
.prose .audio-row:first-child { margin-top: 0; }
.prose .audio-label {
  font-family: var(--mono); font-size: 0.76rem;
  color: var(--muted); letter-spacing: 0.02em;
}

/* ─── Pied de page ────────────────────────────────────────── */
.site-footer {
  margin-top: 4rem; border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; }
.site-footer a { color: var(--soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .socials { display: flex; gap: 1.2rem; }

/* ─── Coloration syntaxique (Rouge, thème clair) ──────────── */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cd { color: #a39e93; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kc { color: #a23b8a; }
.highlight .o, .highlight .ow { color: #5c5a54; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sh, .highlight .dl { color: #4f8a3f; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .il { color: #b5651d; }
.highlight .nf, .highlight .nb, .highlight .bp { color: #2f6f9f; }
.highlight .nc, .highlight .nn { color: #b5651d; }
.highlight .nt { color: #a23b8a; }
.highlight .na { color: #2f6f9f; }
.highlight .n, .highlight .p, .highlight .nv, .highlight .nx { color: var(--ink); }
.highlight .err { color: #c0392b; }
