/* Frontity Docs — static site styles */

:root {
	color-scheme: light;
	--bg: #ffffff;
	--bg-subtle: #f7f9fc;
	--bg-hover: #eef2f8;
	--text: #181d28;
	--text-muted: #5a6372;
	--text-faint: #646b78;
	--border: #e4e8ef;
	--border-strong: #d3d9e3;
	--primary: #3157e6;
	--primary-strong: #2443c4;
	--primary-bg: #eef2ff;
	--primary-border: #c9d5ff;
	--code-bg: #f5f7fa;
	--code-border: #e4e8ef;
	--inline-code-bg: #eef1f6;
	--shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08);
	--overlay: rgba(15, 20, 30, 0.45);

	--info-bg: #eef4ff;
	--info-border: #c7d8ff;
	--info-icon: #3157e6;
	--warning-bg: #fff7e8;
	--warning-border: #fadca0;
	--warning-icon: #c27803;
	--danger-bg: #fff0f0;
	--danger-border: #f7c4c4;
	--danger-icon: #d23b3b;
	--success-bg: #ecfbf2;
	--success-border: #b5e8cb;
	--success-icon: #1f9254;

	--hl-keyword: #cf222e;
	--hl-string: #0a3069;
	--hl-comment: #57606a;
	--hl-number: #0550ae;
	--hl-title: #8250df;
	--hl-attr: #0550ae;
	--hl-builtin: #953800;
	--hl-tag: #116329;
	--hl-variable: #953800;
	--hl-meta: #57606a;
	--hl-regexp: #0a3069;
	--hl-addition: #116329;
	--hl-deletion: #82071e;

	--sidebar-w: 288px;
	--toc-w: 232px;
	--header-h: 56px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--bg: #17181b;
		--bg-subtle: #1d1f23;
		--bg-hover: #262931;
		--text: #e7e9ee;
		--text-muted: #a3aab6;
		--text-faint: #8a91a0;
		--border: #2b2f37;
		--border-strong: #3a3f4a;
		--primary: #7896ff;
		--primary-strong: #9db3ff;
		--primary-bg: rgba(85, 130, 255, 0.14);
		--primary-border: rgba(120, 150, 255, 0.35);
		--code-bg: #1f2227;
		--code-border: #2b2f37;
		--inline-code-bg: #262a31;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
		--overlay: rgba(0, 0, 0, 0.6);

		--info-bg: rgba(85, 130, 255, 0.1);
		--info-border: rgba(120, 150, 255, 0.3);
		--info-icon: #7896ff;
		--warning-bg: rgba(240, 170, 40, 0.1);
		--warning-border: rgba(240, 170, 40, 0.3);
		--warning-icon: #f0b44c;
		--danger-bg: rgba(240, 80, 80, 0.1);
		--danger-border: rgba(240, 80, 80, 0.3);
		--danger-icon: #ff7b7b;
		--success-bg: rgba(60, 200, 120, 0.1);
		--success-border: rgba(60, 200, 120, 0.3);
		--success-icon: #4cd88a;

		--hl-keyword: #ff7b72;
		--hl-string: #a5d6ff;
		--hl-comment: #8b949e;
		--hl-number: #79c0ff;
		--hl-title: #d2a8ff;
		--hl-attr: #79c0ff;
		--hl-builtin: #ffa657;
		--hl-tag: #7ee787;
		--hl-variable: #ffa657;
		--hl-meta: #8b949e;
		--hl-regexp: #a5d6ff;
		--hl-addition: #aff5b4;
		--hl-deletion: #ffdcd7;
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #17181b;
	--bg-subtle: #1d1f23;
	--bg-hover: #262931;
	--text: #e7e9ee;
	--text-muted: #a3aab6;
	--text-faint: #8a91a0;
	--border: #2b2f37;
	--border-strong: #3a3f4a;
	--primary: #7896ff;
	--primary-strong: #9db3ff;
	--primary-bg: rgba(85, 130, 255, 0.14);
	--primary-border: rgba(120, 150, 255, 0.35);
	--code-bg: #1f2227;
	--code-border: #2b2f37;
	--inline-code-bg: #262a31;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
	--overlay: rgba(0, 0, 0, 0.6);

	--info-bg: rgba(85, 130, 255, 0.1);
	--info-border: rgba(120, 150, 255, 0.3);
	--info-icon: #7896ff;
	--warning-bg: rgba(240, 170, 40, 0.1);
	--warning-border: rgba(240, 170, 40, 0.3);
	--warning-icon: #f0b44c;
	--danger-bg: rgba(240, 80, 80, 0.1);
	--danger-border: rgba(240, 80, 80, 0.3);
	--danger-icon: #ff7b7b;
	--success-bg: rgba(60, 200, 120, 0.1);
	--success-border: rgba(60, 200, 120, 0.3);
	--success-icon: #4cd88a;

	--hl-keyword: #ff7b72;
	--hl-string: #a5d6ff;
	--hl-comment: #8b949e;
	--hl-number: #79c0ff;
	--hl-title: #d2a8ff;
	--hl-attr: #79c0ff;
	--hl-builtin: #ffa657;
	--hl-tag: #7ee787;
	--hl-variable: #ffa657;
	--hl-meta: #8b949e;
	--hl-regexp: #a5d6ff;
	--hl-addition: #aff5b4;
	--hl-deletion: #ffdcd7;
}

/* Base */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: 24px;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a {
	color: var(--primary);
	text-decoration-color: color-mix(in srgb, var(--primary) 35%, transparent);
	text-underline-offset: 2px;
}

a:hover {
	color: var(--primary-strong);
	text-decoration-color: currentColor;
}

:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
	border-radius: 4px;
}

button {
	font: inherit;
	color: inherit;
}

.skip-link {
	position: absolute;
	left: 12px;
	top: -48px;
	z-index: 100;
	padding: 8px 12px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 8px;
}

.skip-link:focus {
	top: 12px;
}

.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Layout */

.layout {
	display: grid;
	grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
	min-height: 100vh;
	max-width: 1480px;
	margin: 0 auto;
}

.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--border);
	background: var(--bg);
}

.sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 18px 16px 10px 20px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
	text-decoration: none;
	font-weight: 650;
	font-size: 17px;
	letter-spacing: -0.01em;
}

.brand:hover {
	color: var(--text);
}

.brand img {
	width: 28px;
	height: 28px;
	border-radius: 6px;
	flex: none;
}

.brand .logo-dark {
	display: none;
}

.search-button {
	display: flex;
	align-items: center;
	gap: 8px;
	width: calc(100% - 32px);
	margin: 6px 16px 10px;
	padding: 7px 10px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg-subtle);
	color: var(--text-faint);
	font-size: 14px;
	cursor: pointer;
	text-align: left;
}

.search-button:hover {
	border-color: var(--border-strong);
	color: var(--text-muted);
}

.search-button svg {
	flex: none;
}

.search-button .label {
	flex: 1;
}

kbd {
	font-family: var(--font);
	font-size: 11px;
	line-height: 1;
	padding: 3px 5px;
	border: 1px solid var(--border);
	border-bottom-width: 2px;
	border-radius: 5px;
	background: var(--bg);
	color: var(--text-faint);
}

.sidebar-nav {
	flex: 1;
	overflow-y: auto;
	padding: 4px 12px 24px;
	overscroll-behavior: contain;
}

.nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav-list .nav-list {
	margin: 2px 0 4px 18px;
	padding-left: 10px;
	border-left: 1px solid var(--border);
}

.nav-item {
	margin: 1px 0;
}

.nav-row {
	display: flex;
	align-items: stretch;
	border-radius: 8px;
}

.nav-row:hover {
	background: var(--bg-hover);
}

.nav-link {
	flex: 1;
	display: flex;
	align-items: baseline;
	gap: 8px;
	min-width: 0;
	padding: 6px 10px;
	color: var(--text-muted);
	text-decoration: none;
	font-size: 14.5px;
	line-height: 1.4;
	border-radius: 8px;
}

.nav-link:hover {
	color: var(--text);
}

.nav-emoji {
	flex: none;
	width: 1.2em;
	text-align: center;
}

.nav-item.is-active > .nav-row {
	background: var(--primary-bg);
}

.nav-item.is-active > .nav-row > .nav-link {
	color: var(--primary);
	font-weight: 560;
}

.nav-toggle {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--text-faint);
	cursor: pointer;
	border-radius: 8px;
}

.nav-toggle:hover {
	color: var(--text);
}

.nav-toggle svg {
	transition: transform 0.15s ease;
}

.nav-item.is-open > .nav-row .nav-toggle svg {
	transform: rotate(90deg);
}

.nav-item:not(.is-open) > .nav-list {
	display: none;
}

.sidebar-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 16px 16px 20px;
	border-top: 1px solid var(--border);
	font-size: 12.5px;
	color: var(--text-faint);
}

.sidebar-footer a {
	color: inherit;
}

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid var(--border);
	border-radius: 9px;
	background: var(--bg);
	color: var(--text-muted);
	cursor: pointer;
}

.icon-button:hover {
	color: var(--text);
	border-color: var(--border-strong);
}

.theme-toggle .icon-sun {
	display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
	display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
	display: none;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .theme-toggle .icon-sun {
		display: block;
	}

	:root:not([data-theme="light"]) .theme-toggle .icon-moon {
		display: none;
	}

	:root:not([data-theme="light"]) .brand .logo-light {
		display: none;
	}

	:root:not([data-theme="light"]) .brand .logo-dark {
		display: block;
	}
}

:root[data-theme="dark"] .brand .logo-light {
	display: none;
}

:root[data-theme="dark"] .brand .logo-dark {
	display: block;
}

/* Mobile header */

.mobile-header {
	display: none;
}

/* Main content */

.main {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--toc-w);
	gap: 48px;
	padding: 40px 40px 64px 56px;
	min-width: 0;
}

.main.no-toc {
	grid-template-columns: minmax(0, 1fr);
}

.content {
	min-width: 0;
	max-width: 780px;
}

.page-header {
	margin-bottom: 28px;
}

.breadcrumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	margin-bottom: 10px;
}

.breadcrumbs .breadcrumb {
	margin-bottom: 0;
}

.breadcrumb-sep {
	color: var(--text-faint);
	font-size: 14px;
}

.breadcrumb {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 10px;
	font-size: 14px;
	font-weight: 560;
	color: var(--primary);
	text-decoration: none;
}

.page-title {
	margin: 0;
	font-size: clamp(28px, 4vw, 38px);
	line-height: 1.2;
	letter-spacing: -0.02em;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.page-title .title-emoji {
	margin-right: 0.35em;
}

.page-description {
	margin: 12px 0 0;
	font-size: 18px;
	line-height: 1.55;
	color: var(--text-muted);
}

.page-description p {
	margin: 0;
}

/* Article typography */

.article {
	overflow-wrap: break-word;
}

.article > :first-child {
	margin-top: 0;
}

.article p,
.article ul,
.article ol,
.article blockquote,
.article table,
.article figure,
.article .code-block,
.article .hint,
.article .embed,
.article .content-ref,
.article .table-wrap {
	margin: 0 0 1.15em;
}

.article h1,
.article h2,
.article h3,
.article h4,
.article h5,
.article h6 {
	position: relative;
	line-height: 1.3;
	letter-spacing: -0.01em;
	font-weight: 650;
}

.article h1 {
	font-size: 30px;
	margin: 2em 0 0.6em;
}

.article h2 {
	font-size: 26px;
	margin: 1.9em 0 0.6em;
}

.article h3 {
	font-size: 21px;
	margin: 1.7em 0 0.5em;
}

.article h4 {
	font-size: 18px;
	margin: 1.5em 0 0.5em;
}

.article h5,
.article h6 {
	font-size: 16px;
	margin: 1.4em 0 0.5em;
}

.heading-anchor {
	margin-left: 0.3em;
	color: var(--text-faint);
	text-decoration: none;
	font-weight: 400;
	opacity: 0;
	transition: opacity 0.12s ease;
}

.article :is(h1, h2, h3, h4, h5, h6):hover .heading-anchor,
.heading-anchor:focus-visible {
	opacity: 1;
}

.article ul,
.article ol {
	padding-left: 1.6em;
}

.article li {
	margin: 0.3em 0;
}

.article li > ul,
.article li > ol {
	margin: 0.3em 0;
}

.article li > p {
	margin: 0.3em 0;
}

.article hr {
	height: 1px;
	margin: 2.4em 0;
	border: 0;
	background: var(--border);
}

.article blockquote {
	padding: 2px 0 2px 18px;
	border-left: 3px solid var(--border-strong);
	color: var(--text-muted);
}

.article blockquote > :last-child {
	margin-bottom: 0;
}

.article img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

.article img.inline-img {
	max-width: min(300px, 100%);
	vertical-align: middle;
	border-radius: 4px;
}

.article figure {
	margin-left: 0;
	margin-right: 0;
	text-align: center;
}

.article figcaption {
	margin-top: 8px;
	font-size: 14px;
	color: var(--text-muted);
}

.article strong {
	font-weight: 650;
}

.article :not(pre) > code {
	padding: 0.15em 0.4em;
	border-radius: 6px;
	background: var(--inline-code-bg);
	font-family: var(--mono);
	font-size: 0.86em;
	overflow-wrap: anywhere;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

.article td code,
.article th code {
	overflow-wrap: break-word;
}

.article code.nobr,
.article code .nobr {
	white-space: nowrap;
}

.article td.col-desc,
.article th.col-desc {
	min-width: 14em;
}

.article a code {
	color: inherit;
}

/* Tables */

.table-wrap {
	overflow-x: auto;
	border: 1px solid var(--border);
	border-radius: 10px;
}

.article table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 15px;
}

.article th,
.article td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
}

.article th {
	background: var(--bg-subtle);
	font-weight: 620;
}

.article tr:last-child td {
	border-bottom: 0;
}

/* Code blocks */

.code-block {
	position: relative;
	border: 1px solid var(--code-border);
	border-radius: 12px;
	background: var(--code-bg);
	overflow: hidden;
}

.code-title {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border-bottom: 1px solid var(--code-border);
	font-family: var(--mono);
	font-size: 13px;
	color: var(--text-muted);
}

.code-block pre {
	margin: 0;
	padding: 16px 18px;
	overflow-x: auto;
	font-family: var(--mono);
	font-size: 13.5px;
	line-height: 1.6;
	tab-size: 2;
}

.code-block code {
	font-family: inherit;
	background: none;
	padding: 0;
}

.copy-button {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 30px;
	height: 30px;
	padding: 0 7px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text-muted);
	font-size: 12px;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.12s ease;
}

.code-block.has-title .copy-button {
	top: 4px;
}

.code-block:not(.has-title) pre {
	padding-right: 56px;
}

/* The wrapper clips overflow, so draw the focus ring of a scrollable block inside it. */
.code-block pre:focus-visible {
	outline-offset: -2px;
	border-radius: 0 0 11px 11px;
}

.code-block:not(.has-title) pre:focus-visible {
	border-radius: 11px;
}

.code-block.has-title .code-title {
	padding-right: 56px;
}

.copy-button .icon-check,
.copy-button.is-copied .icon-copy {
	display: none;
}

.copy-button.is-copied .icon-check {
	display: inline;
}

.copy-button.is-copied {
	color: var(--success-icon);
	border-color: var(--success-border);
}

.code-block:hover .copy-button,
.copy-button:focus-visible,
.copy-button.is-copied {
	opacity: 1;
}

@media (hover: none) {
	.copy-button {
		opacity: 1;
	}

	.heading-anchor {
		display: none;
	}

	/* The copy button is always visible on touch screens: give it its own strip. */
	.code-block:not(.has-title) pre {
		padding-top: 46px;
	}
}

.heading-tail {
	white-space: nowrap;
}

.figure-zoom {
	display: inline-block;
	max-width: 100%;
	cursor: zoom-in;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-doctag,
.hljs-template-tag,
.hljs-type {
	color: var(--hl-keyword);
}

.hljs-string,
.hljs-template-string {
	color: var(--hl-string);
}

.hljs-comment,
.hljs-quote {
	color: var(--hl-comment);
	font-style: italic;
}

.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet {
	color: var(--hl-number);
}

.hljs-title,
.hljs-title.function_,
.hljs-section,
.hljs-selector-id,
.hljs-selector-class {
	color: var(--hl-title);
}

.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-selector-attr,
.hljs-selector-pseudo {
	color: var(--hl-attr);
}

.hljs-built_in,
.hljs-title.class_,
.hljs-params {
	color: var(--hl-builtin);
}

.hljs-tag,
.hljs-name {
	color: var(--hl-tag);
}

.hljs-variable,
.hljs-template-variable {
	color: var(--hl-variable);
}

.hljs-meta,
.hljs-meta .hljs-keyword {
	color: var(--hl-meta);
}

.hljs-regexp,
.hljs-link {
	color: var(--hl-regexp);
}

.hljs-addition {
	color: var(--hl-addition);
}

.hljs-deletion {
	color: var(--hl-deletion);
}

.hljs-emphasis {
	font-style: italic;
}

.hljs-strong {
	font-weight: 700;
}

/* Hints */

.hint {
	display: flex;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var(--info-border);
	border-radius: 12px;
	background: var(--info-bg);
}

.hint-icon {
	flex: none;
	display: inline-flex;
	padding-top: 3px;
	color: var(--info-icon);
}

.hint-body {
	flex: 1;
	min-width: 0;
}

.hint-body > :last-child {
	margin-bottom: 0;
}

.hint-body .code-block {
	background: var(--bg);
}

.hint-warning {
	border-color: var(--warning-border);
	background: var(--warning-bg);
}

.hint-warning .hint-icon {
	color: var(--warning-icon);
}

.hint-danger {
	border-color: var(--danger-border);
	background: var(--danger-bg);
}

.hint-danger .hint-icon {
	color: var(--danger-icon);
}

.hint-success {
	border-color: var(--success-border);
	background: var(--success-bg);
}

.hint-success .hint-icon {
	color: var(--success-icon);
}

/* Content refs & embeds */

.content-ref,
.embed-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: 12px;
	color: var(--text);
	text-decoration: none;
	transition: border-color 0.12s ease, background-color 0.12s ease;
}

.content-ref:hover,
.embed-card:hover {
	border-color: var(--primary-border);
	background: var(--bg-subtle);
	color: var(--text);
}

.content-ref-icon,
.embed-card-icon {
	flex: none;
	display: inline-flex;
	color: var(--text-faint);
}

.content-ref-title,
.embed-card-text {
	flex: 1;
	min-width: 0;
	font-weight: 560;
}

.embed-card-text small {
	display: block;
	font-weight: 400;
	font-size: 13px;
	color: var(--text-faint);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.content-ref-arrow {
	color: var(--text-faint);
}

.embed-video {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
}

.embed-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.embed-caption {
	margin: -0.6em 0 1.15em;
	font-size: 13.5px;
	color: var(--text-muted);
}

/* Page footer: prev / next */

.page-meta {
	margin-top: 48px;
	font-size: 13.5px;
	color: var(--text-faint);
}

.pagination {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 20px;
}

.pagination a {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 14px 18px;
	border: 1px solid var(--border);
	border-radius: 12px;
	text-decoration: none;
	color: var(--text);
	transition: border-color 0.12s ease;
}

.pagination a:hover {
	border-color: var(--primary-border);
}

.pagination .next {
	grid-column: 2;
	text-align: right;
}

.pagination small {
	font-size: 13px;
	color: var(--text-faint);
}

.pagination span {
	font-weight: 560;
	color: var(--primary);
}

.site-footer {
	margin-top: 40px;
	padding-top: 20px;
	border-top: 1px solid var(--border);
	font-size: 13px;
	color: var(--text-faint);
}

.site-footer a {
	color: inherit;
}

/* TOC */

.toc {
	overflow-x: hidden;
	position: sticky;
	top: 40px;
	align-self: start;
	max-height: calc(100vh - 80px);
	overflow-y: auto;
	font-size: 13.5px;
}

.toc-title {
	margin: 0 0 10px;
	font-size: 12px;
	font-weight: 650;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-faint);
}

.toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
	border-left: 1px solid var(--border);
}

.toc li {
	margin: 0;
}

.toc a {
	display: block;
	overflow-wrap: anywhere;
	margin-left: -1px;
	padding: 4px 0 4px 14px;
	border-left: 2px solid transparent;
	color: var(--text-muted);
	text-decoration: none;
	line-height: 1.4;
}

.toc a:hover {
	color: var(--text);
}

.toc .toc-h3 a {
	padding-left: 26px;
}

.toc a.is-active {
	color: var(--primary);
	border-left-color: var(--primary);
}

/* Search */

.search-dialog {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 10vh 16px 16px;
	background: var(--overlay);
}

.search-dialog.is-open {
	display: flex;
}

.search-panel {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 640px;
	max-height: 75vh;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--bg);
	box-shadow: var(--shadow);
	overflow: hidden;
}

.search-input-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--border);
	color: var(--text-faint);
}

.search-input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 16px;
}

.search-results {
	list-style: none;
	margin: 0;
	padding: 8px;
	overflow-y: auto;
}

.search-results li a {
	display: block;
	padding: 10px 12px;
	border-radius: 10px;
	color: var(--text);
	text-decoration: none;
}

.search-results li a:hover,
.search-results li.is-selected a {
	background: var(--primary-bg);
}

.search-result-title {
	display: block;
	font-weight: 600;
	font-size: 14.5px;
}

.search-result-path {
	display: block;
	font-size: 12.5px;
	color: var(--text-faint);
}

.search-result-snippet {
	display: block;
	margin-top: 2px;
	font-size: 13.5px;
	color: var(--text-muted);
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.search-results mark {
	background: color-mix(in srgb, var(--primary) 22%, transparent);
	color: inherit;
	border-radius: 3px;
}

.search-empty {
	padding: 24px 16px;
	text-align: center;
	color: var(--text-faint);
	font-size: 14px;
}

/* Error page */

.not-found {
	padding: 80px 0;
}

/* Responsive */

@media (max-width: 1180px) {
	.main {
		grid-template-columns: minmax(0, 1fr);
		padding: 36px 36px 56px 44px;
	}

	.toc {
		display: none;
	}
}

@media (max-width: 900px) {
	.layout {
		display: block;
	}

	.mobile-header {
		position: sticky;
		top: 0;
		z-index: 30;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		height: var(--header-h);
		padding: 0 12px 0 16px;
		border-bottom: 1px solid var(--border);
		background: color-mix(in srgb, var(--bg) 92%, transparent);
		backdrop-filter: blur(8px);
	}

	.mobile-header .actions {
		display: flex;
		gap: 8px;
	}

	html {
		scroll-padding-top: calc(var(--header-h) + 16px);
	}


	.sidebar {
		position: fixed;
		inset: 0 auto 0 0;
		z-index: 50;
		width: min(320px, 86vw);
		height: auto;
		visibility: hidden;
		transform: translateX(-100%);
		transition: transform 0.2s ease, visibility 0s linear 0.2s;
	}

	.nav-open .sidebar {
		visibility: visible;
		transform: none;
		box-shadow: var(--shadow);
		transition: transform 0.2s ease, visibility 0s;
	}

	.nav-backdrop {
		position: fixed;
		inset: 0;
		z-index: 40;
		display: none;
		background: var(--overlay);
	}

	.nav-open .nav-backdrop {
		display: block;
	}

	.nav-open {
		overflow: hidden;
	}

	.main {
		padding: 28px 16px 48px;
	}

	.pagination {
		grid-template-columns: 1fr;
	}

	.pagination .next {
		grid-column: 1;
	}
}

@media (min-width: 901px) {
	.nav-backdrop,
	.sidebar-close {
		display: none;
	}
}

@media print {
	.sidebar,
	.mobile-header,
	.toc,
	.copy-button,
	.pagination,
	.search-dialog {
		display: none !important;
	}

	.layout,
	.main {
		display: block;
		padding: 0;
	}
}

.embed-card-logo {
	width: 20px;
	height: 20px;
	border-radius: 4px;
	object-fit: contain;
}

.content-ref-arrow {
	display: inline-flex;
	flex: none;
}

/* YouTube poster (used when the page is opened from disk, where YouTube refuses to embed) */

.yt-poster {
	position: absolute;
	inset: 0;
	display: block;
}

.yt-poster[hidden] {
	display: none;
}

.yt-poster img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
}

.yt-play {
	white-space: nowrap;
	position: absolute;
	left: 50%;
	top: 50%;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	transform: translate(-50%, -50%);
}

.yt-poster:hover .yt-play {
	background: #e00;
}

/* Transparent diagrams need a light backdrop to stay legible in dark mode */

:root[data-theme="dark"] .article figure img,
:root[data-theme="dark"] .article td img {
	background-color: #fff;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .article figure img,
	:root:not([data-theme="light"]) .article td img {
		background-color: #fff;
	}
}

.search-status {
	margin: 0;
	padding: 0 16px;
	font-size: 13px;
	color: var(--text-faint);
}

.search-status:empty {
	display: none;
}

.search-status:not(:empty) {
	padding: 20px 16px;
	text-align: center;
	font-size: 14px;
}

.search-close {
	display: inline-flex;
	align-items: center;
	padding: 0;
	border: 0;
	background: none;
	color: var(--text-faint);
	cursor: pointer;
}

.search-close-icon {
	display: none;
}

@media (hover: none) {
	.search-close kbd,
	.search-shortcut {
		display: none;
	}

	.search-close-icon {
		display: inline-flex;
		padding: 6px;
	}
}

@media (max-width: 900px) {
	.sidebar-footer {
		padding-bottom: max(16px, env(safe-area-inset-bottom));
	}
}
