/* Flat and square, per DESIGN.md: hairline rules, no radius, no shadow, inherits the header font. */
.mkm-switcher {
	--mkm-ink: #111;
	--mkm-muted: #4c4e51;
	--mkm-rule: #e8e8e8;
	--mkm-hover: #f0eee9;
	--mkm-ease: cubic-bezier(.19, 1, .22, 1);
	--mkm-label-max: 9em;
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	max-width: 100%;
	font: inherit;
	color: inherit;
}
.mkm-switcher__flag {
	width: 18px;
	height: auto;
	aspect-ratio: 18 / 13;
	flex: none;
	object-fit: cover;
	outline: 1px solid rgba(0, 0, 0, .08);
	outline-offset: -1px;
}

/* Toggle. Every state is restated so theme button styles (WoodMart fills buttons on hover) can't leak in. */
.mkm-switcher .mkm-switcher__toggle,
.mkm-switcher .mkm-switcher__toggle:hover,
.mkm-switcher .mkm-switcher__toggle:focus,
.mkm-switcher .mkm-switcher__toggle:active {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-width: 0;
	max-width: 100%;
	min-height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: .02em;
	white-space: nowrap;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
}
/* Clipped at --mkm-label-max with a fade instead of an ellipsis. The mask is measured from the left edge, so a label
   narrower than the max never reaches the fade. ponytail: a name within ~1.25em of the max fades its last letter
   slightly; switch to a JS overflow class if that ever shows. */
.mkm-switcher__label {
	min-width: 0;
	max-width: var(--mkm-label-max);
	overflow: hidden;
	white-space: nowrap;
	line-height: 1.3; /* room for descenders inside the clip box */
	-webkit-mask-image: linear-gradient(90deg, #000 calc(var(--mkm-label-max) - 1.25em), transparent var(--mkm-label-max));
	mask-image: linear-gradient(90deg, #000 calc(var(--mkm-label-max) - 1.25em), transparent var(--mkm-label-max));
}
.mkm-switcher__currency {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	opacity: .55;
	transition: opacity .3s var(--mkm-ease);
}
.mkm-switcher__currency::before {
	content: "";
	width: 1px;
	height: 12px;
	background: currentColor;
	opacity: .5;
}
.mkm-switcher__caret {
	flex: none;
	opacity: .7;
	transition: transform .3s var(--mkm-ease), opacity .3s var(--mkm-ease);
}
.mkm-switcher__toggle:hover .mkm-switcher__currency,
.mkm-switcher__toggle[aria-expanded="true"] .mkm-switcher__currency {
	opacity: .8;
}
.mkm-switcher__toggle:hover .mkm-switcher__caret,
.mkm-switcher__toggle[aria-expanded="true"] .mkm-switcher__caret {
	opacity: 1;
}
.mkm-switcher__toggle[aria-expanded="true"] .mkm-switcher__caret {
	transform: rotate(180deg);
}
.mkm-switcher .mkm-switcher__toggle:focus-visible,
.mkm-switcher__select:focus-visible,
.mkm-switcher__list a:focus-visible {
	outline: 1px solid currentColor;
	outline-offset: 2px;
}

/* Panel. Shown in the top layer (popover) so a header row's overflow:hidden or z-index can't clip it; position:fixed
   is the fallback. switcher.js sets left/top/bottom and max-height in viewport coordinates. ponytail: without popover
   support (Safari < 17) a transformed ancestor would still capture the fixed panel. */
.mkm-switcher__panel {
	position: fixed;
	inset: auto;
	z-index: 100000;
	margin: 0;
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	width: var(--mkm-panel-w, 300px);
	max-width: calc(100vw - 16px);
	max-height: min(70vh, 460px);
	background: #fff;
	color: var(--mkm-ink);
	border: 1px solid rgba(0, 0, 0, .1);
	text-align: left;
	transition: opacity .25s var(--mkm-ease), transform .35s var(--mkm-ease);
}
@starting-style {
	.mkm-switcher__panel {
		opacity: 0;
		transform: translateY(-6px);
	}
}
.mkm-switcher__panel[hidden] {
	display: none;
}
.mkm-switcher__heading {
	margin: 0;
	padding: 16px 16px 4px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--mkm-muted);
}
.mkm-switcher__search {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 16px 6px;
	border-bottom: 1px solid var(--mkm-rule);
	color: var(--mkm-muted);
	transition: border-color .3s var(--mkm-ease);
}
.mkm-switcher__search:focus-within {
	border-color: var(--mkm-ink);
}
.mkm-switcher__search svg {
	flex: none;
}
.mkm-switcher .mkm-switcher__search input {
	flex: 1;
	min-width: 0;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	outline: 0;
	color: var(--mkm-ink);
	font: inherit;
	font-size: 14px;
}
.mkm-switcher__search input::placeholder {
	color: var(--mkm-muted);
	opacity: 1;
}
.mkm-switcher__search input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}
.mkm-switcher__list {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	margin: 0;
	padding: 4px 0 8px;
	list-style: none;
	scrollbar-width: thin;
	scrollbar-color: rgba(0, 0, 0, .18) transparent;
}
/* Chromium/Safari before scrollbar-color: a 2px bar inside a 6px gutter. */
.mkm-switcher__list::-webkit-scrollbar {
	width: 6px;
}
.mkm-switcher__list::-webkit-scrollbar-track {
	background: transparent;
}
.mkm-switcher__list::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, .18) content-box;
	border: 2px solid transparent;
}
.mkm-switcher__list::-webkit-scrollbar-thumb:hover {
	background-color: rgba(0, 0, 0, .35);
}
.mkm-switcher__list li {
	margin: 0;
}
.mkm-switcher__list li[hidden] {
	display: none;
}
.mkm-switcher__list a {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 38px;
	padding: 0 16px;
	color: inherit;
	font-size: 14px;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color .15s;
}
.mkm-switcher__list a:hover,
.mkm-switcher__list a:focus {
	background: var(--mkm-hover);
	color: inherit;
}
.mkm-switcher__list a:focus-visible {
	outline-offset: -1px;
}
.mkm-switcher__name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mkm-switcher__list a[aria-current] {
	font-weight: 500;
}
.mkm-switcher__check {
	flex: none;
}
.mkm-switcher__empty {
	margin: 0;
	padding: 12px 16px 20px;
	font-size: 14px;
	color: var(--mkm-muted);
}
.mkm-switcher__empty[hidden] {
	display: none;
}
.mkm-switcher__note {
	margin: 0;
	padding: 12px 16px;
	border-top: 1px solid var(--mkm-rule);
	font-size: 12px;
	line-height: 1.5;
	color: var(--mkm-muted);
}

/* Footer select: kit field style, bottom rule only, SVG chevron. */
.mkm-switcher--select {
	gap: 10px;
}
.mkm-switcher__select {
	-webkit-appearance: none;
	appearance: none;
	min-height: 40px;
	max-width: 100%;
	padding: 0 24px 0 0;
	border: 0;
	border-bottom: 1px solid currentColor;
	border-radius: 0;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 2px center;
	color: inherit;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}
.mkm-switcher__select option {
	color: #111;
	background: #fff;
}

/* Phones: a lighter toggle (no currency, the sheet's note still states it) and a bottom sheet instead of a positioned panel. */
@media (max-width: 767px) {
	.mkm-switcher {
		--mkm-label-max: 7em;
	}
	.mkm-switcher__currency {
		display: none;
	}
	.mkm-switcher .mkm-switcher__panel {
		position: fixed;
		inset: auto 0 0 0;
		width: auto;
		max-width: none;
		max-height: 75vh;
		border-width: 1px 0 0;
		transition: opacity .25s var(--mkm-ease), transform .35s var(--mkm-ease), bottom .25s var(--mkm-ease), height .25s var(--mkm-ease);
		box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .1); /* Scrim 10 over the page, not a depth shadow */
		transform: none;
	}
	@starting-style {
		.mkm-switcher .mkm-switcher__panel {
			transform: translateY(24px);
		}
	}
	.mkm-switcher__heading {
		padding: 20px 20px 4px;
	}
	.mkm-switcher__search {
		margin: 0 20px 6px;
	}
	.mkm-switcher__list a {
		min-height: 48px;
		padding: 0 20px;
	}
	.mkm-switcher__note {
		padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
	}
	.mkm-switcher .mkm-switcher__search input {
		font-size: 16px; /* stops iOS zooming on focus */
	}
}

@media (prefers-reduced-motion: reduce) {
	.mkm-switcher .mkm-switcher__panel,
	.mkm-switcher__caret,
	.mkm-switcher__currency,
	.mkm-switcher__search {
		transition: none;
	}
}
