/* ChloeDB docs: the pages in docs/site/docs/, which build_docs.py writes.
 * On top of site.css: a sidebar, a reading column, and Markdown's elements
 * (tables, lists, quotes, code) set for long reading. Colours come from
 * site.css's tokens, so dark mode follows it. */
.doc-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 48px; align-items: start; padding-block: 40px 72px; }
.doc-menu { position: sticky; top: 84px; align-self: start; }
.doc-menu > summary { display: none; }
.doc-nav { max-height: calc(100vh - 100px); overflow-y: auto; display: grid; gap: 1px; font-size: 0.9rem; padding-right: 6px; }
.doc-nav a { color: var(--ink-2); text-decoration: none; padding: 5px 10px; border-radius: 6px; border-left: 2px solid transparent; }
.doc-nav a:hover { color: var(--ink); background: var(--sunk); }
.doc-nav a[aria-current="page"] { color: var(--ink); background: var(--accent-wash); border-left-color: var(--accent); font-weight: 500; }
.doc-nav .h { font: 500 0.7rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 16px 10px 6px; }
.doc-nav .h:first-child { padding-top: 0; }

.doc { min-width: 0; max-width: 820px; }
.doc-head { display: grid; gap: 10px; margin-bottom: 20px; }
.doc-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.08; }
.doc-badge { margin: 0; font-size: 0.84rem; color: var(--ink-3); }
.doc-badge.tested::before { content: "✓ "; color: var(--yes); font-weight: 600; }
/* Which version a page describes, and features newer than the latest release (build_docs.py). */
.doc-version { margin: 0; font-size: 0.84rem; color: var(--ink-2); border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; }
.since { display: inline-block; font-size: 0.75rem; font-weight: 600; line-height: 1.5; padding: 0 7px; border-radius: 999px; border: 1px solid var(--rule-2); color: var(--ink-2); vertical-align: 0.1em; white-space: nowrap; }
.since.unreleased { background: var(--accent-wash); border-color: transparent; color: var(--accent); }
p.since { display: table; margin: -6px 0 12px; }

.doc-toc { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 16px; margin-bottom: 28px; font-size: 0.9rem; background: var(--tint); }
.doc-toc summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.doc-toc ol { margin: 8px 0 2px; padding-left: 20px; columns: 2; column-gap: 28px; }
.doc-toc li { break-inside: avoid; margin: 2px 0; }
.doc-toc a { color: var(--ink-2); text-decoration: none; }
.doc-toc a:hover { color: var(--accent); }

.doc-body { line-height: 1.68; color: var(--ink); font-size: 1rem; }
.doc-body > * + * { margin-top: 16px; }
.doc-body h2 { font-size: 1.7rem; margin-top: 48px; padding-top: 8px; scroll-margin-top: 84px; }
.doc-body h3 { font-size: 1.28rem; margin-top: 34px; scroll-margin-top: 84px; }
.doc-body h4 { font-size: 1.05rem; margin-top: 28px; scroll-margin-top: 84px; }
.doc-body h2 + *, .doc-body h3 + *, .doc-body h4 + * { margin-top: 12px; }
.doc-body .anchor { margin-left: 8px; color: var(--ink-3); text-decoration: none; opacity: 0; font-weight: 400; }
.doc-body h2:hover .anchor, .doc-body h3:hover .anchor, .doc-body h4:hover .anchor, .doc-body .anchor:focus { opacity: 1; }
.doc-body p, .doc-body li { color: var(--ink); }
.doc-body ul, .doc-body ol { padding-left: 24px; }
.doc-body li + li { margin-top: 6px; }
.doc-body li > ul, .doc-body li > ol { margin-top: 6px; }
.doc-body :not(pre) > code { background: var(--sunk); padding: 0.12em 0.36em; border-radius: 4px; overflow-wrap: anywhere; }
.doc-body blockquote { margin: 16px 0; padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--tint); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.doc-body blockquote > * + * { margin-top: 10px; }
.doc-body img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); }
.doc-body hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }
.doc-body .code { margin-top: 16px; }
.doc-body .code + .code { margin-top: 12px; }
.doc-body pre.output + .code-head, .doc-body .code:has(pre.output) { border-style: dashed; }
.doc-body pre.mermaid { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 16px; overflow-x: auto; text-align: center; }

.doc-table { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; }
.doc-table table { border-collapse: collapse; width: 100%; font-size: 0.9rem; line-height: 1.5; }
.doc-table th, .doc-table td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.doc-table th { background: var(--tint); font-weight: 600; color: var(--ink); }
.doc-table tr:last-child td { border-bottom: 0; }

.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.doc-cards > p { display: contents; }
.doc-cards a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--panel); }
.doc-cards a:hover { border-color: var(--accent); }
.doc-cards b { font-family: var(--display); font-size: 1.02rem; }
.doc-cards span { color: var(--ink-2); font-size: 0.9rem; line-height: 1.45; }

.doc-foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-size: 0.9rem; }
.doc-foot .pager { display: flex; gap: 20px; }
.doc-foot a { text-decoration: none; }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-block: 20px 56px; }
  .doc-menu { position: static; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 14px; background: var(--tint); }
  .doc-menu > summary { display: list-item; cursor: pointer; font-weight: 600; color: var(--ink-2); }
  .doc-menu[open] > summary { margin-bottom: 10px; }
  .doc-nav { max-height: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
  .doc-nav .h { width: 100%; padding: 8px 0 0; }
  .doc-nav .h:first-child { padding-top: 0; }
  .doc-nav a { border: 1px solid var(--rule-2); border-radius: 999px; padding: 4px 10px; }
  .doc-nav a[aria-current="page"] { border-color: var(--accent); }
  .doc-toc ol { columns: 1; }
}

/* The search box above the sidebar (assets/docs-search.js, over the
 * search-index.js build_docs.py writes). */
.doc-side { position: sticky; top: 84px; align-self: start; display: grid; gap: 14px; min-width: 0; }
.doc-side .doc-menu { position: static; }
.doc-side .doc-nav { max-height: calc(100vh - 156px); }
.doc-search { position: relative; margin: 0; }
.doc-search input { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.9rem; padding: 8px 34px 8px 12px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--panel); color: var(--ink); }
.doc-search input::placeholder { color: var(--ink-3); }
.doc-search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.doc-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 500 0.72rem/1 var(--mono); color: var(--ink-3); border: 1px solid var(--rule-2); border-radius: 4px; padding: 3px 6px; pointer-events: none; }
.doc-search input:focus ~ kbd, .doc-search input:not(:placeholder-shown) ~ kbd { display: none; }
.doc-search-results { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(560px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto; background: var(--panel); border: 1px solid var(--rule-2); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); padding: 6px; }
.doc-search-results[hidden] { display: none; }
.doc-search-hit { display: grid; gap: 2px; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--ink); }
.doc-search-hit:hover, .doc-search-hit[aria-selected="true"] { background: var(--accent-wash); }
.doc-search-hit b { font-weight: 600; font-size: 0.92rem; }
.doc-search-hit .where { font: 500 0.68rem/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.doc-search-hit .snip { font-size: 0.84rem; line-height: 1.45; color: var(--ink-2); }
.doc-search-hit mark { background: transparent; color: var(--accent); font-weight: 600; }
.doc-search-none { margin: 0; padding: 10px 12px; font-size: 0.88rem; color: var(--ink-2); }
@media (max-width: 900px) {
  .doc-side { position: static; gap: 10px; }
  .doc-side .doc-nav { max-height: none; }
  .doc-search-results { width: 100%; }
}
