/* The public Docs (/docs, server/docs.js): a top bar with the search, a menu at the left, the article, its table of contents at
   the right. The colors are the front page's (home.html) in the dark, with a light set for those who prefer it. The app's
   cuts, 900px (no table of contents) and 760px (the menu folds above the article). System fonts: nothing from another site. */
:root {
  --bg: #08090a; --panel: #101113; --panel-2: #16171a; --line: #23252a; --text: #f7f8f8; --muted: #8a8f98; --soft: #b4bcd0;
  --accent: #7cc39b; --code-bg: #16171a; --note: #5e6ad2; --tip: #7cc39b; --warning: #d9a441; color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root {
  --bg: #ffffff; --panel: #f6f7f8; --panel-2: #eef0f2; --line: #e3e5e8; --text: #16181c; --muted: #646b78; --soft: #3f4652;
  --accent: #2b7a55; --code-bg: #f1f3f5; --note: #4650b8; --tip: #2b7a55; --warning: #a8731a; color-scheme: light } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* Top bar */
.docs-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.docs-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.docs-brand:hover { text-decoration: none; }
.docs-brand-sub { color: var(--muted); font-weight: 500; }
.docs-brand-sub::before { content: "/"; margin-right: 9px; color: var(--line); }
.docs-search { position: relative; flex: 1; max-width: 460px; margin-left: 12px; }
.docs-search input { width: 100%; height: 34px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 0.85rem; }
.docs-search input::placeholder { color: var(--muted); }
.docs-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.docs-search kbd { position: absolute; right: 9px; top: 7px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; font: 0.75rem/18px ui-monospace, Menlo, monospace; color: var(--muted); pointer-events: none; }
#docs-results { position: absolute; top: 40px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); max-height: 70vh; overflow-y: auto; }
#docs-results[hidden] { display: none; }
#docs-results li a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
#docs-results li a:hover, #docs-results li a.active { background: var(--panel-2); text-decoration: none; }
#docs-results .r-title { font-size: 0.85rem; font-weight: 600; }
#docs-results .r-where { font-size: 0.75rem; color: var(--muted); }
#docs-results .r-empty { padding: 10px; font-size: 0.8rem; color: var(--muted); }
.docs-top-links { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 0.85rem; }
.docs-top-links a { color: var(--muted); }
.docs-top-links a:hover { color: var(--text); text-decoration: none; }
.docs-top-links .docs-open-app { color: var(--bg); background: var(--text); padding: 5px 12px; border-radius: 8px; font-weight: 500; }
.docs-top-links .docs-open-app:hover { color: var(--bg); background: var(--soft); }

/* Layout: menu | article | table of contents */
.docs-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 40px; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.docs-menu summary { display: none; }
.docs-nav { position: sticky; top: 56px; max-height: calc(100vh - 56px); overflow-y: auto; padding: 28px 0 40px; }
.docs-nav-section + .docs-nav-section { margin-top: 22px; }
.docs-nav h2, .docs-toc h2 { margin: 0 0 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.docs-nav ul, .docs-toc ul { margin: 0; padding: 0; list-style: none; }
.docs-nav a { display: block; padding: 4px 10px; margin-left: -10px; border-radius: 6px; font-size: 0.85rem; color: var(--soft); }
.docs-nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.docs-nav a.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.docs-main { min-width: 0; max-width: 760px; padding: 36px 0 80px; }
.docs-toc { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 36px 0 40px; }
.docs-toc a { display: block; padding: 3px 0 3px 12px; border-left: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.docs-toc a:hover { color: var(--text); text-decoration: none; }
.docs-toc a.active { color: var(--accent); border-left-color: var(--accent); }
.docs-toc .l3 a { padding-left: 24px; }

/* Article */
.docs-crumbs { margin: 0 0 10px; font-size: 0.8rem; color: var(--muted); }
.docs-crumbs a { color: var(--muted); }
.docs-main h1 { margin: 0 0 8px; font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; }
.docs-lead { margin: 0 0 8px; font-size: 1.05rem; color: var(--soft); }
.docs-updated { margin: 0 0 8px; font-size: 0.75rem; color: var(--muted); }
.docs-draft { display: inline-block; vertical-align: middle; padding: 0 7px; border: 1px solid var(--warning); border-radius: 999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0; color: var(--warning); }
.docs-body { margin-top: 28px; }
.docs-body h2 { margin: 2.2em 0 0.5em; padding-top: 0.2em; font-size: 1.35rem; letter-spacing: -0.01em; }
.docs-body h3 { margin: 1.8em 0 0.4em; font-size: 1.1rem; }
.docs-body h4 { margin: 1.5em 0 0.3em; font-size: 0.95rem; }
.docs-body h2:first-child, .docs-body h3:first-child { margin-top: 0; }
.docs-body :is(h2, h3, h4) { position: relative; }
.docs-body .anchor { position: absolute; left: -1.1em; color: var(--muted); opacity: 0; font-weight: 400; } /* in the margin, so the title starts where the text does */
.docs-body :is(h2, h3, h4):hover .anchor, .docs-body .anchor:focus { opacity: 1; text-decoration: none; }
.docs-body p { margin: 0 0 1em; }
.docs-body :is(ul, ol) { margin: 0 0 1em; padding-left: 1.4em; }
.docs-body li { margin: 0.25em 0; }
.docs-body li > :is(ul, ol) { margin: 0.25em 0 0; }
.docs-body code { padding: 1px 6px; border-radius: 5px; background: var(--code-bg); font: 0.85em ui-monospace, "SF Mono", Menlo, monospace; }
.docs-body pre { position: relative; margin: 0 0 1.2em; padding: 14px 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--code-bg); }
.docs-body pre code { padding: 0; background: none; font-size: 0.8rem; line-height: 1.6; }
.docs-body .copy { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); font: inherit; font-size: 0.75rem; cursor: pointer; opacity: 0; }
.docs-body pre:hover .copy, .docs-body .copy:focus-visible { opacity: 1; }
.docs-body blockquote { margin: 0 0 1em; padding: 2px 16px; border-left: 3px solid var(--line); color: var(--soft); }
.docs-body hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.docs-body img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.docs-body .table-wrap { margin: 0 0 1.2em; overflow-x: auto; }
.docs-body table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.docs-body th, .docs-body td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.docs-body th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.callout { margin: 0 0 1.2em; padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--note); border-radius: 8px; background: var(--panel); }
.callout p { margin: 0 0 0.6em; }
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title { margin-bottom: 0.3em; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--note); }
.callout-tip { border-left-color: var(--tip); }
.callout-tip .callout-title { color: var(--tip); }
.callout-warning { border-left-color: var(--warning); }
.callout-warning .callout-title { color: var(--warning); }

/* Previous / next */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.docs-pager a { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 600; }
.docs-pager a:hover { border-color: var(--muted); text-decoration: none; }
.docs-pager a span { display: block; font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.docs-pager .next { text-align: right; grid-column: 2; }

/* The index */
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 28px; }
.docs-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.docs-card h2 { margin: 0 0 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.docs-card ul { margin: 0; padding: 0; list-style: none; }
.docs-card li a { display: block; padding: 7px 10px; margin: 0 -10px; border-radius: 8px; color: var(--text); }
.docs-card li a:hover { background: var(--panel-2); text-decoration: none; }
.docs-card li strong { display: block; font-size: 0.85rem; font-weight: 600; }
.docs-card li span { display: block; font-size: 0.8rem; color: var(--muted); }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 28px; }
  .docs-toc { display: none; }
}
@media (max-width: 760px) {
  .docs-top { padding: 0 16px; gap: 12px; }
  .docs-brand-sub, .docs-top-links a:not(.docs-open-app), .docs-search kbd { display: none; }
  .docs-search { margin-left: 0; }
  .docs-layout { display: block; padding: 0 16px; }
  .docs-menu { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
  .docs-menu summary { display: block; padding: 8px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
  .docs-nav { position: static; max-height: none; padding: 4px 14px 14px; }
  .docs-main { padding: 24px 0 56px; }
  .docs-main h1 { font-size: 1.6rem; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager .next { grid-column: 1; }
}
