/* Pages de documentation (générées par build.py) : les couleurs de la page d'accueil, et une
   colonne « Sur cette page » qui suit la lecture, comme sur le site d'Otter. */

:root {
  --bg: #f6f1e9; --bg-card: #fffdf9; --line: #e6ddcf;
  --fg: #1f1b16; --fg-dim: #6d6359; --accent: #e2600e; --accent-soft: #fde6d4; --accent-2: #2e86ab;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f; --bg-card: #221d18; --line: #352d25;
    --fg: #f4ede3; --fg-dim: #a99e92; --accent: #f47a22; --accent-soft: #3f2412; --accent-2: #6cb7d6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120f; --bg-card: #221d18; --line: #352d25;
  --fg: #f4ede3; --fg-dim: #a99e92; --accent: #f47a22; --accent-soft: #3f2412; --accent-2: #6cb7d6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--fg); font-family: var(--sans); line-height: 1.65;
       -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* Navigation, comme sur la page d'accueil */
.nav { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
       background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--fg); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.nav .links { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: .95rem; }
.nav .links a { color: var(--fg-dim); }
.nav .links a:hover { color: var(--fg); text-decoration: none; }
.nav .links a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Deux colonnes : sommaire et texte */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 52px; padding-top: 34px; padding-bottom: 80px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 14px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 14px; }
.toc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--fg-dim); transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--fg); text-decoration: none; }
/* La section en cours de lecture (toc.js), et la section qui contient la sous-section lue. */
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc a.parent { color: var(--fg); }
.toc .title { font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: 10px; }

/* Le texte */
article.doc { min-width: 0; max-width: 820px; }
article.doc h1 { font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 18px; }
article.doc h2 { font-size: 1.6rem; letter-spacing: -.01em; margin-top: 52px; padding-top: 16px; border-top: 1px solid var(--line); }
article.doc h3 { font-size: 1.2rem; margin-top: 32px; }
article.doc h2, article.doc h3 { scroll-margin-top: 80px; }
article.doc .headerlink { visibility: hidden; margin-left: 8px; color: var(--fg-dim); }
article.doc h2:hover .headerlink, article.doc h3:hover .headerlink { visibility: visible; }
article.doc p, article.doc li { color: color-mix(in srgb, var(--fg) 90%, var(--fg-dim)); }
article.doc li + li { margin-top: 4px; }

article.doc code { font-family: var(--mono); font-size: .88em; background: var(--bg-card); border: 1px solid var(--line);
                   border-radius: 6px; padding: .1em .4em; }
article.doc pre { background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
                  overflow-x: auto; line-height: 1.55; box-shadow: 0 6px 18px -12px rgba(70, 40, 15, .3); }
article.doc pre code { border: 0; background: none; padding: 0; font-size: .86rem; }

article.doc table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .93rem; display: block; overflow-x: auto; }
article.doc th, article.doc td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
article.doc th { background: var(--bg-card); }
article.doc td code { white-space: nowrap; }

article.doc blockquote { margin: 18px 0; padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
/* Images du README (tickets, captures) : centrées côte à côte, comme sur GitHub. */
article.doc p[align="center"] { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 14px; }
article.doc p[align="center"] img { border-radius: 10px; box-shadow: 0 10px 30px -14px rgba(70, 40, 15, .4); height: auto; }

.caption { margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--fg-dim); font-size: .9rem; }

@media (max-width: 900px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; }  /* pas 1fr : les longs blocs de code défilent */
  .toc { position: static; max-height: none; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); }
  .nav .links { gap: 14px; font-size: .9rem; }
}
