/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/* ── Variables ────────────────────────────── */
:root {
  --bg:       #0e0e10;
  --surface:  #16161a;
  --line:     #25252d;
  --txt:      #d4d4d8;
  --muted:    #6b6b75;
  --faint:    #303038;
  --accent:   #818cf8;
  --accent2:  #38bdf8;
  --grad:     linear-gradient(90deg, #818cf8, #c084fc 50%, #38bdf8);
  --tag-bg:   #1a1a2e;
  --tag-fg:   #a5b4fc;
  --mono:     'JetBrains Mono', 'Fira Mono', monospace;
  --sans:     'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Base ─────────────────────────────────── */
body {
  font-family: var(--sans);
  background: var(--bg);
  background-image: radial-gradient(circle, rgba(129,140,248,.035) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--txt);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; border-radius: 5px; }

/* ── Top gradient bar (toujours visible) ──── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad);
  z-index: 300;
}

/* ── Reading progress (pages article) ──────── */
#progress {
  position: fixed;
  top: 2px; left: 0;
  height: 2px;
  width: 0%;
  background: var(--grad);
  z-index: 301;
  transition: width .08s linear;
}

/* ── Layout ───────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
main.wrap { flex: 1; padding-top: 2.5rem; padding-bottom: 3rem; }

/* ── Header ───────────────────────────────── */
header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 2px; /* sous la top-bar */
  background: rgba(14,14,16,.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}
header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 52px;
}

/* Logo dégradé + curseur */
.brand {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand:hover { text-decoration: none; opacity: .85; }

.cursor {
  -webkit-text-fill-color: var(--accent);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0 } }

/* Nav ────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
}
.site-nav a {
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  padding: .25rem .55rem;
  border-radius: 5px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active { color: var(--txt); background: var(--faint); text-decoration: none; }

.rss-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #f97316;
  background: rgba(249,115,22,.1);
  border: 1px solid rgba(249,115,22,.22);
  border-radius: 5px;
  padding: .2rem .5rem;
  transition: background .15s, border-color .15s;
  margin-left: .25rem;
}
.rss-pill svg { width: 12px; height: 12px; fill: currentColor; flex-shrink: 0; }
.rss-pill:hover { background: rgba(249,115,22,.2); border-color: rgba(249,115,22,.5); text-decoration: none; }

/* ── Liste d'articles ─────────────────────── */
.list { list-style: none; }
.list li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  padding-left: 0;
  transition: border-left-color .2s ease, padding-left .2s ease;
}
.list li:first-child { border-top: 1px solid var(--line); }
.list li:hover { border-left-color: var(--accent); padding-left: .75rem; }

.list time {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: .3rem;
}
.list h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.3;
  margin-bottom: .35rem;
}
.list h2 a { color: var(--txt); }
.list h2 a:hover { color: var(--accent); text-decoration: none; }
.list p { font-size: .875rem; color: var(--muted); margin-bottom: .55rem; line-height: 1.55; }

/* ── Tags & meta ──────────────────────────── */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.tag {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--tag-fg);
  background: var(--tag-bg);
  border: 1px solid rgba(165,180,252,.12);
  border-radius: 4px;
  padding: .08rem .4rem;
}
.reading { font-size: .72rem; color: var(--muted); font-family: var(--mono); margin-left: auto; }

/* ── Pagination ───────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  font-size: .875rem;
}
.pager a { color: var(--muted); font-weight: 500; }
.pager a:hover { color: var(--txt); }
.pager span { color: var(--faint); font-family: var(--mono); font-size: .78rem; }

/* ── Article ──────────────────────────────── */
.article-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
article h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.2;
  margin-bottom: 1.1rem;
  background: linear-gradient(135deg, #f4f4f5 55%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Prose ────────────────────────────────── */
.prose { font-size: 1rem; line-height: 1.82; color: var(--txt); }

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: #f4f4f5;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.3;
  margin: 2rem 0 .65rem;
}
.prose h2 { font-size: 1.3rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 1.1rem; }
.prose h4 { font-size: .95rem; color: var(--muted); }

.prose p { margin-bottom: 1.15rem; }
.prose a { color: var(--accent); }
.prose strong { color: #f4f4f5; font-weight: 600; }
.prose em { color: var(--muted); font-style: italic; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose img { margin: 1.5rem auto; border: 1px solid var(--line); }

.prose ul, .prose ol { margin: 0 0 1.15rem 1.4rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: .3rem; }
.prose li::marker { color: var(--accent); }

.prose blockquote {
  border-left: 2px solid var(--accent);
  background: rgba(129,140,248,.06);
  padding: .75rem 1.1rem;
  margin: 1.25rem 0;
  border-radius: 0 5px 5px 0;
  color: var(--muted);
}
.prose blockquote p { margin: 0; font-style: italic; }

.prose code {
  font-family: var(--mono);
  font-size: .82em;
  color: var(--tag-fg);
  background: var(--tag-bg);
  border: 1px solid rgba(165,180,252,.12);
  border-radius: 4px;
  padding: .1em .4em;
}
.prose pre {
  margin: 1.25rem 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow-x: auto;
  position: relative;
}
.prose pre code { background: none; border: none; color: inherit; padding: 0; font-size: .875rem; display: block; }
.prose pre .hljs { padding: 1.1rem 1.25rem; border-radius: 8px; line-height: 1.65; }

.prose table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: .875rem; }
.prose th { background: var(--surface); border: 1px solid var(--line); padding: .5rem .85rem; text-align: left; font-weight: 600; color: #f4f4f5; }
.prose td { border: 1px solid var(--line); padding: .45rem .85rem; color: var(--muted); }
.prose tr:hover td { background: var(--surface); color: var(--txt); }

/* ── Back / liens navigation ─────────────── */
.back {
  display: inline-block;
  margin-top: 2.5rem;
  font-size: .875rem;
  color: var(--muted);
  font-weight: 500;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  width: 100%;
}
.back:hover { color: var(--accent); text-decoration: none; }

/* ── Page title ───────────────────────────── */
.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: #f4f4f5;
  margin-bottom: 2rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}

/* ── Archives ─────────────────────────────── */
.archive-year {
  margin-top: 2rem;
}
.archive-year:first-child { margin-top: 0; }
.year-label {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--faint);
}
.archive-list { list-style: none; }
.archive-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--faint);
  transition: padding-left .15s;
}
.archive-list li:hover { padding-left: .5rem; }
.archive-list li:last-child { border-bottom: none; }
.archive-date {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 5rem;
}
.archive-list a { font-size: .9rem; color: var(--txt); font-weight: 500; }
.archive-list a:hover { color: var(--accent); text-decoration: none; }
.archive-tags { display: flex; gap: .25rem; margin-left: auto; }

/* ── Recherche ────────────────────────────── */
.search-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 2rem;
}
.search-form input[type="search"] {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--txt);
  font-family: var(--sans);
  font-size: .95rem;
  padding: .6rem 1rem;
  border-radius: 7px;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.search-form input[type="search"]::placeholder { color: var(--muted); }
.search-form input[type="search"]:focus { border-color: var(--accent); }
.search-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: .6rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.search-form button:hover { opacity: .85; }

.search-count {
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-bottom: 1.25rem;
}

mark {
  background: rgba(129,140,248,.25);
  color: var(--tag-fg);
  border-radius: 2px;
  padding: 0 .1em;
}

/* ── Empty / misc ─────────────────────────── */
.empty { color: var(--muted); padding: 3rem 0; font-size: .9rem; }
.empty code { font-family: var(--mono); color: var(--tag-fg); }

/* ── Footer ───────────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
  font-size: .72rem;
  color: var(--muted);
  font-family: var(--mono);
}
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); text-decoration: none; }

/* ── Code wrap (badge lang + bouton copier) ── */
.prose .code-wrap { margin: 1.25rem 0; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }
.prose .code-wrap pre { margin: 0; border: none; border-radius: 0; }
.prose .code-wrap pre .hljs { border-radius: 0; }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .35rem .9rem;
  background: rgba(255,255,255,.025);
  border-bottom: 1px solid var(--line);
}
.code-lang {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.copy-btn {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
  user-select: none;
}
.copy-btn:hover { color: var(--txt); }
.copy-btn.copied { color: #4ade80; }

/* ── Table des matières ───────────────────── */
.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 7px 7px 0;
  padding: .9rem 1.1rem;
  margin-bottom: 2rem;
  font-size: .875rem;
}
.toc-title {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
  font-weight: 600;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { padding: .15rem 0; }
.toc li.level-3 { padding-left: 1rem; }
.toc a { color: var(--muted); font-size: .875rem; }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* ── Articles liés ────────────────────────── */
.related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.related-title {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  font-weight: 600;
}
.related-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.related-list li {
  display: flex;
  align-items: baseline;
  gap: .75rem;
}
.related-list time { font-family: var(--mono); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.related-list a { font-size: .9rem; color: var(--txt); font-weight: 500; }
.related-list a:hover { color: var(--accent); text-decoration: none; }

/* ── Tags cliquables ──────────────────────── */
a.tag { text-decoration: none; transition: background .15s, border-color .15s; }
a.tag:hover { background: rgba(165,180,252,.15); border-color: rgba(165,180,252,.4); text-decoration: none; }

/* ── Page tag ─────────────────────────────── */
.tag-hero {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.tag-hero .tag { font-size: .85rem; padding: .25rem .65rem; }
.tag-hero span { font-size: .8rem; color: var(--muted); font-family: var(--mono); }

/* ── Navigation précédent / suivant ──────── */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.post-nav a {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.post-nav a:hover { border-color: var(--accent); background: rgba(129,140,248,.05); text-decoration: none; }
.post-nav .nav-right { text-align: right; }
.nav-dir {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.nav-title { font-size: .875rem; font-weight: 500; color: var(--txt); line-height: 1.35; }

/* ── 404 ──────────────────────────────────── */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 0 4rem;
  text-align: center;
  gap: .75rem;
}
.not-found-code {
  font-family: var(--mono);
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.not-found-msg { color: var(--muted); font-size: .95rem; }
.not-found-back {
  margin-top: .5rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--accent);
}
.not-found-back:hover { text-decoration: underline; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 600px) {
  article h1 { font-size: 1.4rem; }
  .prose h2  { font-size: 1.15rem; }
  .prose pre .hljs { padding: .85rem 1rem; font-size: .8rem; }
  .reading { margin-left: 0; }
  .archive-tags { display: none; }
  .archive-list li { gap: .65rem; }
}
@media (max-width: 420px) {
  .site-nav a:not(.rss-pill) { display: none; }
  .site-nav a.mobile-show { display: inline-flex; }
}
