/* Copyright (c) 2026 Web Upp Limited. Licensed under the GPL-2.0-or-later; see LICENSE. */
/*
 * webupp/scheme-switch (from 3.21.0, R40): the visitor's light and dark
 * switch, an icon button. Loaded only where the block draws (the setting is
 * Device and switch). The sun shows in the dark scheme (switch to light),
 * the moon in the light scheme, chosen from the root attribute, so the icon
 * is right before the switch's script runs. Every rule is at no weight
 * (:where), so a child's own rule on the same class wins.
 */

:where(.wu-scheme) {
	box-sizing: border-box;
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: var(--wu-radius, 10px);
	background: transparent;
	color: var(--wu-muted, currentColor);
	cursor: pointer;
	transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

:where(.wu-scheme):hover {
	border-color: var(--wu-line, currentColor);
	color: var(--wu-text, currentColor);
}

:where(.wu-scheme__icon) {
	display: grid;
	place-items: center;
}

:where(.wu-scheme) svg {
	width: 20px;
	height: 20px;
}

:where(html[data-scheme="light"]) :where(.wu-scheme__icon--sun),
:where(html:not([data-scheme="light"])) :where(.wu-scheme__icon--moon) {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	:where(.wu-scheme) {
		transition: none;
	}
}
