/*
 * font-size defaults to the site's submenu convention (14px) and is
 * inherited from here by both the toggle button (via `font: inherit`) and
 * the dropdown panel below — matching how the old WPML switcher applied one
 * shared font size to both. The block's own "Font size" control (see
 * index.js/render.php) overrides this value right here on the wrapper, so
 * it always reaches both descendants together.
 */
.vlc-language-switcher {
	position: relative;
	display: inline-block;
	font-size: 14px;
}

.vlc-language-switcher--navigation {
	display: flex;
	align-items: center;
}

/*
 * The .wp-block-navigation-item__content class is also present on this
 * button/link (see render.php), which picks up the theme's nav-specific
 * hover/focus rules when a real .wp-block-navigation ancestor exists (the
 * navigation-embedded variant). But that class's own styling is scoped to
 * that ancestor and isn't guaranteed for the standalone variant, so every
 * property that matters for correct appearance is also set explicitly here.
 */
.vlc-language-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	margin: 0;
	min-height: 24px;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.vlc-language-switcher__toggle:hover,
.vlc-language-switcher__toggle:focus-visible {
	color: var( --wp--preset--color--primary );
}

.vlc-language-switcher__icon {
	width: 0.6em;
	height: 0.6em;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.vlc-language-switcher__toggle[aria-expanded="true"] .vlc-language-switcher__icon {
	transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
	.vlc-language-switcher__icon {
		transition: none;
	}
}

/*
 * Background/text default to the site's other submenus ("Dark alt"
 * background, light text). These are plain CSS defaults, not inherited from
 * the wrapper — the block has its own separate "Submenu colors" controls
 * (see index.js), applied here as an inline style only on this element,
 * specifically so they can never also recolor the toggle button the way
 * Gutenberg's built-in wrapper-level color supports would. Font size isn't
 * set here at all: it's inherited from .vlc-language-switcher above, shared
 * with the toggle button.
 */
.vlc-language-switcher__list {
	position: absolute;
	top: 100%;
	inset-inline-start: 0;
	z-index: 30;
	min-width: 100%;
	margin: 0;
	padding: 0.5em 0;
	list-style: none;
	background-color: var( --wp--preset--color--dark-alt, #1e1e1e );
	color: var( --wp--preset--color--light, #fff );
	border: 1px solid transparent;
	box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.15 );
}

.vlc-language-switcher__list[hidden] {
	display: none;
}

/* Same desktop submenu sizing/padding as core Navigation submenus (see blocks.css). */
@media (min-width: 1200px) {
	.vlc-language-switcher__list {
		min-width: 290px;
	}

	.vlc-language-switcher__link {
		padding: 12px;
	}

	.vlc-language-switcher__item:first-child .vlc-language-switcher__link {
		padding-top: 24px;
	}

	.vlc-language-switcher__item:last-child .vlc-language-switcher__link {
		padding-bottom: 24px;
	}
}

.vlc-language-switcher__link {
	display: block;
	padding: 8px;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.vlc-language-switcher__link:hover,
.vlc-language-switcher__link:focus-visible {
	color: var( --wp--preset--color--primary );
}

.vlc-language-switcher__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset( 50% );
	white-space: nowrap;
	border: 0;
}
