/* Documentation publique de Supervise (F-0035).
   Un seul fichier de styles pour toutes les pages. Les couleurs reprennent les jetons de
   l'application (apps/frontend/web/src/app/globals.css), avec un thème sombre. */

:root {
  --bg: #fefefe;
  --bg-soft: #fafafa;
  --surface: #f5f5f5;
  --ink: #191919;
  --ink-soft: #525252;
  --muted: #737373;
  --faint: #a3a3a3;
  --line: #ededed;
  --line-strong: #dcdcdc;

  --blue: #1f4bff;
  --blue-dark: #1538c9;
  --blue-bg: #f5f7ff;
  --blue-line: #dce3ff;
  --green: #1a7f4b;
  --green-bg: #f0faf4;
  --green-line: #c8ebd6;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --amber-line: #f6e2b3;
  --red: #d92d20;
  --red-bg: #fef3f2;
  --red-line: #f3b9b3;

  --code-bg: #f6f7f9;
  --code-ink: #24292f;
  --code-dim: #8a8f98;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  --header-h: 60px;
  --sidebar-w: 272px;
  --toc-w: 220px;
  --content-max: 760px;

  --font-sans: "Geist", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012;
    --bg-soft: #141518;
    --surface: #1b1d21;
    --ink: #ececec;
    --ink-soft: #c2c2c2;
    --muted: #9a9a9a;
    --faint: #6b6b6b;
    --line: #26282d;
    --line-strong: #34373d;
    --blue: #7090ff;
    --blue-dark: #9db2ff;
    --blue-bg: #151b33;
    --blue-line: #263161;
    --green: #4cc38a;
    --green-bg: #11231a;
    --green-line: #1d4430;
    --amber: #f0b354;
    --amber-bg: #251c0c;
    --amber-line: #4a3816;
    --red: #ff7b72;
    --red-bg: #2a1413;
    --red-line: #55231f;
    --code-bg: #16181c;
    --code-ink: #e6edf3;
    --code-dim: #7d8590;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1012;
  --bg-soft: #141518;
  --surface: #1b1d21;
  --ink: #ececec;
  --ink-soft: #c2c2c2;
  --muted: #9a9a9a;
  --faint: #6b6b6b;
  --line: #26282d;
  --line-strong: #34373d;
  --blue: #7090ff;
  --blue-dark: #9db2ff;
  --blue-bg: #151b33;
  --blue-line: #263161;
  --green: #4cc38a;
  --green-bg: #11231a;
  --green-line: #1d4430;
  --amber: #f0b354;
  --amber-bg: #251c0c;
  --amber-line: #4a3816;
  --red: #ff7b72;
  --red-bg: #2a1413;
  --red-line: #55231f;
  --code-bg: #16181c;
  --code-ink: #e6edf3;
  --code-dim: #7d8590;
  color-scheme: dark;
}

/* --- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
code, kbd, pre { font-family: var(--font-mono); }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-md);
}
.skip-link:focus { top: 12px; }

/* --- En-tête ------------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: baseline; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 21px; font-weight: 500; color: var(--blue); letter-spacing: -0.02em; line-height: 1; }
.brand-tag { font-weight: 400; color: var(--muted); font-size: 14px; padding-left: 10px; border-left: 1px solid var(--line-strong); }

.header-search {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 10px;
  width: min(320px, 100%);
  height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg-soft); color: var(--muted); cursor: pointer; font-size: 14px;
}
.header-search:hover { border-color: var(--faint); }
.header-search svg { flex: none; }
.header-search span { flex: 1; text-align: left; }
kbd {
  font-size: 11.5px; padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--muted);
}

.header-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.header-link { font-size: 14px; color: var(--ink-soft); padding: 6px 10px; border-radius: var(--r-md); }
.header-link:hover { background: var(--surface); text-decoration: none; color: var(--ink); }
.menu-btn { display: none; }

/* --- Mise en page ------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1440px; margin: 0 auto;
}
.layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 16px 48px 20px;
  border-right: 1px solid var(--line);
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-group-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 6px 10px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: 6px 10px; border-radius: var(--r-md);
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.4;
}
.nav-list a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.nav-list a[aria-current="page"] { background: var(--blue-bg); color: var(--blue); font-weight: 500; }
.nav-badge {
  margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 99px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line); vertical-align: 1px;
}

.content { padding: 40px 56px 96px; min-width: 0; }
.article { max-width: var(--content-max); margin: 0 auto; }

.toc {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 40px 20px 40px 8px; font-size: 13.5px;
}
.toc-title { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a {
  display: block; padding: 4px 0 4px 14px; margin-left: -1px;
  color: var(--muted); border-left: 1px solid transparent; line-height: 1.4;
}
.toc li.depth-3 a { padding-left: 26px; }
.toc li a:hover { color: var(--ink); text-decoration: none; }
.toc li a.active { color: var(--blue); border-left-color: var(--blue); }

/* --- Typographie de l'article ------------------------------------------- */

.page-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; min-height: 28px; }
.breadcrumb { font-size: 13.5px; color: var(--muted); margin: 0; }
.md-btn { flex: none; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span[aria-hidden] { margin: 0 6px; color: var(--faint); }

.article h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; margin: 0 0 12px; text-wrap: balance; }
.article .lead { font-size: 17.5px; color: var(--ink-soft); margin: 0 0 32px; text-wrap: pretty; }
.article h2 {
  font-size: 23px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600;
  margin: 48px 0 12px; padding-top: 4px;
}
.article h3 { font-size: 18px; font-weight: 600; margin: 32px 0 8px; }
.article h4 { font-size: 15.5px; font-weight: 600; margin: 24px 0 6px; }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; }
.article li { margin: 4px 0; }
.article li > ul, .article li > ol { margin: 4px 0; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.article strong { font-weight: 600; }

.anchor { margin-left: 8px; color: var(--faint); opacity: 0; font-weight: 400; transition: opacity .15s; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; text-decoration: none; }

:not(pre) > code {
  font-size: 0.88em; padding: 0.12em 0.4em; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  overflow-wrap: anywhere;
}

/* --- Blocs de code ------------------------------------------------------- */

.code {
  position: relative; margin: 0 0 20px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--code-bg); overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; color: var(--code-ink); }
.code pre code { white-space: pre; }
.code .c { color: var(--code-dim); }
.code .p { color: var(--code-dim); user-select: none; }
.code .s { color: var(--green); }
.code .k { color: var(--blue); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink-soft);
  font-size: 12.5px; cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--faint); }
.copy-btn[data-done] { color: var(--green); border-color: var(--green-line); }
.code:not(:has(.code-head)) .copy-btn { position: absolute; top: 8px; right: 8px; }
.code:not(:has(.code-head)) pre { padding-right: 104px; }

/* Une invite à donner à Claude, telle quelle */
.prompt {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-soft);
}
.prompt-icon {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; margin-top: 1px;
}
.prompt-text { flex: 1; font-size: 15px; }
.prompt .copy-btn { flex: none; }

/* --- Encadrés ------------------------------------------------------------ */

.callout {
  display: flex; gap: 12px; margin: 0 0 20px; padding: 12px 16px;
  border: 1px solid var(--blue-line); border-radius: var(--r-lg); background: var(--blue-bg);
  font-size: 14.5px;
}
.callout > svg { flex: none; margin-top: 3px; color: var(--blue); }
.callout > div > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; display: block; margin-bottom: 2px; }
.callout.tip { border-color: var(--green-line); background: var(--green-bg); }
.callout.tip > svg { color: var(--green); }
.callout.warn { border-color: var(--amber-line); background: var(--amber-bg); }
.callout.warn > svg { color: var(--amber); }
.callout.danger { border-color: var(--red-line); background: var(--red-bg); }
.callout.danger > svg { color: var(--red); }

/* --- Étapes numérotées --------------------------------------------------- */

.steps { list-style: none; counter-reset: step; padding: 0 !important; margin: 0 0 24px; }
.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 22px 46px; margin: 0;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.steps > li::after {
  content: ""; position: absolute; left: 14px; top: 34px; bottom: 6px; width: 1px; background: var(--line);
}
.steps > li:last-child::after { display: none; }
.steps > li > strong:first-child { display: block; font-size: 16px; margin-bottom: 4px; padding-top: 2px; }
.steps .code, .steps .callout, .steps .prompt { margin-top: 8px; }

/* --- Onglets ------------------------------------------------------------- */

.tabs { margin: 0 0 24px; }
.tab-list {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
  overflow-x: auto; scrollbar-width: none;
}
.tab-list button {
  flex: none; padding: 10px 14px; margin-bottom: -1px; border: 0; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; color: var(--muted); font-size: 14.5px; font-weight: 500;
}
.tab-list button:hover { color: var(--ink); }
.tab-list button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.tab[hidden] { display: none; }

/* --- Cartes -------------------------------------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 24px; }
.card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
a.card:hover { border-color: var(--blue-line); box-shadow: 0 2px 12px rgba(31, 75, 255, 0.06); text-decoration: none; color: var(--ink); }
.card-icon {
  width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center;
  background: var(--blue-bg); color: var(--blue); margin-bottom: 4px;
}
.card-title { font-weight: 600; font-size: 15.5px; }
.card-text { color: var(--muted); font-size: 14px; line-height: 1.5; }
.card.soon { background: var(--bg-soft); border-style: dashed; }
.card.soon .card-icon { background: var(--surface); color: var(--faint); }

/* --- Tableaux ------------------------------------------------------------ */

.table-wrap { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--line); border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; font-size: 13px; color: var(--muted); background: var(--bg-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

/* --- Badges -------------------------------------------------------------- */

.badge {
  display: inline-block; font-size: 12px; font-weight: 500; line-height: 1.6;
  padding: 0 8px; border-radius: 99px; border: 1px solid var(--line-strong);
  color: var(--ink-soft); background: var(--bg); white-space: nowrap;
}
.badge.ok { color: var(--green); border-color: var(--green-line); background: var(--green-bg); }
.badge.warn { color: var(--amber); border-color: var(--amber-line); background: var(--amber-bg); }
.badge.no { color: var(--red); border-color: var(--red-line); background: var(--red-bg); }
.badge.info { color: var(--blue); border-color: var(--blue-line); background: var(--blue-bg); }

/* --- Référence d'un outil ------------------------------------------------ */

.tool { margin: 0 0 40px; }
.tool h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.tool h2 code { font-size: 0.8em; background: none; border: 0; padding: 0; }
.tool-title { color: var(--muted); font-size: 15px; font-weight: 400; margin: -6px 0 12px; }
.params { list-style: none; padding: 0 !important; margin: 0 0 16px; border-top: 1px solid var(--line); }
.params > li { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }
.param-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 2px; }
.param-name { font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.param-type { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.param-req { font-size: 12px; color: var(--amber); font-weight: 500; }
.param-default { font-size: 12.5px; color: var(--muted); }
.params p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

/* --- Schéma du parcours ---------------------------------------------------- */

.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0 28px; }
.flow-step {
  position: relative; padding: 14px 12px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-soft); font-size: 13.5px; line-height: 1.45;
}
.flow-step b { display: block; font-size: 14px; margin-bottom: 4px; }
.flow-step .who { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.flow-step.you { border-color: var(--blue-line); background: var(--blue-bg); }
.flow-step.you .who { color: var(--blue); }
.flow-step.sup { border-color: var(--green-line); background: var(--green-bg); }
.flow-step.sup .who { color: var(--green); }

/* --- Page d'accueil ------------------------------------------------------ */

.hero { padding: 8px 0 8px; }
.hero h1 { font-size: 40px; }
.hero-search {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 520px;
  height: 48px; padding: 0 14px; margin: 8px 0 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--bg);
  color: var(--muted); font-size: 15.5px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.hero-search:hover { border-color: var(--faint); }
.hero-search span { flex: 1; text-align: left; }

/* --- Précédent / suivant, pied de page ----------------------------------- */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink);
}
.pager a:hover { border-color: var(--blue-line); text-decoration: none; }
.pager .next { text-align: right; grid-column: 2; }
.pager small { color: var(--muted); font-size: 12.5px; }
.pager b { font-weight: 500; color: var(--blue); }

.page-footer {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: 13px;
}
.page-footer a { color: var(--muted); }

/* --- Recherche ------------------------------------------------------------ */

.search-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 96px));
  margin: 72px auto auto; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--bg); color: var(--ink); box-shadow: 0 24px 64px rgba(0,0,0,.22);
  overflow: hidden;
}
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgba(10, 12, 20, .35); backdrop-filter: blur(2px); }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-field input {
  flex: 1; height: 54px; border: 0; outline: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px;
}
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results li a {
  display: block; padding: 10px 12px; border-radius: var(--r-md); color: var(--ink);
}
.search-results li a:hover, .search-results li a[aria-selected="true"] { background: var(--blue-bg); text-decoration: none; }
.search-results .r-page { font-size: 12px; color: var(--muted); display: block; }
.search-results .r-title { font-weight: 500; }
.search-results .r-text { font-size: 13px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results mark { background: none; color: var(--blue); font-weight: 600; }
.search-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.search-foot { padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 14px; }

/* --- Petits écrans -------------------------------------------------------- */

@media (max-width: 1180px) {
  .layout, .layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .content { padding: 36px 40px 80px; }
}

@media (max-width: 860px) {
  .layout, .layout.no-toc { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .brand-tag { display: none; }
  .header-search { width: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; margin-left: auto; }
  .header-search span, .header-search kbd { display: none; }
  .header-link { display: none; }
  .site-header { padding: 0 12px 0 16px; gap: 8px; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 30;
    width: min(320px, 86vw); height: auto;
    background: var(--bg); transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
  body.nav-open .sidebar { transform: none; box-shadow: 8px 0 32px rgba(0,0,0,.12); }
  body.nav-open::after {
    content: ""; position: fixed; inset: var(--header-h) 0 0 0; z-index: 20; background: rgba(10,12,20,.3);
  }
  .content { padding: 28px 16px 64px; }
  .article h1, .hero h1 { font-size: 28px; }
  .flow { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .sidebar, .toc, .pager, .copy-btn { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
}
