/*
 * Floating Super Support assistant (layout: floating). Loaded only on pages that render one.
 * Colours come from the WebExpo theme tokens, which swap between dark and light themes.
 */
.webexpo-chat-floating {
	--webexpo-floating-bg: var(--webx-void-100, #0f0f0f);
	--webexpo-floating-surface: var(--webx-void-90, #1f1f1f);
	--webexpo-floating-raised: var(--webx-void-80, #272727);
	--webexpo-floating-edge: var(--webx-void-60, #3f3f3f);
	--webexpo-floating-text: var(--webx-ice-100, #e6e6e6);
	--webexpo-floating-muted: var(--webx-ice-75, #b7b7b7);
	--webexpo-floating-subtle: var(--webx-ice-50, #878787);
	--webexpo-floating-accent: var(--webx-brand-1-100, #dbf227);
	--webexpo-floating-action: var(--webx-brand-1-50, #a8bf00);
	--webexpo-floating-on-accent: var(--webx-void-100, #0f0f0f);
	--webexpo-floating-link: var(--ahref, #2ee5e5);
	--webexpo-floating-scrim: var(--webx-system-75, rgba(0, 0, 0, 0.75));
	--webexpo-floating-launcher-bg: var(--webexpo-floating-accent);
	--webexpo-floating-highlight: var(--webexpo-floating-accent);
	--webexpo-floating-gap: 32px;
	--webexpo-floating-lift: 0px;
	--webexpo-floating-z: 9990;
	font-family: "Oxanium", ui-sans-serif, system-ui, sans-serif;
}

/* Light theme: the magenta accent gives only 3.9:1 behind or as small text, so those use the darker brand shade. */
:root:not(.dark) .webexpo-chat-floating {
	--webexpo-floating-launcher-bg: var(--webexpo-floating-action);
	--webexpo-floating-highlight: var(--webexpo-floating-action);
}

/* Nothing shows until super-support.js has wired the launcher. */
.webexpo-chat-floating:not(.is-ready) {
	display: none;
}

/* Keep clear of the reCAPTCHA badge on pages that load it. */
body:has(.grecaptcha-badge) .webexpo-chat-floating {
	--webexpo-floating-lift: 60px;
}

/* Never cover the cookie banner or its settings popup. */
body:has(#plcb-slide.shown) .webexpo-chat-floating,
body:has(#plcb-settings.shown) .webexpo-chat-floating {
	display: none;
}

.webexpo-chat-floating *,
.webexpo-chat-floating *::before,
.webexpo-chat-floating *::after {
	box-sizing: border-box;
}

/* Launcher. The clipped corner is drawn on ::before so the drop shadow follows its shape. */
.webexpo-chat-floating .webexpo-chat-floating__launcher {
	position: fixed;
	right: var(--webexpo-floating-gap);
	bottom: calc(var(--webexpo-floating-gap) + var(--webexpo-floating-lift));
	z-index: var(--webexpo-floating-z);
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 64px;
	max-width: calc(100vw - 2 * var(--webexpo-floating-gap));
	margin: 0;
	padding: 14px 22px 14px 16px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--webexpo-floating-on-accent);
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.6));
	appearance: none;
}

.webexpo-chat-floating .webexpo-chat-floating__launcher::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--webexpo-floating-launcher-bg);
	clip-path: polygon(0 0, 100% 0, 100% 78%, 94% 100%, 0 100%);
}

.webexpo-chat-floating .webexpo-chat-floating__launcher:focus-visible {
	outline: 3px solid var(--webexpo-floating-accent);
	outline-offset: 3px;
}

.webexpo-chat-floating.is-open .webexpo-chat-floating__launcher {
	display: none;
}

.webexpo-chat-floating__launcher-icon {
	flex: none;
	width: 34px;
	height: 34px;
}

.webexpo-chat-floating__launcher-copy {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.webexpo-chat-floating__launcher-title {
	font-size: 18px;
	font-weight: 800;
	line-height: 1.2;
}

.webexpo-chat-floating__launcher-text {
	font-size: 14px;
	font-weight: 500;
	line-height: 1.25;
}

.webexpo-chat-floating__scrim {
	position: fixed;
	inset: 0;
	z-index: calc(var(--webexpo-floating-z) - 1);
	background: var(--webexpo-floating-scrim);
}

.webexpo-chat-floating__scrim[hidden] {
	display: none;
}

/* Panel. Also a .webexpo-chat-support-chat root, so the shared answer and feedback styles read these tokens. */
.webexpo-chat-floating .webexpo-chat-floating__panel {
	--webexpo-support-panel: var(--webexpo-floating-bg);
	--webexpo-support-panel-edge: var(--webexpo-floating-edge);
	--webexpo-support-text: var(--webexpo-floating-text);
	--webexpo-support-muted: var(--webexpo-floating-muted);
	--webexpo-support-field: var(--webexpo-floating-surface);
	--webexpo-support-field-border: var(--webexpo-floating-edge);
	--webexpo-support-accent: var(--webexpo-floating-accent);
	--webexpo-support-button-text: var(--webexpo-floating-on-accent);
	position: fixed;
	right: var(--webexpo-floating-gap);
	bottom: calc(var(--webexpo-floating-gap) + var(--webexpo-floating-lift));
	z-index: var(--webexpo-floating-z);
	display: flex;
	flex-direction: column;
	width: 440px;
	max-width: calc(100vw - 2 * var(--webexpo-floating-gap));
	height: min(680px, calc(100vh - 2 * var(--webexpo-floating-gap) - var(--webexpo-floating-lift)));
	margin: 0;
	border: 1px solid var(--webexpo-floating-edge);
	border-top: 4px solid var(--webexpo-floating-accent);
	background: var(--webexpo-floating-bg);
	color: var(--webexpo-floating-text);
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
	font-family: inherit;
	animation: webexpo-floating-panel-in 160ms ease-out;
}

@supports (height: 100dvh) {
	.webexpo-chat-floating .webexpo-chat-floating__panel {
		height: min(680px, calc(100dvh - 2 * var(--webexpo-floating-gap) - var(--webexpo-floating-lift)));
	}
}

.webexpo-chat-floating .webexpo-chat-floating__panel[hidden] {
	display: none;
}

/* Only the thread grows and shrinks; the rest of the panel keeps its natural height. */
.webexpo-chat-floating__panel > * {
	flex: none;
}

/* The theme sizes every p and li at 1.25rem; inside the panel they follow the sizes set here. */
.webexpo-chat-floating__panel p,
.webexpo-chat-floating__panel li {
	font-size: inherit;
}

@keyframes webexpo-floating-panel-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.webexpo-chat-floating__panel a:focus-visible,
.webexpo-chat-floating__panel button:focus-visible {
	outline: 2px solid var(--webexpo-floating-accent);
	outline-offset: 2px;
}

.webexpo-chat-floating__grab {
	display: none;
}

.webexpo-chat-floating .webexpo-chat-floating__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	padding: 16px 16px 12px;
	border-bottom: 1px solid var(--webexpo-floating-edge);
	background: none;
}

.webexpo-chat-floating__heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.webexpo-chat-floating .webexpo-chat-floating__title {
	margin: 0;
	padding: 0;
	color: var(--webexpo-floating-text);
	font-family: inherit;
	font-size: 20px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.webexpo-chat-floating .webexpo-chat-floating__subtitle {
	margin: 0;
	color: var(--webexpo-floating-muted);
	font-size: 13px;
	line-height: 1.4;
}

.webexpo-chat-floating .webexpo-chat-floating__close {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--webexpo-floating-edge);
	border-radius: 0;
	background: var(--webexpo-floating-raised);
	color: var(--webexpo-floating-text);
	cursor: pointer;
	appearance: none;
}

.webexpo-chat-floating .webexpo-chat-floating__close:hover {
	border-color: var(--webexpo-floating-accent);
}

.webexpo-chat-floating__notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 8px;
	padding: 8px 16px;
	background: var(--webexpo-floating-surface);
	font-size: 13px;
	line-height: 1.35;
}

.webexpo-chat-floating__notice[hidden] {
	display: none;
}

.webexpo-chat-floating__notice-text {
	color: var(--webexpo-floating-highlight);
	font-weight: 600;
}

.webexpo-chat-floating .webexpo-chat-floating__jump,
.webexpo-chat-floating .webexpo-chat-floating__fallback a {
	color: var(--webexpo-floating-link);
	text-decoration: underline;
	text-underline-offset: 0.16em;
}

/* Thread: question bubbles and answers, newest last, with the status region at the end. */
.webexpo-chat-floating__thread {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 16px;
	min-height: 0;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.webexpo-chat-floating__turn {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.webexpo-chat-floating .webexpo-chat-floating__question {
	align-self: flex-end;
	max-width: 85%;
	margin: 0;
	padding: 10px 14px;
	border: 1px solid var(--webexpo-floating-edge);
	background: var(--webexpo-floating-raised);
	color: var(--webexpo-floating-text);
	font-size: 15px;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.webexpo-chat-floating .webexpo-chat-support-chat__answer {
	max-width: none;
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
}

.webexpo-chat-floating .webexpo-chat-support-chat__answer-paragraph,
.webexpo-chat-floating .webexpo-chat-support-chat__answer-list {
	margin: 0 0 10px;
}

.webexpo-chat-floating .webexpo-chat-support-chat__answer > :last-child {
	margin-bottom: 0;
}

.webexpo-chat-floating .webexpo-chat-support-chat__answer-link,
.webexpo-chat-floating .webexpo-chat-support-chat__source-link,
.webexpo-chat-floating .webexpo-chat-super-support__result-title[href] {
	color: var(--webexpo-floating-link);
}

.webexpo-chat-floating .webexpo-chat-support-chat__answer-link:hover,
.webexpo-chat-floating .webexpo-chat-support-chat__source-link:hover,
.webexpo-chat-floating .webexpo-chat-super-support__result-title[href]:hover {
	color: var(--webexpo-floating-link);
	text-decoration: none;
}

.webexpo-chat-floating .webexpo-chat-floating__note--error {
	color: var(--webexpo-floating-text);
	font-weight: 600;
}

.webexpo-chat-floating .webexpo-chat-support-chat__sources,
.webexpo-chat-floating .webexpo-chat-super-support__results {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 12px 0 0;
	padding-top: 10px;
	border-top: 1px solid var(--webexpo-floating-edge);
	font-size: 14px;
}

.webexpo-chat-floating .webexpo-chat-support-chat__sources-heading {
	margin: 0;
	color: var(--webexpo-floating-subtle);
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.webexpo-chat-floating .webexpo-chat-support-chat__source-list,
.webexpo-chat-floating .webexpo-chat-super-support__result-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.webexpo-chat-floating .webexpo-chat-super-support__result {
	display: flex;
	flex-direction: column;
	margin: 0;
}

.webexpo-chat-floating .webexpo-chat-super-support__result-speaker {
	color: var(--webexpo-floating-muted);
	font-size: 13px;
}

.webexpo-chat-floating .webexpo-chat-super-support__notice {
	border-left: 0;
	padding-left: 0;
}

/* Existing like/dislike feedback, sized for touch. */
.webexpo-chat-floating .webexpo-chat-feedback {
	justify-content: flex-start;
	margin: 12px 0 0;
	padding: 0;
	font-size: 13px;
	text-align: left;
}

.webexpo-chat-floating .webexpo-chat-feedback__label {
	color: var(--webexpo-floating-muted);
	font-weight: 400;
}

.webexpo-chat-floating .webexpo-chat-feedback__controls {
	justify-content: flex-start;
}

.webexpo-chat-floating .webexpo-chat-feedback__button {
	min-width: 44px;
	min-height: 32px;
	padding: 4px 10px;
	border-color: var(--webexpo-floating-edge);
	background: transparent;
	color: var(--webexpo-floating-text);
	font-size: 13px;
}

/* Status: the loading line with a three-square pulse; outcome messages are announced only. */
.webexpo-chat-floating .webexpo-chat-support-chat__status {
	margin: 0;
	padding: 0;
	color: var(--webexpo-floating-muted);
	font-size: 14px;
	line-height: 1.4;
}

.webexpo-chat-floating .webexpo-chat-support-chat__status--loading {
	display: flex;
	align-items: center;
	gap: 10px;
}

.webexpo-chat-floating .webexpo-chat-support-chat__status--loading::before {
	content: "";
	flex: none;
	width: 8px;
	height: 8px;
	margin-right: 24px;
	animation: webexpo-floating-pulse 1.2s steps(1, end) infinite;
}

@keyframes webexpo-floating-pulse {
	0% {
		background: var(--webexpo-floating-accent);
		box-shadow: 12px 0 0 color-mix(in srgb, var(--webexpo-floating-accent) 30%, transparent), 24px 0 0 color-mix(in srgb, var(--webexpo-floating-accent) 30%, transparent);
	}

	33% {
		background: color-mix(in srgb, var(--webexpo-floating-accent) 30%, transparent);
		box-shadow: 12px 0 0 var(--webexpo-floating-accent), 24px 0 0 color-mix(in srgb, var(--webexpo-floating-accent) 30%, transparent);
	}

	66% {
		background: color-mix(in srgb, var(--webexpo-floating-accent) 30%, transparent);
		box-shadow: 12px 0 0 color-mix(in srgb, var(--webexpo-floating-accent) 30%, transparent), 24px 0 0 var(--webexpo-floating-accent);
	}
}

.webexpo-chat-floating .webexpo-chat-support-chat__status--warning {
	color: var(--webexpo-floating-text);
}

.webexpo-chat-floating .webexpo-chat-support-chat__status--announce {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Prompt chips. */
.webexpo-chat-floating .webexpo-chat-support-chat__prompts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 10px 16px 0;
}

.webexpo-chat-floating .webexpo-chat-support-chat__prompts[hidden] {
	display: none;
}

.webexpo-chat-floating .webexpo-chat-support-chat__prompt {
	width: auto;
	height: auto;
	min-height: 36px;
	padding: 7px 10px;
	border: 1px solid var(--webexpo-floating-accent);
	border-radius: 0;
	background: transparent;
	color: var(--webexpo-floating-text);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
}

.webexpo-chat-floating .webexpo-chat-support-chat__prompt:hover,
.webexpo-chat-floating .webexpo-chat-support-chat__prompt:focus-visible {
	background: color-mix(in srgb, var(--webexpo-floating-accent) 14%, transparent);
	border-color: var(--webexpo-floating-accent);
	color: var(--webexpo-floating-text);
}

/* Once there is a conversation, the chips share one scrolling row so the thread keeps its height. */
.webexpo-chat-floating .has-thread .webexpo-chat-support-chat__prompts {
	flex-wrap: nowrap;
	overflow-x: auto;
	padding-bottom: 4px;
	scrollbar-width: thin;
}

.webexpo-chat-floating .has-thread .webexpo-chat-support-chat__prompt {
	flex: none;
	white-space: nowrap;
}

/* Single-line input row. */
.webexpo-chat-floating .webexpo-chat-support-chat__form {
	display: flex;
	gap: 0;
	margin: 0;
	padding: 12px 16px 12px;
}

.webexpo-chat-floating .webexpo-chat-support-chat__query {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	height: 48px;
	min-height: 0;
	margin: 0;
	padding: 0 12px;
	border: 1px solid var(--webexpo-floating-edge);
	border-right: 0;
	border-radius: 0;
	background: var(--webexpo-floating-surface);
	color: var(--webexpo-floating-text);
	font-family: inherit;
	font-size: 15px;
	line-height: normal;
}

.webexpo-chat-floating .webexpo-chat-support-chat__query:focus {
	border-color: var(--webexpo-floating-accent);
}

.webexpo-chat-floating .webexpo-chat-support-chat__submit {
	flex: none;
	width: auto;
	height: 48px;
	min-height: 0;
	margin: 0;
	padding: 0 20px;
	border: 0;
	border-radius: 0;
	background: var(--webexpo-floating-action);
	color: var(--webexpo-floating-on-accent);
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
}

.webexpo-chat-floating .webexpo-chat-support-chat__submit:hover,
.webexpo-chat-floating .webexpo-chat-support-chat__submit:focus-visible {
	background: var(--webexpo-floating-accent);
	color: var(--webexpo-floating-on-accent);
}

.webexpo-chat-floating .webexpo-chat-floating__fallback {
	margin: 0;
	padding: 0 16px 14px;
	color: var(--webexpo-floating-muted);
	font-size: 13px;
	line-height: 1.4;
}

/* Phones: the panel becomes a modal bottom sheet. */
@media (max-width: 781px) {
	.webexpo-chat-floating {
		--webexpo-floating-gap: 16px;
	}

	/* Title only, so the launcher doesn't become a full-width bar over the page. */
	.webexpo-chat-floating .webexpo-chat-floating__launcher {
		padding-right: 20px;
	}

	.webexpo-chat-floating__launcher-text {
		display: none;
	}

	.webexpo-chat-floating .webexpo-chat-floating__panel {
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		max-width: none;
		height: 85vh;
		border: 0;
		border-top: 4px solid var(--webexpo-floating-accent);
		animation-name: webexpo-floating-sheet-in;
	}

	@supports (height: 100dvh) {
		.webexpo-chat-floating .webexpo-chat-floating__panel {
			height: 85dvh;
		}
	}

	.webexpo-chat-floating__grab {
		display: block;
		flex: none;
		width: 40px;
		height: 4px;
		margin: 8px auto 0;
		background: var(--webexpo-floating-edge);
	}

	.webexpo-chat-floating .webexpo-chat-floating__header {
		padding-top: 8px;
	}

	.webexpo-chat-floating .webexpo-chat-support-chat__prompts {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.webexpo-chat-floating .webexpo-chat-support-chat__prompt {
		flex: none;
		white-space: nowrap;
	}

	/* 16px stops iOS zooming into the field. */
	.webexpo-chat-floating .webexpo-chat-support-chat__query {
		font-size: 16px;
	}

	.webexpo-chat-floating .webexpo-chat-floating__fallback {
		padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	}

	html.webexpo-chat-floating-locked,
	html.webexpo-chat-floating-locked body {
		overflow: hidden;
	}
}

@keyframes webexpo-floating-sheet-in {
	from {
		opacity: 0;
		transform: translateY(24px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.webexpo-chat-floating .webexpo-chat-floating__panel,
	.webexpo-chat-floating .webexpo-chat-support-chat__prompt {
		animation: none;
	}

	.webexpo-chat-floating .webexpo-chat-support-chat__status--loading::before {
		animation: none;
		background: var(--webexpo-floating-accent);
		box-shadow: 12px 0 0 var(--webexpo-floating-accent), 24px 0 0 var(--webexpo-floating-accent);
	}
}
