/**
 * FeniusML language switcher styles.
 *
 * Neutral, dependency-free, and themeable via CSS custom properties. Override
 * any of the --feniusml-switcher-* variables in your theme to restyle.
 */
.feniusml-switcher {
	--feniusml-switcher-bg: #ffffff;
	--feniusml-switcher-toggle-bg: transparent;
	--feniusml-switcher-toggle-border: 0;
	--feniusml-switcher-fg: #1a1a1a;
	--feniusml-switcher-border: rgba(0, 0, 0, 0.18);
	--feniusml-switcher-hover-bg: rgba(0, 0, 0, 0.06);
	--feniusml-switcher-current-fg: #0b57d0;
	--feniusml-switcher-radius: 6px;
	--feniusml-switcher-gap: 0.25em;
	--feniusml-switcher-pad-y: 0.4em;
	--feniusml-switcher-pad-x: 0.75em;

	display: inline-block;
	font-size: inherit;
	line-height: 1.4;
}

.feniusml-switcher__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.feniusml-switcher__link {
	display: block;
	padding: var(--feniusml-switcher-pad-y) var(--feniusml-switcher-pad-x);
	color: var(--feniusml-switcher-fg);
	text-decoration: none;
	border-radius: var(--feniusml-switcher-radius);
	white-space: nowrap;
}

.feniusml-switcher__link:hover,
.feniusml-switcher__link:focus {
	background: var(--feniusml-switcher-hover-bg);
}

.feniusml-switcher__link--current {
	color: var(--feniusml-switcher-current-fg);
	font-weight: 600;
}

/* Inline style: a horizontal row of links. */
.feniusml-switcher--inline .feniusml-switcher__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--feniusml-switcher-gap);
	align-items: center;
}

/* Dropdown style: a <details>/<summary> disclosure that needs no JavaScript. */
.feniusml-switcher--dropdown .feniusml-switcher__details {
	position: relative;
	display: inline-block;
}

/*
 * The toggle borrows the surrounding design instead of imposing one. Dropped
 * into a theme's header — beside the account and cart icons — a switcher with
 * its own background and text colour reads as a foreign object, and following
 * the visitor's OS dark-mode preference made it a black pill on a light site.
 * The open list still paints itself, because it floats over page content and
 * has to stay readable.
 */
.feniusml-switcher--dropdown .feniusml-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: var(--feniusml-switcher-pad-y) var(--feniusml-switcher-pad-x);
	background: var(--feniusml-switcher-toggle-bg, transparent);
	color: inherit;
	border: var(--feniusml-switcher-toggle-border, 0);
	border-radius: var(--feniusml-switcher-radius);
	cursor: pointer;
	list-style: none;
	user-select: none;
}

/* Hide the default disclosure triangle in WebKit/Blink. */
.feniusml-switcher--dropdown .feniusml-switcher__toggle::-webkit-details-marker {
	display: none;
}

.feniusml-switcher__arrow {
	width: 0;
	height: 0;
	border-left: 0.32em solid transparent;
	border-right: 0.32em solid transparent;
	border-top: 0.36em solid currentColor;
	transition: transform 0.15s ease;
}

.feniusml-switcher--dropdown .feniusml-switcher__details[open] .feniusml-switcher__arrow {
	transform: rotate(180deg);
}

.feniusml-switcher--dropdown .feniusml-switcher__list {
	position: absolute;
	z-index: 50;
	min-width: 100%;
	margin-top: 0.25em;
	padding: 0.25em;
	background: var(--feniusml-switcher-bg);
	border: 1px solid var(--feniusml-switcher-border);
	border-radius: var(--feniusml-switcher-radius);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* Flag images (show=flag / show=flag_name). */
/*
 * Specificity, not elegance. Themes ship `img { height: auto }` and Elementor
 * ships `.elementor img { height: auto }`. A bare `.feniusml-flag` loses to both
 * and the flag renders at the SVG's intrinsic size — 213x160 on a real site.
 * `img.feniusml-flag` only TIES with `.elementor img`, and Elementor's stylesheet
 * loads later, so inside a widget it still won and collapsed the flag to 0x0.
 * Qualifying by our own containers finally settles it. max-width/max-height are
 * reset because themes cap images too.
 */
img.feniusml-flag,
.feniusml-switcher img.feniusml-flag,
.feniusml-menu-item img.feniusml-flag,
.feniusml-post-translations img.feniusml-flag {
	display: inline-block;
	width: auto;
	height: 1em;
	max-width: none;
	max-height: none;
	vertical-align: -0.12em;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Space between a flag and a following name. */
.feniusml-flag + .feniusml-flag-name {
	margin-left: 0.4em;
}

/* Visually hidden helper for flag-only mode (kept for assistive tech). */
.feniusml-flag-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/**
 * Switcher injected into a theme nav menu (wp_nav_menu_items).
 *
 * Deliberately minimal: the .feniusml-menu-item <li>s use standard WordPress menu
 * classes (menu-item, menu-item-has-children, sub-menu, current-menu-item) so
 * the theme's own desktop and mobile menu CSS styles them. We only reset the
 * sub-menu's list markers as a safety net for themes that don't.
 */
.feniusml-menu-item--parent > .sub-menu {
	list-style: none;
}

/*
 * No prefers-color-scheme block on purpose. The switcher lives inside someone
 * else's design, and a site that is light for every visitor stays light for a
 * visitor whose laptop is in dark mode — following the OS preference here made
 * the switcher the only dark element on the page. Restyle through the
 * --feniusml-switcher-* variables instead; they are the supported seam.
 */

/* ---------------------------------------------------------------------------
 * Theme-independent placements (floating corner box, top-of-page bar, and the
 * "also available in" links around post content).
 * ------------------------------------------------------------------------ */

.feniusml-floating {
	position: fixed;
	z-index: 9990;
	background: #fff;
	border-radius: 4px;
	padding: 0.35em 0.6em;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

.feniusml-floating--bottom-right { right: 1em; bottom: 1em; }
.feniusml-floating--bottom-left  { left: 1em;  bottom: 1em; }
.feniusml-floating--top-right    { right: 1em; top: 1em; }
.feniusml-floating--top-left     { left: 1em;  top: 1em; }

/* A floating box near the bottom must open upwards or it falls off screen. */
.feniusml-floating--bottom-right .feniusml-switcher__list,
.feniusml-floating--bottom-left .feniusml-switcher__list {
	top: auto;
	bottom: 100%;
}

.feniusml-bar {
	display: flex;
	justify-content: flex-end;
	gap: 0.5em;
	padding: 0.3em 1em;
	background: rgba(0, 0, 0, 0.04);
	font-size: 0.9em;
}

.feniusml-post-translations {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5em;
	margin: 1.5em 0;
	padding: 0.6em 0.9em;
	border-left: 3px solid currentColor;
	background: rgba(0, 0, 0, 0.03);
}

.feniusml-post-translations__label { font-weight: 600; }

.feniusml-post-translations__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.feniusml-post-translations__item { margin: 0; }
