/* Documentation Urox — même identité que le site vitrine, en clair comme en sombre.
   Sobre : titres en 600, tout le reste en 400, l'emphase passe par la couleur. */

@font-face { font-family: 'NouvellesMontreal'; src: url('assets/fonts/PPNeueMontreal-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'NouvellesMontreal'; src: url('assets/fonts/PPNeueMontreal-Semibold.otf') format('opentype'); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light dark;
  --canvas: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: rgba(0,0,0,0.04);
  --text: #0E0E0E;
  --text-2: #3C3C3C;
  --text-muted: #6E6E6E;
  --text-faint: #9A9A9A;
  --accent: #16A34A;
  --accent-soft: rgba(34,197,94,0.12);
  --warn: #B45309;
  --warn-soft: rgba(245,158,11,0.14);
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.18);
  --glass: rgba(250,250,250,0.78);
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  --r-card: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --top: 60px;
}
/* Sombre : choisi par la personne (data-theme, mémorisé), sinon celui du système. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0E0E0E;
  --surface: #1A1A1A;
  --surface-2: rgba(255,255,255,0.07);
  --text: #F5F5F5;
  --text-2: #C8C8C8;
  --text-muted: #8C8C8C;
  --text-faint: #5E5E5E;
  --accent: #4ADE80;
  --accent-soft: rgba(74,222,128,0.12);
  --warn: #FBBF24;
  --warn-soft: rgba(251,191,36,0.12);
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --glass: rgba(20,20,20,0.72);
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25);
}
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0E0E0E;
    --surface: #1A1A1A;
    --surface-2: rgba(255,255,255,0.07);
    --text: #F5F5F5;
    --text-2: #C8C8C8;
    --text-muted: #8C8C8C;
    --text-faint: #5E5E5E;
    --accent: #4ADE80;
    --accent-soft: rgba(74,222,128,0.12);
  --warn: #FBBF24;
  --warn-soft: rgba(251,191,36,0.12);
    --border: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.18);
    --glass: rgba(20,20,20,0.72);
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 4px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'NouvellesMontreal', system-ui, -apple-system, 'SF Pro Display', Inter, sans-serif;
  font-size: 16px; line-height: 1.6; letter-spacing: -0.01em;
  color: var(--text-2);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ── Barre du haut ─────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--top);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.top__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-muted); font-size: 14px; flex-shrink: 0; }
.logo { display: block; }
/* logo--light = logo sombre, pour fond clair ; logo--dark = logo clair, pour fond sombre. */
.logo--dark { display: none; }
:root[data-theme="dark"] .logo--dark { display: block; }
:root[data-theme="dark"] .logo--light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo--dark { display: block; }
  :root:not([data-theme="light"]) .logo--light { display: none; }
}
.search {
  flex: 1; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text-muted);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.search:focus-within { border-color: var(--border-strong); background: var(--surface); }
.search input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 15px; color: var(--text);
}
.search input::placeholder { color: var(--text-faint); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search kbd {
  font: inherit; font-size: 12px; color: var(--text-faint);
  padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border);
}
.top__links { display: flex; gap: 18px; font-size: 14px; flex-shrink: 0; }
.top__links a { color: var(--text-muted); text-decoration: none; }
.top__links a:hover { color: var(--text); }

/* Thème : automatique, clair, sombre */
.theme { display: flex; flex-shrink: 0; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.theme button {
  width: 30px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-muted);
  cursor: pointer; transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.theme button:hover { color: var(--text); }
.theme button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.10); }

/* ── Mise en page ──────────────────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; }
.side {
  position: sticky; top: var(--top); align-self: start;
  max-height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 28px 12px 40px 20px;
  font-size: 14.5px;
}
.side__title { margin: 22px 0 6px; padding: 0 10px; font-size: 13px; color: var(--text-faint); }
.side__title:first-child { margin-top: 0; }
.side a { display: block; padding: 6px 10px; border-radius: 9px; color: var(--text-muted); text-decoration: none; line-height: 1.35; }
.side a:hover { color: var(--text); background: var(--surface-2); }
.side a[aria-current] { color: var(--text); background: var(--surface-2); }

.doc { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 48px; padding: 44px 32px 80px; }
.doc article { min-width: 0; max-width: 720px; }
.toc { position: sticky; top: calc(var(--top) + 28px); align-self: start; font-size: 13.5px; }
.toc p { color: var(--text-faint); margin-bottom: 8px; }
.toc a { display: block; padding: 4px 0; color: var(--text-muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--text); }
/* Section en cours de lecture : un point et la couleur du texte. */
.toc a { position: relative; padding-left: 14px; transition: color 0.15s var(--ease); }
.toc a::before { content: ''; position: absolute; left: 0; top: 0.72em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0; transform: scale(0.4); transition: opacity 0.15s var(--ease), transform 0.15s var(--ease); }
.toc a.is-current { color: var(--text); }
.toc a.is-current::before { opacity: 1; transform: none; }

/* Progression de lecture, sous la barre du haut. */
.progress { position: fixed; top: var(--top); left: 0; right: 0; height: 2px; z-index: 21; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* Titre de la section en cours : épinglé en haut, replié tant qu'il l'est. */
.doc section > h2 {
  position: sticky; top: var(--top); z-index: 5;
  margin: 0 -14px 6px; padding: 12px 14px;
  background: var(--canvas);
}
.doc section > h2 a { display: inline-block; transform-origin: left center; transition: transform 0.18s var(--ease), color 0.18s var(--ease); }
.doc section > h2::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 1px; background: var(--border); opacity: 0; transition: opacity 0.18s var(--ease); }
.doc section > h2.is-stuck a { transform: scale(0.74); color: var(--text-muted); }
.doc section > h2.is-stuck::after { opacity: 1; }

.eyebrow { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; color: var(--text); }
.lead { margin-top: 12px; font-size: 18px; line-height: 1.5; color: var(--text-muted); max-width: 58ch; }

/* ── Texte d'un guide (aussi utilisé dans les résultats de recherche) ──────── */
section { padding-top: 44px; }
h2 { font-size: 23px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; color: var(--text); margin-bottom: 14px; }
h2 a { text-decoration: none; }
h3 { font-size: 17px; font-weight: 600; color: var(--text); margin: 24px 0 8px; }
section p, .result__body p { margin: 12px 0; }
section ul, section ol, .result__body ul, .result__body ol { margin: 12px 0; padding-left: 22px; }
section li, .result__body li { margin: 6px 0; padding-left: 4px; }
section li::marker, .result__body li::marker { color: var(--text-faint); }
strong { font-weight: 600; color: var(--text); }
em { font-style: normal; color: var(--text); }
article a, .result__body a, .foot a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
article a:hover, .result__body a:hover, .foot a:hover { text-decoration-color: currentColor; }
h2 a, .pager a { text-decoration: none !important; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.86em; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); }
pre { margin: 16px 0; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); overflow-x: auto; }
pre code { padding: 0; background: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
/* Encarts : un repère de couleur et un mot, jamais de liseré. */
.callout { margin: 20px 0; padding: 14px 18px 15px; border-radius: 16px; background: var(--surface-2); color: var(--text-2); }
.callout p { margin: 6px 0 0 !important; }
.callout .callout__label { margin: 0 !important; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.callout__label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.callout--astuce { background: var(--accent-soft); }
.callout--astuce .callout__label { color: var(--accent); }
.callout--astuce .callout__label::before { background: var(--accent); }
.callout--attention { background: var(--warn-soft); }
.callout--attention .callout__label { color: var(--warn); }
.callout--attention .callout__label::before { background: var(--warn); }
.callout--exemple { background: transparent; border: 1px dashed var(--border-strong); }

/* Étapes numérotées : une pastille par étape. */
section ol, .result__body ol { list-style: none; padding-left: 0; counter-reset: step; }
section ol > li, .result__body ol > li { counter-increment: step; position: relative; padding-left: 38px; margin: 10px 0; min-height: 26px; }
section ol > li::before, .result__body ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600;
}

/* Touches du clavier */
article kbd, .result__body kbd {
  font: inherit; font-size: 0.82em; padding: 2px 7px; border-radius: 7px; white-space: nowrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: 0 1px 0 var(--border-strong);
}
mark { background: var(--accent-soft); color: var(--text); border-radius: 4px; padding: 0 2px; }

.table { margin: 16px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.45; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; }
th { font-weight: 400; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tr + tr td { border-top: 1px solid var(--border); }
td:first-child { color: var(--text); }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager a { display: block; color: var(--text); max-width: 46%; }
.pager a span { display: block; font-size: 13px; color: var(--text-faint); }
.pager__next { text-align: right; margin-left: auto; }

/* ── Illustration : une séance rendue comme dans l'app ─────────────────────── */
.seance { margin: 20px 0; max-width: 380px; }
.seance figcaption { margin-top: 8px; font-size: 13px; color: var(--text-faint); }
.seance__phone {
  padding: 14px; border-radius: 24px;
  background: #121212; color: #C8C8C8;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow);
  display: grid; gap: 10px;
  font-size: 15px; line-height: 1.35;
}
.sx-text p { margin: 0; font-size: 14px; color: #A8A8A8; }
.sx-card { padding: 12px; border-radius: 16px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); }
.sx-title { margin: 0 0 8px !important; font-size: 16px; font-weight: 600; color: #F5F5F5; }
.sx-head { margin: 0 0 12px !important; }
.sx-pill { display: inline-block; max-width: 100%; padding: 4px 10px; border-radius: 99px; background: #2A2A2A; border: 1px solid rgba(140,140,140,0.45); font-size: 12.5px; line-height: 1.3; }
.sx-format { font-weight: 600; color: #DCDCDC; }
.sx-params { color: #8C8C8C; }
.sx-body { display: grid; gap: 12px; }
.sx-ex { display: grid; gap: 2px; }
.sx-ex + .sx-ex { margin-top: 6px; }
.sx-name { font-weight: 600; color: #F5F5F5; }
.sx-qty { color: #4ADE80; }
.sx-load { font-size: 13px; color: #C8C8C8; }
.sx-load--dyn { color: #C8C8C8; }
.sx-note { margin: -8px 0 0 !important; font-size: 12.5px; color: #8C8C8C; }
.sx-step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; }
.sx-bubble { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,0.10); color: #8C8C8C; font-size: 11px; font-weight: 600; margin-top: 2px; }
.sx-minute { margin: 0 0 1px !important; font-size: 11px; color: #5E5E5E; }
.sx-rest { display: inline-block; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10); font-size: 12px; color: #8C8C8C; }

/* ── Accueil ───────────────────────────────────────────────────────────────── */
.home { padding: 56px 32px 80px; max-width: 900px; }
.home__space { margin-top: 48px; }
.home__intro { color: var(--text-muted); margin-top: -6px; }
.home__section { margin: 28px 0 10px; font-size: 14px; color: var(--text-faint); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card {
  display: grid; gap: 6px; align-content: start;
  padding: 18px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card__title { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.25; }
.card__text { font-size: 14.5px; color: var(--text-muted); line-height: 1.45; }

/* ── Résultats de recherche ────────────────────────────────────────────────── */
.results { padding: 36px 32px 80px; max-width: 800px; min-width: 0; }
.results__count { color: var(--text-muted); margin-bottom: 20px; }
.result { padding: 22px 24px; margin-bottom: 14px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border); }
.result__path { font-size: 13px; color: var(--text-faint); margin-bottom: 4px; }
.result h2 { font-size: 20px; margin-bottom: 6px; }
.result__body { font-size: 15.5px; }
.result__more { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--text-muted); text-decoration: none; }
.result__more:hover { color: var(--text); }
.result__more::after { content: ' →'; }

.foot { padding: 28px 20px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-muted); text-align: center; }
.foot p { margin: 0; }

/* ── Écrans étroits ────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .doc { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; padding: 16px 16px 0; display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; }
  .side__title { display: none; }
  .side a { flex-shrink: 0; background: var(--surface-2); }
  .doc, .home, .results { padding: 28px 16px 60px; }
  .top { gap: 10px; padding: 0 16px; }
  .top__brand span, .top__links, .search kbd { display: none; }
  .theme button { width: 26px; }
}
@media (max-width: 800px) { .progress { top: var(--top); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
