/* The docs site. Same palette as the editor, so the two read as one project. */
:root {
  --bg: #0d1117; --panel: #12161c; --line: #222a35; --text: #d6deeb;
  --muted: #7c8b9d; --accent: #82aaff; --ok: #6ec49a; --err: #ff6b7f;
  --code-bg: #10141a; --mark: #c792ea; --str: #c3e88d; --num: #f78c6c;
  --header: 45px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.65 ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* --- header ------------------------------------------------------------------------- */

header.site {
  position: sticky; top: 0; z-index: 20; height: var(--header);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  font-size: 13px;
}
header.site .brand { font-weight: 700; letter-spacing: .02em; color: var(--text); }
header.site .brand span { color: var(--accent); }
header.site .brand:hover { text-decoration: none; }
header.site .tag {
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 9px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
}
header.site .grow { flex: 1; }

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

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 32px;
  max-width: 1400px; margin: 0 auto; padding: 0 20px;
  align-items: start;
}

.sidebar {
  position: sticky; top: var(--header);
  max-height: calc(100vh - var(--header)); overflow-y: auto;
  padding: 26px 0 40px; font-size: 13.5px;
}
.nav-section + .nav-section { margin-top: 20px; }
.nav-section h2 {
  margin: 0 0 7px; font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 3px 10px; border-radius: 5px;
  color: var(--text); border-left: 2px solid transparent;
}
.sidebar li a:hover { background: var(--panel); text-decoration: none; }
.sidebar li a.current {
  color: var(--accent); background: var(--panel); border-left-color: var(--accent); font-weight: 600;
}

.nav-button { display: none; }

main { min-width: 0; padding: 26px 0 80px; }

.toc {
  position: sticky; top: var(--header);
  max-height: calc(100vh - var(--header)); overflow-y: auto;
  padding: 26px 0 40px; font-size: 12.5px;
}
.toc h2 {
  margin: 0 0 7px; font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { color: var(--muted); display: block; padding: 2px 0; }
.toc a:hover { color: var(--accent); }
.toc .d3 { padding-left: 12px; }

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

.prose { max-width: 48rem; }
.prose > *:first-child { margin-top: 0; }

.prose h1 { font-size: 30px; line-height: 1.25; margin: 0 0 22px; letter-spacing: -.01em; }
.prose h2 {
  font-size: 21px; margin: 44px 0 14px; padding-top: 10px;
  border-top: 1px solid var(--line); letter-spacing: -.01em;
}
.prose h3 { font-size: 17px; margin: 30px 0 10px; }
.prose h4 { font-size: 14px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.prose h1 code, .prose h2 code, .prose h3 code {
  font-size: .95em; background: none; padding: 0; color: inherit;
}

.anchor { margin-left: .4em; color: var(--line); font-weight: 400; opacity: 0; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }

.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0; }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }

.prose blockquote {
  margin: 0 0 16px; padding: 10px 16px;
  border-left: 3px solid var(--accent); background: var(--panel);
  border-radius: 0 6px 6px 0;
}
.prose blockquote > *:last-child { margin-bottom: 0; }

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .875em;
}
.prose :not(pre) > code {
  background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 4px; padding: .1em .35em; color: #e6edf3;
}
pre.code {
  margin: 0 0 16px; padding: 13px 16px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px;
  line-height: 1.55;
}
pre.code code { background: none; border: 0; padding: 0; font-size: 13px; }

.tok-m { color: var(--muted); font-style: italic; }   /* comment    */
.tok-s { color: var(--str); }                          /* string     */
.tok-i { color: var(--accent); }                       /* ${splice}  */
.tok-n { color: var(--num); }                          /* number     */
.tok-k { color: var(--mark); }                         /* keyword    */
.tok-b { color: var(--accent); }                       /* block      */
.tok-f { color: var(--ok); }                           /* function   */
.tok-c { color: #ffcb6b; }                             /* constant   */
.tok-a { color: #b2ccd6; }                             /* attribute  */

/* --- tables ------------------------------------------------------------------------- */

.prose table {
  width: 100%; margin: 0 0 18px; border-collapse: collapse;
  font-size: 13.5px; display: block; overflow-x: auto;
}
.prose th, .prose td {
  text-align: left; vertical-align: top;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
}
.prose th {
  color: var(--muted); font-weight: 600; font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.prose tbody tr:hover { background: var(--panel); }
.prose td code { white-space: nowrap; }

/* --- narrow ------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }

  /* A checkbox rather than a script: the sidebar is the only interactive thing on the
     page, and it is not worth a bundle. */
  .nav-button {
    display: inline-block; margin: 16px 0 0; padding: 6px 12px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--panel); color: var(--muted); font-size: 13px; cursor: pointer;
  }
  .nav-button::before { content: "☰  "; }
  .sidebar { display: none; position: static; max-height: none; padding: 16px 0 0; }
  #nav-toggle:checked ~ .sidebar { display: block; }
  main { padding-top: 20px; }
  .prose h1 { font-size: 25px; }
}
