/* Carlo Tours — Language switcher.
   A globe in the header bar that drops a short menu of the four
   languages. Built on <details>, so it opens and closes with no
   JavaScript at all; carlo-lang.js only adds outside-click and Escape. */

.carlo-lang {
	position: relative;
	display: flex;
	align-items: center;
}

/* Desktop: past the nav links, so the globe reads last on a wide bar.
   Below the 920px collapse it stays before the hamburger, which keeps
   the hamburger itself at the screen edge where a thumb expects it. */
@media (min-width: 920px) {
	.carlo-lang {
		order: 2;
	}
}

/* ---------------------------------------------------------------
   The toggle.
   A <summary>, so Enter and Space work without a key handler. The
   default disclosure triangle has to be removed twice: list-style for
   everything current, and the -webkit- pseudo for older WebKit.
   --------------------------------------------------------------- */
.carlo-lang__toggle {
	display: flex;
	align-items: center;
	gap: 0.125rem;
	/* 44px tap target out of a 20px icon, without the box growing */
	padding: 0.625rem 0.375rem;
	margin: -0.625rem -0.375rem;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	list-style: none;
	transition: color 0.3s var(--wp--custom--ease);
}

.carlo-lang__toggle::-webkit-details-marker {
	display: none;
}

.carlo-lang__toggle::marker {
	content: "";
}

.carlo-lang__toggle:hover {
	color: var(--wp--preset--color--accent);
}

.carlo-lang__icon svg {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
}

.carlo-lang__chevron svg {
	display: block;
	width: 0.75rem;
	height: 0.75rem;
	transition: transform 0.3s var(--wp--custom--ease);
}

.carlo-lang[open] .carlo-lang__chevron svg {
	transform: rotate(180deg);
}

/* ---------------------------------------------------------------
   The menu.
   Paints its own light surface, so it stays readable even while the
   bar above it is transparent over the hero photographs.
   --------------------------------------------------------------- */
.carlo-lang__menu {
	position: absolute;
	/* Clears the header before it opens: the globe sits in a 40px row with
	   24px of header padding below it, so the panel has to drop half that
	   row plus the padding to reach the header's bottom hairline, and a
	   little further to hang clear of it. carlo-lang.js measures the real
	   header when the menu opens and overrides the figure below, which is
	   the fallback for the first frame and for no JavaScript at all. */
	top: calc(100% + var(--carlo-lang-drop, 2.625rem));
	right: 0;
	z-index: 120;
	display: flex;
	flex-direction: column;
	min-width: 10rem;
	padding: 0.375rem 0;
	background-color: var(--wp--preset--color--base);
	border: var(--wp--custom--rule) solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius);
	box-shadow: 0 1rem 2rem rgba(18, 19, 17, 0.1);
	animation: carlo-lang-in 0.22s var(--wp--custom--ease) both;
}

@keyframes carlo-lang-in {
	from {
		opacity: 0;
		transform: translateY(-0.375rem);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.carlo-lang__menu {
		animation: none;
	}

	.carlo-lang__chevron svg {
		transition: none;
	}
}

/* GTranslate prints each item as a bare <a> and adds .glink to it once
   its script has run; both selectors are listed so the menu looks right
   on the first frame, before base.js has touched anything. */
.carlo-lang__menu a,
.carlo-lang__menu a.glink {
	display: block;
	padding: 0.5rem 1rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 400;
	line-height: 1.4;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	white-space: nowrap;
	transition:
		background-color 0.2s var(--wp--custom--ease),
		color 0.2s var(--wp--custom--ease);
}

.carlo-lang__menu a:hover,
.carlo-lang__menu a.glink:hover {
	background-color: var(--wp--preset--color--accent-soft);
	color: var(--wp--preset--color--accent);
}

/* base.js moves this class onto whichever language is actually showing,
   so the tick follows the real state rather than the server's guess. */
.carlo-lang__menu a.gt-current-lang {
	font-weight: 600;
	color: var(--wp--preset--color--accent);
}

.carlo-lang__menu a.gt-current-lang::after {
	content: "";
	float: right;
	width: 0.5rem;
	height: 0.5rem;
	margin-top: 0.3125rem;
	margin-left: 0.75rem;
	background-color: currentColor;
}

/* ---------------------------------------------------------------
   Over the hero photographs.
   Matches what phase 4 does to the nav links: white while the bar is
   transparent, back to the token colour once it is solid. The menu
   itself is excluded -- it has its own white panel.
   --------------------------------------------------------------- */
body.carlo-film-hero:not(.carlo-header-solid) .carlo-lang__toggle {
	color: #ffffff;
}

body.carlo-film-hero:not(.carlo-header-solid) .carlo-lang__toggle:hover {
	color: var(--wp--preset--color--accent-soft);
}

body.carlo-film-hero:not(.carlo-header-solid) .carlo-lang__icon svg {
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* ---------------------------------------------------------------
   The stock floating widget.
   The setting is off, but if a plugin update or the owner switches it
   back on, this keeps it from parking a second switcher over the page.
   Remove this rule if the floating selector is ever wanted.
   --------------------------------------------------------------- */
.gtranslate_wrapper .gt_float_switcher {
	display: none;
}
