/**
 * Header location selector.
 *
 * Written with CSS logical properties throughout, so the same rules lay the
 * selector out correctly in an RTL region without a mirrored stylesheet.
 */

.compunnel-region-selector {
	position: relative;
	display: inline-block;
	vertical-align: middle;
	margin-inline-end: 12px;
	font-size: 14px;
	line-height: 1.2;
	text-align: start;
}

.compunnel-region-selector__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 12px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	white-space: nowrap;
}

.compunnel-region-selector__toggle:hover,
.compunnel-region-selector__toggle:focus-visible {
	border-color: #0050ef;
	color: #0050ef;
}

.compunnel-region-selector__toggle:focus-visible {
	outline: 2px solid #0050ef;
	outline-offset: 2px;
}

/* Globe, drawn in CSS so the selector adds no image request. */
.compunnel-region-selector__icon {
	inline-size: 15px;
	block-size: 15px;
	flex: 0 0 auto;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	position: relative;
}

.compunnel-region-selector__icon::before,
.compunnel-region-selector__icon::after {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-start: 50%;
	transform: translateX(-50%);
	border: 1.5px solid currentColor;
	border-radius: 50%;
	inline-size: 6px;
	border-block: 0;
}

.compunnel-region-selector__icon::after {
	inset-block: 50%;
	inset-inline: 0;
	inline-size: auto;
	block-size: 0;
	transform: none;
	border: 0;
	border-block-start: 1.5px solid currentColor;
	border-radius: 0;
}

.compunnel-region-selector__caret {
	inline-size: 0;
	block-size: 0;
	flex: 0 0 auto;
	border-inline: 4px solid transparent;
	border-block-start: 5px solid currentColor;
	transition: transform 0.15s ease;
}

.compunnel-region-selector__toggle[aria-expanded="true"] .compunnel-region-selector__caret {
	transform: rotate(180deg);
}

/* Desktop header: a bare icon drawn like the theme's search icon (same box,
   size, stroke and colours), plus a short country code when a region is
   selected. The full name lives in the panel and the button's aria-label, so a
   long location name can never widen the header. */
.compunnel-region-selector--desktop {
	margin-inline-end: 16px;
}

.compunnel-region-selector--desktop .compunnel-region-selector__toggle {
	position: relative;
	top: 4px;
	block-size: 25px;
	min-inline-size: 25px;
	padding: 0;
	gap: 4px;
	border: 0;
	border-radius: 0;
	color: #222;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.compunnel-region-selector--desktop .compunnel-region-selector__toggle:hover {
	color: #0050ef;
}

body.hero-slider .compunnel-region-selector--desktop .compunnel-region-selector__toggle {
	color: #fff;
}

/* Same states that turn the theme's search icon dark: the header scrolled,
   sticky, or hovered (which also gives the hero header its white background). */
.header.headroom--not-top .compunnel-region-selector--desktop .compunnel-region-selector__toggle,
.header.sticky .compunnel-region-selector--desktop .compunnel-region-selector__toggle,
.header:hover .compunnel-region-selector--desktop .compunnel-region-selector__toggle {
	color: var(--normalFontColor);
}

.header:hover .compunnel-region-selector--desktop .compunnel-region-selector__toggle:hover {
	color: #0050ef;
}

.compunnel-region-selector--desktop .compunnel-region-selector__icon {
	inline-size: 17px;
	block-size: 17px;
	margin-inline: 4px;
	border-width: 2px;
}

.compunnel-region-selector--desktop .compunnel-region-selector__caret,
.compunnel-region-selector--desktop .compunnel-region-selector__current {
	display: none;
}

.compunnel-region-selector__code {
	max-inline-size: 5ch;
	overflow: hidden;
	text-overflow: clip;
}

.compunnel-region-selector__panel {
	position: absolute;
	inset-block-start: calc(100% + 6px);
	inset-inline-end: 0;
	z-index: 1200;
	min-inline-size: 160px;
	max-block-size: 60vh;
	overflow-y: auto;
	padding: 8px 0;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.compunnel-region-selector__panel[hidden] {
	display: none;
}

.compunnel-region-selector__heading {
	margin: 0;
	padding: 4px 16px 8px;
	color: #6b7280;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.compunnel-region-selector__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.compunnel-region-selector__link {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 16px;
	color: #1f2937;
	text-decoration: none;
}

.compunnel-region-selector__link:hover,
.compunnel-region-selector__link:focus-visible {
	background: #f3f4f6;
	color: #0050ef;
	text-decoration: none;
}

.compunnel-region-selector__item.is-current .compunnel-region-selector__link {
	font-weight: 700;
	color: #0050ef;
}

/* A check mark on the selected entry, so the current location reads as chosen
   rather than merely emphasised. */
.compunnel-region-selector__item.is-current .compunnel-region-selector__label::after {
	content: "";
	display: inline-block;
	inline-size: 5px;
	block-size: 9px;
	margin-inline-start: 8px;
	border-inline-end: 2px solid currentColor;
	border-block-end: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
}

.compunnel-region-selector__sub {
	color: #6b7280;
	font-size: 13px;
	font-weight: 400;
}

/* Mobile drawer variant: a plain block rather than a dropdown. */
.compunnel-region-selector--mobile {
	display: block;
	margin: 8px 16px 16px;
}

.compunnel-region-selector--mobile .compunnel-region-selector__toggle {
	inline-size: 100%;
	justify-content: space-between;
}

.compunnel-region-selector--mobile .compunnel-region-selector__panel {
	position: static;
	inline-size: 100%;
	max-block-size: none;
	margin-block-start: 6px;
	box-shadow: none;
}

@media (max-width: 991px) {
	.compunnel-region-selector--desktop {
		display: none;
	}
}

@media (min-width: 992px) {
	.compunnel-region-selector--mobile {
		display: none;
	}
}

.compunnel-region-selector__item.is-fallback .compunnel-region-selector__label {
	color: #4b5563;
}

.compunnel-region-selector__sub {
	display: block;
	font-size: 12px;
}

/* Location notice: the visitor's location was selected for them, and this is
   how to get to the Global website instead. A card at the bottom of the screen
   by default; pointing up at the header selector where that is on screen. */
.compunnel-region-notice {
	position: fixed;
	inset-inline: 16px;
	inset-block-end: 16px;
	z-index: 1300;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	max-inline-size: 360px;
	margin-inline-start: auto;
	padding: 16px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
	color: #1f2937;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	text-align: start;
	white-space: normal;
	animation: compunnel-region-notice-in 0.2s ease-out;
}

.compunnel-region-notice--anchored {
	position: absolute;
	inset-block: calc(100% + 12px) auto;
	inset-inline: auto 0;
	inline-size: 300px;
	margin: 0;
}

/* The arrow up to the selector. Physical borders on purpose: rotated, they make
   an upward point in either text direction. */
.compunnel-region-notice--anchored::before {
	content: "";
	position: absolute;
	inset-block-start: -6px;
	inset-inline-end: 28px;
	inline-size: 10px;
	block-size: 10px;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
	border-left: 1px solid rgba(0, 0, 0, 0.12);
	background: #fff;
	transform: rotate(45deg);
}

.compunnel-region-notice__text {
	margin: 0;
}

.compunnel-region-notice__text strong {
	font-weight: 700;
}

.compunnel-region-notice__text a {
	color: #0050ef;
	text-decoration: underline;
}

.compunnel-region-notice__ok {
	align-self: flex-end;
	padding: 6px 20px;
	border: 0;
	border-radius: 4px;
	background: #0050ef;
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.compunnel-region-notice__ok:hover {
	background: #003ec0;
}

.compunnel-region-notice :focus-visible {
	outline: 2px solid #0050ef;
	outline-offset: 2px;
}

@keyframes compunnel-region-notice-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.compunnel-region-notice {
		animation: none;
	}
}

