:root {
  --bg: #0b0a0b;
  --panel: #101011;
  --panel-2: #161517;
  --panel-3: #1d1b1e;
  --line: #262326;
  --text: #ece8e8;
  --muted: #9b9397;
  --dim: #6f696c;
  --accent: #d3181e;
  --accent-2: #f0343a;
  --accent-soft: rgba(211, 24, 30, .14);
  --radius: 4px;
  --sb: 300px;
  --top: 68px;
  --font-head: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.75 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.ic { width: 18px; height: 18px; flex: none; }

/* ------------------------------------------------------------ sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb);
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 22px 12px 28px; overflow-y: auto; z-index: 40;
  scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; box-shadow: 0 6px 18px rgba(211,24,30,.28); }
.brand-txt { display: flex; flex-direction: column; line-height: 1; }
.brand-txt small { font: 800 11px/1 var(--font-head); letter-spacing: .2em; color: var(--accent-2); margin-bottom: 6px; }
.brand-txt strong { font: 900 28px/1 var(--font-head); letter-spacing: -.01em; text-transform: uppercase; }
.tagline { margin: 14px 8px 22px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.sidebar .sb-close { display: none; }

.nav-group { margin-bottom: 6px; }
.nav-group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 8px; color: var(--muted);
  font: 700 11.5px/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary span { flex: 1; }
.nav-group > summary:hover { color: var(--text); }
.ic-cat { width: 16px; height: 16px; opacity: .8; }
.ic-chev { width: 16px; height: 16px; transition: transform .2s; }
.nav-group:not([open]) .ic-chev { transform: rotate(-90deg); }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 1px 0;
  border-radius: var(--radius); color: #d9d4d5; font-size: 15px; line-height: 1.3; font-weight: 500;
}
.nav-item .ic { color: var(--dim); }
.nav-item:hover { background: var(--panel-3); color: #fff; text-decoration: none; }
.nav-item:hover .ic { color: var(--muted); }
.nav-item.is-active { background: var(--accent); color: #fff; font-weight: 700; }
.nav-item.is-active .ic { color: #fff; }

/* ------------------------------------------------------------ top bar */
.main { margin-left: var(--sb); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  padding: 0 32px; background: rgba(11,10,11,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-brand { display: none; align-items: center; gap: 10px; color: var(--text); margin-right: auto; }
.top-brand img { border-radius: 5px; }
.top-brand strong { font: 900 18px/1 var(--font-head); text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 30px; }
.top-link {
  color: #e6e1e2; font: 700 12.5px/1 var(--font-head); letter-spacing: .1em; text-transform: uppercase;
}
.top-link:hover { color: var(--accent-2); text-decoration: none; }
.btn-accent {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 20px;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  font: 800 12.5px/1 var(--font-head); letter-spacing: .1em; text-transform: uppercase;
  transition: background .15s, transform .15s;
}
.btn-accent:hover { background: var(--accent-2); text-decoration: none; transform: translateY(-1px); }
.btn-accent .ic { width: 16px; height: 16px; }
.icon-btn {
  background: none; border: 1px solid var(--line); color: var(--text); border-radius: var(--radius);
  width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--panel-3); }
.burger { display: none; }
.scrim { display: none; }

/* ------------------------------------------------------------ layout */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 48px;
  max-width: 1180px; margin: 0 auto; padding: 56px 40px 80px;
}
.article { min-width: 0; max-width: 760px; width: 100%; margin: 0 auto; }

.crumbs { font: 700 11.5px/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { margin: 0 10px; color: var(--dim); }
.crumbs .cur { color: var(--text); }

h1, h2, h3, h4 { font-family: var(--font-head); text-transform: uppercase; letter-spacing: -.01em; }
.article h1 { font-weight: 900; font-size: clamp(2.5rem, 5.4vw, 3.8rem); line-height: 1; margin: 26px 0 18px; }
.subtitle { font-size: 1.25rem; line-height: 1.5; color: #d2cccd; margin: 0 0 22px; }
.badge {
  display: inline-block; padding: 8px 12px; background: var(--panel-3); border-radius: 3px;
  color: var(--muted); font: 700 11px/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase;
}

/* ------------------------------------------------------------ contenu */
.prose { margin-top: 36px; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.2em; color: #d9d4d5; }
.prose strong { color: #fff; }
.prose h2 {
  font-weight: 900; font-size: 1.75rem; line-height: 1.1; margin: 2.4em 0 .8em;
  padding-top: 1.4em; border-top: 1px solid var(--line);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border: 0; }
.prose h3 { font-weight: 800; font-size: 1.2rem; margin: 2em 0 .6em; color: #fff; }
.prose h4 { font-weight: 800; font-size: 1rem; margin: 1.6em 0 .5em; color: var(--accent-2); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.3em; color: #d9d4d5; }
.prose li { margin: .4em 0; }
.prose li::marker { color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); display: block; margin: 1.6em 0; }
.prose figure { margin: 1.6em 0; }
.prose figure img { margin: 0; }
.prose figcaption { color: var(--muted); font-size: 14px; margin-top: 8px; }
.prose code {
  background: var(--panel-3); padding: .15em .45em; border-radius: 3px; font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #ffb3b5;
}
.prose pre {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; margin: 0 0 1.4em;
}
.prose pre code { background: none; padding: 0; color: #e6e1e2; }
.prose blockquote {
  margin: 0 0 1.3em; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: #cfc9ca;
}

.table-wrap { overflow-x: auto; margin: 0 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th {
  background: var(--panel-3); text-align: left; padding: 14px 16px; color: var(--muted);
  font: 800 11.5px/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.prose td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: top; color: #d9d4d5; }
.prose tr:hover td { background: rgba(255,255,255,.015); }
.prose td a { font-weight: 700; }

.callout {
  margin: 0 0 1.5em; padding: 16px 20px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent);
}
.callout > :last-child { margin-bottom: 0; }
.callout > :first-child { margin-top: 0; }
.callout-info { border-left-color: #4f8cff; }
.callout-success { border-left-color: #2fbf71; }
.callout-warning { border-left-color: #f0a020; }
.callout-danger { border-left-color: var(--accent-2); background: var(--accent-soft); }

/* surlignages de couleur (venus de GitBook) */
.mk { font-weight: 700; }
.mk-primary { color: #ff5a5f; }
.mk-success { color: #3ddc84; }
.mk-warning { color: #ffb020; }
.mk-info { color: #6ea8ff; }
.mk-purple { color: #c08bff; }

/* blocs repliables */
.fold { margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  font: 800 13px/1.2 var(--font-head); letter-spacing: .08em; text-transform: uppercase;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸"; color: var(--accent-2); transition: transform .15s; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold-body { padding: 14px 20px 6px; border-top: 1px solid var(--line); }
.fold-body > :last-child { margin-bottom: 0; }

.card-link {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 0 10px; padding: 18px 20px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius); color: #fff;
  font: 800 15px/1.2 var(--font-head); letter-spacing: .04em; text-transform: uppercase;
  transition: border-color .15s, background .15s, transform .15s;
}
.card-link .ic { color: var(--accent-2); transition: transform .15s; }
.card-link:hover { text-decoration: none; border-color: var(--accent); background: var(--panel-3); }
.card-link:hover .ic { transform: translateX(4px); }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.pn {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel-2); color: #fff;
}
.pn:hover { text-decoration: none; border-color: var(--accent); }
.pn small { color: var(--muted); font: 700 11px/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; }
.pn span { font-weight: 700; }
.pn-next { text-align: right; grid-column: 2; }
.pn-prev { grid-column: 1; }

.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--dim); font-size: 13px;
}
.foot a { color: var(--muted); }

/* ------------------------------------------------------------ sommaire */
.toc { position: sticky; top: calc(var(--top) + 36px); align-self: start; font-size: 14px; }
.toc-title { font: 800 11px/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.toc-item {
  display: block; padding: 8px 12px; color: var(--muted); border-left: 2px solid transparent; line-height: 1.35;
}
.toc-item.lvl3 { padding-left: 26px; font-size: 13px; }
.toc-item:hover { color: var(--text); text-decoration: none; }
.toc-item.is-active { color: #fff; border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 44px 32px 72px; }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: 0 0 60px rgba(0,0,0,.6); }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 35; }
  body.nav-open .scrim { display: block; }
  body.nav-open { overflow: hidden; }
  .burger, .sidebar .sb-close { display: inline-grid; }
  .top-brand { display: inline-flex; }
  .topbar { padding: 0 16px; justify-content: flex-start; }
  .top-actions { gap: 16px; margin-left: auto; }
  .top-link { display: none; }
  .btn-accent { padding: 12px 14px; }
  .layout { padding: 32px 18px 64px; }
}
@media (max-width: 520px) {
  .top-brand img { border-radius: 5px; }
.top-brand strong { display: none; }
  .prevnext { grid-template-columns: 1fr; }
  .pn-next, .pn-prev { grid-column: auto; text-align: left; }
}
