/* ---------- Polices (servies par le site, aucune requête externe) ---------- */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/newsreader-latin-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/newsreader-latin-ext-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/newsreader-latin-opsz-italic.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/newsreader-latin-ext-opsz-italic.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Couleurs (le mode sombre suit le réglage du système) ---------- */
:root {
  --paper: #f6f2ea;
  --ink: #1c1a17;
  --ink-soft: #5c574e;
  --ink-faint: #9a9387;
  --rule: #e2dccf;
  --accent: #b23a26;
  --code-bg: #efe9dd;
  --selection: #f1d7c9;

  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --measure: 40rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151412;
    --ink: #ece6da;
    --ink-soft: #b3ab9c;
    --ink-faint: #756e62;
    --rule: #2b2925;
    --accent: #e8735c;
    --code-bg: #1f1d1a;
    --selection: #4a2a22;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  font-optical-sizing: auto;
}

::selection { background: var(--selection); }

a { color: inherit; text-decoration-color: var(--ink-faint); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding: 0 1rem;
}

.meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.skip {
  position: absolute; left: 1rem; top: -3rem;
  padding: 0.4rem 0.8rem; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.8rem; text-decoration: none; z-index: 1;
}
.skip:focus { top: 1rem; }

/* ---------- En-tête ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.brand::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
}
.site-header nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.site-header nav a { text-decoration: none; color: var(--ink-soft); }
.site-header nav a:hover, .site-header nav a[aria-current='page'] { color: var(--ink); }

/* ---------- Contenu ---------- */
main {
  flex: 1;
  padding-top: 3.5rem;
  padding-bottom: 5rem;
}

/* ---------- Pied de page ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--rule);
}

/* ---------- Accueil ---------- */
.epigraph {
  margin: 0 0 3.5rem;
  font-size: clamp(1.6rem, 4.5vw, 2.25rem);
  line-height: 1.2;
  font-style: italic;
  font-weight: 350;
  letter-spacing: -0.015em;
  max-width: 30rem;
  text-wrap: balance;
}

.year + .year { margin-top: 3rem; }
.year h2 { margin: 0 0 0.75rem; font-weight: 400; }

.posts { list-style: none; margin: 0; padding: 0; }
.posts li { padding: 0.9rem 0; border-top: 1px solid var(--rule); }
.posts li:last-child { border-bottom: 1px solid var(--rule); }
.posts a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  text-decoration: none;
}
.posts .title { font-size: 1.25rem; line-height: 1.35; font-weight: 450; }
.posts a:hover .title { color: var(--accent); }
.posts .meta { flex-shrink: 0; }
.posts p {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 34rem;
}

/* ---------- Article ---------- */
.post-header { margin-bottom: 2.75rem; }
.post-header .meta { margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.post-header h1, .page-title {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.08;
  font-weight: 450;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.lede {
  margin: 1.1rem 0 0;
  font-size: 1.25rem;
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.post-footer {
  margin-top: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}
.post-footer p { margin: 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0; padding: 0; color: var(--ink-soft); }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.pager a { display: flex; flex-direction: column; gap: 0.3rem; text-decoration: none; line-height: 1.35; }
.pager a:hover span:last-child { color: var(--accent); }
.pager .newer { grid-column: 2; text-align: right; }
@media (max-width: 520px) {
  .pager { grid-template-columns: 1fr; }
  .pager .newer { grid-column: 1; text-align: left; }
}

/* ---------- Corps de texte ---------- */
.prose { hyphens: auto; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.25em; }
.prose p { margin: 0; }
.prose p + p { margin-top: 1em; }

.prose h2, .prose h3, .prose h4 {
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.2em 0 0.6em;
}
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; font-style: italic; }
.prose h4 { font-size: 1rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }

.prose blockquote {
  margin: 1.8em 0;
  padding: 0 0 0 1.25em;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-soft);
}

.prose hr { border: 0; margin: 2.8em 0; text-align: center; }
.prose hr::after { content: '⁂'; color: var(--ink-faint); font-size: 1.1rem; }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--ink-faint); }

.prose img { max-width: 100%; height: auto; display: block; margin: 2em auto; border-radius: 2px; }
.prose figure { margin: 2em 0; }
.prose figcaption { text-align: center; font-size: 0.9rem; color: var(--ink-soft); font-style: italic; }

.prose code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose pre {
  font-size: 0.85rem;
  line-height: 1.55;
  padding: 1rem 1.1rem;
  border-radius: 4px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--rule);
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.5em 0.75em; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 500; }

/* Notes : <sup><a href="#n1" id="r1">1</a></sup> dans le texte, <section class="footnotes"> à la fin */
.prose sup a { text-decoration: none; color: var(--accent); font-family: var(--mono); font-size: 0.7em; padding: 0 0.1em; }
.prose .footnotes { margin-top: 3.5em; padding-top: 1.5em; border-top: 1px solid var(--rule); font-size: 0.92rem; color: var(--ink-soft); }
.prose .footnotes h2 { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin: 0 0 1em; }
.prose .footnotes a[href^='#r'] { text-decoration: none; }

/* Lettrine sur le premier paragraphe */
.prose > p:first-of-type::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: 0.85;
  padding: 0.08em 0.1em 0 0;
  color: var(--accent);
}

@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  main { padding-top: 2.25rem; }
}

/* ---------- Images et vidéos ---------- */

/* Vignette facultative sur l'accueil : <img class="thumb"> en premier dans le lien */
.posts .title { flex: 1; }
.posts .thumb {
  flex-shrink: 0;
  align-self: center;
  width: 4.5rem;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  background: var(--code-bg);
}
.posts a:hover .thumb { opacity: 0.85; }

/* Image à la une, entre l'en-tête et le texte */
.cover { margin: 0 0 3rem; }
.cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 2px;
  background: var(--code-bg);
}
.cover figcaption {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}
@media (min-width: 760px) {
  .cover { margin-left: -3rem; margin-right: -3rem; }
}

/* Médias dans le texte : <figure> contenant <img> ou <video> */
.prose video {
  display: block;
  width: 100%;
  height: auto;
  margin: 2em auto;
  border-radius: 2px;
  background: #000;
}
.prose figure img, .prose figure video { margin: 0 auto; }
.prose figcaption { margin-top: 0.6rem; }
@media (min-width: 760px) {
  .prose figure.large { margin-left: -3rem; margin-right: -3rem; }
}
