:root {
	color-scheme: light dark;
}

:root[data-theme='light'] {
	color-scheme: light;
}

:root[data-theme='dark'] {
	color-scheme: dark;
}

:root[data-theme='sepia'] {
	color-scheme: light;
	--page-background: #f6ecd6;
	--page-color: #493921;
}

body {
	font-family:
		-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	line-height: 1.6;
	color: var(--page-color, CanvasText);
	background: var(--page-background, Canvas);
	max-width: 1400px;
	margin: 0 auto;
	padding: 1rem;
}

h1 {
	font-size: 2rem;
	margin-block: 0 0.5rem;
}

h2 {
	font-size: 1.5rem;
	margin-block: 2rem 1rem;
	border-bottom: 2px solid;
	padding-block-end: 0.5rem;
}

h3,
p {
	margin-block: 0.5rem;
}

header {
	margin-block-end: 2rem;
}

a {
	color: LinkText;
	text-decoration-skip-ink: auto;
}

code {
	background: ButtonFace;
	color: ButtonText;
	padding: 0.125rem 0.25rem;
	border-radius: 3px;
	font-family: ui-monospace, monospace;
	font-size: 0.9em;
}

.demo-section {
	margin-block: 2rem;
	padding: 1.5rem;
	background: ButtonFace;
	border: 1px solid ButtonBorder;
	border-radius: 8px;
}

.code-demo-pair {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
	align-items: start;
	margin-block: 1rem;
}

.code-demo-pair > * {
	min-inline-size: 0;
}

pre {
	background: Field;
	color: FieldText;
	padding: 1rem;
	border-radius: 6px;
	overflow: auto;
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.4;
}

pre code {
	background: none;
	color: inherit;
	padding: 0;
	font-size: inherit;
}

.demo {
	background: Canvas;
	color: CanvasText;
	padding: 1rem;
	border: 1px solid ButtonBorder;
	border-radius: 6px;
}

theme-switcher {
	margin-block: 1rem;
}

button {
	font: inherit;
	min-block-size: 2.75rem;
	padding: 0.35em 0.8em;
	cursor: pointer;
}

output {
	display: block;
	overflow-wrap: anywhere;
}

.pill {
	--multi-switch-radius: 999px;
	--multi-switch-border: #173f63;
	--multi-switch-background: #eef4ff;
	--multi-switch-color: #173f63;
	--multi-switch-selected-background: #173f63;
	--multi-switch-selected-color: #fff;
	--multi-switch-focus-color: #173f63;
}

theme-switcher.hide-legend legend {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.icons [data-multi-switch-choice]::before {
	content: '';
	inline-size: 1.25em;
	block-size: 1.25em;
	flex-shrink: 0;
	background: currentColor;
	mask: var(--theme-icon) center / contain no-repeat;
}

.icons [data-value='system'] {
	--theme-icon: url('./system.svg');
}

.icons [data-value='light'] {
	--theme-icon: url('./light.svg');
}

.icons [data-value='dark'] {
	--theme-icon: url('./dark.svg');
}

@media (forced-colors: active) {
	.icons [data-multi-switch-choice]::before {
		background: ButtonText;
		forced-color-adjust: none;
	}

	.icons [data-selected]::before {
		background: HighlightText;
	}
}

iframe {
	display: block;
	inline-size: 100%;
	min-block-size: 22rem;
	border: 1px solid ButtonBorder;
	box-sizing: border-box;
	background: Canvas;
}

.demo > iframe + button {
	margin-block-start: 1rem;
}

footer {
	margin-block-start: 3rem;
	padding-block-start: 2rem;
	border-top: 2px solid ButtonBorder;
	color: GrayText;
}

@media (min-width: 48rem) {
	.code-demo-pair {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 30rem) {
	body {
		padding: 0.5rem;
	}

	.demo-section {
		padding: 0.75rem;
	}
}
