/*! Transport Tangier Language Switcher 1.0.0 */

/*
 * A 54 px round button in the bottom corner, the same size and height as the WhatsApp button
 * (Chaty) in the opposite corner: navy, a gold ring, the flag of the page's language and a small
 * gold badge. The menu opens above it.
 *
 * ":is(.ttls,#ttls-x)" matches the switcher with the weight of an id (the id itself is never
 * used), so the theme's styles for links, lists and buttons cannot change it.
 */

:is(.ttls,#ttls-x),
:is(.ttls,#ttls-x) *,
:is(.ttls,#ttls-x) ::before,
:is(.ttls,#ttls-x) ::after {
	box-sizing: border-box;
}

:is(.ttls,#ttls-x) {
	--ttls-size: 54px;
	--ttls-ease: cubic-bezier(.2,.7,.2,1);
	position: fixed;
	top: auto;
	right: auto;
	bottom: var(--ttls-bottom, 25px);
	left: var(--ttls-side, 29px);
	z-index: var(--ttls-z, 997);
	display: block;
	width: var(--ttls-size);
	height: var(--ttls-size);
	margin: 0;
	padding: 0;
	border: 0;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	color: #fff;
	text-align: start;
	letter-spacing: normal;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	-webkit-tap-highlight-color: transparent;
}

:is(.ttls--right,#ttls-x) {
	right: var(--ttls-side, 29px);
	left: auto;
}

/* Reset of the theme's styles inside the switcher. */
:is(.ttls,#ttls-x) :is(details,summary,nav,ul,li,p,a,span) {
	float: none;
	min-width: 0;
	min-height: 0;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font: inherit;
	color: inherit;
	letter-spacing: normal;
	text-decoration: none;
	text-shadow: none;
	text-transform: none;
	list-style: none;
	opacity: 1;
	visibility: visible;
}

/* Icons some themes add to lists, accordions (details/summary) and links. */
:is(.ttls,#ttls-x) li::before,
:is(.ttls,#ttls-x) li::after,
:is(.ttls,#ttls-x) .ttls__details::before,
:is(.ttls,#ttls-x) .ttls__details::after,
:is(.ttls,#ttls-x) .ttls__button::before,
:is(.ttls,#ttls-x) .ttls__button::after,
:is(.ttls,#ttls-x) .ttls__item::before {
	content: none;
	display: none;
}

:is(.ttls,#ttls-x) li::marker {
	content: none;
}

:is(.ttls,#ttls-x) .ttls__details {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
}

/* The button */

:is(.ttls,#ttls-x) .ttls__button {
	position: relative;
	display: block;
	width: var(--ttls-size);
	height: var(--ttls-size);
	border-radius: 50%;
	outline: none;
	list-style: none;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	transition: transform .3s var(--ttls-ease);
}

:is(.ttls,#ttls-x) .ttls__button::-webkit-details-marker {
	display: none;
}

:is(.ttls,#ttls-x) .ttls__button::marker {
	content: "";
	font-size: 0;
}

:is(.ttls,#ttls-x) .ttls__button:focus-visible {
	outline: 2px solid var(--ttls-accent);
	outline-offset: 3px;
}

:is(.ttls,#ttls-x) .ttls__ring {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid transparent;
	border-radius: 50%;
	background:
		radial-gradient(circle at 32% 26%, var(--ttls-bg-2) 0%, var(--ttls-bg) 72%) padding-box,
		linear-gradient(145deg, var(--ttls-accent-2) 0%, var(--ttls-accent) 42%, var(--ttls-accent-3) 72%, var(--ttls-accent-2) 100%) border-box;
	box-shadow: 0 16px 24px rgba(73,104,126,.16), 0 4px 10px rgba(16,38,61,.22);
	transition: box-shadow .3s var(--ttls-ease);
}

/* Flags: round, with a soft light on top. */

:is(.ttls,#ttls-x) .ttls__flag {
	position: relative;
	display: block;
	flex: none;
	width: 28px;
	height: 28px;
	overflow: hidden;
	border-radius: 50%;
	background: #E3E9EF;
	-webkit-clip-path: circle(50% at 50% 50%);
	clip-path: circle(50% at 50% 50%);
}

:is(.ttls,#ttls-x) .ttls__flag--main {
	width: 40px;
	height: 40px;
	transition: transform .35s var(--ttls-ease);
}

:is(.ttls,#ttls-x) .ttls__flag::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background:
		radial-gradient(circle at 30% 22%, rgba(255,255,255,.4) 0%, rgba(255,255,255,.08) 36%, rgba(255,255,255,0) 58%),
		linear-gradient(180deg, rgba(255,255,255,0) 55%, rgba(0,0,0,.14) 100%);
	box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
	pointer-events: none;
}

/* The colours of the flags are in style attributes; these keep theme rules off the rest. */
:is(.ttls,#ttls-x) .ttls__flag svg * {
	stroke: none;
}

:is(.ttls,#ttls-x) .ttls__flag g > * {
	fill: inherit;
}

:is(.ttls,#ttls-x) .ttls__flag svg,
:is(.ttls,#ttls-x) .ttls__flag img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
}

:is(.ttls,#ttls-x) .ttls__flag-code {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: var(--ttls-accent);
	color: var(--ttls-bg);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .04em;
}

/* Language code badge, in the outer top corner (like the counter of the WhatsApp button). */

:is(.ttls,#ttls-x) .ttls__badge {
	position: absolute;
	top: -4px;
	left: -4px;
	z-index: 2;
	display: block;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: linear-gradient(180deg, var(--ttls-accent-2) 0%, var(--ttls-accent) 100%);
	box-shadow: 0 0 0 1.5px #fff, 0 2px 6px rgba(16,38,61,.3);
	color: var(--ttls-bg);
	font-size: 9px;
	font-weight: 800;
	line-height: 16px;
	letter-spacing: .04em;
	text-align: center;
	pointer-events: none;
}

:is(.ttls--right,#ttls-x) .ttls__badge {
	right: -4px;
	left: auto;
}

/* Label next to the button: the same white pill as the "Contact us" label of the WhatsApp button. */

:is(.ttls,#ttls-x) .ttls__tip {
	position: absolute;
	top: 50%;
	left: calc(100% + 10px);
	display: block;
	padding: 5px 15px;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
	color: var(--ttls-bg);
	font-size: 17px;
	font-weight: 500;
	line-height: 21px;
	white-space: nowrap;
	pointer-events: none;
	transform: translateY(-50%);
	transition: opacity .25s var(--ttls-ease), transform .25s var(--ttls-ease), visibility .25s;
}

:is(.ttls,#ttls-x) .ttls__tip::before {
	content: "";
	position: absolute;
	top: 50%;
	left: -5px;
	margin-top: -5px;
	border-style: solid;
	border-width: 5px 5px 5px 0;
	border-color: transparent #fff transparent transparent;
}

:is(.ttls--right,#ttls-x) .ttls__tip {
	right: calc(100% + 10px);
	left: auto;
}

:is(.ttls--right,#ttls-x) .ttls__tip::before {
	right: -5px;
	left: auto;
	border-width: 5px 0 5px 5px;
	border-color: transparent transparent transparent #fff;
}

:is(.ttls--label-hover,#ttls-x) .ttls__tip {
	opacity: 0;
	visibility: hidden;
	transform: translate(-6px, -50%);
}

:is(.ttls--label-hover.ttls--right,#ttls-x) .ttls__tip {
	transform: translate(6px, -50%);
}

:is(.ttls--label-hover,#ttls-x) .ttls__button:focus-visible .ttls__tip {
	opacity: 1;
	visibility: visible;
	transform: translate(0, -50%);
}

:is(.ttls--label-never,#ttls-x) .ttls__tip {
	display: none;
}

@media (hover: hover) {
	:is(.ttls,#ttls-x) .ttls__button:hover {
		transform: translateY(-2px);
	}

	:is(.ttls,#ttls-x) .ttls__button:hover .ttls__ring {
		box-shadow: 0 20px 30px rgba(73,104,126,.22), 0 6px 14px rgba(16,38,61,.28);
	}

	:is(.ttls,#ttls-x) .ttls__button:hover .ttls__flag--main {
		transform: scale(1.06);
	}

	:is(.ttls--label-hover,#ttls-x) .ttls__button:hover .ttls__tip {
		opacity: 1;
		visibility: visible;
		transform: translate(0, -50%);
	}
}

:is(.ttls,#ttls-x) .ttls__button:active {
	transform: translateY(0) scale(.96);
}

/* Open */

:is(.ttls,#ttls-x) .ttls__details[open] > .ttls__button .ttls__ring {
	box-shadow: 0 0 0 4px rgba(var(--ttls-accent-rgb),.22), 0 16px 24px rgba(73,104,126,.16), 0 4px 10px rgba(16,38,61,.22);
}

:is(.ttls,#ttls-x) .ttls__details[open] > .ttls__button .ttls__tip {
	opacity: 0;
	visibility: hidden;
}

/* The menu */

:is(.ttls,#ttls-x) .ttls__panel {
	position: absolute;
	bottom: calc(100% + 14px);
	left: 0;
	display: block;
	width: 236px;
	max-width: calc(100vw - 2 * var(--ttls-side, 29px));
	padding: 14px 8px 8px;
	border: 1px solid rgba(var(--ttls-accent-rgb),.38);
	border-radius: 18px;
	background: linear-gradient(165deg, var(--ttls-bg-2) 0%, var(--ttls-bg) 62%);
	box-shadow: 0 24px 48px rgba(8,20,34,.34), 0 6px 16px rgba(8,20,34,.2), inset 0 1px 0 rgba(255,255,255,.06);
	color: #fff;
	transform-origin: 27px 100%;
	animation: ttls-in .26s var(--ttls-ease) both;
}

:is(.ttls--right,#ttls-x) .ttls__panel {
	right: 0;
	left: auto;
	transform-origin: calc(100% - 27px) 100%;
}

/* Small point towards the button. */
:is(.ttls,#ttls-x) .ttls__panel::after {
	content: "";
	position: absolute;
	bottom: -7px;
	left: 20px;
	width: 12px;
	height: 12px;
	border-right: 1px solid rgba(var(--ttls-accent-rgb),.38);
	border-bottom: 1px solid rgba(var(--ttls-accent-rgb),.38);
	border-bottom-right-radius: 3px;
	background: var(--ttls-bg);
	transform: rotate(45deg);
}

:is(.ttls--right,#ttls-x) .ttls__panel::after {
	right: 20px;
	left: auto;
}

:is(.ttls,#ttls-x) .ttls__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 4px 6px;
	padding: 0 8px 11px;
	border-bottom: 1px solid rgba(255,255,255,.08);
	color: var(--ttls-accent);
	font-size: 10.5px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .22em;
	text-transform: uppercase;
}

:is(.ttls,#ttls-x) .ttls__title::before {
	content: "";
	flex: none;
	width: 18px;
	height: 1px;
	background: currentColor;
}

:is(.ttls,#ttls-x) .ttls__list {
	display: grid;
	gap: 2px;
}

:is(.ttls,#ttls-x) .ttls__list > li {
	display: block;
}

:is(.ttls,#ttls-x) .ttls__item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 8px 12px 8px 8px;
	border-radius: 12px;
	color: rgba(255,255,255,.9) !important;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	cursor: pointer;
	transition: background-color .2s, color .2s;
}

:is(.ttls,#ttls-x) .ttls__item:hover {
	background: rgba(255,255,255,.07);
	color: #fff !important;
}

:is(.ttls,#ttls-x) .ttls__item:focus-visible {
	outline: 2px solid var(--ttls-accent);
	outline-offset: -2px;
	background: rgba(255,255,255,.07);
}

:is(.ttls,#ttls-x) .ttls__item.is-current {
	background: linear-gradient(90deg, rgba(var(--ttls-accent-rgb),.17) 0%, rgba(var(--ttls-accent-rgb),.04) 100%);
	box-shadow: inset 0 0 0 1px rgba(var(--ttls-accent-rgb),.24);
	color: var(--ttls-accent-2) !important;
	cursor: default;
}

:is(.ttls,#ttls-x) .ttls__item .ttls__flag::after {
	box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.22);
}

:is(.ttls,#ttls-x) .ttls__item.is-current .ttls__flag::after {
	box-shadow: inset 0 0 0 1.5px var(--ttls-accent);
}

:is(.ttls,#ttls-x) .ttls__name {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

:is(.ttls,#ttls-x) .ttls__code {
	display: block;
	flex: none;
	margin-inline-start: auto;
	color: rgba(255,255,255,.42);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .12em;
	transition: color .2s;
}

:is(.ttls,#ttls-x) .ttls__item:hover .ttls__code {
	color: var(--ttls-accent);
}

:is(.ttls,#ttls-x) .ttls__check {
	display: block;
	flex: none;
	width: 18px;
	height: 18px;
	margin-inline-start: auto;
	color: var(--ttls-accent);
}

/* While the next page loads. */
:is(.ttls,#ttls-x) .ttls__item.is-loading .ttls__code {
	display: none;
}

:is(.ttls,#ttls-x) .ttls__item.is-loading::after {
	content: "";
	flex: none;
	width: 14px;
	height: 14px;
	margin-inline-start: auto;
	border: 2px solid rgba(var(--ttls-accent-rgb),.3);
	border-top-color: var(--ttls-accent);
	border-radius: 50%;
	animation: ttls-spin .7s linear infinite;
}

@keyframes ttls-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(.97);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes ttls-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Phones: no label next to the button (the WhatsApp label needs the room). */
@media (max-width: 599px) {
	:is(.ttls,#ttls-x) .ttls__tip {
		display: none;
	}
}

@media (max-width: 1024px) {
	:is(.ttls--desktop-only,#ttls-x) {
		display: none !important;
	}
}

@media (min-width: 1025px) {
	:is(.ttls--mobile-only,#ttls-x) {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	:is(.ttls,#ttls-x) *,
	:is(.ttls,#ttls-x) ::before,
	:is(.ttls,#ttls-x) ::after {
		animation: none !important;
		transition: none !important;
	}

	:is(.ttls,#ttls-x) .ttls__button:hover,
	:is(.ttls,#ttls-x) .ttls__button:hover .ttls__flag--main {
		transform: none;
	}
}

@media print {
	:is(.ttls,#ttls-x) {
		display: none !important;
	}
}

/* Preview on the settings page. */
:is(.ttls--preview,#ttls-x) {
	position: relative;
	top: auto;
	right: auto;
	bottom: auto;
	left: auto;
	z-index: 1;
}

:is(.ttls--preview,#ttls-x) .ttls__panel {
	animation: none;
}
