/* Docs: the page list on the left, the page in the middle at a reading width. Below 860px the list sits above the page. */
:root { --fs-xs: .78rem; --fs-s: .94rem; --fs-b: 1.0625rem; --fs-m: 1.22rem; --measure: 70ch; }
@media (max-width: 639px) { :root { --fs-xs: .8rem; --fs-s: 1rem; } }

.doc-shell { display: grid; grid-template-columns: 1fr; gap: calc(var(--gap) * 1.6); padding-block: 18px 72px; }
@media (min-width: 860px) { .doc-shell { grid-template-columns: 220px minmax(0, 1fr); gap: calc(var(--gap) * 3); } }
.doc-shell > * { min-width: 0; }

/* ---------- the page list ---------- */
.side { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-s); align-self: start; }
@media (min-width: 860px) { .side { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow-y: auto; padding-right: 6px; } }
@media (max-width: 859px) { .side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; } .side-toc { display: none; } }
.side a { color: var(--muted); text-decoration: none; display: block; padding: 3px 0; }
.side a:hover { color: var(--ink); }
.side a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.side-home { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.side-kind { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 12px 0 0 !important; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side-toc ul { border-left: 1px solid var(--line); margin: 4px 0 6px 2px; padding-left: 12px; }
.side-toc a { font-size: var(--fs-xs); padding: 2px 0; }

/* ---------- the page ---------- */
.doc { max-width: var(--measure); }
.kind { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 10px !important; }
.doc h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem); line-height: 1.02; letter-spacing: -.03em; text-wrap: balance; margin: 0; }
.doc-lead { font-size: var(--fs-m); color: var(--muted); margin-top: 14px !important; text-wrap: pretty; }

.tk .prose { margin-top: 28px; line-height: 1.6; }
.tk .prose > * + * { margin-top: 1em; }
.tk .prose h2 { font-size: 1.55rem; margin-top: 2.1em; scroll-margin-top: 16px; }
.tk .prose h3 { margin-top: 1.6em; scroll-margin-top: 16px; }
.tk .prose h2 + *, .tk .prose h3 + * { margin-top: .6em; }
.tk .prose ul, .tk .prose ol { padding-left: 1.3em; }
.tk .prose li + li { margin-top: .35em; }
.tk .prose a { text-underline-offset: 2px; }
.tk .prose strong { font-weight: 600; }
.tk .prose :not(pre) > code { background: var(--sunk); border-radius: 4px; padding: .08em .35em; font-size: .88em; overflow-wrap: anywhere; }
.tk .prose pre { background: var(--sunk); border-radius: calc(var(--r) * .7); padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: .86rem; line-height: 1.55; }
.tk .prose pre code { font-size: inherit; }
.tk .prose blockquote { margin-left: 0; border-left: 3px solid var(--accent); padding: 2px 0 2px 16px; color: var(--muted); }
.tk .prose hr { border: 0; border-top: 1px dashed var(--line); margin-block: 2em; }
.tk .prose .table-wrap, .tk .prose table { display: block; overflow-x: auto; }
.tk .prose table { border-collapse: collapse; font-size: var(--fs-s); }
.tk .prose th, .tk .prose td { text-align: left; vertical-align: top; padding: .55em .9em .55em 0; border-bottom: 1px solid var(--line); }
.tk .prose th { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------- the docs home ---------- */
.kinds { display: grid; gap: var(--gap); margin-top: 32px; }
@media (min-width: 640px) { .kinds { grid-template-columns: 1fr 1fr; } }
.kind-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--pad-y) var(--pad-x); display: flex; flex-direction: column; gap: 8px; }
.kind-card ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.kind-card li a { font-weight: 600; }
.kind-card li .note { display: block; }
.side-group { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; margin: 8px 0 0 !important; }

/* ---------- code windows: every fenced block, framed like the home page's terminal ---------- */
.tk .prose .code-win { margin: 1.2em 0 0; border: 1px solid var(--line); border-radius: calc(var(--r) * .7); overflow: hidden; background: var(--sunk); }
.tk .prose li .code-win { margin-top: .7em; }
.code-win .term-bar { border-radius: 0; gap: .45em; min-width: 0; }
.code-win .cw-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.code-win .cw-lang { flex: none; padding: .1em .55em; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .85em; letter-spacing: .06em; text-transform: uppercase; }
.code-win .cw-copy { flex: none; font: inherit; color: var(--muted); background: none; border: 1px solid transparent; border-radius: var(--r-button); padding: .15em .55em; cursor: pointer; }
.code-win .cw-copy:hover, .code-win .cw-copy:focus-visible { color: var(--ink); border-color: var(--line); background: var(--surface); }
.tk .prose .code-win pre { margin: 0; border-radius: 0; background: none; padding: 14px 16px; }
/* the prompt of a command you type: the shell's $, the agent's › */
.is-sh .line:first-child::before { content: "$ "; color: var(--accent); }
.is-agent .line:first-child::before { content: "› "; color: var(--accent); }
.is-sh .line:first-child::before, .is-agent .line:first-child::before { user-select: none; }

/* highlighting, from the design tokens so it follows the theme */
.chroma .c, .chroma .c1, .chroma .cm, .chroma .ch { color: var(--muted); font-style: italic; }
.chroma .nt, .chroma .na, .chroma .k, .chroma .kd, .chroma .nb { color: var(--accent); }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb, .chroma .sd, .chroma .se { color: var(--l2); }
.chroma .m, .chroma .mi, .chroma .mf, .chroma .kc, .chroma .l { color: var(--l3); }
.chroma .nv, .chroma .nx { color: var(--ink); }
.chroma .p, .chroma .o { color: var(--muted); }
.chroma .gh, .chroma .gu { color: var(--accent); font-weight: 600; }
/* the bar is black in both themes, like a terminal's title bar */
.code-win { --bar: #0e131b; --bar-ink: #e6ebf2; --bar-muted: #9aa5b5; --bar-line: #2a3342; }
.code-win .term-bar { background: var(--bar); color: var(--bar-muted); border-bottom: 1px solid var(--bar-line); }
.code-win .cw-title { color: var(--bar-ink); }
.code-win .cw-lang { background: none; border-color: var(--bar-line); color: var(--bar-muted); }
.code-win .cw-copy { color: var(--bar-muted); }
.code-win .cw-copy:hover, .code-win .cw-copy:focus-visible { color: var(--bar-ink); border-color: var(--bar-line); background: #1a2230; }
.tk .prose .code-win { border-color: var(--bar); }

/* ---------- docs search (Pagefind), in the design tokens ---------- */
.docsearch { margin-bottom: 10px; --pagefind-ui-scale: .8; --pagefind-ui-primary: var(--accent); --pagefind-ui-text: var(--ink); --pagefind-ui-background: var(--surface); --pagefind-ui-border: var(--line); --pagefind-ui-tag: var(--sunk); --pagefind-ui-border-width: 1px; --pagefind-ui-border-radius: var(--r-button); --pagefind-ui-font: inherit; }
.docsearch .pagefind-ui__result-link { color: var(--ink); }
.docsearch .pagefind-ui__result-excerpt { color: var(--muted); }
.docsearch mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; }
/* results open in a panel over the page: the nav scrolls, so a panel inside it would be clipped */
.docsearch .pagefind-ui__drawer { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 120px); overflow-y: auto; padding: 4px 20px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 48px rgb(0 0 0 / .28); z-index: 30; }
.docsearch .pagefind-ui__drawer:not(:has(.pagefind-ui__message)) { display: none; }
