/* Docs page (/docs): sidebar with the table of contents, one long article, hand-drawn SVG figures.
   Builds on site.css (tokens, header, buttons, footer). */

.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; align-items: start; padding: 48px 0 40px; }

/* ---------- language picker in the header (same languages as the panel) ---------- */
.docs-lang { position: relative; display: inline-flex; align-items: center; color: var(--text-dim); }
.docs-lang svg { position: absolute; left: 10px; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.docs-lang select {
  height: 34px; padding: 0 28px 0 32px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  color: var(--text); font: 500 13px var(--font-ui); cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 10px) 15px; background-size: 4px 4px; background-repeat: no-repeat;
  transition: border-color 0.2s;
}
.docs-lang select:hover, .docs-lang select:focus-visible { border-color: var(--line-strong); outline: none; }

/* ---------- sidebar ---------- */
.docs-nav { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.docs-nav__title { margin-bottom: 10px; font: 500 12px/1 var(--font-ui); color: var(--text-faint); }
.docs-nav ol { display: flex; flex-direction: column; gap: 1px; margin-bottom: 22px; }
.docs-nav a {
  display: block; padding: 6px 10px; border-radius: 7px; border-left: 2px solid transparent;
  color: var(--text-dim); font-size: 14px; line-height: 1.35; transition: color .15s, background-color .15s, border-color .15s;
}
.docs-nav a:hover { color: var(--text); background: var(--hover); }
.docs-nav a.is-active { color: var(--text); background: var(--surface-2); border-left-color: var(--accent); border-radius: 0 7px 7px 0; }
.docs-nav__search { width: 100%; margin-bottom: 16px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.docs-nav__search:focus { outline: none; border-color: var(--text-faint); }
.docs-nav__empty { padding: 6px 10px; font-size: 13.5px; color: var(--text-faint); }

/* ---------- article ---------- */
.docs-main { min-width: 0; max-width: 780px; }
.docs-hero { padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.docs-hero h1 { font: 700 clamp(36px, 5vw, 56px)/1.02 var(--font-display); letter-spacing: -0.035em; }
.docs-hero h1 em { font-style: normal; color: var(--accent); }
.docs-hero p { margin-top: 16px; max-width: 620px; color: var(--text-dim); font-size: 17px; }
.docs-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.docs-quick a { display: block; padding: 16px 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color .2s; }
.docs-quick a:hover { border-color: var(--accent-line); }
.docs-quick b { display: block; font-weight: 600; font-size: 15px; }
.docs-quick span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }

.docs-sec { padding: 56px 0 8px; scroll-margin-top: 80px; }
.docs-sec + .docs-sec { border-top: 1px solid var(--line); }
.docs-sec__n { display: block; margin-bottom: 10px; font: 500 12.5px/1 var(--font-mono); color: var(--accent); }
.docs-sec h2 { font: 700 clamp(26px, 3.2vw, 34px)/1.1 var(--font-display); letter-spacing: -0.025em; }
.docs-sec h3 { margin: 32px 0 10px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; scroll-margin-top: 80px; }
.docs-sec p, .docs-sec li { color: var(--text-dim); font-size: 15.5px; line-height: 1.75; }
.docs-sec > p:first-of-type { margin-top: 14px; }
.docs-sec p + p { margin-top: 12px; }
.docs-sec strong, .docs-sec b { color: var(--text); font-weight: 600; }
.docs-sec a:not(.btn) { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.docs-sec a:not(.btn):hover { text-decoration-color: var(--accent); }
.docs-sec ul.list { margin: 12px 0 4px; padding-left: 20px; list-style: disc; }
.docs-sec ul.list li + li { margin-top: 6px; }
.docs-sec code { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--text); font: 13.5px/1.6 var(--font-mono); }

/* numbered steps */
.docs-steps { counter-reset: st; margin: 22px 0 6px; display: grid; gap: 12px; }
.docs-steps > li { position: relative; padding: 18px 20px 18px 62px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.docs-steps > li::before {
  counter-increment: st; content: counter(st); position: absolute; left: 18px; top: 17px; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--accent-line); background: var(--accent-wash);
  font: 600 14px/1 var(--font-display); color: var(--accent);
}
.docs-steps > li > b { display: block; margin-bottom: 4px; font-size: 15.5px; color: var(--text); }
.docs-steps p { font-size: 15px; }

/* code blocks with copy button */
.code { position: relative; margin: 16px 0 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-raised); overflow: hidden; }
.code__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); font: 500 12px/1 var(--font-mono); color: var(--text-faint); }
.code__copy { height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; font: 500 12px/1 var(--font-ui); color: var(--text-dim); transition: color .15s, border-color .15s; }
.code__copy:hover { color: var(--text); border-color: var(--line-strong); }
.code__copy.is-done { color: var(--accent); border-color: var(--accent-line); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13.5px/1.7 var(--font-mono); color: var(--text); }
.code .c { color: var(--text-faint); }
.code .s { color: var(--accent); }
.code .k { color: var(--blue); }

/* callouts */
.note { display: flex; gap: 12px; margin: 20px 0 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--text-dim); }
.note p { font-size: 15px; }
.note--tip { border-color: var(--accent-line); background: linear-gradient(var(--accent-wash), var(--accent-wash)), var(--surface); }
.note--tip svg { color: var(--accent); }
.note--warn { border-color: color-mix(in srgb, var(--amber) 35%, transparent); background: linear-gradient(var(--amber-wash), var(--amber-wash)), var(--surface); }
.note--warn svg { color: var(--amber); }
.note--bad { border-color: color-mix(in srgb, var(--red) 35%, transparent); background: linear-gradient(var(--red-wash), var(--red-wash)), var(--surface); }
.note--bad svg { color: var(--red); }

/* tables */
.dtable { width: 100%; margin: 16px 0 6px; border: 1px solid var(--line); border-radius: var(--r); border-collapse: separate; border-spacing: 0; overflow: hidden; background: var(--surface); font-size: 14.5px; }
.dtable th { padding: 10px 14px; text-align: left; font-weight: 500; font-size: 13px; color: var(--text-faint); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dtable td { padding: 11px 14px; vertical-align: top; color: var(--text-dim); border-bottom: 1px solid var(--line); line-height: 1.55; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable td:first-child { color: var(--text); white-space: nowrap; }
.dtable-wrap { overflow-x: auto; }

/* ---------- figures (inline SVG, colours from the theme) ---------- */
.fig { margin: 24px 0 8px; padding: 22px 18px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig figcaption { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-faint); line-height: 1.55; }
.fig figcaption b { color: var(--text-dim); font-weight: 600; }
.f-box { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.f-box--accent { fill: var(--accent-wash); stroke: var(--accent-line); }
.f-box--warn { fill: var(--amber-wash); stroke: color-mix(in srgb, var(--amber) 40%, transparent); }
.f-box--bad { fill: var(--red-wash); stroke: color-mix(in srgb, var(--red) 40%, transparent); }
.f-box--plain { fill: var(--bg-raised); stroke: var(--line-strong); }
.f-title { fill: var(--text); font: 600 14px var(--font-ui); }
.f-text { fill: var(--text-dim); font: 400 12.5px var(--font-ui); }
.f-small { fill: var(--text-faint); font: 400 11.5px var(--font-ui); }
.f-mono { fill: var(--text); font: 500 12px var(--font-mono); }
.f-mono-dim { fill: var(--text-faint); font: 400 12px var(--font-mono); }
.f-accent { fill: var(--accent); }
.f-amber { fill: var(--amber); }
.f-red { fill: var(--red); }
.f-line { stroke: var(--text-faint); stroke-width: 1.4; fill: none; }
.f-line--accent { stroke: var(--accent); }
.f-line--dash { stroke-dasharray: 4 4; }
.f-arrow { fill: var(--text-faint); }
.f-arrow--accent { fill: var(--accent); }
.f-dot { fill: var(--accent); }
.f-badge { fill: var(--accent); }
.f-badge-t { fill: var(--accent-ink); font: 700 12px var(--font-ui); }
.f-track { fill: var(--surface-3); }

@media (max-width: 960px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 28px; }
  .docs-nav { position: static; max-height: none; margin-bottom: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .docs-nav ol { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .nav__cta .btn--ghost { display: none; }   /* room for the language picker; the logo links home */
  .docs-lang select { max-width: 132px; }
  .docs-quick { grid-template-columns: minmax(0, 1fr); }
  .docs-nav ol { grid-template-columns: minmax(0, 1fr); }
  .docs-steps > li { padding: 16px 16px 16px 56px; }
  .docs-steps > li::before { left: 14px; }
  .fig { padding: 14px 10px 10px; }
  .dtable td:first-child { white-space: normal; }
}
