:root {
  --bg: #0b0d12;
  --bg-elevated: #141821;
  --bg-header: #1c222e;
  --bg-code: #12161f;
  --border: #283040;
  --border-strong: #374156;

  --text: #cdd6f4;
  --text-strong: #ffffff;
  --text-muted: #8492a6;

  --accent: #7aa2f7;
  --accent-bg: rgba(122, 162, 247, 0.1);
  --accent-border: rgba(122, 162, 247, 0.3);

  --green: #9ece6a;
  --green-bg: rgba(158, 206, 106, 0.1);

  --warn: #e0af68;
  --warn-bg: rgba(224, 175, 104, 0.09);
  --warn-border: rgba(224, 175, 104, 0.3);

  --danger: #f7768e;
  --danger-bg: rgba(247, 118, 142, 0.09);
  --danger-border: rgba(247, 118, 142, 0.3);

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;

  --max-width: 740px;
}

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

html {
  font-size: 16px;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0 1.25rem;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.72;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
.site-header {
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-strong);
  text-decoration: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  transition: border-color 0.15s ease;
}

.brand .prompt {
  color: var(--green);
}

.brand:hover {
  border-color: var(--accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text-strong);
  background: var(--bg-elevated);
}

/* Main Content */
main {
  flex: 1;
}

.intro {
  margin-bottom: 2.25rem;
  padding: 1rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.95rem;
}

.intro p {
  margin: 0;
}

.empty-state {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.page-heading {
  font-size: 1.6rem;
  color: var(--text-strong);
  margin: 0 0 1.5rem;
  letter-spacing: -0.02em;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 2.25rem 0 0.85rem;
}

/* Post List */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.post-item:hover {
  border-color: var(--border-strong);
}

.post-link {
  color: var(--text-strong);
  text-decoration: none;
  font-weight: 600;
}

.post-link:hover {
  color: var(--accent);
}

.tags {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.tag::before {
  content: "#";
  opacity: 0.7;
  margin-right: 0.1rem;
}

.tag:hover {
  background: var(--accent);
  color: var(--bg);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.tag-cloud .tag {
  font-size: 0.85rem;
  padding: 0.25rem 0.7rem;
}

/* Article Header & Typography */
article > header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

article h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  color: var(--text-strong);
  margin: 0 0 0.9rem;
  letter-spacing: -0.025em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

article h2 {
  font-size: 1.28rem;
  color: var(--text-strong);
  margin: 2.75rem 0 1rem;
  padding: 0.45rem 0.75rem;
  background: linear-gradient(90deg, var(--bg-elevated) 0%, transparent 100%);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

article h2::before {
  content: "## ";
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95em;
}

article h3 {
  font-size: 1.08rem;
  color: var(--text-strong);
  margin: 2rem 0 0.65rem;
}

article h3::before {
  content: "### ";
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9em;
}

article p {
  margin: 0 0 1.25rem;
}

article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

article :is(p, li) a[href*="/posts/"]:not([href$="/posts/"]) {
  display: inline;
  padding: 0.1em 0.45em;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

article :is(p, li) a[href*="/posts/"]:not([href$="/posts/"])::before {
  content: "↗ ";
  font-family: var(--font-mono);
  font-size: 0.85em;
  opacity: 0.85;
}

article :is(p, li) a[href*="/posts/"]:not([href$="/posts/"]):hover {
  border-color: var(--accent);
  background: rgba(122, 162, 247, 0.18);
  color: var(--text-strong);
}

article .tags a {
  text-decoration: none;
}

article ul,
article ol {
  margin: 0 0 1.35rem;
  padding-left: 1.4rem;
}

article li {
  margin-bottom: 0.4rem;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.6rem 1.1rem;
  background: var(--bg-elevated);
  border-left: 3px solid var(--text-muted);
  color: var(--text-muted);
  border-radius: 0 4px 4px 0;
}

/* Inline Code & Code Blocks */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: #1a202c;
  border: 1px solid var(--border-strong);
  padding: 0.14em 0.42em;
  border-radius: 4px;
  color: #ff9e64;
}

pre {
  background-color: var(--bg-code) !important;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  line-height: 1.6;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

pre code {
  background: none !important;
  border: none;
  padding: 0;
  font-size: 0.86rem;
  color: var(--text);
}

.code-header {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-strong);
  background: var(--bg-header);
  border: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  padding: 0.45rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.code-header span:first-child {
  color: var(--green);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  background: var(--green-bg);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}

.code-header span:last-child {
  color: var(--text-muted);
}

.code-header + pre,
.code-header + * pre {
  margin-top: 0 !important;
  border-top: none !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

/* Table of Contents (Distinct from Code Blocks) */
.toc {
  background: rgba(122, 162, 247, 0.04);
  border: 1px dashed var(--accent-border);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.35rem;
  margin: 0 0 2.25rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.toc-title {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.74rem;
  margin-bottom: 0.65rem;
}

.toc ol {
  list-style: none;
  counter-reset: toc-item;
  padding-left: 0;
  margin: 0;
}

.toc ol ol {
  padding-left: 1.4rem;
  margin-top: 0.3rem;
}

.toc li {
  counter-increment: toc-item;
  margin-bottom: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.toc li::before {
  content: "0" counter(toc-item) " →";
  color: var(--text-muted);
  font-size: 0.76rem;
}

.toc a {
  color: var(--text-strong);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-strong);
}

.toc a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Callouts / Admonitions */
.callout {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  font-size: 0.93rem;
  border-radius: 0 6px 6px 0;
}

.callout.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn);
}

.callout.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  border-left-color: var(--danger);
}

.callout.ok,
.callout.tip {
  background: var(--green-bg);
  border-color: rgba(158, 206, 106, 0.3);
  border-left-color: var(--green);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.45rem;
  color: var(--accent);
}

.callout-icon {
  flex-shrink: 0;
}

.callout.warn .callout-title {
  color: var(--warn);
}

.callout.danger .callout-title {
  color: var(--danger);
}

.callout.ok .callout-title,
.callout.tip .callout-title {
  color: var(--green);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-strong);
  background: var(--bg-header);
  font-weight: 600;
}

/* Post Footer Nav */
.post-nav {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.post-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.post-nav a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text-strong);
}

/* Article card (lien vers un autre article) */
.article-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 1.5rem 0;
  padding: 0.9rem 1.1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.article-card:hover {
  border-color: var(--accent);
  background: rgba(122, 162, 247, 0.15);
}

.article-card-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.article-card-title {
  font-weight: 600;
  color: var(--text-strong);
}

.article-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 404 */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 0 2rem;
}

.not-found-code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(4rem, 14vw, 6.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--border-strong);
}

.not-found-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.not-found-text {
  margin: 0;
  max-width: 28rem;
  color: var(--text-muted);
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  color: var(--text-strong);
  border-color: var(--border-strong);
}

.btn-primary {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.btn-primary:hover {
  color: var(--text-strong);
  border-color: var(--accent);
}

/* Responsive */
@media (max-width: 600px) {
  .post-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .post-nav {
    flex-direction: column;
  }
}
