/* ---------------------------------------------------------------------------
   The documentation
   ---------------------------------------------------------------------------
   Loaded after `shared.css` and `site.css`, so the bar, the footer, the type
   and the palette are the site's own. What this file adds is the shape of a
   page that is read for an hour rather than scanned for a minute: a left-hand
   nav that stays put, a measure for the prose, an outline on the right, and a
   figure that shows a screenshot at the size it was taken.

   Light and dark. The site itself is dark and stays dark; a reference is
   read in whichever the reader's day is set to, so this follows the operating
   system until the switch in the toolbar says otherwise. The light values are
   `shared.css`'s own — the palette the site was drawn on before it went dark —
   so the two themes are one design at two brightnesses rather than two
   designs.
   --------------------------------------------------------------------------- */

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #faf9f7;
    --bg-panel: #ffffff;
    --bg-raised: #f3f1ed;
    --line: #e2ded6;
    --line-soft: #eeebe5;
    --text: #17171a;
    --text-soft: #55555e;
    --text-dim: #6f6f79;
    --accent: #c7491c;
    --accent-wash: rgba(199, 73, 28, 0.09);
    --ok: #2c864d;
    --err: #cf3b32;
    --violet: #5a46d2;
    --dot: rgba(23, 23, 26, 0.06);
    color-scheme: light;
  }
}

:root[data-theme='light'] {
  --bg: #faf9f7;
  --bg-panel: #ffffff;
  --bg-raised: #f3f1ed;
  --line: #e2ded6;
  --line-soft: #eeebe5;
  --text: #17171a;
  --text-soft: #55555e;
  --text-dim: #6f6f79;
  --accent: #c7491c;
  --accent-wash: rgba(199, 73, 28, 0.09);
  --ok: #2c864d;
  --err: #cf3b32;
  --violet: #5a46d2;
  --dot: rgba(23, 23, 26, 0.06);
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

:root {
  /*
   * Three columns need more room than a landing page, so a docs page widens
   * `.wrap` — the header included, which is the part that was missed before.
   * Widening the shell alone left the search box starting 60px inside the logo
   * and the right rail hanging past "Get started". Every container on the page
   * takes its width from here, and none may set one of its own.
   */
  --docs-nav-w: 236px;
  --docs-toc-w: 196px;
  --docs-gap: 40px;
  --docs-measure: 760px;
  --docs-wrap: 1320px;
  --docs-bar-h: 66px;
  --docs-tools-h: 52px;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.docs-body {
  background: var(--bg);
}

/* The bar, the toolbar and the shell all sit on this one measure. */
.docs-body .wrap {
  max-width: var(--docs-wrap);
}

.docs-skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 60;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.docs-skip:focus {
  top: 12px;
}

/* --- the toolbar under the bar ------------------------------------------- */

.docs-tools {
  position: sticky;
  top: var(--docs-bar-h);
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.docs-tools-in {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--docs-tools-h);
}

.docs-menu,
.docs-theme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}

.docs-menu:hover,
.docs-theme:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.docs-menu {
  display: none;
}

.docs-theme {
  width: 34px;
  padding: 0;
  justify-content: center;
  margin-left: auto;
}

.docs-theme .docs-theme-moon {
  display: none;
}

:root[data-theme='light'] .docs-theme .docs-theme-sun {
  display: none;
}

:root[data-theme='light'] .docs-theme .docs-theme-moon {
  display: block;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .docs-theme .docs-theme-sun {
    display: none;
  }

  :root:not([data-theme='dark']) .docs-theme .docs-theme-moon {
    display: block;
  }
}

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

.docs-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 100%);
  height: 34px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-dim);
}

.docs-search:focus-within {
  border-color: var(--text-dim);
  color: var(--text);
}

.docs-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.docs-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.docs-search > kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.docs-search-results {
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(100% + 6px);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45);
}

.docs-search-results[hidden] {
  display: none;
}

.docs-search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
}

.docs-search-results a:hover,
.docs-search-results a[aria-selected='true'] {
  background: var(--bg-raised);
}

.docs-search-results .hit-title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
  font-weight: 500;
}

.docs-search-results .hit-section {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

.docs-search-results .hit-text {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.docs-search-results mark {
  background: var(--accent-wash);
  color: inherit;
  border-radius: 2px;
}

.docs-search-results .hit-none {
  padding: 10px;
  font-size: 13.5px;
  color: var(--text-dim);
}

/* --- the shell --------------------------------------------------------------- */

.docs-shell {
  display: grid;
  grid-template-columns: var(--docs-nav-w) minmax(0, 1fr) var(--docs-toc-w);
  gap: var(--docs-gap);
  align-items: start;
}

.docs-nav,
.docs-toc {
  position: sticky;
  top: calc(var(--docs-bar-h) + var(--docs-tools-h));
  max-height: calc(100vh - var(--docs-bar-h) - var(--docs-tools-h));
  overflow-y: auto;
  padding: 28px 0 40px;
  font-size: 14px;
  scrollbar-width: thin;
}

.docs-nav {
  border-right: 1px solid var(--line);
  padding-right: 16px;
}

.docs-nav-home {
  display: block;
  margin-bottom: 14px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-soft);
  font-weight: 500;
  text-decoration: none;
}

.docs-nav-home:hover,
.docs-nav-home[aria-current] {
  color: var(--text);
  background: var(--bg-raised);
}

.docs-nav-group {
  margin: 0 0 6px;
}

.docs-nav-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.docs-nav-group summary::-webkit-details-marker {
  display: none;
}

.docs-nav-group summary::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform 140ms ease;
  margin-right: 2px;
}

.docs-nav-group[open] summary::before {
  transform: rotate(45deg);
}

.docs-nav-group summary:hover {
  background: var(--bg-raised);
}

.docs-nav-group ul {
  margin: 2px 0 8px;
  padding: 0 0 0 12px;
  list-style: none;
  border-left: 1px solid var(--line);
  margin-left: 14px;
}

.docs-nav-group li a {
  display: block;
  padding: 5px 10px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--text-soft);
  text-decoration: none;
  line-height: 1.35;
}

.docs-nav-group li a:hover {
  color: var(--text);
  background: var(--bg-raised);
}

.docs-nav-group li a[aria-current] {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* --- the outline ------------------------------------------------------------- */

.docs-toc {
  padding-left: 4px;
  font-size: 13px;
}

.docs-toc-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.docs-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.docs-toc li a {
  display: block;
  padding: 4px 12px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--text-soft);
  text-decoration: none;
  line-height: 1.4;
}

.docs-toc li.toc-3 a {
  padding-left: 24px;
  font-size: 12.5px;
}

.docs-toc li a:hover {
  color: var(--text);
}

.docs-toc li a.is-active {
  color: var(--text);
  border-left-color: var(--accent);
}

.docs-toc code {
  font-size: 0.92em;
}

/* --- the article ------------------------------------------------------------- */

.docs-main {
  min-width: 0;
  padding: 36px 0 64px;
}

.docs-article {
  max-width: var(--docs-measure);
  font-size: 16px;
  line-height: 1.65;
}

.docs-article .crumb {
  margin-bottom: 10px;
}

.docs-article h1 {
  font-size: clamp(30px, 4vw, 40px);
  margin-bottom: 12px;
}

.docs-lede {
  margin: 0 0 28px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-soft);
  max-width: 60ch;
}

.docs-article h2,
.docs-article h3,
.docs-article h4 {
  position: relative;
  scroll-margin-top: calc(var(--docs-bar-h) + var(--docs-tools-h) + 20px);
}

.docs-article h2 {
  margin: 44px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 25px;
}

.docs-article h3 {
  margin: 32px 0 10px;
  font-size: 19px;
}

.docs-article h4 {
  margin: 24px 0 8px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0;
}

.docs-article h2 .anchor,
.docs-article h3 .anchor,
.docs-article h4 .anchor {
  position: absolute;
  left: -1.1em;
  top: inherit;
  color: var(--text-dim);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
}

.docs-article h2 .anchor {
  top: 20px;
}

.docs-article h2:hover .anchor,
.docs-article h3:hover .anchor,
.docs-article h4:hover .anchor,
.docs-article .anchor:focus-visible {
  opacity: 1;
}

.docs-article p {
  margin: 0 0 16px;
}

.docs-article a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}

.docs-article a:hover {
  text-decoration-color: currentColor;
}

.docs-article ul,
.docs-article ol {
  margin: 0 0 16px;
  padding-left: 26px;
}

.docs-article li {
  margin: 0 0 6px;
}

.docs-article li > ul,
.docs-article li > ol {
  margin: 6px 0 0;
}

.docs-article li > p {
  margin-bottom: 10px;
}

.docs-article ol > li::marker {
  font-weight: 500;
  color: var(--text-soft);
}

.docs-article strong {
  font-weight: 600;
}

.docs-article code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.docs-article kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-panel);
  font-family: var(--font-mono);
  font-size: 0.82em;
}

.docs-article hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.docs-article blockquote {
  margin: 0 0 16px;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--line);
  color: var(--text-soft);
}

.docs-article blockquote > :last-child {
  margin-bottom: 0;
}

/* code blocks */

.docs-article .code {
  position: relative;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  overflow: hidden;
}

.docs-article .code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  tab-size: 2;
}

.docs-article .code pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  overflow-wrap: normal;
}

.docs-article .code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 46px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.docs-article .code .copy {
  position: absolute;
  top: 6px;
  right: 6px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease;
}

.docs-article .code:hover .copy,
.docs-article .code .copy:focus-visible {
  opacity: 1;
}

.docs-article .code .copy:hover {
  color: var(--text);
}

/* tables */

.docs-article .table-scroll {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.docs-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}

.docs-article th,
.docs-article td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.docs-article th {
  background: var(--bg-raised);
  font-weight: 500;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
}

.docs-article tr:last-child td {
  border-bottom: 0;
}

.docs-article td code {
  white-space: nowrap;
}

/* callouts */

.docs-article .callout {
  margin: 0 0 20px;
  padding: 14px 16px 4px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--callout, var(--text-dim));
  border-radius: 10px;
  background: var(--bg-panel);
}

.docs-article .callout-note {
  --callout: var(--violet);
}

.docs-article .callout-tip {
  --callout: var(--ok);
}

.docs-article .callout-warning,
.docs-article .callout-important {
  --callout: var(--err);
}

.docs-article .callout-label {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--callout);
}

.docs-article .callout p {
  margin-bottom: 10px;
}

/* figures: a screenshot at the size it was taken, never larger */

.docs-article .shot {
  margin: 28px 0 32px;
  width: 100%;
  max-width: var(--shot-w, 100%);
}

.docs-article .shot-frame {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.docs-article .shot img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.docs-article figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.docs-article .shot-todo-box {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px dashed var(--err);
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 14px;
}

.docs-article .shot-todo-box strong {
  color: var(--err);
}

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

.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: var(--docs-measure);
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.docs-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  background: var(--bg-panel);
}

.docs-pager a:hover {
  border-color: var(--text-dim);
}

.docs-pager a span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
}

.docs-pager-next {
  text-align: right;
  align-items: flex-end;
}

/* --- the home page's cards ---------------------------------------------------- */

.docs-article .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.docs-article .cards li {
  margin: 0;
}

.docs-article .cards a {
  display: block;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
}

.docs-article .cards a:hover {
  border-color: var(--text-dim);
}

.docs-article .cards strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.docs-article .cards a span {
  font-size: 13.5px;
  color: var(--text-soft);
}

/* --- narrower ---------------------------------------------------------------- */

@media (max-width: 1180px) {
  .docs-shell {
    grid-template-columns: var(--docs-nav-w) minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 880px) {
  .docs-shell {
    display: block;
  }

  .docs-menu {
    display: inline-flex;
  }

  .docs-nav {
    position: fixed;
    inset: calc(var(--docs-bar-h) + var(--docs-tools-h)) auto 0 0;
    z-index: 35;
    width: min(320px, 86vw);
    max-height: none;
    padding: 16px 16px 40px;
    border-right: 1px solid var(--line);
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: none;
  }

  .docs-nav.is-open {
    transform: none;
    box-shadow: 24px 0 48px -24px rgba(0, 0, 0, 0.5);
  }

  .docs-main {
    padding-top: 24px;
  }

  .docs-article {
    font-size: 15.5px;
  }

  .docs-article h2 .anchor,
  .docs-article h3 .anchor,
  .docs-article h4 .anchor {
    display: none;
  }

  .docs-pager {
    grid-template-columns: 1fr;
  }

  .docs-pager-next {
    text-align: left;
    align-items: flex-start;
  }

  .docs-search > kbd {
    display: none;
  }
}

@media (max-width: 560px) {
  .docs-article th,
  .docs-article td {
    padding: 8px 10px;
  }

  .docs-article .code pre {
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-nav {
    transition: none;
  }
}
