/* Delightful docs. Sits on /css/site.css (the site tokens, nav and footer); the --d-* names below map to those tokens. */
:root {
  --d-bg: var(--ground); --d-surface: var(--surface-1); --d-raised: var(--surface-2);
  --d-line: var(--line); --d-line-2: var(--line-2);
  --d-fg: var(--text-1); --d-fg-2: var(--text-2); --d-fg-3: var(--text-3);
  --d-accent: var(--text-1); --d-accent-fg: var(--ground); --d-code-bg: var(--ground); --d-focus: var(--text-1);
  --d-sans: var(--font); --d-mono: var(--mono);
  --d-radius: 12px; --d-bar: 112px;
  --t-k: #ededed; --t-s: #c9c9c9; --t-n: #ededed; --t-c: #919191;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--d-bar) + 20px); }
body { font: 400 15.5px/1.65 var(--d-sans); }
article a, .pager a, .docfoot a { color: var(--d-fg); text-decoration: underline; text-decoration-color: var(--d-line-2); text-underline-offset: 3px; }
article a:hover { text-decoration-color: var(--d-fg); }
:focus-visible { outline: 2px solid var(--d-focus); outline-offset: 2px; border-radius: 4px; }

/* docs sub-bar under the site nav */
.docsbar { position: sticky; top: var(--nav-h); z-index: 29; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 max(var(--gutter), calc((100vw - 1280px) / 2)); background: color-mix(in srgb, var(--d-bg) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--d-line); }
.brand-docs { color: var(--d-fg); font-size: 14px; font-weight: 600; }
.search-open { margin: 0 0 0 12px; flex: 0 1 360px; display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px 0 12px; background: var(--surface-2); border: 0; border-radius: var(--r-control); color: var(--d-fg-3); font: inherit; font-size: 13px; cursor: pointer; }
.search-open:hover { background: var(--surface-3); color: var(--d-fg-2); }
.search-open span { flex: 1; text-align: left; }
kbd { font: 500 11px/1 var(--d-mono); color: var(--d-fg-3); border-radius: 6px; padding: 4px 6px; background: var(--surface-3); }
.menu { display: none; background: none; border: 0; color: var(--d-fg); padding: 8px; margin-left: -8px; cursor: pointer; border-radius: 8px; }

/* shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 232px; max-width: calc(1280px + var(--gutter) * 2); padding-inline: var(--gutter); margin: 0 auto; }
.side { position: sticky; top: var(--d-bar); align-self: start; height: calc(100vh - var(--d-bar)); overflow-y: auto; padding: 28px 16px 40px 0; border-right: 1px solid var(--d-line); }
.nav-group + .nav-group { margin-top: 26px; }
.nav-h { margin: 0 0 8px; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--d-fg-3); }
.side ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; text-decoration: none; padding: 6px 10px; border-radius: 7px; color: var(--d-fg-2); font-size: 14.5px; line-height: 1.4; }
.side a:hover { color: var(--d-fg); background: var(--surface-2); }
.side a[aria-current] { color: var(--d-fg); background: var(--surface-2); font-weight: 550; }
.main { padding: 40px clamp(20px, 4vw, 64px) 72px; min-width: 0; max-width: 860px; width: 100%; margin: 0 auto; }
.toc { position: sticky; top: var(--d-bar); align-self: start; max-height: calc(100vh - var(--d-bar)); overflow-y: auto; padding: 40px 24px 40px 8px; }
.toc .nav-h { padding-left: 12px; }
.toc a { text-decoration: none; display: block; padding: 4px 12px; border-left: 1px solid var(--d-line); color: var(--d-fg-3); font-size: 13.5px; line-height: 1.4; }
.toc li.l3 a { padding-left: 24px; }
.toc a:hover { color: var(--d-fg); text-decoration: none; }
.toc a.on { color: var(--d-fg); border-left-color: var(--d-accent); }

/* article */
.main .crumbs { display: flex; gap: 8px; font-size: 13.5px; color: var(--d-fg-3); margin-bottom: 18px; padding-top: 0; }
.crumbs a { color: var(--d-fg-3); }
article h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.12; letter-spacing: -0.03em; font-weight: 650; margin: 0 0 14px; text-wrap: balance; }
.lede { font-size: 18px; line-height: 1.55; color: var(--d-fg-2); margin: 0 0 8px; text-wrap: pretty; max-width: 62ch; }
article h2 { font-size: 24px; letter-spacing: -0.02em; line-height: 1.25; font-weight: 620; margin: 56px 0 12px; padding-top: 28px; border-top: 1px solid var(--d-line); }
article h3 { font-size: 17.5px; letter-spacing: -0.01em; line-height: 1.35; font-weight: 600; margin: 34px 0 8px; }
.anchor { margin-left: -1.1em; padding-right: 0.35em; color: var(--d-fg-3); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.anchor:hover { text-decoration: none; color: var(--d-accent); }
article p { margin: 0 0 16px; max-width: 66ch; text-wrap: pretty; }
article ul, article ol { margin: 0 0 18px; padding-left: 22px; max-width: 66ch; }
article ul { list-style: none; padding-left: 0; }
article ul > li { position: relative; padding-left: 20px; }
article ul > li::before { content: ""; position: absolute; left: 0; top: .8em; width: 8px; height: 1px; background: var(--d-fg-3); }
article ol { list-style: decimal; }
article li { margin: 5px 0; padding-left: 4px; }
article li::marker { color: var(--d-fg-3); }
article strong { font-weight: 600; color: var(--d-fg); }
code { font: 400 0.87em/1 var(--d-mono); background: var(--d-surface); border: 1px solid var(--d-line); padding: 0.14em 0.4em; border-radius: 6px; color: var(--d-fg); overflow-wrap: anywhere; }
.note { margin: 0 0 20px; padding: 14px 18px; border: 1px solid var(--d-line); border-left: 3px solid var(--d-accent); background: var(--d-surface); border-radius: var(--d-radius); }
.note p:last-child { margin-bottom: 0; }
.note p { max-width: none; font-size: 15px; }

/* code blocks */
figure.code { margin: 0 0 22px; border: 1px solid var(--d-line); border-radius: 12px; background: var(--d-code-bg); overflow: hidden; }
figure.code figcaption { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; height: 40px; border-bottom: 1px solid var(--d-line); font-size: 12.5px; color: var(--d-fg-3); }
.lang { font: 500 11px/1 var(--d-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--d-fg-2); padding: 4px 7px; border: 1px solid var(--d-line-2); border-radius: 5px; }
.ttl { flex: 1; font-family: var(--d-mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
figure.code figcaption .lang:last-child { margin-right: auto; }
.copy { margin-left: auto; font: 500 12.5px var(--d-sans); color: var(--d-fg-2); background: transparent; border: 1px solid transparent; padding: 6px 10px; border-radius: 7px; cursor: pointer; min-width: 62px; }
.copy:hover { background: var(--d-raised); border-color: var(--d-line); color: var(--d-fg); }
.copy.done { color: var(--t-s); }
figure.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 400 13.5px/1.7 var(--d-mono); color: var(--d-fg); tab-size: 2; }
figure.code pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; overflow-wrap: normal; }
.t-k { color: var(--t-k); } .t-s { color: var(--t-s); } .t-n { color: var(--t-n); } .t-c { color: var(--t-c); }

/* tables */
.table-wrap { margin: 0 0 24px; overflow-x: auto; border: 1px solid var(--d-line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--d-fg-2); background: var(--d-surface); padding: 10px 14px; border-bottom: 1px solid var(--d-line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--d-line); vertical-align: top; color: var(--d-fg-2); }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--d-fg); white-space: nowrap; }
td code { white-space: nowrap; }

/* pager and foot */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.pager a { display: block; text-decoration: none; padding: 14px 18px; border: 1px solid var(--d-line); border-radius: 12px; color: var(--d-fg); font-weight: 560; }
.pager a:hover { border-color: var(--d-line-2); background: var(--d-surface); text-decoration: none; }
.pager span { display: block; font-size: 12.5px; font-weight: 450; color: var(--d-fg-3); margin-bottom: 2px; }
.pager .next { text-align: right; grid-column: 2; }
.docfoot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--d-line); font-size: 13.5px; color: var(--d-fg-3); }

/* search dialog */
dialog.search { width: min(620px, calc(100vw - 32px)); margin: 12vh auto 0; padding: 0; border: 1px solid var(--d-line-2); border-radius: 14px; background: var(--d-raised); color: var(--d-fg); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); overflow: hidden; }
dialog.search::backdrop { background: rgba(2, 3, 6, 0.6); backdrop-filter: blur(3px); }
dialog.search form { margin: 0; }
dialog.search input { width: 100%; height: 56px; padding: 0 20px; background: transparent; border: 0; border-bottom: 1px solid var(--d-line); color: var(--d-fg); font: 400 17px var(--d-sans); outline: none; }
.results { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
.results:empty { display: none; }
.results a { text-decoration: none; display: grid; gap: 1px; padding: 10px 12px; border-radius: 9px; color: var(--d-fg); }
.results a:hover { text-decoration: none; }
.results [aria-selected="true"] a, .results a:hover { background: var(--d-surface); box-shadow: inset 0 0 0 1px var(--d-line); }
.results b { font-weight: 560; font-size: 15px; }
.results span { font-size: 12.5px; color: var(--d-accent); }
.results small { font-size: 13px; color: var(--d-fg-3); line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results mark { background: none; color: var(--d-fg); text-decoration: underline; text-decoration-color: var(--d-accent); text-underline-offset: 2px; }
.results .none { padding: 18px 12px; color: var(--d-fg-3); }
.hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--d-line); font-size: 12.5px; color: var(--d-fg-3); display: flex; gap: 6px; align-items: center; }
.scrim { position: fixed; inset: var(--d-bar) 0 0 0; background: rgba(2, 3, 6, 0.6); z-index: 19; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .menu { display: block; }
  .search-open { margin-left: auto; flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; }
  .search-open span, .search-open kbd { display: none; }
  .shell { display: block; padding-inline: 0; }
  .side { position: fixed; z-index: 20; top: var(--d-bar); left: 0; bottom: 0; width: min(300px, 86vw); height: auto; background: var(--d-bg); transform: translateX(-102%); transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1); }
  .nav-open .side { transform: none; }
  .main { padding: 28px 16px 56px; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: auto; }
  article h2 { margin-top: 44px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
