/* The /docs/ pages. Only the site's tokens (site.css :root, light and dark) are used, so the
   docs follow the theme; code token colours are mixed with --text so they adapt as well. */

.docs {
  --docs-measure: 70ch;
  --docs-code-bg: color-mix(in srgb, var(--text) 4%, var(--surface, var(--bg)));
  --docs-chip-bg: color-mix(in srgb, var(--text) 7%, transparent);
  --docs-hover: color-mix(in srgb, var(--text) 5%, transparent);
  --docs-tok-keyword: color-mix(in oklab, #b04ad8 72%, var(--text));
  --docs-tok-string: color-mix(in oklab, #2f9e44 72%, var(--text));
  --docs-tok-number: color-mix(in oklab, #d9480f 72%, var(--text));
  --docs-tok-name: color-mix(in oklab, #1c7ed6 62%, var(--text));
  --docs-tok-builtin: color-mix(in oklab, #0c8599 70%, var(--text));
  --docs-tok-comment: var(--text-3);
  --docs-tok-op: var(--text-2);
  --docs-sticky-top: 88px;
  color: var(--text);
  font-family: var(--font);
}

.docs-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- home -------------------------------------------------------------------------------- */

.docs-hero {
  text-align: center;
  padding: clamp(40px, 9vw, 112px) 0 clamp(32px, 6vw, 72px);
  max-width: 820px;
  margin: 0 auto;
}
.docs-hero h1 {
  font-size: clamp(40px, 7vw, 80px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 10px 0 18px;
}
.docs-hero .lead {
  margin: 0 auto 36px;
  max-width: 600px;
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--text-2);
  line-height: 1.5;
}

.docs-section { padding: clamp(24px, 5vw, 56px) 0; border-top: 1px solid var(--line); }
.docs-section-head { margin-bottom: 28px; max-width: var(--docs-measure); }
.docs-section-head h2 {
  font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 650;
}
.docs-section-head p { margin: 0; font-size: 17px; color: var(--text-2); }

.docs-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.docs-card {
  display: flex; flex-direction: column; gap: 10px; height: 100%;
  padding: 28px 28px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}
.docs-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.docs-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.docs-card-title { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
.docs-card-desc { color: var(--text-2); font-size: 16px; line-height: 1.55; flex: 1; }
.docs-card-more { color: var(--accent-text); font-weight: 550; font-size: 16px; }
.docs-empty { text-align: center; padding: 40px 0; }

.docs-results-page { max-width: var(--docs-measure); margin: 0 auto 48px; }
.docs-results-page h2 { font-size: 22px; margin: 0 0 16px; }
.docs-hit-list { list-style: none; margin: 0; padding: 0; }

/* --- search ------------------------------------------------------------------------------ */

.docs-search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  max-width: 560px; margin: 0 auto;
  padding: 6px 6px 6px 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  text-align: left;
}
.docs-search:focus-within { border-color: var(--accent); }
.docs-search-icon {
  position: absolute; left: 18px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border: 2px solid var(--text-3); border-radius: 50%;
}
.docs-search-icon::after {
  content: ""; position: absolute; width: 7px; height: 2px; background: var(--text-3);
  right: -6px; bottom: -3px; transform: rotate(45deg); border-radius: 1px;
}
.docs-search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 17px;
  padding: 10px 0;
}
.docs-search input::placeholder { color: var(--text-3); }
.docs-search input::-webkit-search-cancel-button { display: none; }
.docs-search-go { flex: none; }
html.js .docs-search-go { display: none; }
html.js .docs-search { padding-right: 18px; }

.docs-search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30;
  max-height: min(60vh, 480px); overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
}
.docs-search-results ul { list-style: none; margin: 0; padding: 0; }
.docs-search-empty { margin: 0; padding: 14px 16px; color: var(--text-2); }
.docs-hit {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; border-radius: 12px;
  color: var(--text); text-decoration: none;
}
.docs-hit:hover, .docs-hit:focus-visible { background: var(--docs-hover); outline: none; }
.docs-hit-title { font-weight: 600; font-size: 16px; }
.docs-hit-page { font-size: 13px; color: var(--accent-text); }
.docs-hit-text { font-size: 14px; color: var(--text-2); line-height: 1.45; }

.docs-search-compact { max-width: none; margin: 0 0 28px; box-shadow: none; padding-left: 40px; }
.docs-search-compact .docs-search-icon { left: 15px; width: 14px; height: 14px; margin-top: -7px; }
.docs-search-compact input { font-size: 15px; padding: 7px 0; }

/* --- page layout ------------------------------------------------------------------------- */

.docs-crumbs {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 14px; color: var(--text-2);
  padding: 28px 0 0;
}
.docs-crumbs a { color: var(--accent-text); text-decoration: none; }
.docs-crumbs a:hover { text-decoration: underline; }

.docs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px;
  padding-bottom: 80px;
}
@media (min-width: 1024px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}

.docs-article { min-width: 0; max-width: calc(var(--docs-measure) + 4ch); }
.docs-head { padding: 20px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.docs-head .eyebrow { margin: 0 0 10px; }
.docs-title {
  font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -0.025em;
  font-weight: 700; margin: 0 0 14px;
}
.docs-head .lead { margin: 0; color: var(--text-2); font-size: clamp(18px, 2vw, 21px); line-height: 1.5; }

.docs-aside { display: none; }
@media (min-width: 1024px) {
  .docs-aside { display: block; }
  .docs-aside-inner {
    position: sticky; top: var(--docs-sticky-top);
    max-height: calc(100vh - var(--docs-sticky-top) - 24px);
    display: flex; flex-direction: column;
    padding-top: 20px;
  }
}
.docs-toc { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.docs-toc-title {
  margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
.docs-toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.docs-toc-list a {
  display: block;
  padding: 5px 12px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-2); text-decoration: none;
  font-size: 14px; line-height: 1.4;
  overflow-wrap: anywhere;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.docs-toc-list .docs-toc-l3 a { padding-left: 24px; font-size: 13px; color: var(--text-3); }
.docs-toc-list a:hover { color: var(--text); }
.docs-toc-list a[aria-current] { color: var(--accent-text); border-left-color: var(--accent); }

.docs-toc-mobile {
  margin: 0 0 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.docs-toc-mobile summary {
  cursor: pointer; list-style: none;
  padding: 14px 20px; font-weight: 600; font-size: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.docs-toc-mobile summary::-webkit-details-marker { display: none; }
.docs-toc-mobile summary::after {
  content: ""; width: 8px; height: 8px; margin-left: 12px;
  border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg) translateY(-2px); transition: transform 0.3s var(--ease);
}
.docs-toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.docs-toc-mobile nav { max-height: 55vh; overflow: auto; padding: 0 20px 16px; }
@media (min-width: 1024px) { .docs-toc-mobile { display: none; } }

/* --- prose ------------------------------------------------------------------------------- */

.docs-prose { font-size: 17px; line-height: 1.7; color: var(--text); overflow-wrap: break-word; }
.docs-prose > * { max-width: var(--docs-measure); }
.docs-prose > :first-child { margin-top: 0; }
.docs-prose p, .docs-prose ul, .docs-prose ol { margin: 0 0 1.15em; }
.docs-prose ul, .docs-prose ol { padding-left: 1.4em; }
.docs-prose li { margin: 0.3em 0; }
.docs-prose li > p { margin: 0 0 0.5em; }
.docs-prose strong { font-weight: 650; }
.docs-prose h2, .docs-prose h3, .docs-prose h4 {
  scroll-margin-top: var(--docs-sticky-top);
  letter-spacing: -0.015em; line-height: 1.25; font-weight: 650;
}
.docs-prose h2 {
  font-size: clamp(26px, 3vw, 32px); margin: 2.2em 0 0.7em;
  padding-top: 1.2em; border-top: 1px solid var(--line);
}
.docs-prose h3 { font-size: 21px; margin: 1.9em 0 0.6em; }
.docs-prose h4 { font-size: 18px; margin: 1.6em 0 0.5em; }
.docs-prose h2 code, .docs-prose h3 code, .docs-prose h4 code { font-size: 0.86em; }
.docs-prose a { color: var(--accent-text); text-decoration: none; text-underline-offset: 0.18em; }
.docs-prose a:hover { text-decoration: underline; }
.docs-prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.docs-prose img { max-width: 100%; height: auto; border-radius: var(--radius); }

.docs-prose :not(pre) > code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--docs-chip-bg);
  padding: 0.12em 0.42em; border-radius: 6px;
  overflow-wrap: anywhere;
}

.docs-prose blockquote {
  margin: 1.6em 0; padding: 18px 22px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface, var(--bg)));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  color: var(--text);
}
.docs-prose blockquote > :last-child { margin-bottom: 0; }

.docs-prose table {
  display: block; max-width: 100%; overflow-x: auto;
  border-collapse: collapse; margin: 1.6em 0;
  font-size: 15px; line-height: 1.5;
}
.docs-prose th, .docs-prose td {
  padding: 10px 16px 10px 0; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.docs-prose th { font-weight: 600; color: var(--text-2); font-size: 13px; letter-spacing: 0.02em; }

.docs-prose .footnotes { font-size: 15px; color: var(--text-2); }
.docs-prose .footnotes-sep { margin: 3em 0 1.2em; }

/* --- code blocks ------------------------------------------------------------------------- */

.docs-code {
  margin: 1.4em 0 1.6em;
  background: var(--docs-code-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.docs-code-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 34px; padding: 0 8px 0 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.docs-code-lang {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3);
}
.docs-code[data-lang=""] .docs-code-head:not(:has(.docs-copy)) { display: none; }
.docs-copy {
  font: inherit; font-size: 12px; font-weight: 550;
  color: var(--text-2); background: transparent;
  border: 1px solid transparent; border-radius: 999px;
  padding: 4px 12px; margin: 4px 0; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.docs-copy:hover { background: var(--docs-hover); color: var(--text); }
.docs-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.docs-copy.is-done { color: var(--accent-text); }
.docs-pre {
  margin: 0; padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono); font-size: 14px; line-height: 1.6;
  tab-size: 4;
}
.docs-pre code { font-family: inherit; background: none; padding: 0; white-space: pre; }

/* Pygments tokens (classprefix "docs-tok-"). */
.docs-tok-k, .docs-tok-kd, .docs-tok-kn, .docs-tok-kr, .docs-tok-kc, .docs-tok-kt, .docs-tok-ow {
  color: var(--docs-tok-keyword);
}
.docs-tok-s, .docs-tok-s1, .docs-tok-s2, .docs-tok-sb, .docs-tok-sd, .docs-tok-se, .docs-tok-sh,
.docs-tok-si, .docs-tok-sx, .docs-tok-sr, .docs-tok-ss, .docs-tok-sc, .docs-tok-dl {
  color: var(--docs-tok-string);
}
.docs-tok-m, .docs-tok-mi, .docs-tok-mf, .docs-tok-mh, .docs-tok-mo, .docs-tok-mb, .docs-tok-il {
  color: var(--docs-tok-number);
}
.docs-tok-nf, .docs-tok-fm, .docs-tok-nc, .docs-tok-nt, .docs-tok-na { color: var(--docs-tok-name); }
.docs-tok-nb, .docs-tok-bp, .docs-tok-vg { color: var(--docs-tok-builtin); }
.docs-tok-c, .docs-tok-c1, .docs-tok-cm, .docs-tok-cs, .docs-tok-ch, .docs-tok-cp, .docs-tok-cpf {
  color: var(--docs-tok-comment); font-style: italic;
}
.docs-tok-o, .docs-tok-p { color: var(--docs-tok-op); }
.docs-tok-err { color: inherit; border: 0; }

/* --- previous / next --------------------------------------------------------------------- */

.docs-pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--line);
  max-width: var(--docs-measure);
}
.docs-pager a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.docs-pager a:hover { border-color: var(--accent); background: var(--docs-hover); }
.docs-pager-next { grid-column: 2; text-align: right; }
.docs-pager-dir { font-size: 13px; color: var(--text-2); }
.docs-pager-title { font-weight: 600; color: var(--accent-text); }

/* --- small screens ----------------------------------------------------------------------- */

@media (max-width: 600px) {
  .docs-prose { font-size: 16.5px; }
  .docs-hero { text-align: left; }
  .docs-hero .lead { margin-left: 0; }
  .docs-search { padding-left: 42px; }
  .docs-code { border-radius: 12px; margin-left: calc(-1 * min(var(--gutter, 16px), 8px)); margin-right: calc(-1 * min(var(--gutter, 16px), 8px)); }
  .docs-pre { font-size: 13px; padding: 14px; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-next { grid-column: 1; }
  .docs-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .docs *, .docs *::before, .docs *::after { transition: none !important; animation: none !important; }
  .docs-card:hover { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  html:has(.docs-doc) { scroll-behavior: smooth; }
}
