/* Theme toggle (light/dark). Loads only on pages that render the button.
   The behaviour lives in assets/js/revsults.js (asset revsults-js), which
   also mirrors the scheme as html.revsults-dark / .revsults-light. */

.revsults-theme-toggle {
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border-radius: var(--wp--custom--radius--pill, 999px);
	border: var(--wp--custom--border--width, 1px) solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--base-2);
	color: var(--wp--preset--color--contrast-2);
	cursor: pointer;
	transition: color var(--wp--custom--transition--fast, 0.15s ease), border-color var(--wp--custom--transition--fast, 0.15s ease), transform var(--wp--custom--transition--fast, 0.15s ease);
}

.revsults-theme-toggle:hover,
.revsults-theme-toggle:focus-visible {
	color: var(--wp--preset--color--secondary, var(--wp--preset--color--primary));
	border-color: var(--wp--preset--color--border-strong, var(--wp--preset--color--border));
	transform: translateY(-1px);
}

.revsults-theme-toggle svg {
	width: 1.25rem;
	height: 1.25rem;
}

.revsults-theme-toggle__moon {
	display: none;
}

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

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

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

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

/* Inside the dark footer the button sits on the dark surface. */
.is-style-section-dark .revsults-theme-toggle {
	background: transparent;
	color: var(--wp--preset--color--contrast-3);
}

/* Inside the overlay menu (primary panel) the button takes the panel's ink. */
.revsults-overlay .revsults-theme-toggle {
	background: transparent;
	border-color: color-mix(in srgb, var(--wp--preset--color--primary-contrast) 15%, transparent);
	color: var(--wp--preset--color--primary-contrast);
}

.revsults-overlay .revsults-theme-toggle:hover,
.revsults-overlay .revsults-theme-toggle:focus-visible {
	color: var(--wp--preset--color--primary-contrast);
	border-color: var(--wp--preset--color--primary-contrast);
}

/* Inside a light island the icons follow the island, not the page. */
.revsults-scheme-light .revsults-theme-toggle__moon {
	display: none;
}

.revsults-scheme-light .revsults-theme-toggle__sun {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.revsults-theme-toggle {
		transition: none;
	}
}
