/*
 * Wayline Translate: language picker.
 * Colours and type come from the active block theme's presets, so the picker
 * reads as part of the site. Override the --wl-* variables in Appearance >
 * Editor > Styles > Additional CSS to fine-tune.
 */
:root {
	--wl-ink: var(--wp--preset--color--contrast, #1f2a2e);
	--wl-paper: var(--wp--preset--color--base, #ffffff);
	--wl-muted: color-mix(in srgb, var(--wl-ink) 55%, var(--wl-paper));
	--wl-hover: color-mix(in srgb, var(--wl-ink) 7%, var(--wl-paper));
	--wl-font: inherit;
}

/* Floating picker, bottom-left. */
.wlt-picker {
	position: fixed;
	left: calc(18px + env(safe-area-inset-left, 0px));
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	font-family: var(--wl-font);
	font-size: 15px;
	line-height: 1.2;
	direction: ltr;
}

.wlt-picker__button {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px 10px 13px;
	list-style: none;
	cursor: pointer;
	background: var(--wl-ink);
	color: var(--wl-paper);
	border-radius: 999px;
	box-shadow: 0 6px 20px color-mix(in srgb, var(--wl-ink) 28%, transparent);
	user-select: none;
}

.wlt-picker__button::-webkit-details-marker,
.wlt-picker__button::marker {
	display: none;
	content: "";
}

.wlt-picker__current {
	font-weight: 600;
}

.wlt-picker__panel {
	position: absolute;
	left: 0;
	bottom: calc(100% + 8px);
	min-width: 190px;
	max-height: min(70vh, 380px);
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--wl-paper);
	color: var(--wl-ink);
	border: 1px solid color-mix(in srgb, var(--wl-ink) 14%, transparent);
	border-radius: 6px;
	box-shadow: 0 12px 32px color-mix(in srgb, var(--wl-ink) 18%, transparent);
}

.wlt-picker[open] .wlt-picker__panel {
	animation: wlt-rise 0.14s ease-out;
}

@keyframes wlt-rise {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}

.wlt-picker__item {
	margin: 0;
	padding: 0;
}

.wlt-picker__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 4px;
	color: inherit;
	text-decoration: none;
}

.wlt-picker__link:hover {
	background: var(--wl-hover);
}

.wlt-picker__link[aria-current="true"] .wlt-picker__name {
	font-weight: 700;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

/* Country flags. */
.wlt-flag {
	display: inline-block;
	flex: 0 0 auto;
	width: 21px;
	height: 14px;
	border-radius: 2px;
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--wl-ink) 18%, transparent);
	vertical-align: middle;
}

.wlt-picker__button .wlt-flag {
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--wl-paper) 35%, transparent);
}

/* Inline bar from the [wayline_languages] shortcode. */
.wlt-langbar__list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wlt-langbar__item {
	margin: 0;
	padding: 0;
}

.wlt-langbar__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: inherit;
	font-size: 0.875em;
	text-decoration: none;
	opacity: 0.7;
}

.wlt-langbar__link:hover {
	opacity: 1;
}

.wlt-langbar__link[aria-current="true"] {
	font-weight: 700;
	opacity: 1;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.wlt-picker__button:focus-visible,
.wlt-picker__link:focus-visible,
.wlt-langbar__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.wlt-picker[open] .wlt-picker__panel {
		animation: none;
	}
}

@media (max-width: 600px) {
	.wlt-picker {
		left: calc(12px + env(safe-area-inset-left, 0px));
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	}
}

/* Keep translated navigation labels in their natural case. */
body.wlt-translated .wp-block-navigation-item__label {
	text-transform: none;
}
