/* ============================================================================
 * MCOS theme switcher (System / Hell / Dunkel)
 * ----------------------------------------------------------------------------
 * Base + light-mode appearance of the header control rendered by
 * template-parts/theme-switcher.php. The DARK appearance lives in
 * assets/css/dark-mode.css with the rest of the dark layer.
 *
 * Shipped as a standalone file rather than folded into style.scss because ~25
 * page templates dequeue the global stylesheet (front-page.php among them) —
 * the switcher renders in the header of every one of them, and an unstyled
 * three-glyph stack in the header is not an acceptable failure mode. Same
 * reasoning as mobile-shell.css and cart-merge-modal.min.css.
 *
 * Visual language matches the language switcher it sits next to (see the
 * TOGGLE_CSS block in assets/js/i18n/index.js): a borderless 26px circular
 * icon button with a faint hover wash.
 * ========================================================================== */

.theme-switch-wrap {
	display: flex;
	align-items: center;
}

.theme-switch.theme-switch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	width: 34px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #274446;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.theme-switch.theme-switch:hover {
	background: rgba(39, 68, 70, 0.09);
}

.theme-switch.theme-switch:focus-visible {
	outline: 2px solid #274446;
	outline-offset: 2px;
}

.theme-switch.theme-switch:active {
	transform: scale(0.94);
}

.theme-switch__glyph {
	display: none;
	width: 22px;
	height: 22px;
	line-height: 0;
}

.theme-switch__glyph svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Which glyph shows is driven entirely by the attribute the wp_head priority-0
 * bootstrap writes (inc/Theme/init.php), so the control is already correct on
 * the first paint of a shared-cached page. The bare `[data-theme-glyph="system"]`
 * fallback covers the case where the bootstrap never ran (JS disabled): the
 * button then shows the honest "following the system" state. */
.theme-switch__glyph[data-theme-glyph="system"] { display: block; }

html[data-mcos-theme="light"] .theme-switch__glyph,
html[data-mcos-theme="dark"]  .theme-switch__glyph { display: none; }

html[data-mcos-theme="system"] .theme-switch__glyph[data-theme-glyph="system"] { display: block; }
html[data-mcos-theme="light"]  .theme-switch__glyph[data-theme-glyph="light"]  { display: block; }
html[data-mcos-theme="dark"]   .theme-switch__glyph[data-theme-glyph="dark"]   { display: block; }

/* Accessible name for the current value; the button's aria-label carries the
 * current + next pair, this is the plain live value. */
.theme-switch__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 600px) {
	.theme-switch.theme-switch { width: 32px; height: 32px; }
	.theme-switch__glyph { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.theme-switch.theme-switch { transition: none; }
	.theme-switch.theme-switch:active { transform: none; }
}
