/* ==========================================================================
   VOI Docs: GitBook-style, monochrome base, VOI green accent, Axiforma.
   Light + dark mode via [data-voi-theme] on the .voi-docs root.
   Accent system:
     - Chrome (active nav, callout border, button, focus, TOC) = VOI green.
     - Links: unvisited = green, visited = indigo.
     - Green text is contrast-darkened in light / lifted in dark.
   ========================================================================== */

.voi-docs {
	/* --- Brand constants --- */
	--voi-green:        #58BD47;  /* true brand green, used for fills/borders */
	--voi-indigo:       #1F1F5E;  /* brand indigo (reference) */

	--voi-font: 'Axiforma', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--voi-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
	--voi-radius: 8px;
	--voi-measure: 720px;
	--voi-sidebar-w: 288px;
	--voi-toc-w: 240px;

	font-family: var(--voi-font);
	-webkit-font-smoothing: antialiased;
	line-height: 1.6;
	color: var(--ink);
	background: var(--bg);
}

/* ---------- LIGHT theme tokens (default) ---------- */
.voi-docs,
.voi-docs[data-voi-theme="light"] {
	--bg:            #FFFFFF;
	--surface-2:     #FAFAF9;  /* sidebar / off-white */
	--surface-hover: #F4F4F2;
	--code-bg:       #F6F6F5;
	--ink:           #1F1F1E;
	--ink-2:         #4A4A48;
	--ink-3:         #6E6E6C;
	--line:          #E6E6E4;

	--accent-fill:   #58BD47;  /* button/callout/active-bg fills */
	--accent-text:   #3B8B2E;  /* green for small text (contrast-safe on light) */
	--accent-bg:     rgba(88,189,71,.10);
	--accent-hint:   rgba(88,189,71,.07);
	--accent-line:   rgba(88,189,71,.40);
	--accent-ring:   rgba(88,189,71,.30);
	--btn-text:      #0E2A08;  /* dark green text on green button */

	--link-fresh:    #3B8B2E;
	--link-fresh-b:  rgba(88,189,71,.40);
	--link-visited:  #3A3A8C;  /* indigo, light mode */
	--link-visited-b: rgba(58,58,140,.40);

	/* IDE syntax tokens (light) */
	--tok-com:  #008000;
	--tok-str:  #A31515;
	--tok-key:  #0451A5;
	--tok-num:  #098658;
	--tok-bool: #0000FF;
	--tok-punc: #4A4A48;
}

/* ---------- DARK theme tokens ---------- */
/* Preboot selector (set on <html> before paint) shares the dark token block
   so dark-mode users never flash the light palette before JS attaches. */
html[data-voi-preboot="dark"] .voi-docs,
.voi-docs[data-voi-theme="dark"] {
	--bg:            #0D0D0F;
	--surface-2:     #141416;
	--surface-hover: #1F1F23;
	--code-bg:       #1B1B1E;
	--ink:           #ECECEA;
	--ink-2:         #B4B4B0;
	--ink-3:         #8A8A86;
	--line:          #26262A;

	--accent-fill:   #58BD47;
	--accent-text:   #7BD86B;  /* lifted green for text on dark */
	--accent-bg:     rgba(88,189,71,.14);
	--accent-hint:   rgba(88,189,71,.10);
	--accent-line:   rgba(111,208,94,.45);
	--accent-ring:   rgba(88,189,71,.35);
	--btn-text:      #0E2A08;

	--link-fresh:    #6FD05E;
	--link-fresh-b:  rgba(111,208,94,.45);
	--link-visited:  #8B87E0;  /* lifted indigo, dark mode */
	--link-visited-b: rgba(139,135,224,.45);

	/* IDE syntax tokens (dark) */
	--tok-com:  #6A9955;
	--tok-str:  #CE9178;
	--tok-key:  #9CDCFE;
	--tok-num:  #B5CEA8;
	--tok-bool: #569CD6;
	--tok-punc: #B4B4B0;
}

.voi-docs *, .voi-docs *::before, .voi-docs *::after { box-sizing: border-box; }

/* ---------- Grid ---------- */
.voi-docs__grid {
	display: grid;
	grid-template-columns: var(--voi-sidebar-w) minmax(0, 1fr) var(--voi-toc-w);
	max-width: 1440px;
	margin: 0 auto;
	align-items: start;
}

/* ---------- Brand / logo ---------- */
.voi-docs__brand { display: inline-flex; align-items: center; text-decoration: none; }
/* The grayscale SVG (light mode) has ~38% transparent padding baked in above/
   below the artwork (which is perfectly centered). object-fit: cover on a wide,
   short box crops that dead space so the logo reads at full size. The dark-mode
   white PNG is already tightly cropped, so it uses contain to avoid distortion. */
.voi-docs__logo { display: block; height: 40px; }
.voi-docs__logo--light { width: 172px; object-fit: cover; object-position: center; }
.voi-docs__logo--dark  { width: auto; max-width: 200px; object-fit: contain; }
.voi-docs__brand--desktop { padding: 4px 0 22px; }
/* Swap logo per theme: light uses grayscale, dark uses white version */
.voi-docs .voi-docs__logo--dark { display: none; }
html[data-voi-preboot="dark"] .voi-docs__logo--light,
.voi-docs[data-voi-theme="dark"] .voi-docs__logo--light { display: none; }
html[data-voi-preboot="dark"] .voi-docs__logo--dark,
.voi-docs[data-voi-theme="dark"] .voi-docs__logo--dark { display: block; }

/* ---------- Theme toggle ---------- */
.voi-docs__themetoggle {
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px;
	background: none; border: 1px solid var(--line); border-radius: var(--voi-radius);
	color: var(--ink-2); cursor: pointer; margin-left: auto;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.voi-docs__themetoggle:hover { background: var(--surface-hover); color: var(--ink); }
.voi-docs__themetoggle svg { width: 17px; height: 17px; }
.voi-docs__themetoggle .voi-icon-sun { display: none; }
html[data-voi-preboot="dark"] .voi-docs__themetoggle .voi-icon-moon,
.voi-docs[data-voi-theme="dark"] .voi-docs__themetoggle .voi-icon-moon { display: none; }
html[data-voi-preboot="dark"] .voi-docs__themetoggle .voi-icon-sun,
.voi-docs[data-voi-theme="dark"] .voi-docs__themetoggle .voi-icon-sun { display: block; }

/* ---------- Sidebar ---------- */
.voi-docs__sidebar {
	position: sticky; top: 0; align-self: start;
	height: 100vh; overflow-y: auto;
	padding: 28px 22px 48px;
	background: var(--surface-2);
	border-right: 1px solid var(--line);
}
.voi-docs__sidebar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }

.voi-docs__search { margin-bottom: 22px; }
.voi-docs__search input[type="search"] {
	width: 100%; font-family: var(--voi-font); font-size: 14px; color: var(--ink);
	padding: 9px 12px; background: var(--bg); border: 1px solid var(--line);
	border-radius: var(--voi-radius); outline: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.voi-docs__search input[type="search"]:focus {
	border-color: var(--accent-fill);
	box-shadow: 0 0 0 3px var(--accent-ring);
}
.voi-docs__search input::placeholder { color: var(--ink-3); }

/* Tree */
.voi-docs-tree { font-size: 14px; }
.voi-docs-tree__section { margin-bottom: 6px; }
.voi-docs-tree__section-toggle {
	display: block; width: 100%; text-align: left;
	font-family: var(--voi-font); font-weight: 600; font-size: 12px;
	letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3);
	background: none; border: 0; padding: 14px 8px 8px; cursor: pointer;
}
.voi-docs-tree__list { list-style: none; margin: 0; padding: 0; }
.voi-docs-tree__section .voi-docs-tree__list { display: none; }
.voi-docs-tree__section.is-open .voi-docs-tree__list { display: block; }

.voi-docs-tree__item a {
	display: block; padding: 7px 10px; margin: 1px 0;
	color: var(--ink-2); text-decoration: none; border-radius: 6px;
	border-left: 2px solid transparent;
	transition: background .12s ease, color .12s ease;
}
.voi-docs-tree__item a:hover { background: var(--surface-hover); color: var(--ink); }
.voi-docs-tree__item.is-active a {
	color: var(--accent-text); background: var(--accent-bg);
	border-left-color: var(--accent-fill); font-weight: 600;
}

/* ---------- Content ---------- */
.voi-docs__content { padding: 48px 56px 96px; min-width: 0; }
.voi-docs__article, .voi-docs__hub { max-width: var(--voi-measure); }

.voi-docs__content h1 {
	font-family: var(--voi-font); font-weight: 700; font-size: 34px;
	line-height: 1.2; letter-spacing: -.01em; margin: 0 0 12px; color: var(--ink);
}
.voi-docs__lede { font-size: 17px; color: var(--ink-3); margin: 0 0 32px; }

.voi-docs__body { font-size: 16px; color: var(--ink); }
.voi-docs__body h2 {
	font-weight: 700; font-size: 24px; line-height: 1.3;
	margin: 44px 0 14px; padding-top: 12px; scroll-margin-top: 24px; letter-spacing: -.005em;
	color: var(--ink);
}
.voi-docs__body h3 { font-weight: 600; font-size: 19px; margin: 32px 0 10px; scroll-margin-top: 24px; color: var(--ink); }
.voi-docs__body p { margin: 0 0 18px; }

/* Links: unvisited green, visited indigo, both underlined */
.voi-docs__body a {
	color: var(--link-fresh); text-decoration: none;
	border-bottom: 1px solid var(--link-fresh-b);
	transition: border-color .12s ease, color .12s ease;
}
.voi-docs__body a:hover { border-bottom-color: var(--link-fresh); }
.voi-docs__body a:visited { color: var(--link-visited); border-bottom-color: var(--link-visited-b); }

.voi-docs__body ul, .voi-docs__body ol { margin: 0 0 18px; padding-left: 22px; }
.voi-docs__body li { margin: 6px 0; }
.voi-docs__body hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.voi-docs__body code {
	font-family: var(--voi-mono); font-size: .88em;
	color: var(--ink) !important;
	background: var(--code-bg); border: 1px solid var(--line);
	border-radius: 5px; padding: 1px 6px;
}
.voi-docs__body pre {
	font-family: var(--voi-mono); font-size: 13.5px; line-height: 1.6;
	color: var(--ink) !important;
	background: var(--code-bg); border: 1px solid var(--line);
	border-radius: var(--voi-radius); padding: 16px 18px; overflow-x: auto; margin: 0 0 22px;
}
.voi-docs__body pre code { background: none; border: 0; padding: 0; color: var(--ink) !important; }

/* IDE-style syntax tokens (applied by voi-docs.js) */
.voi-docs__body pre code .tok-com  { color: var(--tok-com); font-style: italic; }
.voi-docs__body pre code .tok-str  { color: var(--tok-str); }
.voi-docs__body pre code .tok-key  { color: var(--tok-key); }
.voi-docs__body pre code .tok-num  { color: var(--tok-num); }
.voi-docs__body pre code .tok-bool { color: var(--tok-bool); }
.voi-docs__body pre code .tok-punc { color: var(--tok-punc); }

.voi-docs__body .voi-hint, .voi-docs__body blockquote {
	border-left: 3px solid var(--accent-fill); background: var(--accent-hint);
	border-radius: 0 var(--voi-radius) var(--voi-radius) 0;
	padding: 14px 18px; margin: 0 0 22px; color: var(--ink-2);
}
.voi-docs__body blockquote p:last-child { margin-bottom: 0; }

.voi-docs__body table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 0 0 24px; }
.voi-docs__body th, .voi-docs__body td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.voi-docs__body th { font-weight: 600; color: var(--ink); border-bottom-color: var(--ink-3); }

.voi-docs__body img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--voi-radius); }

.voi-docs__article-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.voi-docs__updated { font-size: 13px; color: var(--ink-3); margin: 0; }

/* ---------- Hub cards ---------- */
.voi-docs__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 8px; }
.voi-docs__card {
	display: block; padding: 22px; background: var(--bg);
	border: 1px solid var(--line); border-radius: var(--voi-radius);
	text-decoration: none; color: var(--ink);
	transition: border-color .15s ease, transform .15s ease;
}
.voi-docs__card:hover { border-color: var(--accent-fill); transform: translateY(-2px); }
.voi-docs__card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; color: var(--ink); }
.voi-docs__card p { margin: 0; font-size: 14px; color: var(--ink-3); }

/* ---------- Button (green fill, dark-green text) ---------- */
.voi-docs__btn {
	display: inline-block; background: var(--accent-fill); color: var(--btn-text);
	padding: 10px 18px; border-radius: var(--voi-radius);
	font-size: 14px; font-weight: 600; text-decoration: none;
	transition: filter .15s ease;
}
.voi-docs__btn:hover { filter: brightness(.95); }

/* ---------- TOC rail ---------- */
.voi-docs__toc { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 52px 24px 48px; }
.voi-docs__toc-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.voi-docs__toc-list a {
	display: block; font-size: 13.5px; color: var(--ink-3); text-decoration: none;
	padding: 5px 0 5px 12px; border-left: 2px solid var(--line);
	transition: color .12s ease, border-color .12s ease;
}
.voi-docs__toc-list a.is-child { padding-left: 24px; font-size: 13px; }
.voi-docs__toc-list a:hover { color: var(--ink); }
.voi-docs__toc-list a.is-active { color: var(--accent-text); border-left-color: var(--accent-fill); }

/* ---------- Mobile ---------- */
.voi-docs__mobilebar { display: none; }
.voi-docs__scrim { display: none; }

@media (max-width: 1100px) {
	.voi-docs__grid { grid-template-columns: var(--voi-sidebar-w) minmax(0, 1fr); }
	.voi-docs__toc { display: none; }
	.voi-docs__content { padding: 40px 40px 80px; }
}
@media (max-width: 782px) {
	.voi-docs__grid { grid-template-columns: 1fr; }
	.voi-docs__mobilebar {
		display: flex; align-items: center; justify-content: space-between;
		padding: 12px 18px; border-bottom: 1px solid var(--line);
		background: var(--bg); position: sticky; top: 0; z-index: 40; gap: 10px;
	}
	.voi-docs__brand--desktop { display: none; }
	.voi-docs__menu-btn { background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 6px; }
	.voi-docs__menu-btn span { width: 20px; height: 2px; background: var(--ink); display: block; }
	.voi-docs__sidebar {
		position: fixed; top: 0; left: 0; z-index: 50;
		width: 84%; max-width: 320px; height: 100vh;
		transform: translateX(-100%); transition: transform .22s ease;
	}
	.voi-docs.is-nav-open .voi-docs__sidebar { transform: translateX(0); }
	.voi-docs.is-nav-open .voi-docs__scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.5); }
	.voi-docs__content { padding: 28px 20px 64px; }
	.voi-docs__content h1 { font-size: 28px; }
}


/* ==========================================================================
   Scrollbars: follow the active docs theme.
   The theme JS keeps [data-voi-preboot] on <html> in sync with
   [data-voi-theme] on the docs root, so a runtime toggle updates both the
   native window scrollbar and the inner scroll containers.
   ========================================================================== */

/* Native UI (window scrollbar, form controls) follows the DOCS theme rather
   than the OS preference. The explicit light rule matters as much as the dark
   one: without it, a user whose OS is dark but who has chosen light docs gets
   dark native scrollbars against a white page. */
html[data-voi-preboot="dark"]  { color-scheme: dark; }
html[data-voi-preboot="light"] { color-scheme: light; }

/* Palette-matched window scrollbar. These are literals because the theme
   tokens are declared on .voi-docs, not on <html>. If --bg or --surface-hover
   change in the dark token block above, update these to match. */
html[data-voi-preboot="dark"] {
	scrollbar-width: thin;
	scrollbar-color: #34343B #0D0D0F;
}
html[data-voi-preboot="dark"]::-webkit-scrollbar { width: 12px; height: 12px; }
html[data-voi-preboot="dark"]::-webkit-scrollbar-track { background: #0D0D0F; }
html[data-voi-preboot="dark"]::-webkit-scrollbar-thumb {
	background: #34343B;
	border: 3px solid transparent;
	background-clip: padding-box;
	border-radius: 8px;
}
html[data-voi-preboot="dark"]::-webkit-scrollbar-thumb:hover { background: #45454E; background-clip: padding-box; }
html[data-voi-preboot="dark"]::-webkit-scrollbar-corner { background: #0D0D0F; }
/* Kill the stepper arrows that Windows renders by default. */
html[data-voi-preboot="dark"]::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* Inner scroll containers: sidebar, TOC rail, and horizontally scrolling code
   blocks. These sit inside .voi-docs so they can use the theme tokens. */
.voi-docs[data-voi-theme="dark"] .voi-docs__sidebar,
.voi-docs[data-voi-theme="dark"] .voi-docs__toc,
.voi-docs[data-voi-theme="dark"] .voi-docs__body pre {
	scrollbar-width: thin;
	scrollbar-color: #34343B transparent;
}
.voi-docs[data-voi-theme="dark"] .voi-docs__sidebar::-webkit-scrollbar,
.voi-docs[data-voi-theme="dark"] .voi-docs__toc::-webkit-scrollbar,
.voi-docs[data-voi-theme="dark"] .voi-docs__body pre::-webkit-scrollbar { width: 10px; height: 10px; }
.voi-docs[data-voi-theme="dark"] .voi-docs__sidebar::-webkit-scrollbar-track,
.voi-docs[data-voi-theme="dark"] .voi-docs__toc::-webkit-scrollbar-track,
.voi-docs[data-voi-theme="dark"] .voi-docs__body pre::-webkit-scrollbar-track { background: transparent; }
.voi-docs[data-voi-theme="dark"] .voi-docs__sidebar::-webkit-scrollbar-thumb,
.voi-docs[data-voi-theme="dark"] .voi-docs__toc::-webkit-scrollbar-thumb,
.voi-docs[data-voi-theme="dark"] .voi-docs__body pre::-webkit-scrollbar-thumb {
	background: #34343B;
	border: 2px solid transparent;
	background-clip: padding-box;
	border-radius: 8px;
}
.voi-docs[data-voi-theme="dark"] .voi-docs__sidebar::-webkit-scrollbar-thumb:hover,
.voi-docs[data-voi-theme="dark"] .voi-docs__toc::-webkit-scrollbar-thumb:hover,
.voi-docs[data-voi-theme="dark"] .voi-docs__body pre::-webkit-scrollbar-thumb:hover {
	background: #45454E;
	background-clip: padding-box;
}
.voi-docs[data-voi-theme="dark"] .voi-docs__sidebar::-webkit-scrollbar-button,
.voi-docs[data-voi-theme="dark"] .voi-docs__toc::-webkit-scrollbar-button,
.voi-docs[data-voi-theme="dark"] .voi-docs__body pre::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
