/* The handbook at /handbook. Built by apps/web/vite.handbook.ts. */
@font-face {
	font-family: 'Inter';
	src: url('/handbook/assets/inter.woff2') format('woff2');
	font-weight: 100 900;
	font-display: swap;
}

/* Colors match the app's chrome tokens (Figma "theme" collection). */
:root {
	color-scheme: light dark;
	--bg: #fcfcfd;
	--fg: #1f1f1f;
	--muted: #808081;
	--faint: #f2f2f2;
	--hover: #e9e9e9;
	--rule: #e4e4ea;
	--accent: #3182ed;
	--current: #2855e5;
	--figure: #f7f7f7;
}
/* Dark follows the system unless the masthead toggle chose a theme (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--bg: #0c0c0d;
		--fg: #f1f1f1;
		--muted: #7a8185;
		--faint: #18181a;
		--hover: #1f1f22;
		--rule: #24242a;
		--accent: #4387f4;
		--current: #4387f4;
		--figure: #141415;
	}
}
:root[data-theme='dark'] {
	color-scheme: dark;
	--bg: #0c0c0d;
	--fg: #f1f1f1;
	--muted: #7a8185;
	--faint: #18181a;
	--hover: #1f1f22;
	--rule: #24242a;
	--accent: #4387f4;
	--current: #4387f4;
	--figure: #141415;
}
:root[data-theme='light'] {
	color-scheme: light;
}

/* Each page is its own document. A same-origin view transition keeps the
   masthead and sidebar in place across a click instead of repainting them. */
@view-transition {
	navigation: auto;
}
.hb-masthead {
	view-transition-name: hb-masthead;
}
.hb-nav {
	view-transition-name: hb-nav;
}
::view-transition-group(root) {
	animation-duration: 120ms;
}
@media (prefers-reduced-motion: reduce) {
	@view-transition {
		navigation: none;
	}
}

* {
	box-sizing: border-box;
}
html {
	-webkit-text-size-adjust: 100%;
	background: var(--bg);
}
/* No rubber-band bounce: the page stops at its edges, and the fixed masthead never moves. */
html,
body {
	overscroll-behavior: none;
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font:
		16px/1.6 'Inter',
		-apple-system,
		BlinkMacSystemFont,
		'Segoe UI',
		system-ui,
		sans-serif;
	font-feature-settings: 'cv11', 'ss01';
}
a {
	color: var(--accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.hb-skip {
	position: absolute;
	left: -9999px;
}
.hb-skip:focus {
	position: fixed;
	left: 16px;
	top: 12px;
	z-index: 2;
	background: var(--bg);
	padding: 4px 8px;
}

.hb-masthead {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 12px;
	height: 56px;
	padding: 0 max(16px, env(safe-area-inset-left));
	background: color-mix(in srgb, var(--bg) 92%, transparent);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--rule);
	font-size: 14px;
	line-height: 22.4px;
}
.hb-wordmark {
	display: block;
	/* The lockup sits 2px above centre, as in the design. */
	padding-bottom: 4px;
}
/* The lockup is a mask filled with the text color, so it follows the chosen theme. */
.hb-wordmark span {
	display: block;
	width: 126px;
	height: 20.4px;
	background: var(--fg);
	mask: url('/handbook/assets/logo.svg') center / contain no-repeat;
}
@media (forced-colors: active) {
	.hb-wordmark span {
		background: CanvasText;
	}
}
.hb-section::before {
	content: '/';
	margin-right: 12px;
}
.hb-section a {
	color: var(--fg);
	text-decoration: none;
}
.hb-open {
	margin-left: auto;
	color: var(--accent);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	text-decoration: none;
}
.hb-open:hover {
	text-decoration: underline;
}
.hb-theme {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	margin-right: -8px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	color: var(--fg);
	cursor: pointer;
}
.hb-theme:hover {
	background: var(--hover);
}
.hb-theme:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}
/* The button shows the theme it switches to: a moon in light, a sun in dark. */
.hb-theme .hb-sun {
	display: none;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) .hb-theme .hb-sun {
		display: block;
	}
	:root:not([data-theme='light']) .hb-theme .hb-moon {
		display: none;
	}
}
:root[data-theme='dark'] .hb-theme .hb-sun {
	display: block;
}
:root[data-theme='dark'] .hb-theme .hb-moon {
	display: none;
}

.hb-layout {
	display: grid;
	grid-template-columns: 268px minmax(0, 1fr);
	max-width: 1120px;
	margin: 0 auto;
	gap: 46px;
	/* Clears the fixed masthead. */
	padding: 56px 24px 0 14px;
}
.hb-nav {
	position: sticky;
	top: 56px;
	align-self: start;
	max-height: calc(100vh - 56px);
	overflow-y: auto;
	padding: 32px 0 48px;
	font-size: 14px;
}
.hb-nav ul {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
}
.hb-nav li + li {
	margin-top: 0;
}
.hb-nav a {
	position: relative;
	isolation: isolate;
	display: block;
	padding: 2px 10px 2px 20px;
	line-height: 32px;
	border-radius: 6px;
	color: var(--fg);
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
/* Hover fill, inset 2px inside the 36px row. */
.hb-nav a::before {
	content: '';
	position: absolute;
	inset: 2px;
	z-index: -1;
	border-radius: 6px;
}
.hb-nav a:hover::before {
	background: var(--hover);
}
/* The current page is marked with a dot in the left gutter. */
.hb-nav a.hb-current::after {
	content: '';
	position: absolute;
	left: 8px;
	top: 15px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--current);
}
.hb-nav-home {
	margin-bottom: 16px;
}
.hb-nav-chapter {
	display: flex;
	align-items: flex-end;
	height: 36px;
	margin: 0 0 4px;
	padding: 0 20px 4px;
	font-size: 12px;
	font-weight: 600;
	line-height: 19px;
	letter-spacing: 0.02em;
	color: var(--muted);
}

.hb-main {
	max-width: 720px;
	padding: 40px 0 96px;
	min-width: 0;
}
.hb-chapter {
	margin: 0;
	font-size: 13px;
	line-height: 20.8px;
	color: var(--muted);
}
h1 {
	font-size: 36px;
	line-height: 44px;
	letter-spacing: -0.02em;
	font-weight: 600;
	margin: 6px 0 12px;
}
h2 {
	font-size: 22px;
	line-height: 1.3;
	letter-spacing: -0.01em;
	font-weight: 600;
	margin: 48px 0 8px;
	scroll-margin-top: 72px;
}
h3 {
	font-size: 17px;
	font-weight: 600;
	margin: 32px 0 4px;
	scroll-margin-top: 72px;
}
.hb-lead {
	font-size: 19px;
	line-height: 1.5;
	margin: 0 0 16px;
}
.hb-platforms {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 32px;
}
.hb-platforms span {
	font-size: 12px;
	color: var(--muted);
	border: 1px solid var(--rule);
	border-radius: 999px;
	padding: 1px 9px;
}

p,
ul,
ol {
	margin: 12px 0;
}
li + li {
	margin-top: 4px;
}
strong {
	font-weight: 600;
}
kbd {
	font:
		500 13px/1 'Inter',
		system-ui,
		sans-serif;
	border: 1px solid var(--rule);
	border-bottom-width: 2px;
	border-radius: 5px;
	padding: 2px 6px;
	background: var(--faint);
}
code {
	font-size: 0.9em;
	background: var(--faint);
	border-radius: 4px;
	padding: 1px 4px;
}

figure {
	margin: 28px 0;
}
figure img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	border: 1px solid var(--rule);
	background: var(--figure);
}
figcaption {
	margin-top: 8px;
	font-size: 14px;
	color: var(--muted);
}

table {
	width: 100%;
	border-collapse: collapse;
	margin: 20px 0;
	font-size: 15px;
}
th,
td {
	text-align: left;
	vertical-align: top;
	padding: 9px 12px 9px 0;
	border-bottom: 1px solid var(--rule);
}
th {
	font-size: 13px;
	font-weight: 600;
	color: var(--muted);
}

blockquote {
	margin: 24px 0;
	padding: 12px 16px;
	border-radius: 10px;
	background: var(--faint);
}
blockquote p {
	margin: 4px 0;
}

.hb-pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 64px;
	padding-top: 24px;
	border-top: 1px solid var(--rule);
}
.hb-pager a {
	display: block;
	color: var(--fg);
	text-decoration: none;
	border-radius: 10px;
	padding: 12px 16px;
	font-weight: 500;
}
.hb-pager a:hover {
	background: var(--faint);
}
.hb-pager a span {
	display: block;
	font-size: 12px;
	line-height: 19px;
	font-weight: 400;
	color: var(--muted);
}
.hb-next {
	text-align: right;
}

.hb-index-chapter {
	margin-top: 40px;
}
.hb-index-chapter h2 {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin: 0 0 8px;
}
.hb-index-number {
	font-size: 14px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.hb-index-chapter ul {
	list-style: none;
	padding: 0;
	margin: 0;
	border-top: 1px solid var(--rule);
}
.hb-index-chapter li {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 16px;
	margin: 0;
	padding: 10px 0;
	border-bottom: 1px solid var(--rule);
}
.hb-index-chapter li a {
	font-weight: 500;
	text-decoration: none;
	color: var(--fg);
}
.hb-index-chapter li span {
	color: var(--muted);
	font-size: 15px;
}

.hb-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
	max-width: 1120px;
	margin: 0 auto;
	padding: 24px 24px max(32px, env(safe-area-inset-bottom)) 34px;
	border-top: 1px solid var(--rule);
	font-size: 13px;
	line-height: 20px;
	color: var(--muted);
}
.hb-footer a {
	color: var(--muted);
	text-decoration: none;
}
.hb-footer a:hover {
	color: var(--fg);
}
.hb-footer span {
	margin-right: auto;
}

@media (max-width: 860px) {
	.hb-layout {
		display: flex;
		flex-direction: column-reverse;
		gap: 0;
		padding: 56px 16px 0;
	}
	.hb-nav {
		position: static;
		align-self: stretch;
		max-height: none;
		/* Let the 20px link gutter use the page gutter so labels line up with the text above. */
		margin: 0 -16px;
		border-top: 1px solid var(--rule);
	}
	.hb-main {
		padding-top: 28px;
	}
	h1 {
		font-size: 30px;
		line-height: 1.2;
	}
	/* Wide tables scroll sideways on phones; on desktop they span the column. */
	.hb-main > table {
		display: block;
		overflow-x: auto;
	}
	.hb-index-chapter li {
		grid-template-columns: 1fr;
		gap: 2px;
	}
	.hb-section {
		display: none;
	}
	.hb-footer {
		padding-left: 16px;
		padding-right: 16px;
	}
	.hb-footer span {
		flex-basis: 100%;
	}
}
