/* The docs (server/docs.py), laid out like Vercel's docs: a sidebar of pages, the page, and its "On this page" list,
   in Geist with Vercel's sizes and spacing. The colours are the site's (warm greys on #111, not Vercel's pure black). */
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 500; font-display: swap;
  src: url("/static/fonts/geist/Geist-Regular.ttf") format("truetype");
}
@font-face { /* the only heavier face: 600 (Vercel's headings) draws with it too */
  font-family: "Geist"; font-style: normal; font-weight: 600 900; font-display: swap;
  src: url("/static/fonts/geist/Geist-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Geist"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/geist/Geist-Italic.ttf") format("truetype");
}

:root {
  --bg: #111111;
  --bg-1: #161616;      /* code, buttons */
  --bg-2: #1c1c1c;      /* inline code, keys */
  --bg-3: #242424;      /* hovered and current sidebar items */
  --line: #222222;      /* dividers */
  --line-2: #2e2e2e;    /* borders */
  --line-3: rgba(255, 255, 255, 0.14);
  --white: #f2f1ea;     /* headings */
  --text: #e3e2db;      /* reading text */
  --text-2: #a19f97;
  --text-3: #84827b;
  --accent: #3291ff;
  --font: "Geist", "Inter Variable", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Cascadia Mono", monospace; /* Consolas: lighter than Cascadia */
  --top: 52px; /* the app's bar */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 24px); }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ top bar */
.d-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--top); padding: 0 12px; background: var(--bg); /* the app's bar, so the name sits where the app's does */
  /* the other pages' bar font (landing.css --font): they load no Geist, so it draws in the system's font */
  font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
.d-brand { /* the app's .brand, as on the other pages' bar (landing.css .lp-brand) */
  display: block; margin-left: -2px; padding: 4px 6px; border-radius: 6px; color: var(--white); font-size: 15px;
  line-height: 1.4; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap;
}
.d-brand:hover { background: #262626; }
.d-account { display: flex; gap: 4px; }
.d-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--bg-1); color: var(--white); font-size: 14px; line-height: 21px;
  font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .12s;
}
.d-btn span { display: inline-block; } /* center.js moves the words for the eye */
.d-btn:hover { background: var(--bg-3); }
.d-btn.primary { border-color: var(--white); background: var(--white); color: #111; }
.d-btn.primary:hover { border-color: #fff; background: #fff; }
.d-btn.ghost { border-color: transparent; background: none; color: #898781; } /* landing.css --text-2 */
.d-btn.ghost:hover { border-color: #262626; background: #262626; color: var(--white); }

/* the phone's bar under the top bar: the sidebar opens from it */
.d-bar { display: none; }

/* ------------------------------------------------------------------ the three columns */
.d-body {
  flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr) 256px; width: 100%; max-width: 1440px;
  margin: 0 auto;
}

/* sidebar */
.d-side {
  position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px 32px; scrollbar-width: thin; scrollbar-color: #2e2e2e transparent;
}
.d-search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 10px; border-radius: 6px;
  box-shadow: 0 0 0 1px var(--line-2); color: var(--text-2); cursor: text;
}
.d-search:focus-within { box-shadow: 0 0 0 1px var(--line-2), 0 0 0 3px rgba(50, 145, 255, 0.45); }
.d-search svg { flex: none; }
.d-search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; color: var(--white);
  font: 14px/21px var(--font);
}
.d-search input::placeholder { color: var(--text-2); }
.d-search input::-webkit-search-cancel-button { display: none; }
.d-search kbd { flex: none; }
.d-nav { margin-top: 16px; }
.d-group { margin: 16px 0 0; padding: 8px 10px 4px; color: var(--text-3); font-size: 13px; line-height: 16px; }
.d-group:first-child { margin-top: 0; }
.d-item, .d-hit {
  display: flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: 6px; color: var(--text);
  font-size: 14px; line-height: 21px; text-decoration: none;
}
.d-item:hover, .d-hit:hover, .d-hit.on { background: var(--bg-3); color: var(--white); }
.d-item[aria-current] { background: var(--bg-3); color: var(--white); font-weight: 500; }

/* search results take the sidebar's list's place */
.d-results { margin-top: 12px; }
.d-hit { flex-direction: column; align-items: flex-start; justify-content: center; padding: 7px 10px; gap: 1px; }
.d-hit .t { color: var(--white); }
.d-hit .p { color: var(--text-3); font-size: 12px; line-height: 16px; }
.d-none { padding: 8px 10px; color: var(--text-3); font-size: 14px; }

/* the page */
.d-main { min-width: 0; padding: 72px 48px 0 12px; }
.d-article { max-width: 800px; }
.d-article > * { margin: 0; }
.d-article > * + * { margin-top: 20px; }
.d-article h1 { color: var(--white); font-size: 40px; line-height: 48px; font-weight: 600; letter-spacing: -0.05em; }
.d-article .d-lead { margin-top: 12px; color: var(--text-2); font-size: 18px; line-height: 28px; }
.d-article h2 { margin-top: 56px; color: var(--white); font-size: 24px; line-height: 32px; font-weight: 600;
  letter-spacing: -0.04em; }
.d-article h3 { margin-top: 36px; color: var(--white); font-size: 20px; line-height: 26px; font-weight: 600;
  letter-spacing: -0.02em; }
.d-article h2 + *, .d-article h3 + * { margin-top: 14px; }
.d-article h2 a, .d-article h3 a { color: inherit; text-decoration: none; }
.d-article p, .d-article li { line-height: 1.7; }
.d-article a:not(h2 a, h3 a) {
  color: var(--white); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(242, 241, 234, 0.45);
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.d-article a:not(h2 a, h3 a):hover { text-decoration-color: currentColor; }
.d-article strong { color: var(--white); font-weight: 600; }
.d-article ul, .d-article ol { padding-left: 24px; }
.d-article li { padding-left: 4px; }
.d-article li + li { margin-top: 8px; }
.d-article ul li::marker { color: #4a4945; }
.d-article ol li::marker { color: var(--text-2); }

code, kbd { font-family: var(--mono); }
.d-article :not(pre) > code {
  padding: 1px 5px; border-radius: 4px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line-3);
  color: var(--white); font-size: 0.86em;
}
kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 4px; background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-3); color: var(--text); font-size: 12px; line-height: 20px; text-align: center;
  white-space: nowrap; vertical-align: 1px;
}

/* a code block: its name, a Copy button, then the code */
.d-code { border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2); overflow: hidden; }
.d-code figcaption {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 5px 0 16px; border-bottom: 1px solid var(--line-2);
  color: var(--text-2); font-size: 13px; line-height: 16px;
}
.d-code figcaption span { flex: 1; }
.d-copy {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--text-2); cursor: pointer;
}
.d-copy:hover { background: var(--bg-3); color: var(--white); }
.d-copy.done { color: #62c073; }
.d-code pre {
  margin: 0; padding: 16px; background: var(--bg-1); overflow-x: auto; color: var(--text); font: 13.5px/1.7 var(--mono);
  tab-size: 2; scrollbar-width: thin; scrollbar-color: #2e2e2e transparent;
}

/* tables */
.d-table { border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2); overflow-x: auto; }
.d-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
.d-table th { padding: 10px 16px; background: var(--bg-1); border-bottom: 1px solid var(--line-2); color: var(--text-2);
  font-weight: 500; text-align: left; white-space: nowrap; }
.d-table td { padding: 12px 16px; vertical-align: top; }
.d-table tr + tr td { border-top: 1px solid var(--line); }
.d-table td:first-child { color: var(--white); white-space: nowrap; }

/* a note */
.d-note { padding: 12px 16px; border-radius: 8px; background: var(--bg-1); box-shadow: 0 0 0 1px var(--line-2);
  font-size: 14px; line-height: 1.6 !important; }

/* Previous / Next */
.d-pager { display: flex; justify-content: space-between; gap: 16px; max-width: 800px; margin: 80px 0 64px; }
.d-pager a { display: flex; flex-direction: column; gap: 4px; padding: 0 0 0 24px; text-decoration: none; }
.d-pager .d-next { margin-left: auto; align-items: flex-end; padding: 0 24px 0 0; text-align: right; }
.d-dir { color: var(--text-2); font-size: 13px; line-height: 16px; }
.d-to { position: relative; color: var(--white); font-size: 16px; line-height: 24px; font-weight: 500; }
.d-to svg { position: absolute; top: 4px; color: var(--text-3); transition: transform .15s; }
.d-prev .d-to svg { left: -24px; }
.d-next .d-to svg { right: -24px; }
.d-prev:hover .d-to svg { transform: translateX(-2px); color: var(--white); }
.d-next:hover .d-to svg { transform: translateX(2px); color: var(--white); }

/* On this page */
.d-toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 28px 16px 32px 0; scrollbar-width: none; }
.d-toc-title { margin: 0; padding-bottom: 14px; color: var(--text-3); font-size: 14px; line-height: 20px; }
.d-toc ul { margin: 0; padding: 0; list-style: none; box-shadow: inset 1px 0 0 var(--line-2); }
.d-toc a {
  display: block; padding: 6px 0 6px 16px; border-left: 1px solid transparent; color: var(--text-2); font-size: 14px;
  line-height: 20px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.d-toc .l3 a { padding-left: 32px; }
.d-toc a:hover { color: var(--white); }
.d-toc a.on { border-left-color: var(--white); color: var(--white); font-weight: 500; }

/* foot, under the page (inside its column, so the sticky sidebar never moves up for it) */
.d-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; max-width: 800px; padding: 16px 0 24px;
  border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; line-height: 20px;
}
.d-foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.d-foot a { color: var(--text-3); text-decoration: none; }
.d-foot a:hover { color: var(--white); }

/* ------------------------------------------------------------------ narrower windows */
@media (max-width: 1279px) { /* no room for On this page */
  .d-body { grid-template-columns: 300px minmax(0, 1fr); }
  .d-toc { display: none; }
}
@media (max-width: 1023px) { /* the sidebar opens from a Menu button */
  :root { --bar: 48px; }
  html { scroll-padding-top: calc(var(--top) + var(--bar) + 16px); }
  .d-bar {
    position: sticky; top: var(--top); z-index: 15; display: flex; align-items: center; gap: 12px; height: var(--bar);
    padding: 0 16px; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  }
  .d-menu { display: flex; align-items: center; gap: 8px; height: 32px; margin-left: -8px; padding: 0 8px; border: 0;
    border-radius: 6px; background: none; color: var(--white); font-size: 14px; font-weight: 500; cursor: pointer; }
  .d-menu:hover { background: var(--bg-3); }
  .d-bar-title { min-width: 0; overflow: hidden; color: var(--text-2); font-size: 14px; text-overflow: ellipsis;
    white-space: nowrap; }
  .d-body { display: block; }
  .d-side { position: fixed; inset: calc(var(--top) + var(--bar)) 0 0; z-index: 14; height: auto; padding: 16px;
    background: var(--bg); visibility: hidden; opacity: 0; transition: opacity .15s, visibility 0s .15s; }
  body.menu-open { overflow: hidden; }
  body.menu-open .d-side { visibility: visible; opacity: 1; transition: opacity .15s; }
  .d-main { padding: 40px 16px 0; }
  .d-article h1 { font-size: 32px; line-height: 40px; }
  .d-pager { margin: 64px 0 48px; }
  .d-search kbd { display: none; }
}
@media (max-width: 420px) {
  .d-account .d-btn:not(.primary) { display: none; }
}
