/* Documentation Modem — mise en page façon Mintlify : navbar + onglets,
   sidebar à icônes, sommaire à droite. Deux thèmes complets. */

@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/sora-latin.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --code-bg: #ffffff;
  --fg: #111111;
  --fg-soft: #545454;
  --fg-faint: #9b9b9b;
  --border: rgba(0, 0, 0, .10);
  --border-strong: rgba(0, 0, 0, .22);
  --primary: #111111;
  --primary-soft: rgba(0, 0, 0, .06);
  --note-bg: #f7f7f7;
  --note-border: rgba(0, 0, 0, .12);
  --note-fg: #333333;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --display: "Sora", var(--sans);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --nav-h: 56px;
  --tabs-h: 40px;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #151515;
  --code-bg: #0a0a0a;
  --fg: #f2f2f2;
  --fg-soft: #a6a6a6;
  --fg-faint: #6f6f6f;
  --border: rgba(255, 255, 255, .12);
  --border-strong: rgba(255, 255, 255, .26);
  --primary: #ffffff;
  --primary-soft: rgba(255, 255, 255, .09);
  --note-bg: #141414;
  --note-border: rgba(255, 255, 255, .14);
  --note-fg: #cfcfcf;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { flex: none; }

/* ── navbar ─────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 90rem; margin: 0 auto; padding: 0 20px; }
.nav-top { height: var(--nav-h); display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: .45em; font-family: var(--display);
        font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
.logo svg { height: .95em; width: auto; display: block; }
.logo .sub { font-family: var(--sans); font-size: 12px; font-weight: 500;
             color: var(--fg-faint); letter-spacing: 0; padding-top: 3px; }

.search {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; max-width: 22rem; height: 36px; padding: 0 12px 0 14px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(28, 25, 23, .04); color: var(--fg-faint);
  font: inherit; font-size: 13.5px;
}
[data-theme="dark"] .search { background: rgba(255, 255, 255, .05); }
.search:hover { background: rgba(28, 25, 23, .09); color: var(--fg-soft); }
[data-theme="dark"] .search:hover { background: rgba(255, 255, 255, .1); }
.search .left { display: flex; align-items: center; gap: 8px; }
.search kbd { font: inherit; font-size: 11px; font-weight: 600; }
.nav-center { flex: 1; display: flex; justify-content: center; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.ghlink { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--fg-soft); }
.ghlink:hover { color: var(--fg); }
.icon-btn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; cursor: pointer; padding: 0;
  background: rgba(28, 25, 23, .04); color: var(--fg-soft);
}
[data-theme="dark"] .icon-btn { background: rgba(255, 255, 255, .08); }
.icon-btn:hover { color: var(--fg); }
[data-theme="dark"] .sun-i { display: block; }
[data-theme="dark"] .moon-i { display: none; }
.sun-i { display: none; }
.moon-i { display: block; }
#burger { display: none; }

/* onglets */
.tabs { height: var(--tabs-h); display: flex; gap: 24px; padding: 0 4px; }
.tabs a {
  position: relative; display: flex; align-items: center; font-size: 14px; font-weight: 500;
  color: var(--fg-soft);
}
.tabs a:hover { color: var(--fg); }
.tabs a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: transparent; }
.tabs a:hover::after { background: var(--border-strong); }
.tabs a[aria-current] { color: var(--fg); font-weight: 600; }
.tabs a[aria-current]::after { background: var(--fg); }

/* ── ossature ───────────────────────────────────────────────── */
.wrap { max-width: 90rem; margin: 0 auto; padding: 0 20px; display: flex; }

.side {
  position: sticky; top: calc(var(--nav-h) + var(--tabs-h));
  align-self: flex-start; flex: none; width: 17.5rem;
  height: calc(100dvh - var(--nav-h) - var(--tabs-h));
  overflow-y: auto; padding: 24px 20px 40px 0;
  border-right: 1px solid var(--border);
}
.side .grp + .grp { margin-top: 22px; }
.side h4 {
  margin: 0 0 8px; padding-left: 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--fg);
}
.side a {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: 10px; font-size: 14px; color: var(--fg-soft);
}
.side a svg { width: 15px; height: 15px; color: var(--fg-faint); }
.side a:hover { background: rgba(28, 25, 23, .04); color: var(--fg); }
[data-theme="dark"] .side a:hover { background: rgba(255, 255, 255, .05); }
.side a[aria-current] { background: var(--primary-soft); color: var(--fg); font-weight: 600; }
.side a[aria-current] svg { color: var(--fg); }

.main { flex: 1; min-width: 0; display: flex; gap: 40px; padding: 36px 0 80px 40px; }
.article { flex: 1; min-width: 0; max-width: 46rem; }
.toc {
  position: sticky; top: calc(var(--nav-h) + var(--tabs-h) + 36px);
  align-self: flex-start; flex: none; width: 15rem;
  max-height: calc(100dvh - var(--nav-h) - var(--tabs-h) - 60px); overflow-y: auto;
  font-size: 13px;
}
.toc h5 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--fg-soft); display: flex; align-items: center; gap: 8px; }
.toc a { display: block; padding: 4px 0 4px 14px; border-left: 1px solid var(--border); color: var(--fg-soft); }
.toc a:hover { color: var(--fg); border-left-color: var(--border-strong); }
.toc a.on { color: var(--fg); border-left-color: var(--fg); font-weight: 500; }

/* ── contenu ────────────────────────────────────────────────── */
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--fg-faint); margin-bottom: 8px;
}
.article h1 {
  font-family: var(--display); font-size: clamp(26px, 3.4vw, 32px); font-weight: 700;
  letter-spacing: -.03em; line-height: 1.2; margin: 0 0 8px;
}
.article .lede { font-size: 17px; color: var(--fg-soft); margin: 0 0 8px; }
.article h2 {
  font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.02em;
  margin: 40px 0 12px; scroll-margin-top: 130px;
}
.article h3 { font-size: 16px; font-weight: 600; margin: 26px 0 6px; }
.article p { margin: 12px 0; color: var(--fg-soft); }
.article strong { color: var(--fg); font-weight: 600; }
.article ul, .article ol { padding-left: 22px; color: var(--fg-soft); }
.article li { margin: 5px 0; }
.article a:not(.card):not(.pg) { color: var(--fg); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px; text-decoration-color: var(--border-strong); }
.article a:not(.card):not(.pg):hover { text-decoration-color: var(--fg); }
.article hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }

code {
  font-family: var(--mono); font-size: .875em;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 5px; padding: .1em .35em; color: var(--fg);
}
pre {
  position: relative; margin: 20px 0; padding: 14px 16px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 16px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--fg);
  box-shadow: var(--shadow);
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
pre .c { color: var(--fg-faint); }
pre .p { color: var(--fg-faint); }
.copy {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--fg-faint);
  cursor: pointer; opacity: 0; transition: opacity .15s ease;
}
pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--fg); background: var(--bg-soft); }

/* tableaux */
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 28rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--fg-soft); }
thead th { background: var(--bg-soft); color: var(--fg); font-weight: 600; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }

/* cartes */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin: 20px 0; }
.card {
  display: block; padding: 20px 22px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg); box-shadow: var(--shadow);
}
.card:hover { border-color: var(--border-strong); }
.card .ic { color: var(--fg); margin-bottom: 12px; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; color: var(--fg); }
.card p { margin: 0; font-size: 14px; color: var(--fg-soft); }

/* callout */
.callout {
  display: flex; gap: 12px; margin: 18px 0; padding: 14px 18px; border-radius: 16px;
  background: var(--note-bg); border: 1px solid var(--note-border); color: var(--note-fg);
  font-size: 14px;
}
.callout p { margin: 0; color: inherit; }
.callout a { color: inherit !important; }

/* étapes */
.steps { margin: 26px 0 26px 14px; }
.step { position: relative; padding: 0 0 22px 32px; }
.step::before {
  content: attr(data-n); position: absolute; left: -14px; top: 0;
  width: 28px; height: 28px; border-radius: 999px; background: var(--bg-soft);
  color: var(--fg); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.step::after { content: ""; position: absolute; left: 0; top: 32px; bottom: 0; width: 1px; background: var(--border); }
.step:last-child::after { display: none; }
.step h3 { margin: 4px 0 2px; }
.step p { margin: 0 0 6px; }

/* accordéon */
details {
  margin: 10px 0; border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  background: var(--bg);
}
summary {
  list-style: none; cursor: pointer; padding: 14px 20px; font-weight: 500; color: var(--fg);
  display: flex; align-items: center; gap: 10px; font-size: 14.5px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; width: 0; height: 0; border-left: 5px solid var(--fg-faint);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
details[open] summary::before { transform: rotate(90deg); }
summary:hover { background: var(--bg-soft); }
details > div { padding: 0 20px 16px 35px; font-size: 14.5px; color: var(--fg-soft); }
details > div p { margin: 0 0 8px; }

kbd {
  font-family: var(--mono); font-size: 12px; padding: 1px 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--bg-soft); color: var(--fg);
}

/* pagination */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.pg { border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; }
.pg:hover { border-color: var(--border-strong); }
.pg .dir { font-size: 13px; color: var(--fg-faint); display: flex; align-items: center; gap: 5px; }
.pg .ti { font-weight: 500; color: var(--fg); }
.pg.next { grid-column: 2; text-align: right; }
.pg.next .dir { flex-direction: row-reverse; }

/* ── recherche ──────────────────────────────────────────────── */
.dialog { position: fixed; inset: 0; z-index: 60; display: none; }
.dialog[open] { display: block; }
.dialog .veil { position: absolute; inset: 0; background: rgba(12, 10, 9, .45); backdrop-filter: blur(2px); }
.dialog .panel {
  position: relative; max-width: 34rem; margin: 12vh auto 0; background: var(--bg);
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .35);
}
.dialog input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent;
  padding: 16px 18px; font: inherit; font-size: 15px; color: var(--fg); outline: none;
}
.dialog .results { max-height: 22rem; overflow-y: auto; padding: 6px; }
.dialog .results a { display: block; padding: 9px 12px; border-radius: 10px; }
.dialog .results a .t { font-size: 14px; color: var(--fg); font-weight: 500; }
.dialog .results a .d { font-size: 12.5px; color: var(--fg-faint); }
.dialog .results a.sel, .dialog .results a:hover { background: var(--primary-soft); }
.dialog .empty { padding: 18px; font-size: 14px; color: var(--fg-faint); }

/* ── responsive ─────────────────────────────────────────────── */
@media (max-width: 1180px) { .toc { display: none; } .main { padding-left: 32px; } }
@media (max-width: 900px) {
  #burger { display: inline-flex; }
  .nav-center, .ghlink, .tabs { display: none; }
  .side {
    position: fixed; inset: var(--nav-h) auto 0 0; width: 17rem; z-index: 39;
    background: var(--bg); padding: 20px 16px 40px; transform: translateX(-102%);
    transition: transform .2s ease; height: calc(100dvh - var(--nav-h));
  }
  body.open .side { transform: none; }
  body.open::after { content: ""; position: fixed; inset: var(--nav-h) 0 0; background: rgba(0,0,0,.4); z-index: 38; }
  .main { padding: 28px 0 64px; }
  .pager { grid-template-columns: 1fr; }
  .pg.next { grid-column: 1; }
}
