@font-face {
	font-family: 'Inter';
	src: url('/fonts/Inter-Light.woff2') format('woff2');
	font-weight: 300;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: 'Inter';
	src: url('/fonts/Inter-Regular.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: 'Inter';
	src: url('/fonts/Inter-SemiBold.woff2') format('woff2');
	font-weight: 600;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: 'Inter';
	src: url('/fonts/Inter-Bold.woff2') format('woff2');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

:root {
	--font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, 'Segoe UI', Inter, Roboto, sans-serif;
	--font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Inter, Roboto, sans-serif;
	--font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;

	--r-xs: 6px;
	--r-sm: 9px;
	--r-md: 12px;
	--r-lg: 16px;
	--r-xl: 20px;
	--r-pill: 999px;

	--sp-1: 4px;
	--sp-2: 8px;
	--sp-3: 12px;
	--sp-4: 16px;
	--sp-5: 20px;
	--sp-6: 24px;
	--sp-8: 32px;
	--sp-10: 40px;

	--topbar-h: 64px;
	--sidebar-w: 296px;
	--prose-max: 74ch;

	--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
	--dur-1: 120ms;
	--dur-2: 180ms;
	--dur-3: 240ms;

	--bg: #0b0b0d;
	--bg-tint: none;
	--surface: #1c1c1e;
	--surface-2: #232325;
	--surface-3: #2c2c2e;
	--surface-inset: #141416;
	--surface-glass: rgba(28, 28, 30, 0.72);

	--border: rgba(255, 255, 255, 0.09);
	--border-strong: rgba(255, 255, 255, 0.16);
	--border-subtle: rgba(255, 255, 255, 0.06);

	--text: #f5f5f7;
	--text-muted: #98989d;
	--text-subtle: #949499;
	--text-on-accent: #ffffff;

	--accent: #0a84ff;
	--accent-strong: #409cff;
	--accent-quiet: #0071e3;
	--accent-fill: #0073e1;
	--accent-fill-deep: #005fc0;
	--accent-soft: rgba(10, 132, 255, 0.16);
	--accent-border: rgba(10, 132, 255, 0.4);

	--coral: #ff453a;
	--coral-soft: rgba(255, 69, 58, 0.14);
	--coral-border: rgba(255, 69, 58, 0.38);

	--success: #30d158;
	--info: #64d2ff;

	--focus-ring: 0 0 0 3px rgba(10, 132, 255, 0.35);
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
	--shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
	--shadow-lg: 0 26px 64px rgba(0, 0, 0, 0.55), 0 8px 22px rgba(0, 0, 0, 0.35);
	--glow-accent: 0 0 0 1px var(--accent-border), 0 14px 38px rgba(10, 132, 255, 0.22);

	color-scheme: dark;
}

:root[data-theme="light"] {
	--bg: #f2f2f7;
	--bg-tint: none;
	--surface: #ffffff;
	--surface-2: #ffffff;
	--surface-3: #f2f2f7;
	--surface-inset: #e9e9ee;
	--surface-glass: rgba(255, 255, 255, 0.78);

	--border: #e5e5ea;
	--border-strong: #d1d1d6;
	--border-subtle: #ececf1;

	--text: #1c1c1e;
	--text-muted: #6e6e73;
	--text-subtle: #67676b;
	--text-on-accent: #ffffff;

	--accent: #0069db;
	--accent-strong: #0058b7;
	--accent-quiet: #0069db;
	--accent-fill: #0069db;
	--accent-fill-deep: #0058b7;
	--accent-soft: rgba(0, 122, 255, 0.12);
	--accent-border: rgba(0, 122, 255, 0.34);

	--coral: #ff3b30;
	--coral-soft: rgba(255, 59, 48, 0.1);
	--coral-border: rgba(255, 59, 48, 0.3);

	--success: #34c759;
	--info: #32ade6;

	--focus-ring: 0 0 0 3px rgba(0, 122, 255, 0.26);
	--shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.06);
	--shadow-md: 0 10px 28px rgba(20, 20, 30, 0.08);
	--shadow-lg: 0 26px 60px rgba(20, 20, 30, 0.13);
	--glow-accent: 0 0 0 1px var(--accent-border), 0 14px 34px rgba(0, 122, 255, 0.16);

	color-scheme: light;
}

* {
	box-sizing: border-box;
}

::selection {
	background: color-mix(in srgb, var(--accent-quiet) 70%, black);
	color: #fff;
}

::-moz-selection {
	background: color-mix(in srgb, var(--accent-quiet) 70%, black);
	color: #fff;
}

html, body {
	margin: 0;
	min-height: 100%;
}

body {
	background: var(--bg);
	background-image: var(--bg-tint);
	background-attachment: fixed;
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	font-optical-sizing: auto;
}

body.modal-open {
	overflow: hidden;
}

a {
	color: var(--accent);
	text-decoration: none;
	transition: color var(--dur-2) var(--ease-out);
}

a:hover {
	color: var(--accent-strong);
	text-decoration: underline;
	text-underline-offset: 2px;
}

:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
	border-radius: var(--r-xs);
}

/* ---- Topbar ----------------------------------------------------------- */
.docs-topbar {
	position: sticky;
	top: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-4);
	height: var(--topbar-h);
	padding: 0 var(--sp-6);
	background: var(--surface-glass);
	backdrop-filter: blur(20px) saturate(160%);
	-webkit-backdrop-filter: blur(20px) saturate(160%);
	border-bottom: 1px solid var(--border-subtle);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="light"] .docs-topbar {
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.docs-topbar__left {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	min-width: 0;
}

.docs-topbar__right {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
}

.page-title {
	font-family: var(--font-display);
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text);
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 1px solid var(--border-strong);
	border-radius: var(--r-md);
	background: var(--surface-2);
	color: var(--text);
	cursor: pointer;
	transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}

.icon-btn:hover {
	border-color: var(--accent-border);
	color: var(--accent);
}

.icon-btn:active {
	transform: scale(0.92);
	transition-duration: 60ms;
}

.icon-btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.theme-toggle .sun {
	display: none;
}

.theme-toggle[aria-pressed="false"] .moon {
	display: none;
}

.theme-toggle[aria-pressed="false"] .sun {
	display: block;
}

.account-link {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	height: 42px;
	padding: 0 var(--sp-4);
	border: 1px solid var(--border-strong);
	border-radius: var(--r-pill);
	background: var(--surface-2);
	color: var(--text);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	transition: border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}

.account-link:hover {
	border-color: var(--accent-border);
	color: var(--accent);
	text-decoration: none;
}

.account-link:active {
	transform: scale(0.96);
	transition-duration: 60ms;
}

.account-link svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---- Shell layout ----------------------------------------------------- */
.layout {
	display: grid;
	grid-template-columns: var(--sidebar-w) 1fr;
	align-items: start;
	max-width: 1320px;
	margin: 0 auto;
	padding: var(--sp-6);
	gap: var(--sp-8);
}

.sidebar {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
	padding: var(--sp-4);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--r-xl);
	box-shadow: var(--shadow-sm);
}

.toc-title {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--text-subtle);
	padding: var(--sp-1) var(--sp-2);
}

.toc {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.toc-item {
	position: relative;
	display: block;
	width: 100%;
	background: transparent;
	border: 0;
	padding: 10px var(--sp-3);
	border-radius: var(--r-md);
	text-align: left;
	cursor: pointer;
	font-family: var(--font-sans);
	font-size: 14px;
	font-weight: 600;
	color: var(--text);
	transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}

.toc-item:hover {
	background: var(--surface-3);
}

.toc-item:active {
	transform: scale(0.98);
	transition-duration: 60ms;
}

.toc-item.active {
	background: var(--accent-soft);
	color: var(--accent);
}

.toc-item.active::before {
	content: "";
	position: absolute;
	left: 4px;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 18px;
	border-radius: var(--r-pill);
	background: var(--accent);
}

.toc-item.sub-item {
	padding: 8px var(--sp-3) 8px var(--sp-6);
	font-size: 13.5px;
	font-weight: 500;
	color: var(--text-muted);
}

.toc-item.sub-item:hover {
	background: var(--surface-3);
	color: var(--text);
}

.toc-item.sub-item.active {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}

/* ---- Main / sections -------------------------------------------------- */
.main {
	min-width: 0;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--r-xl);
	box-shadow: var(--shadow-md);
	overflow: hidden;
}

.section {
	display: none;
}

.section.active {
	display: block;
	padding: var(--sp-8) var(--sp-10);
	max-width: none;
	will-change: transform, opacity;
}

.welcome-message {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
	font-size: 16px;
	color: var(--text-muted);
	text-align: center;
}

.section h2 {
	font-family: var(--font-display);
	font-size: clamp(24px, 1.6vw + 20px, 28px);
	font-weight: 700;
	letter-spacing: -0.022em;
	line-height: 1.14;
	color: var(--text);
	margin: 0 0 var(--sp-5) 0;
	max-width: var(--prose-max);
	font-optical-sizing: auto;
}

.section h3 {
	font-family: var(--font-display);
	font-size: 19px;
	font-weight: 600;
	letter-spacing: -0.012em;
	line-height: 1.3;
	color: var(--text);
	border-left: 3px solid var(--accent);
	padding-left: var(--sp-3);
	margin: var(--sp-8) 0 var(--sp-4);
	max-width: var(--prose-max);
	font-optical-sizing: auto;
}

.section h3:first-of-type {
	margin-top: 0;
}

.section p,
.section li {
	font-size: 15px;
	line-height: 1.7;
	color: var(--text-muted);
	margin: 0 0 var(--sp-2) 0;
	max-width: var(--prose-max);
}

.section p strong,
.section li strong {
	color: var(--text);
	font-weight: 600;
}

.section ul,
.section ol {
	margin: var(--sp-3) 0 var(--sp-4) 0;
	padding-left: var(--sp-6);
	max-width: var(--prose-max);
}

.section li {
	margin-bottom: var(--sp-2);
}

.section ul li {
	list-style-type: disc;
}

.section ol li::marker {
	color: var(--accent);
	font-weight: 600;
}

.section ul li::marker {
	color: var(--accent);
}

.kbd {
	font-family: var(--font-mono);
	font-size: 0.9em;
	background: var(--surface-inset);
	color: var(--text);
	border: 1px solid var(--border);
	padding: 2px 7px;
	border-radius: var(--r-xs);
	overflow-wrap: break-word;
}

/* ---- Figures ---------------------------------------------------------- */
figure {
	margin: var(--sp-5) 0;
}

.img {
	width: 100%;
	border-radius: var(--r-lg);
	border: 1px solid var(--border);
	box-shadow: var(--shadow-sm);
	display: block;
	cursor: zoom-in;
	transition: transform 120ms var(--ease-out);
}

.img:active {
	transform: scale(0.985);
	transition-duration: 60ms;
}

.caption,
figcaption {
	font-size: 12.5px;
	color: var(--text-subtle);
	margin-top: var(--sp-2);
	text-align: center;
}

/* Small text reads better with a touch of positive tracking; large display
   text (h2/h3 above) wants the opposite — negative tracking as it grows. */
.caption,
figcaption,
.footnote,
.kbd,
.toc-item.sub-item,
.support-note {
	letter-spacing: 0.01em;
}

/* ---- Notes / callouts ------------------------------------------------- */
.note,
.warn,
.callout,
.support-note {
	max-width: var(--prose-max);
}

.note {
	background: var(--accent-soft);
	border: 1px solid var(--accent-border);
	border-left: 3px solid var(--accent);
	padding: var(--sp-3) var(--sp-4);
	border-radius: var(--r-md);
	margin: var(--sp-4) 0;
	color: var(--text);
	font-size: 14px;
	line-height: 1.6;
}

.warn {
	background: var(--coral-soft);
	border: 1px solid var(--coral-border);
	border-left: 3px solid var(--coral);
	padding: var(--sp-3) var(--sp-4);
	border-radius: var(--r-md);
	margin: var(--sp-4) 0;
	color: var(--text);
	font-size: 14px;
	line-height: 1.6;
}

.callout {
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-left: 3px solid var(--accent);
	border-radius: var(--r-lg);
	padding: var(--sp-5);
	margin: var(--sp-5) 0;
	color: var(--text-muted);
}

.callout-install {
	background: var(--surface-2);
	border-left-color: var(--accent);
}

.callout-header {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	margin-bottom: var(--sp-3);
}

.callout-header h4 {
	margin: 0;
	font-family: var(--font-display);
	font-size: 16px;
	font-weight: 600;
	color: var(--text);
}

.callout-icon {
	flex: 0 0 18px;
	color: var(--accent);
}

.callout ol,
.callout ul {
	margin: var(--sp-2) 0 0 0;
	padding-left: var(--sp-5);
}

.callout p,
.callout li {
	color: var(--text-muted);
}

.support-note {
	margin-top: var(--sp-5);
	padding: var(--sp-4);
	border-radius: var(--r-md);
	border: 1px solid var(--border);
	border-left: 3px solid var(--text-subtle);
	background: var(--surface-2);
	color: var(--text-muted);
	font-size: 14px;
}

/* ---- Status indicators ------------------------------------------------ */
.status-list {
	list-style: none;
	padding-left: 0;
	margin-left: 0;
}

.status-list li {
	display: flex;
	align-items: flex-start;
	list-style: none;
}

.status-indicator {
	width: 13px;
	height: 13px;
	border-radius: 50%;
	display: inline-block;
	margin-right: var(--sp-2);
	margin-top: 6px;
	flex-shrink: 0;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.status-indicator.red { background-color: var(--coral); }
.status-indicator.blue { background-color: var(--accent); }
.status-indicator.orange { background-color: #ff9f0a; }
.status-indicator.green { background-color: var(--success); }
.status-indicator.gray { background-color: var(--text-subtle); }

/* ---- Footnotes -------------------------------------------------------- */
.footnote {
	font-size: 13px;
	color: var(--text-subtle);
	padding-left: var(--sp-3);
	margin-top: var(--sp-4);
	display: none;
	max-width: var(--prose-max);
}

.footnote.active {
	display: block;
}

#meta-footnote {
	max-width: 1320px;
	margin: 0 auto var(--sp-6);
	padding: 0 var(--sp-6);
}

/* ---- Section navigation ----------------------------------------------- */
.section-nav {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--sp-8);
	padding-top: var(--sp-5);
	border-top: 1px solid var(--border);
}

.next-section-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	background: linear-gradient(150deg, var(--accent-fill), var(--accent-fill-deep));
	color: var(--text-on-accent);
	border: none;
	border-radius: var(--r-md);
	padding: 11px var(--sp-5);
	font-family: var(--font-sans);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), filter var(--dur-2) var(--ease-out);
	box-shadow: var(--glow-accent);
}

.next-section-btn:hover {
	transform: translateY(-1px);
	filter: brightness(1.05);
}

.next-section-btn:active {
	transform: translateY(0) scale(0.97);
	transition-duration: 60ms;
}

/* ---- Hamburger / mobile drawer ---------------------------------------- */
.hamburger {
	display: none;
	width: 42px;
	height: 42px;
	padding: 0;
	place-items: center;
	border-radius: var(--r-md);
	background: var(--surface-2);
	border: 1px solid var(--border-strong);
	color: var(--text);
	cursor: pointer;
	transition: border-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}

.hamburger:hover {
	border-color: var(--accent-border);
}

.hamburger:active {
	transform: scale(0.92);
	transition-duration: 60ms;
}

.hamburger svg rect {
	fill: currentColor;
}

.sidebar-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 55;
}

/* ---- Image lightbox --------------------------------------------------- */
.modal {
	display: none;
	position: fixed;
	z-index: 1200;
	inset: 0;
	overflow: auto;
	background-color: rgb(0 0 0 / calc(0.86 * var(--modal-dim, 1)));
	backdrop-filter: blur(calc(6px * var(--modal-dim, 1)));
	-webkit-backdrop-filter: blur(calc(6px * var(--modal-dim, 1)));
}

.modal-content {
	display: block;
	margin: auto;
	max-width: 92%;
	max-height: 84%;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	border-radius: var(--r-lg);
	box-shadow: var(--shadow-lg);
	touch-action: none;
	cursor: grab;
	will-change: transform, opacity;
}

.modal-content:active {
	cursor: grabbing;
}

.close {
	background: none;
	border: 0;
	padding: 0;
	font-family: inherit;
	position: absolute;
	top: var(--sp-5);
	right: var(--sp-8);
	color: #f5f5f7;
	font-size: 40px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: color var(--dur-2) var(--ease-out);
}

.close:hover,
.close:focus {
	color: var(--accent);
}

#caption {
	display: none;
}

/* ---- Reduced motion / transparency / contrast -------------------------- */
@media (prefers-reduced-motion: reduce) {
	* {
		scroll-behavior: auto !important;
	}
	.icon-btn,
	.account-link,
	.toc-item,
	.hamburger,
	.next-section-btn,
	.img {
		transition-duration: 60ms !important;
	}
	.icon-btn:active,
	.account-link:active,
	.toc-item:active,
	.hamburger:active,
	.next-section-btn:active,
	.img:active {
		transform: none !important;
	}
}

@media (prefers-reduced-transparency: reduce) {
	.docs-topbar {
		background: var(--surface);
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
	.modal {
		background-color: rgb(0 0 0 / 0.94);
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
}

@media (prefers-reduced-transparency: reduce) and (max-width: 980px) {
	.sidebar {
		background: var(--surface);
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
}

@media (prefers-contrast: more) {
	.card,
	.sidebar,
	.docs-topbar,
	.icon-btn,
	.account-link,
	.hamburger {
		border-color: var(--text-subtle);
	}
	.note,
	.warn {
		border-width: 2px;
	}
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 1100px) {
	.layout {
		gap: var(--sp-6);
	}
}

@media (max-width: 980px) {
	.docs-topbar {
		padding-inline: var(--sp-4);
	}
	.layout {
		grid-template-columns: 1fr;
		padding: var(--sp-5) var(--sp-4) var(--sp-8);
	}
	.hamburger {
		display: inline-grid;
	}
	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		width: min(86vw, 320px);
		height: 100%;
		max-height: none;
		border-radius: 0;
		border: none;
		border-right: 1px solid var(--border);
		transform: translateX(-100%);
		z-index: 70;
		padding-top: var(--sp-5);
		background: var(--surface-glass);
		backdrop-filter: blur(24px) saturate(160%);
		-webkit-backdrop-filter: blur(24px) saturate(160%);
		touch-action: pan-y;
		will-change: transform;
	}
	/* .open is the JS-driven resting state; the transform itself is set
	   inline by the spring engine in script.js so it can be interrupted
	   and dragged at any point. This class is the no-JS/reduced-motion
	   fallback and the source of truth for aria/visibility. */
	.sidebar.open {
		transform: translateX(0);
		box-shadow: var(--shadow-lg);
	}
	.sidebar-backdrop.open {
		display: block;
	}
	body.nav-lock {
		overflow: hidden;
	}
	#meta-footnote {
		padding-inline: var(--sp-4);
	}
}

@media (max-width: 600px) {
	.account-link span {
		display: none;
	}
	.account-link {
		padding-inline: 0;
		width: 42px;
		justify-content: center;
	}
}

@media (max-width: 480px) {
	.section.active {
		padding: var(--sp-5) var(--sp-4);
	}
	.callout {
		padding: var(--sp-4);
	}
	.callout-header h4 {
		font-size: 15px;
	}
	.section h2 {
		font-size: 23px;
	}
}

.docs-legal {
	margin-top: var(--sp-10);
	padding-top: var(--sp-5);
	border-top: 1px solid var(--border, rgba(127, 127, 127, 0.2));
	font-size: 13px;
	line-height: 1.5;
	color: var(--text-muted);
}
