/* =============================================================================
   Documentation. Loaded only on /docs. Shared tokens live in site.css.
   A single long, anchored page: sticky sidebar of #slug links, all articles
   rendered inline. Fully static — no JS required.
   ========================================================================== */

html { scroll-behavior: smooth; }

/* overflow-x:clip (not hidden) guards against horizontal overflow WITHOUT
   making .docs a scroll container — `hidden` would coerce overflow-y to auto,
   which would capture the sticky sidebar and stop it sticking to the viewport. */
.docs { background: #fff; color: var(--ink); overflow-x: clip; }
.docs__wrap {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: flex-start;
}

/* ------------------------------------------------------------------ sidebar -- */
.docs__sidebar {
  width: 276px; flex: none;
  position: sticky; top: 68px;
  max-height: calc(100vh - 68px); overflow-y: auto;
  border-right: 1px solid var(--line-2);
  padding: 30px 22px 40px;
}
.docs__search {
  display: flex; align-items: center; gap: 9px;
  background: #f1f4f8; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 12px; margin-bottom: 24px;
}
.docs__search svg { flex: none; }
.docs__searchinput {
  border: none; outline: none; flex: 1; min-width: 0;
  font: inherit; font-size: 14px; color: var(--ink); background: transparent;
}
.docs__searchinput::placeholder { color: #8b8f82; }

.docs__seclabel {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #8b8f82; font-weight: 700; margin: 20px 0 8px;
}
.docs__seclabel:first-of-type { margin-top: 0; }

.docs__navitem {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; margin-bottom: 2px; border-radius: 8px;
  font-size: 14.5px; font-weight: 500; color: #4c5147;
  text-decoration: none;
}
.docs__navitem:hover { background: #eef2f7; }
.docs__navbar {
  width: 4px; height: 16px; border-radius: 2px; flex: none;
  background: transparent;
}
.docs__navitem:hover .docs__navbar { background: var(--line-2); }

/* active article — highlighted in the sidebar (green pill + bar) */
.docs__navitem--active,
.docs__navitem--active:hover {
  color: var(--accent-deep); font-weight: 600;
  background: rgba(0, 214, 119, .12);
}
.docs__navitem--active .docs__navbar { background: var(--accent); }

/* --------------------------------------------------------------------- main -- */
.docs__main { flex: 1; min-width: 0; padding: 48px 56px 90px; }
.docs__head { max-width: 760px; }
.docs__title {
  margin: 0; font-size: 40px; line-height: 1.1; letter-spacing: -.03em;
  font-weight: 700; color: var(--ink);
}
.docs__lede {
  max-width: 680px; margin: 16px 0 0;
  font-size: 19px; line-height: 1.6; color: #565a4f; text-wrap: pretty;
}

/* ------------------------------------------------------------------ article -- */
.doc-article {
  max-width: 760px;
  padding-top: 40px; margin-top: 40px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 84px;   /* clear the sticky header on anchor jump */
}
/* first article sits flush with the main padding — no divider above it,
   matching the design where the page opens straight on the breadcrumb. */
.docs__main .doc-article:first-of-type {
  padding-top: 0; margin-top: 0; border-top: none;
}
.doc-article:target .doc-article__title { color: var(--accent-deep); }

.doc-article__crumb {
  font-size: 13px; color: #8b8f82; font-weight: 500; margin-bottom: 14px;
}
.doc-article__sep { margin: 0 8px; color: #c2c6cc; }

.doc-article__title {
  margin: 0; font-size: 40px; line-height: 1.1; letter-spacing: -.03em;
  font-weight: 700; color: var(--ink);
}
.doc-article__intro {
  font-size: 19px; line-height: 1.6; color: #565a4f;
  margin: 18px 0 30px; text-wrap: pretty;
}
.doc-article__h {
  font-size: 23px; font-weight: 700; color: var(--ink);
  letter-spacing: -.01em; margin: 34px 0 12px;
}
.doc-article__p {
  font-size: 16.5px; line-height: 1.75; color: #4c5147;
  margin: 0 0 16px; text-wrap: pretty;
}
.doc-article__list { margin: 0 0 16px; padding-left: 20px; }
.doc-article__list li {
  font-size: 16.5px; line-height: 1.7; color: #4c5147; margin-bottom: 8px;
}
.doc-article__h3 {
  font-size: 17px; font-weight: 700; color: var(--ink);
  letter-spacing: -.01em; margin: 24px 0 10px;
}

/* -------------------------------------------------------------- numbered steps -- */
.doc-steps {
  margin: 4px 0 22px; padding-left: 0; list-style: none;
  counter-reset: docstep;
}
.doc-steps li {
  position: relative; padding-left: 44px; min-height: 28px;
  margin-bottom: 14px;
  font-size: 16.5px; line-height: 1.7; color: #4c5147;
  counter-increment: docstep;
}
.doc-steps li::before {
  content: counter(docstep);
  position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,214,119,.12);
  border: 1px solid rgba(0,214,119,.38);
  color: var(--accent-deep);
  font-size: 13.5px; font-weight: 700;
}

/* --------------------------------------------------------------- note callout -- */
.doc-note {
  margin: 4px 0 22px; padding: 14px 16px 14px 18px;
  background: rgba(0,214,119,.055);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-size: 15.5px; line-height: 1.65; color: #4c5147; text-wrap: pretty;
}

/* ----------------------------------------------------- figure / img placeholder -- */
.doc-fig { margin: 6px 0 26px; display: none;}
.doc-fig__ph {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  aspect-ratio: 16 / 9; min-height: 200px;
  padding: 24px; box-sizing: border-box; text-align: center;
  background: #f5f7fa;
  border: 1.5px dashed var(--line-2);
  border-radius: 14px;
}
.doc-fig__icon { color: var(--accent-deep); opacity: .65; flex: none; }
.doc-fig__phtxt {
  max-width: 82%;
  font-size: 14px; font-weight: 600; line-height: 1.5; color: #6b6f64;
}
.doc-fig__cap {
  margin-top: 10px; text-align: center;
  font-size: 13.5px; line-height: 1.55; color: #8b8f82; font-style: italic;
}

/* ---------------------------------------------------------------- prev/next -- */
.doc-pager {
  display: flex; gap: 16px;
  margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line-2);
}
.doc-pager__link {
  flex: 1; text-decoration: none;
  border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 18px;
}
.doc-pager__link:hover { border-color: var(--accent); background: rgba(0,214,119,.05); }
.doc-pager__link--next { text-align: right; }
.doc-pager__dir { display: block; font-size: 12px; color: #8b8f82; margin-bottom: 4px; }
.doc-pager__title { display: block; font-size: 15.5px; font-weight: 600; color: var(--ink); }

/* --------------------------------------------------------------------- help -- */
.docs__help {
  max-width: 760px; margin-top: 40px;
  font-size: 15px; line-height: 1.6; color: #565a4f;
}
.docs__help a { color: var(--accent-deep); font-weight: 600; text-decoration: none; }
.docs__help a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- responsive -- */
@media (max-width: 860px) {
  .docs__wrap { flex-direction: column; }
  .docs__sidebar {
    width: 100%; position: static; max-height: none;
    border-right: none; border-bottom: 1px solid var(--line-2);
  }
  .docs__main { padding: 32px 22px 70px; }
  .doc-pager { flex-direction: column; }
  .doc-pager__link--next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* fix: sidebar nav wrapper */
.docs__nav { display: block; }

/* ------------------------------------------------------- collapsible sections -- */
.docs__sec { margin-bottom: 4px; }
.docs__sec > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 0; margin: 0;
}
.docs__sec > summary::-webkit-details-marker { display: none; }
/* The twisty is drawn here rather than left to the browser, so it is the same
   shape in every engine and rotates with the open state. */
.docs__sec > summary::before {
  content: ''; flex: none;
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  opacity: .55;
  transition: transform .12s ease;
}
.docs__sec[open] > summary::before { transform: rotate(90deg); }
.docs__sec > summary:hover { color: var(--accent-deep); }
.docs__seclabel:first-of-type { margin-top: 0; }

/* =============================================================================
   Search, versions, tables and callouts.
   ========================================================================== */

/* --------------------------------------------------------------- search box -- */
.docs__searchkbd {
  flex: none; font: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  color: #8b8f82; background: #fff; border: 1px solid var(--line-2);
  border-radius: 5px; padding: 2px 5px;
}

/* The results sit IN FLOW under the box rather than floating over the nav: the
   sidebar is a sticky scroll container, and an absolutely positioned panel would
   be clipped by its own overflow. Pushing the nav down costs nothing — nobody
   reads the nav while typing a query. */
.docs__results {
  margin: -12px 0 20px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; overflow: hidden;
  max-height: 60vh; overflow-y: auto;
}
.docs__result {
  display: block; padding: 10px 12px; text-decoration: none;
  border-bottom: 1px solid var(--line-2);
}
.docs__result:last-child { border-bottom: none; }
.docs__result:hover,
.docs__result--on { background: rgba(0,214,119,.08); }
.docs__resulttitle {
  display: block; font-size: 14px; font-weight: 600; color: var(--ink);
  line-height: 1.35;
}
.docs__resultsec {
  display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: #8b8f82; font-weight: 600; margin-top: 3px;
}
.docs__resulttext {
  display: block; margin-top: 4px;
  font-size: 12.5px; line-height: 1.5; color: #6b6f64;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.docs__noresult { padding: 14px 12px; font-size: 13.5px; color: #8b8f82; }

/* ------------------------------------------------------------------ version -- */
.docs__version { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.docs__versionlabel {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #8b8f82; font-weight: 700;
}
.docs__versionsel {
  flex: 1; min-width: 0; font: inherit; font-size: 13.5px; color: var(--ink);
  background: #f1f4f8; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 8px;
}
.docs__versiontag {
  display: inline-block; margin-bottom: 22px; padding: 4px 9px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: #6b6f64; background: #f5f7fa;
}
.docs__newbadge {
  margin-left: auto; padding: 1px 6px; border-radius: 999px;
  background: rgba(0,214,119,.16); color: var(--accent-deep);
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}

/* ------------------------------------------------------------------ banners -- */
.doc-banner {
  margin: 0 0 24px; padding: 12px 15px;
  border: 1px solid var(--line-2); border-left: 3px solid #c2c6cc;
  border-radius: 10px; background: #f5f7fa;
  font-size: 14.5px; line-height: 1.6; color: #565a4f;
}
.doc-banner a { color: var(--accent-deep); font-weight: 600; }
.doc-banner--old { border-left-color: #e0a92b; background: rgba(224,169,43,.07); }
.doc-note--warn {
  background: rgba(224,169,43,.08); border-left-color: #e0a92b;
}

/* -------------------------------------------------------------- on this page -- */
.doc-toc {
  margin: 0 0 30px; padding: 14px 16px;
  border: 1px solid var(--line-2); border-radius: 12px; background: #fafbfc;
}
.doc-toc__label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #8b8f82; font-weight: 700; margin-bottom: 8px;
}
.doc-toc ul { margin: 0; padding-left: 16px; }
.doc-toc li { margin-bottom: 5px; }
.doc-toc a { font-size: 14.5px; color: #4c5147; text-decoration: none; }
.doc-toc a:hover { color: var(--accent-deep); }
.doc-toc a.doc-toc__on { color: var(--accent-deep); font-weight: 600; }

/* ------------------------------------------------------------ heading anchor -- */
.doc-article__h, .doc-article__h3 { scroll-margin-top: 84px; }
.doc-anchor {
  margin-left: 8px; color: var(--line-2); text-decoration: none;
  opacity: 0; font-weight: 400;
}
.doc-article__h:hover .doc-anchor,
.doc-article__h3:hover .doc-anchor { opacity: 1; }
.doc-anchor:hover { color: var(--accent-deep); }

/* -------------------------------------------------------------- key + tables -- */
.doc-keys { border-collapse: collapse; width: 100%; margin: 4px 0 24px; }
.doc-keys tr { border-bottom: 1px solid var(--line-2); }
.doc-keys tr:last-child { border-bottom: none; }
.doc-keys__k { padding: 8px 14px 8px 0; white-space: nowrap; vertical-align: top; width: 1%; }
.doc-keys__d { padding: 8px 0; font-size: 15.5px; line-height: 1.6; color: #4c5147; }
.doc-keys kbd,
.docs kbd {
  display: inline-block; margin-right: 4px; padding: 3px 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: #f5f7fa; border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 6px;
}

/* A reference table can be wider than the column; it scrolls in its own box so
   the page itself never scrolls sideways. */
.doc-tablewrap { overflow-x: auto; margin: 4px 0 26px; }
.doc-table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc-table th, .doc-table td {
  text-align: left; padding: 9px 14px 9px 0; vertical-align: top;
  border-bottom: 1px solid var(--line-2); line-height: 1.6; color: #4c5147;
}
.doc-table th { font-weight: 700; color: var(--ink); font-size: 13px; letter-spacing: .02em; }
.doc-table tr:last-child td { border-bottom: none; }
