/* Docs: sidebar, one article at a time, and an on-this-page outline. Builds on ../styles.css tokens and primitives. */
.docs-header .header-inner { grid-template-columns: auto 1fr auto; }
.docs-crumb { display: flex; align-items: center; gap: 12px; font: 13px var(--mono); color: var(--muted); }
.docs-crumb::before { content: '/'; color: var(--line-2); }

.docs-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr) 176px; gap: 40px; align-items: start; padding-block: 48px 96px; }

/* Sidebar */
.docs-sidebar { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; padding-right: 8px; }
/* Sidebar scrollbars: thin and hidden until the pointer is over the list. */
.docs-sidebar, .docs-nav-panel { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.docs-sidebar:hover, .docs-sidebar:focus-within, .docs-nav-panel:hover { scrollbar-color: var(--line-2) transparent; }
@supports not (scrollbar-color: auto) {
  .docs-sidebar::-webkit-scrollbar, .docs-nav-panel::-webkit-scrollbar { width: 6px; }
  .docs-sidebar::-webkit-scrollbar-thumb, .docs-nav-panel::-webkit-scrollbar-thumb { border-radius: 3px; background: transparent; }
  .docs-sidebar:hover::-webkit-scrollbar-thumb, .docs-nav-panel:hover::-webkit-scrollbar-thumb { background: var(--line-2); }
}
.docs-filter { display: block; width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: 13px var(--sans); }
.docs-filter::placeholder { color: var(--muted); }
.docs-filter { transition: border-color .15s, box-shadow .15s; }
.docs-filter:focus, .docs-filter:focus-visible { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.docs-group { margin-top: 28px; }
.docs-group-title { margin-bottom: 8px; font: 500 11px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.docs-group ul { border-left: 1px solid var(--line); }
.docs-group a { display: block; margin-left: -1px; padding: 6px 12px; border-left: 1px solid transparent; font-size: 14px; color: var(--ink-2); transition: color .15s, border-color .15s; }
.docs-group a:hover { color: var(--ink); }
.docs-group a[aria-current="page"] { border-left-color: var(--accent); color: var(--ink); font-weight: 500; }
.docs-empty { margin-top: 20px; font-size: 13px; color: var(--muted); }
.docs-external { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.docs-external a { display: block; padding: 6px 0; font-size: 14px; color: var(--muted); transition: color .15s; }
.docs-external a:hover { color: var(--ink); }
.docs-menu-toggle { display: none; }

/* Article */
.doc { max-width: 720px; }
.doc + .doc { margin-top: 96px; padding-top: 48px; border-top: 1px solid var(--line); }
.docs-js .doc { display: none; margin-top: 0; padding-top: 0; border-top: 0; }
.docs-js .doc.is-active { display: block; animation: doc-in .25s ease both; }
@keyframes doc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.doc h1 { margin-top: 0; font: 500 clamp(38px, 4.4vw, 52px)/1 var(--display); letter-spacing: -.015em; }
.doc .doc-lead { margin-top: 16px; font-size: 18px; line-height: 1.6; color: var(--ink-2); }
.doc h2 { margin-top: 48px; padding-top: 8px; font-family: var(--sans); font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -.015em; scroll-margin-top: 96px; }
.doc h3 { margin-top: 28px; font-size: 16px; font-weight: 600; }
.doc p, .doc li { font-size: 15px; line-height: 1.75; color: var(--ink-2); }
.doc p { margin-top: 14px; }
.doc ul, .doc ol { margin-top: 12px; padding-left: 20px; }
.doc ul { list-style: disc; }
.doc ol { list-style: decimal; }
.doc li + li { margin-top: 6px; }
.doc li::marker { color: var(--muted); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a:not(.doc-pager a) { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.doc :not(pre) > code { padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--ink); font: .88em var(--mono); }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--ink); font: 500 12px/1.5 var(--mono); text-align: center; }

.doc-code { position: relative; margin-top: 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); }
.doc-code pre { overflow-x: auto; padding: 16px 52px 16px 18px; font: 13.5px/1.7 var(--mono); color: var(--ink); }
.doc-code .prompt-glyph { user-select: none; }
.doc-code .code-comment { color: var(--muted); }
.doc-copy { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-3); color: var(--ink-2); opacity: 0; transition: opacity .15s, background .15s, color .15s; }
.doc-code:hover .doc-copy, .doc-copy:focus-visible, .doc-copy.is-copied { opacity: 1; }
.doc-copy:hover { background: var(--line-2); color: var(--ink); }
.doc-copy.is-copied { color: var(--green); }

.doc-note { margin-top: 20px; padding: 14px 18px; border: 1px solid var(--accent-line); border-left-width: 3px; border-radius: var(--radius-sm); background: var(--accent-dim); }
.doc-note p { margin-top: 0; font-size: 14px; }
.doc-note p + p { margin-top: 8px; }
.doc-note-title { display: block; margin-bottom: 4px; font: 500 11px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.doc-note.is-warning { border-color: #e3b34166; background: #e3b34112; }
.doc-note.is-warning .doc-note-title { color: var(--amber); }

.doc-table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.doc th, .doc td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); line-height: 1.6; }
.doc thead th { font: 500 11px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface); }
.doc tbody tr:last-child > * { border-bottom: 0; }
.doc td:first-child { white-space: nowrap; color: var(--ink); }

.doc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.doc-cards a { display: block; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none !important; transition: border-color .15s, transform .15s; }
.doc-cards a:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.doc-cards strong { display: block; font-size: 15px; }
.doc-cards span { display: block; margin-top: 4px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }

.doc-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc-pager a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s; }
.doc-pager a:hover { border-color: var(--accent-line); }
.doc-pager a[rel="next"] { grid-column: 2; text-align: right; }
.doc-pager small { display: block; font: 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.doc-pager span { display: block; margin-top: 4px; font-size: 15px; font-weight: 500; color: var(--ink); }

/* On this page */
.docs-toc { position: sticky; top: 96px; text-align: right; }
.docs-toc[hidden] { display: none; }
.docs-toc-title { margin-bottom: 10px; font: 500 11px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.docs-toc a { display: block; padding: 4px 0; font-size: 13px; line-height: 1.5; color: var(--muted); transition: color .15s; }
.docs-toc a:hover, .docs-toc a.is-active { color: var(--ink); }

@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 48px; }
  .docs-toc { display: none; }
}
@media (max-width: 800px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; }
  .doc td:first-child { white-space: normal; }
  .doc td:first-child code { white-space: nowrap; overflow-wrap: normal; }
  .doc th, .doc td { padding: 10px 12px; }
  .docs-js .docs-sidebar { position: sticky; top: var(--docs-header-height, 56px); z-index: 15; max-height: none; overflow: visible; margin-top: -24px; padding: 12px 0; background: var(--bg); }
  html:not(.docs-js) .docs-sidebar { position: static; max-height: none; padding: 0; }
  .docs-js .docs-menu-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-size: 14px; }
  .docs-menu-toggle svg { width: 12px; height: 12px; transition: transform .2s; }
  .docs-menu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  /* The page list opens as an overlay under the pinned toggle and scrolls on its own, however long the docs get. */
  .docs-js .docs-nav-panel { position: fixed; z-index: 14; top: var(--docs-panel-top, 124px); left: 0; right: 0; bottom: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px var(--docs-panel-x, 16px) 40px; border-top: 1px solid var(--line); background: var(--bg); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility 0s .18s; }
  .docs-js .docs-nav-panel.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .18s ease, transform .18s ease, visibility 0s; }
  .docs-menu-open { overflow: hidden; }
  .doc-cards { grid-template-columns: 1fr; }
  .doc-pager { grid-template-columns: 1fr; }
  .doc-pager a[rel="next"] { grid-column: auto; }
  .doc-code pre { font-size: 12.5px; }
}
@media (forced-colors: active) {
  .docs-group a[aria-current="page"] { border-left-color: Highlight; }
  .docs-filter:focus { outline: 2px solid Highlight; }
  .doc-code, .doc-note, .doc-cards a, .doc-pager a, kbd { border-color: CanvasText; }
}
.docs-brand { display: flex; align-items: center; gap: 12px; }
