/* SystemRoles Docs theme
   Colours use light-dark(): the first value is the light theme, the second the dark.
   <html data-theme="light|dark"> picks one; without JS the OS setting applies. */

/* ---------- Tokens ---------- */
:root {
	color-scheme: light dark;

	--bg:            light-dark(#ffffff, #0d1117);
	--bg-soft:       light-dark(#f6f8fa, #131922);
	--bg-raised:     light-dark(#ffffff, #161b22);
	--bg-hover:      light-dark(#eef1f5, #1c2330);
	--text:          light-dark(#1f2328, #e6edf3);
	--text-strong:   light-dark(#0d1117, #ffffff);
	--muted:         light-dark(#57606a, #9da7b3);
	--border:        light-dark(#d8dee4, #2a313c);
	--border-soft:   light-dark(#e8ecf0, #21262d);

	--accent:        light-dark(#1d64d8, #6cb0ff);
	--accent-strong: light-dark(#1849a9, #a8d0ff);
	--accent-bg:     light-dark(#eef5ff, #0f2140);
	--accent-btn:    light-dark(#1d64d8, #2563eb);
	--accent-btn-hover: light-dark(#1849a9, #1d4ed8);
	--on-accent:     #ffffff;

	--code-bg:       light-dark(#f6f8fa, #161b22);
	--code-head:     light-dark(#eaeef2, #1c2128);
	--inline-code-bg: light-dark(rgb(175 184 193 / .22), rgb(110 118 129 / .35));
	--mark-bg:       light-dark(#fff3a3, #5c4a00);
	--mark-text:     light-dark(#1f2328, #fff8c5);

	--info-bg:       light-dark(#eff6ff, #0c1a33);
	--info-border:   light-dark(#3b82f6, #3b82f6);
	--info-title:    light-dark(#1d4ed8, #93c5fd);
	--warn-bg:       light-dark(#fffbeb, #2a1f05);
	--warn-border:   light-dark(#d97706, #d29922);
	--warn-title:    light-dark(#92400e, #f5c56a);

	/* Syntax colours (AA contrast on --code-bg in both themes) */
	--hl-keyword:  light-dark(#cf222e, #ff7b72);
	--hl-type:     light-dark(#953800, #ffa657);
	--hl-property: light-dark(#8250df, #d2a8ff);
	--hl-value:    light-dark(#0a3069, #a5d6ff);
	--hl-variable: light-dark(#0550ae, #79c0ff);
	--hl-number:   light-dark(#0550ae, #79c0ff);
	--hl-comment:  light-dark(#57606a, #8b949e);
	--hl-generic:  light-dark(#116329, #7ee787);
	--hl-attr:     light-dark(#0550ae, #79c0ff);

	--focus: light-dark(#1d64d8, #6cb0ff);
	--shadow: light-dark(0 1px 2px rgb(31 35 40 / .06), 0 1px 2px rgb(0 0 0 / .4));
	--shadow-lg: light-dark(0 16px 48px rgb(31 35 40 / .18), 0 16px 48px rgb(0 0 0 / .6));

	--font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

	--header-h: 60px;
	--sidebar-w: 268px;
	--toc-w: 232px;
	--content-w: 760px;
	--radius: 8px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 20px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.7 var(--font);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: from-font; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }
.icon { width: 20px; height: 20px; flex: none; }
.sr-only {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
	position: absolute; left: 12px; top: -100px; z-index: 100;
	background: var(--accent-btn); color: var(--on-accent); padding: 10px 16px; border-radius: var(--radius);
	font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 10px; color: var(--on-accent); }
kbd {
	font: 600 11px/1 var(--font);
	padding: 3px 6px; border-radius: 4px;
	border: 1px solid var(--border); border-bottom-width: 2px;
	background: var(--bg-raised); color: var(--muted);
}
mark { background: var(--mark-bg); color: var(--mark-text); border-radius: 2px; padding: 0 1px; }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 40;
	height: var(--header-h);
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: saturate(180%) blur(10px);
	-webkit-backdrop-filter: saturate(180%) blur(10px);
	border-bottom: 1px solid var(--border-soft);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; } }
.header-inner {
	max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 20px;
	display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text-strong); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.01em; flex: none; }
.brand:hover { color: var(--text-strong); }
.brand-logo { width: 28px; height: 28px; color: var(--accent); }
.brand-tag { font-weight: 500; color: var(--muted); font-size: 15px; }
.header-search { position: relative; flex: 1; max-width: 420px; margin-left: 24px; display: flex; align-items: center; }
.header-search .search-icon { position: absolute; left: 10px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.header-search-input {
	width: 100%; height: 38px; padding: 0 70px 0 34px;
	font: inherit; font-size: 14px; color: var(--text);
	background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
	cursor: pointer;
}
.header-search-input::placeholder { color: var(--muted); opacity: 1; }
.header-search-input:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.header-search .search-kbd { position: absolute; right: 9px; pointer-events: none; }
.header-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.text-link { color: var(--text); font-weight: 500; font-size: 15px; text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.text-link:hover { color: var(--accent); }
.icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--radius);
	background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-strong); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.nav-toggle, .search-btn-mobile { display: none; }

/* ---------- Docs layout ---------- */
.docs-layout {
	flex: 1;
	width: 100%; max-width: 1440px; margin: 0 auto;
	display: grid;
	grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
	gap: 0 40px;
	padding: 0 20px;
}
.docs-layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.docs-main { min-width: 0; padding: 36px 0 64px; }
.doc { max-width: var(--content-w); margin: 0 auto; }
.no-toc .doc { margin: 0 auto 0 0; max-width: calc(var(--content-w) + 120px); }

/* Sidebar */
.docs-sidebar {
	position: sticky; top: var(--header-h);
	height: calc(100vh - var(--header-h));
	overflow-y: auto; overscroll-behavior: contain;
	padding: 28px 8px 40px 0;
	border-right: 1px solid var(--border-soft);
	scrollbar-width: thin;
}
.admin-bar .docs-sidebar { top: calc(var(--header-h) + 32px); height: calc(100vh - var(--header-h) - 32px); }
.drawer-head { display: none; }
.nav-section + .nav-section { margin-top: 18px; }
.nav-section-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.nav-section-link {
	flex: 1; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
	color: var(--text-strong); text-decoration: none; padding: 4px 10px; border-radius: 6px;
}
.nav-section-link:hover { color: var(--accent); }
.nav-section-link[aria-current="page"] { color: var(--accent); }
.nav-section-toggle {
	width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
	background: none; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer; padding: 0;
}
.nav-section-toggle:hover { background: var(--bg-hover); color: var(--text-strong); }
.nav-section-toggle .chevron { width: 16px; height: 16px; transform: rotate(90deg); transition: transform .15s ease; }
.nav-section-toggle[aria-expanded="false"] .chevron { transform: rotate(0deg); }
.nav-pages { list-style: none; margin: 4px 0 0; padding: 0 0 0 10px; }
.nav-pages[hidden] { display: none; }
.nav-pages a {
	display: block; padding: 5px 10px; margin-left: -1px;
	font-size: 14.5px; line-height: 1.45; color: var(--muted); text-decoration: none;
	border-left: 1px solid var(--border); border-radius: 0 6px 6px 0;
}
.nav-pages a:hover { color: var(--text-strong); border-left-color: var(--muted); background: var(--bg-soft); }
.nav-pages a[aria-current="page"] { color: var(--accent); font-weight: 600; border-left: 2px solid var(--accent); background: var(--accent-bg); padding-left: 9px; }

/* Right column: On this page */
.docs-toc { min-width: 0; }
.toc-sticky {
	position: sticky; top: var(--header-h);
	max-height: calc(100vh - var(--header-h)); overflow-y: auto;
	padding: 36px 0 40px; scrollbar-width: thin;
}
.admin-bar .toc-sticky { top: calc(var(--header-h) + 32px); max-height: calc(100vh - var(--header-h) - 32px); }
.toc-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-strong); }
.toc-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; line-height: 1.45; border-left: 1px solid var(--border-soft); }
.toc-list a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.toc-list .toc-l3 a { padding-left: 24px; }
.toc-list a:hover { color: var(--text-strong); }
.toc-list a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-mobile { display: none; }

/* Doc header */
.breadcrumbs ol { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 14px; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 6px 0 2px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--text); }
.doc-eyebrow { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--accent); }
.doc-title { margin: 0 0 24px; font-size: clamp(30px, 4vw, 38px); line-height: 1.2; letter-spacing: -.02em; color: var(--text-strong); font-weight: 750; }

/* ---------- Prose ---------- */
.prose { font-size: 16px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose .table-wrap, .prose .code-block, .prose blockquote, .prose .mermaid-block { margin: 0 0 20px; }
.prose h2, .prose h3, .prose h4 { position: relative; color: var(--text-strong); line-height: 1.3; letter-spacing: -.01em; }
.prose h2 { font-size: 24px; margin: 48px 0 16px; padding-top: 24px; border-top: 1px solid var(--border-soft); }
.prose h3 { font-size: 19px; margin: 32px 0 12px; }
.prose h4 { font-size: 16px; margin: 24px 0 8px; }
.prose h2 code, .prose h3 code { font-size: .88em; }
.heading-anchor {
	margin-left: 8px; color: var(--muted); text-decoration: none; font-weight: 400;
	opacity: 0; transition: opacity .12s ease;
}
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .prose h4:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }
@media (hover: none) { .heading-anchor { opacity: .5; } }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0 0; }
.prose li > p { margin: 0 0 8px; }
.prose strong { color: var(--text-strong); font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.prose a code { color: inherit; }

/* Inline code */
.prose :not(pre) > code, .section-page-desc code {
	font-family: var(--mono); font-size: .875em;
	background: var(--inline-code-bg); color: var(--text-strong);
	padding: .15em .38em; border-radius: 5px;
	overflow-wrap: anywhere;
}

/* Task lists */
.prose ul:has(> li.task-item) { list-style: none; padding-left: 0; }
.task-item label { display: flex; gap: 10px; align-items: baseline; }
.task-item input { margin: 0; width: 16px; height: 16px; flex: none; transform: translateY(3px); accent-color: var(--accent-btn); }

/* Tables */
.table-wrap {
	overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius);
	scrollbar-width: thin;
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--border-soft); }
.table-wrap th { background: var(--bg-soft); color: var(--text-strong); font-weight: 650; white-space: nowrap; border-bottom-color: var(--border); }
.table-wrap tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-soft) 55%, transparent); }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap td code { overflow-wrap: break-word; }
.table-wrap td:first-child code { white-space: nowrap; overflow-wrap: normal; }
.table-wrap td:first-child { white-space: nowrap; }
.table-wrap td:first-child wbr { display: none; }
.table-wrap td:first-child:has(> :not(code)), .table-wrap td:first-child:not(:has(code)) { white-space: normal; }

/* Callouts */
.callout {
	position: relative;
	padding: 14px 16px 14px 46px; border-radius: var(--radius);
	border: 1px solid; border-left-width: 4px;
	font-size: 15px;
}
.callout > :last-child { margin-bottom: 0; }
.callout::before {
	content: ""; position: absolute; left: 15px; top: 16px; width: 20px; height: 20px;
	background: currentColor;
	-webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.callout-info {
	background: var(--info-bg); border-color: color-mix(in srgb, var(--info-border) 35%, transparent); border-left-color: var(--info-border);
	--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E");
}
.callout-info::before { color: var(--info-title); }
.callout-warning {
	background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn-border) 35%, transparent); border-left-color: var(--warn-border);
	--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 20h20L12 3Z'/%3E%3Cpath d='M12 10v4M12 17v.5'/%3E%3C/svg%3E");
}
.callout-warning::before { color: var(--warn-title); }
.callout-warning > p:first-child > strong:first-child { color: var(--warn-title); }

/* Code blocks */
.code-block {
	background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
	overflow: hidden;
}
.code-head {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	min-height: 36px; padding: 0 6px 0 14px;
	background: var(--code-head); border-bottom: 1px solid var(--border);
	font-size: 12.5px;
}
.code-lang { font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.code-copy {
	font: 600 12.5px/1 var(--font); color: var(--muted);
	background: transparent; border: 1px solid transparent; border-radius: 6px;
	padding: 6px 10px; cursor: pointer;
}
.code-copy:hover { color: var(--text-strong); background: var(--bg-hover); border-color: var(--border); }
.code-copy.is-copied { color: var(--hl-generic); }
html:not(.js) .code-copy { display: none; }
.code-block pre {
	margin: 0; padding: 14px 16px; overflow-x: auto;
	font: 13.5px/1.65 var(--mono); tab-size: 4;
	white-space: pre; word-wrap: normal; overflow-wrap: normal;
	scrollbar-width: thin;
}
.code-block code { font: inherit; background: none; padding: 0; color: var(--text); }
.code-block .prompt { color: var(--muted); user-select: none; }

/* Syntax highlighting (tempest/highlight classes) */
.hl-keyword, .hl-tag { color: var(--hl-keyword); }
.hl-type { color: var(--hl-type); }
.hl-property, .hl-function-name { color: var(--hl-property); }
.hl-value, .hl-string { color: var(--hl-value); }
.hl-variable { color: var(--hl-variable); }
.hl-number, .hl-literal { color: var(--hl-number); }
.hl-comment, .hl-comment * { color: var(--hl-comment); font-style: italic; }
.hl-generic, .hl-addition { color: var(--hl-generic); }
.hl-attribute { color: var(--hl-attr); }
.hl-operator { color: var(--hl-keyword); }
.hl-deletion { color: var(--hl-keyword); }
.hl-injection { color: inherit; }
.hl-em { font-style: italic; }
.hl-strong { font-weight: 700; }

/* Mermaid */
.mermaid-block {
	padding: 16px; scrollbar-width: thin; border: 1px solid var(--border); border-radius: var(--radius);
	background: var(--bg-raised); overflow-x: auto; text-align: center;
}
.mermaid-block pre.mermaid { margin: 0; font: 13px/1.5 var(--mono); color: var(--muted); text-align: left; white-space: pre; }
.mermaid-block pre.mermaid[data-processed] { text-align: center; white-space: normal; }
.js .mermaid-block pre.mermaid:not([data-processed]) {
	position: relative; min-height: 420px; color: transparent; overflow: hidden; user-select: none;
}
.js .mermaid-block pre.mermaid:not([data-processed])::after {
	content: "Loading diagram…"; position: absolute; inset: 0; display: grid; place-items: center;
	color: var(--muted); font: 14px/1 var(--font);
}
.mermaid-block pre.mermaid[data-processed] svg { height: auto; }

/* Section overview pages */
.section-pages { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.section-page-card {
	display: flex; flex-direction: column; gap: 6px; height: 100%;
	padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px;
	background: var(--bg-raised); text-decoration: none; color: var(--text);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.section-page-card:hover { border-color: var(--accent); box-shadow: var(--shadow); color: var(--text); }
.section-page-title { font-weight: 650; color: var(--text-strong); }
.section-page-card:hover .section-page-title { color: var(--accent); }
.section-page-desc { font-size: 14px; color: var(--muted); line-height: 1.55; }

/* Doc footer */
.doc-footer { margin-top: 56px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager-link {
	display: flex; flex-direction: column; gap: 4px; padding: 14px 18px;
	border: 1px solid var(--border); border-radius: 10px; text-decoration: none;
	transition: border-color .15s ease;
}
.pager-link:hover { border-color: var(--accent); }
.pager-next { grid-column: 2; text-align: right; align-items: flex-end; }
.pager-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pager-label .icon { width: 15px; height: 15px; }
.pager-title { font-weight: 650; color: var(--accent); }
.doc-meta { margin: 28px 0 0; font-size: 14px; color: var(--muted); }
.doc-meta a { color: var(--muted); }
.doc-meta a:hover { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 44px; padding: 0 20px; border-radius: var(--radius);
	font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer;
	border: 1px solid transparent; transition: background-color .15s ease, border-color .15s ease;
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-btn); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-btn-hover); color: var(--on-accent); }
.btn-secondary { background: var(--bg-raised); color: var(--text-strong); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-strong); }

/* ---------- Home ---------- */
.home { flex: 1; }
.hero {
	padding: 72px 20px 64px;
	background:
		radial-gradient(60% 80% at 15% 0%, color-mix(in srgb, var(--accent-btn) 13%, transparent), transparent 70%),
		radial-gradient(50% 60% at 95% 20%, color-mix(in srgb, #06b6d4 10%, transparent), transparent 70%);
	border-bottom: 1px solid var(--border-soft);
}
.hero-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.hero-badge {
	display: inline-block; margin: 0 0 18px; padding: 4px 12px; border-radius: 999px;
	font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-bg);
	border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.hero-title { margin: 0 0 18px; font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -.03em; font-weight: 800; color: var(--text-strong); }
.hero-title .accent { color: var(--accent); }
.hero-lead { margin: 0 0 28px; font-size: 18.5px; line-height: 1.6; color: var(--muted); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.install { max-width: 480px; }
.install-block pre { font-size: 14.5px; }
.hero-code .code-block { box-shadow: var(--shadow-lg); }
.hero-code pre { font-size: 13.5px; }
.home-section { padding: 64px 20px; }
.home-section + .home-section { padding-top: 8px; }
.home-inner { max-width: 1200px; margin: 0 auto; }
.home-h2 { margin: 0 0 28px; font-size: 28px; letter-spacing: -.02em; color: var(--text-strong); }
.feature-grid, .section-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature { padding: 22px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raised); }
.feature-icon {
	display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
	border-radius: 10px; background: var(--accent-bg); color: var(--accent); margin-bottom: 14px;
}
.feature-title { margin: 0 0 6px; font-size: 17px; }
.feature-title a { color: var(--text-strong); text-decoration: none; }
.feature-title a:hover { color: var(--accent); text-decoration: underline; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.section-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.section-card { padding: 22px 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raised); }
.section-card-title { margin: 0 0 6px; font-size: 19px; }
.section-card-title a { color: var(--text-strong); text-decoration: none; }
.section-card-title a:hover { color: var(--accent); text-decoration: underline; }
.section-card-desc { margin: 0 0 14px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.section-card-pages { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--border-soft); columns: 2; column-gap: 16px; font-size: 14.5px; }
.section-card-pages li { break-inside: avoid; padding: 3px 0; }
.section-card-pages a { text-decoration: none; }
.section-card-pages a:hover { text-decoration: underline; }

/* ---------- Generic pages, search page, 404 ---------- */
.page-main { flex: 1; width: 100%; max-width: calc(var(--content-w) + 40px); margin: 0 auto; padding: 48px 20px 72px; }
.search-page-form { display: flex; gap: 10px; margin: 0 0 28px; }
.search-page-form input {
	flex: 1; min-width: 0; height: 44px; padding: 0 14px; font: inherit; color: var(--text);
	background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
}
.search-count { color: var(--muted); font-size: 14px; }
.search-page-results { list-style: none; margin: 0; padding: 0; }
.search-page-result { padding: 18px 0; border-bottom: 1px solid var(--border-soft); }
.result-section { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.result-title { margin: 2px 0 6px; font-size: 19px; }
.result-title a { text-decoration: none; }
.result-title a:hover { text-decoration: underline; }
.result-excerpt { margin: 0; color: var(--muted); font-size: 15px; }
.nf-links { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; list-style: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); background: var(--bg-soft); font-size: 14px; color: var(--muted); }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 22px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.footer-inner p { margin: 0; }
.footer-inner strong { color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Search dialog ---------- */
.search-dialog {
	width: min(680px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 80px));
	margin: 72px auto auto; padding: 0;
	border: 1px solid var(--border); border-radius: 14px;
	background: var(--bg-raised); color: var(--text); box-shadow: var(--shadow-lg);
	overflow: hidden;
}
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgb(1 4 9 / .55); backdrop-filter: blur(2px); }
.search-dialog-form { position: relative; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.search-dialog-form .search-icon { color: var(--accent); }
.search-dialog-input {
	flex: 1; min-width: 0; height: 58px; border: 0; outline: none; background: transparent;
	font: inherit; font-size: 17px; color: var(--text-strong);
}
.search-dialog-input::placeholder { color: var(--muted); opacity: 1; }
.search-dialog-input::-webkit-search-cancel-button { display: none; }
.search-close { background: none; border: 0; padding: 4px; cursor: pointer; }
.search-body { overflow-y: auto; padding: 8px; flex: 1; overscroll-behavior: contain; }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.search-result a {
	display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text);
	border: 1px solid transparent;
}
.search-result .r-title { display: block; font-weight: 600; color: var(--text-strong); font-size: 15px; }
.search-result .r-title .r-sep { color: var(--muted); font-weight: 400; margin: 0 4px; }
.search-result .r-text { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.5; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result a[aria-selected="true"], .search-result a:hover { background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.search-result a[aria-selected="true"] .r-title { color: var(--accent); }
.search-status { margin: 0; padding: 18px 12px; color: var(--muted); font-size: 14px; text-align: center; }
.search-status:empty { display: none; }
.search-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex: none; background: var(--bg-soft); }
.search-foot kbd { margin-right: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
	.docs-layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
	.docs-toc { display: none; }
	.toc-mobile { display: block; }
}
@media (max-width: 1023px) {
	:root { --header-h: 56px; }
	.nav-toggle { display: inline-flex; margin-left: -8px; }
	.docs-layout, .docs-layout.no-toc { grid-template-columns: minmax(0, 1fr); padding: 0 20px; }
	.docs-main { padding-top: 24px; }
	.no-toc .doc { margin: 0 auto; }
	.docs-sidebar {
		position: fixed; z-index: 60; top: 0; left: 0; bottom: 0;
		width: min(320px, 86vw); height: 100%;
		background: var(--bg); border-right: 1px solid var(--border);
		padding: 0 12px 40px; box-shadow: var(--shadow-lg);
		transform: translateX(-105%); visibility: hidden;
		transition: transform .2s ease, visibility 0s linear .2s;
	}
	.admin-bar .docs-sidebar { top: 0; height: 100%; }
	.nav-open .docs-sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
	.drawer-head { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); position: sticky; top: 0; background: var(--bg); z-index: 1; margin-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
	.drawer-title { font-weight: 700; color: var(--text-strong); padding-left: 10px; }
	.drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: rgb(1 4 9 / .5); }
	.drawer-backdrop[hidden] { display: none; }
	.hero-inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
	.feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
	.header-inner { gap: 8px; padding: 0 12px; }
	.header-search { display: none; }
	.search-btn-mobile { display: inline-flex; }
	.text-link, .brand-tag { display: none; }
	.docs-layout, .docs-layout.no-toc { padding: 0 16px; }
	.doc-title { margin-bottom: 18px; }
	.prose h2 { font-size: 21px; margin-top: 36px; padding-top: 20px; }
	.prose h3 { font-size: 18px; }
	.code-block { border-radius: 6px; }
	.code-block pre { font-size: 13px; padding: 12px 14px; }
	.pager { grid-template-columns: 1fr; }
	.pager-next { grid-column: 1; }
	.hero { padding: 44px 16px 44px; }
	.hero-lead { font-size: 17px; }
	.home-section { padding: 44px 16px; }
	.feature-grid { grid-template-columns: minmax(0, 1fr); }
	.section-grid { grid-template-columns: minmax(0, 1fr); }
	.section-card-pages { columns: 1; }
	.search-dialog { margin-top: 12px; max-height: calc(100vh - 24px); }
	.search-foot { display: none; }
	.footer-inner { flex-direction: column; align-items: flex-start; }
}

/* Mobile "On this page" */
.toc-mobile { margin: 0 0 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); }
.toc-mobile summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14.5px; color: var(--text-strong); list-style: none; display: flex; align-items: center; justify-content: space-between; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc-mobile .toc-list { margin: 0 14px 12px; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}

@media print {
	.site-header, .docs-sidebar, .docs-toc, .toc-mobile, .doc-footer, .site-footer, .code-copy, .heading-anchor { display: none !important; }
	.docs-layout { display: block; }
	.code-block pre { white-space: pre-wrap; }
}
