/*
 * VillaNytt country selector (inc/vn-country.php).
 *
 * Header bar (1200 px and up): a quiet toggle between the primary navigation
 * and the search field; the countries open in a card under it. Below 1200 px
 * the same toggle sits in the top bar next to the cart and the list opens full
 * width under the header. The hamburger drawer lists the countries like its
 * top_menu rows.
 *
 * Loaded after vn-menu-v2.css. The legacy theme styles every button, list,
 * paragraph and header link globally, so the component sets what it uses.
 */

.vn-menu .vn-country {
	--vn-country-ink: #202622;
	--vn-country-muted: #5a5f5c;
	--vn-country-line: #e3e1d8;
	--vn-country-hover: #f3f6f4;
	--vn-country-current-bg: var(--vn-menu-state-bg, #eaf1ec);
	--vn-country-current-ink: var(--vn-menu-state-accent, #1f5a44);
}

.vn-menu .vn-country .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Toggle on the dark green header. */

.vn-menu .vn-country--desktop {
	display: flex;
	align-items: center;
	order: 3;
	flex: 0 0 auto;
}

.vn-menu .vn-country .vn-country__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	box-shadow: none;
	color: var(--vn-shell-light);
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1;
	text-transform: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.vn-menu .vn-country .vn-country__toggle:hover,
.vn-menu .vn-country .vn-country__toggle:active,
.vn-menu .vn-country .vn-country__toggle[aria-expanded="true"] {
	border-color: rgba(255, 255, 255, 0.42);
	background: rgba(255, 255, 255, 0.08);
	color: var(--vn-shell-light);
}

.vn-menu .vn-country .vn-country__toggle:focus {
	outline: 0;
	box-shadow: none;
}

/* The same white ring as the other controls on the header (vn-menu-v2.css). */
.vn-menu .vn-country .vn-country__toggle:focus-visible {
	outline: 3px solid var(--vn-shell-light);
	outline-offset: 2px;
	box-shadow: none;
}

.vn-menu .vn-country .vn-country__globe,
.vn-menu .vn-country .vn-country__chevron {
	display: block;
	flex: 0 0 auto;
}

.vn-menu .vn-country .vn-country__globe {
	width: 18px;
	height: 18px;
}

.vn-menu .vn-country .vn-country__code {
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
}

.vn-menu .vn-country .vn-country__chevron {
	width: 12px;
	height: 12px;
	transition: transform 0.15s ease;
}

.vn-menu .vn-country .vn-country__toggle[aria-expanded="true"] .vn-country__chevron {
	transform: rotate(180deg);
}

/* Panel: full width under the header below 1200 px, a card under the toggle above. */

.vn-menu .vn-country .vn-country__panel {
	position: absolute;
	top: 100%;
	right: 0;
	left: 0;
	z-index: 20;
	padding: 8px 16px 14px;
	border-top: 1px solid var(--vn-country-line);
	border-bottom: 1px solid var(--vn-country-line);
	background: #fff;
	box-shadow: 0 12px 24px rgba(17, 53, 42, 0.12);
	color: var(--vn-country-ink);
	text-align: left;
}

.vn-menu .vn-country .vn-country__panel[hidden] {
	display: none !important;
}

.vn-menu .vn-country .vn-country__heading {
	margin: 0;
	padding: 10px 12px 8px;
	color: var(--vn-country-muted);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.2;
	text-transform: uppercase;
}

.vn-menu .vn-country .vn-country__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vn-menu .vn-country .vn-country__list > li {
	margin: 0;
	padding: 0;
}

.vn-menu .vn-country .vn-country__option,
.vn-menu .vn-country .vn-country__other {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 10px 12px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: var(--vn-country-ink);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.25;
	text-align: left;
	text-decoration: none;
}

.vn-menu .vn-country .vn-country__option:hover,
.vn-menu .vn-country .vn-country__other:hover {
	background: var(--vn-country-hover);
	color: var(--vn-country-ink);
}

.vn-menu .vn-country .vn-country__option.is-current,
.vn-menu .vn-country .vn-country__option.is-current:hover {
	background: var(--vn-country-current-bg);
	color: var(--vn-country-current-ink);
	font-weight: 700;
}

/* Inside the row, so the ring is never clipped by the drawer's scroller. */
.vn-menu .vn-country .vn-country__option:focus-visible,
.vn-menu .vn-country .vn-country__other:focus-visible {
	outline: 3px solid var(--vn-menu-primary, #1a4837);
	outline-offset: -3px;
	box-shadow: none;
}

.vn-menu .vn-country .vn-country__flag {
	display: block;
	flex: 0 0 auto;
	width: 24px;
	height: 16px;
	border-radius: 2px;
	overflow: hidden;
}

.vn-menu .vn-country .vn-country__name {
	flex: 1 1 auto;
	min-width: 0;
}

.vn-menu .vn-country .vn-country__check {
	display: block;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	color: var(--vn-country-current-ink);
}

.vn-menu .vn-country .vn-country__other {
	margin-top: 6px;
	border-top: 1px solid var(--vn-country-line);
	border-radius: 0 0 8px 8px;
}

.vn-menu .vn-country .vn-country__other-icon {
	display: block;
	flex: 0 0 auto;
	width: 24px;
	height: 20px;
	color: var(--vn-country-muted);
}

.vn-menu .vn-country .vn-country__note {
	margin: 6px 0 0;
	padding: 0 12px;
	color: var(--vn-country-muted);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
}

/* Hamburger drawer: rows like the drawer's top_menu list. */

.vn-menu .vn-country--drawer {
	flex: 0 0 auto;
	background: #f5f5f3;
}

.vn-menu .vn-country--drawer .vn-menu__categories-label {
	border-top: 1px solid var(--vn-country-line);
}

.vn-menu .vn-country--drawer .vn-country__list {
	padding: 10px 20px 4px;
}

.vn-menu .vn-country--drawer .vn-country__option,
.vn-menu .vn-country--drawer .vn-country__other {
	color: #343936;
	font-size: 17px;
}

.vn-menu .vn-country--drawer .vn-country__option.is-current {
	color: var(--vn-country-current-ink);
}

.vn-menu .vn-country--drawer .vn-country__other {
	width: auto;
	margin: 6px 20px 0;
}

.vn-menu .vn-country--drawer .vn-country__note {
	margin: 0;
	padding: 6px 32px 18px;
}

@media (max-width: 1199px) {
	/* Top bar: menu, logo … [globe SE] [cart]. The logo's auto margin pushes both right. */
	.vn-menu .vn-country--desktop {
		margin-right: 4px;
	}

	.vn-menu .vn-country--desktop ~ .vn-shell__header-actions {
		flex: 0 0 auto;
		margin-left: 0;
	}
}

@media (max-width: 399px) {
	.vn-menu .vn-country--desktop .vn-country__toggle {
		padding: 0 8px;
	}

	.vn-menu .vn-country--desktop .vn-country__chevron {
		display: none;
	}
}

@media (min-width: 1200px) {
	.vn-menu .vn-country--desktop {
		position: relative;
		margin-left: clamp(6px, 0.8vw, 14px);
	}

	/*
	 * With the production menu the bar is full between 1200 and about 1310 px.
	 * The search field gives up its width first so the menu items never slide
	 * under the selector; the field keeps a usable minimum.
	 */
	.vn-menu .vn-country--desktop ~ .navigation-search {
		flex-shrink: 1000;
		min-width: 160px;
	}

	.vn-menu .vn-country--desktop .vn-country__panel {
		top: calc(100% + 8px);
		right: 0;
		left: auto;
		min-width: 240px;
		padding: 6px;
		border: 1px solid var(--vn-country-line);
		border-radius: 12px;
		box-shadow: 0 12px 28px rgba(17, 53, 42, 0.14);
	}
}

@media (min-width: 1200px) and (max-width: 1365px) {
	.vn-menu .vn-country--desktop .vn-country__toggle {
		padding: 0 8px;
	}

	.vn-menu .vn-country--desktop .vn-country__chevron {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vn-menu .vn-country .vn-country__toggle,
	.vn-menu .vn-country .vn-country__chevron {
		transition: none;
	}
}
