/* Color scheme (light/dark mode)
 * Follows the visitor's system setting by default. The toggle in the header
 * sets data-theme="light" or "dark" on <html> to override it (see functions.php).
 * Overriding the palette variables recolours everything that uses them.
 */
:root {
	color-scheme: light;
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--wp--preset--color--primary: #f0703f;
	--wp--preset--color--secondary: #a8a8a8;
	--wp--preset--color--foreground: #ececec;
	--wp--preset--color--background: #161616;
	--wp--preset--color--wrapper: #0c0c0c;
	--wp--preset--color--tertiary: #2c2c2c;
	--wp--custom--form--border--color: #2c2c2c;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--wp--preset--color--primary: #f0703f;
		--wp--preset--color--secondary: #a8a8a8;
		--wp--preset--color--foreground: #ececec;
		--wp--preset--color--background: #161616;
		--wp--preset--color--wrapper: #0c0c0c;
		--wp--preset--color--tertiary: #2c2c2c;
		--wp--custom--form--border--color: #2c2c2c;
	}
}

/* Header: color scheme toggle */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
	line-height: 0;
}

.theme-toggle svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.theme-toggle .theme-toggle__sun {
	display: none;
}

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

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

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

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