/* AgentDB docs portal. Colours and type from the app (src/web/pages.ts SITE_CSS). No external fonts. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #ffffff; --surface: #f6f7f9; --text: #17212e; --muted: #576474; --line: #e0e5eb;
  --blue: #175ec9; --blue-hover: #124ea8; --blue-tint: #edf3fc;
  --ok: #1a7f4b; --warn: #8a5300; --err: #b42318;
  --code-bg: #f6f7f9;
  --radius: 4px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151d; --surface: #17202b; --text: #e6ebf1; --muted: #9aa8b8; --line: #2a3644;
    --blue: #7fb0ff; --blue-hover: #a8c8ff; --blue-tint: #1a2a40;
    --ok: #5fd69a; --warn: #f0b45a; --err: #ff8a80;
    --code-bg: #17202b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* rc.13: anchor targets (headings, search results, "?" help links) land below the sticky header.
   Header: about 62px wide, about 100px at 390px (logo row + search row). Margin = height + 8px or more. */
[id], h1, h2, h3, h4, :target { scroll-margin-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--blue-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, pre:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
code, pre { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 4px; overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1400px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.brand img { width: 150px; height: auto; display: block; }
.brand .tag { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 1px 6px; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; font: inherit; font-size: .95rem; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 70vh; overflow: auto; }
.results a { display: block; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; }
.results a[aria-selected="true"], .results a:hover { background: var(--blue-tint); text-decoration: none; }
.results .r-t { font-weight: 600; display: block; }
.results .r-s { font-size: .8rem; color: var(--muted); display: block; }
.results .r-x { font-size: .85rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .empty { padding: 10px 12px; color: var(--muted); margin: 0; }
.top-links { display: flex; gap: 18px; font-size: .9rem; flex: none; }
.top-links a { color: var(--muted); }
.top-links a:hover { color: var(--text); }
.menu { display: none; font: inherit; font-size: .9rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; }

/* layout */
.layout { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 32px; padding: 0 20px; }
.side { position: sticky; top: 62px; align-self: start; max-height: calc(100vh - 62px); overflow: auto; padding: 20px 0 40px; font-size: .9rem; }
.side ul, .toc ul { list-style: none; margin: 0 0 14px; padding: 0; }
.side li a, .toc li a { display: block; padding: 3px 8px; border-radius: var(--radius); color: var(--muted); }
.side li a:hover, .toc li a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.side li a[aria-current="page"] { color: var(--blue); background: var(--blue-tint); font-weight: 600; }
.nav-h { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 8px 4px; }
.nav-build { border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: var(--radius); padding: 2px 4px 4px; margin: 6px 0 14px; }
.nav-build-h { font-size: .78rem; color: var(--text); font-weight: 700; }
.nav-build-h a { color: var(--blue); }
.nav-sub { font-size: .72rem; color: var(--muted); margin: 8px 8px 2px; font-weight: 600; }
.nav-build ul { margin-bottom: 4px; }
.toc { position: sticky; top: 62px; align-self: start; max-height: calc(100vh - 62px); overflow: auto; padding: 24px 0; font-size: .85rem; }
.content { min-width: 0; padding: 24px 0 64px; }

/* content */
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; position: relative; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.3rem); margin: 8px 0 16px; letter-spacing: -0.025em; }
h2 { font-size: 1.4rem; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
h3 { font-size: 1.08rem; margin: 26px 0 8px; }
h4 { font-size: 1rem; margin: 20px 0 6px; }
.anchor { position: absolute; left: -1.1em; color: var(--line); font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; color: var(--muted); text-decoration: none; }
p, ul, ol { margin: 0 0 14px; }
li { margin: 3px 0; }
.lead { font-size: 1.1rem; color: var(--muted); }
.note { border-left: 3px solid var(--blue); background: var(--blue-tint); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 16px; }
.note p { margin: 0; }
.note.warn { border-left-color: var(--warn); }
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; background: var(--surface); }
code.type { white-space: normal; }
.code { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 16px; background: var(--code-bg); }
.code-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--line); font-size: .78rem; }
.code-label { font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.checked { font-size: .72rem; color: var(--ok); border: 1px solid var(--ok); border-radius: 10px; padding: 0 7px; }
.code-file { font-family: var(--mono); font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
.code-wrong { border-color: var(--err); border-left: 3px solid var(--err); }
.code-wrong .code-label { color: var(--err); font-weight: 700; }
.code-secure { border-left: 3px solid var(--ok); }
.code-secure .code-label { color: var(--ok); font-weight: 700; }
.copy { margin-left: auto; font: inherit; font-size: .78rem; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 10px; cursor: pointer; }
.copy:hover { border-color: var(--blue); }
pre { margin: 0; padding: 12px 14px; overflow-x: auto; line-height: 1.5; }
.badge { display: inline-block; font-family: var(--mono); font-size: .72rem; padding: 0 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.b-stable { color: var(--ok); border-color: var(--ok); }
.b-experimental { color: var(--warn); border-color: var(--warn); }
.b-deprecated, .b-destructive { color: var(--err); border-color: var(--err); }
.op { margin-top: 8px; }
.op h2 code { font-size: 1.05em; background: none; border: 0; padding: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
dl.access { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 14px; font-size: .9rem; }
dl.access dt { color: var(--muted); }
dl.access dd { margin: 0; overflow-wrap: anywhere; }
.cli h3 code { background: none; border: 0; padding: 0; }
ul.cols { columns: 4 160px; padding-left: 18px; }
ul.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
ul.cards a { display: block; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--text); }
ul.cards a:hover { border-color: var(--blue); text-decoration: none; }
ul.cards span { display: block; color: var(--muted); font-size: .88rem; margin-top: 4px; }
#search-page a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
#search-page .r-s { display: block; font-size: .82rem; color: var(--muted); }
#search-page .r-x { display: block; color: var(--muted); font-size: .9rem; }

/* footer */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.foot-in { max-width: 1400px; margin: 0 auto; padding: 18px 20px 32px; }
.foot p { margin: 0 0 6px; }
.foot .machine a { margin-right: 10px; }

/* responsive */
@media (max-width: 1180px) { .layout { grid-template-columns: 230px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .top-in { flex-wrap: wrap; gap: 10px; }
  .brand img { width: 120px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .top-links { display: none; }
  .menu { display: block; margin-left: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .side { position: static; max-height: none; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .js .side.collapsed { display: none; }
  .anchor { display: none; }
  [id], h1, h2, h3, h4, :target { scroll-margin-top: 112px; }
  dl.access { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .top, .side, .toc, .foot, .copy { display: none; } .layout { display: block; } }
