/*
 * GreenTangelo Assistant: CityBook look.
 *
 * The launcher copies CityBook's own chat button: a 40px square with a soft
 * white ring, in the same column as the theme's back-to-top button
 * (.to-top: right 50px, bottom 60px) and stacked above it, so the two never
 * overlap. The accent comes from the theme's `theme-color` (printed inline by
 * the plugin); the values below are the GreenTangelo defaults. Every rule is
 * scoped to .gt-assistant and sets the properties the theme styles globally
 * (p, a, button, textarea, :focus) so neither side leaks into the other.
 */
.gt-assistant {
	--gt-assistant-accent: #319033;      /* theme-color */
	--gt-assistant-accent-text: #2b7f2d; /* theme-color darkened for white text and links (4.5:1+) */
	--gt-assistant-navy: #2c3b5a;        /* CityBook dark (to-top hover) */
	--gt-assistant-heading: #334e6f;     /* CityBook heading colour */
	--gt-assistant-muted: #566985;
	--gt-assistant-surface: #f6f7fb;
	--gt-assistant-border: #e5e7f2;
	--gt-assistant-danger: #b3261e;
	bottom: 120px;
	color: var(--gt-assistant-heading);
	font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	position: fixed;
	right: 50px;
	text-align: left;
	z-index: 116; /* same layer as .to-top; below the theme's modals */
}
.gt-assistant--left {
	bottom: 60px;
	left: 50px;
	right: auto;
}
.gt-assistant *,
.gt-assistant *::before,
.gt-assistant *::after {
	box-sizing: border-box;
}
.gt-assistant p {
	color: inherit;
	font-size: inherit;
	font-weight: 500;
	line-height: 1.5;
	margin: 0;
	padding: 0;
}
.gt-assistant a {
	color: var(--gt-assistant-accent-text);
	font-weight: 600;
	position: static;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.gt-assistant a:hover {
	color: var(--gt-assistant-navy);
}
.gt-assistant button {
	cursor: pointer;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
}
.gt-assistant svg {
	fill: currentColor;
}

/* Launcher ------------------------------------------------------------- */
.gt-assistant__launcher {
	align-items: center;
	background: var(--gt-assistant-accent);
	border: 0;
	border-radius: 3px;
	box-shadow: 0 0 0 7px rgba(255, 255, 255, .2);
	color: #fff;
	display: flex;
	height: 40px;
	justify-content: center;
	margin: 0;
	padding: 0;
	position: relative;
	width: 40px;
}
.gt-assistant__launcher:hover,
.gt-assistant__launcher[aria-expanded="true"] {
	background: var(--gt-assistant-navy);
}
.gt-assistant__icon {
	height: 20px;
	width: 20px;
}
.gt-assistant__icon--close,
.gt-assistant__launcher[aria-expanded="true"] .gt-assistant__icon--chat {
	display: none;
}
.gt-assistant__launcher[aria-expanded="true"] .gt-assistant__icon--close {
	display: block;
}
/* The label is the button's accessible name; it shows as CityBook's
   tooltip on hover or keyboard focus and is visually hidden otherwise. */
.gt-assistant__launcher-label {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}
.gt-assistant__launcher:focus-visible .gt-assistant__launcher-label {
	background: var(--gt-assistant-navy);
	border-radius: 3px;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .2);
	clip: auto;
	clip-path: none;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	height: 40px;
	line-height: 40px;
	overflow: visible;
	padding: 0 14px;
	right: calc(100% + 12px);
	top: 0;
	width: auto;
}
.gt-assistant--left .gt-assistant__launcher:focus-visible .gt-assistant__launcher-label {
	left: calc(100% + 12px);
	right: auto;
}
/* Hover tooltip only where hover is real (a tap must not leave it stuck). */
@media (hover: hover) {
	.gt-assistant__launcher[aria-expanded="false"]:hover .gt-assistant__launcher-label {
		background: var(--gt-assistant-navy);
		border-radius: 3px;
		box-shadow: 0 0 0 2px rgba(255, 255, 255, .2);
		clip: auto;
		clip-path: none;
		color: #fff;
		font-size: 12px;
		font-weight: 600;
		height: 40px;
		line-height: 40px;
		overflow: visible;
		padding: 0 14px;
		right: calc(100% + 12px);
		top: 0;
		width: auto;
	}
	.gt-assistant--left .gt-assistant__launcher[aria-expanded="false"]:hover .gt-assistant__launcher-label {
		left: calc(100% + 12px);
		right: auto;
	}
}

/* Panel ---------------------------------------------------------------- */
.gt-assistant__dialog {
	background: #fff;
	border-radius: 6px;
	bottom: 60px; /* above the launcher, as CityBook's chat window */
	box-shadow: 0 0 80px rgba(0, 0, 0, .2);
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 276px); /* stays below the 80px fixed header */
	max-height: min(34rem, calc(100dvh - 276px));
	max-width: calc(100vw - 32px);
	overflow: hidden;
	position: absolute;
	right: 0;
	width: 340px;
}
.gt-assistant--left .gt-assistant__dialog {
	left: 0;
	right: auto;
}
.gt-assistant__dialog[hidden] {
	display: none;
}
.gt-assistant__header {
	align-items: center;
	background: var(--gt-assistant-accent-text);
	color: #fff;
	display: flex;
	flex: none;
	gap: 8px;
	justify-content: space-between;
	padding: 10px 10px 10px 16px;
}
.gt-assistant__title {
	color: #fff;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
	padding: 0;
	text-transform: none;
}
.gt-assistant__close {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 3px;
	color: #fff;
	display: flex;
	flex: none;
	height: 36px;
	justify-content: center;
	margin: 0;
	padding: 0;
	width: 36px;
}
.gt-assistant__close:hover {
	background: rgba(0, 0, 0, .18);
}
.gt-assistant__close svg {
	height: 20px;
	width: 20px;
}
.gt-assistant__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	min-height: 9rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 12px 14px;
}
.gt-assistant .gt-assistant__privacy {
	background: var(--gt-assistant-surface);
	border-left: 3px solid var(--gt-assistant-accent);
	border-radius: 3px;
	color: var(--gt-assistant-muted);
	font-size: 12px;
	padding: 8px 10px;
}
.gt-assistant__messages {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.gt-assistant__message {
	border-radius: 6px;
	max-width: 92%;
	padding: 9px 12px;
	word-wrap: break-word;
}
.gt-assistant__message p {
	white-space: pre-line; /* answers use line breaks for steps and lists */
}
.gt-assistant__message strong {
	display: block;
	font-size: 12px;
	font-weight: 700;
	margin-bottom: 2px;
}
.gt-assistant__message--assistant {
	align-self: flex-start;
	background: var(--gt-assistant-surface);
	color: var(--gt-assistant-heading);
}
.gt-assistant__message--user {
	align-self: flex-end;
	background: var(--gt-assistant-accent-text);
	color: #fff;
}
.gt-assistant__message--user strong {
	color: #fff;
}
.gt-assistant__links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin-top: 6px;
}
.gt-assistant__links a {
	display: inline-block;
	padding: 3px 0; /* at least 24px tall touch targets */
}

/* Form ----------------------------------------------------------------- */
.gt-assistant__form {
	border-top: 1px solid var(--gt-assistant-border);
	flex: none;
	margin: 0;
	padding: 10px 14px 6px;
}
.gt-assistant__label {
	color: var(--gt-assistant-heading);
	display: block;
	font-size: 13px;
	font-weight: 700;
	margin: 0 0 4px;
}
.gt-assistant__row {
	align-items: stretch;
	display: flex;
	gap: 8px;
}
.gt-assistant__input {
	background: #fff;
	border: 1px solid #8a93ab; /* 3:1 so the field's edge is visible */
	border-radius: 6px;
	color: #333;
	flex: 1 1 auto;
	font-family: inherit;
	font-size: 16px; /* 16px stops mobile browsers zooming in on focus */
	line-height: 1.4;
	margin: 0;
	max-height: 8rem;
	min-height: 44px;
	min-width: 0;
	padding: 8px 10px;
	resize: vertical;
	width: auto;
}
.gt-assistant__send {
	background: var(--gt-assistant-accent-text);
	border: 0;
	border-radius: 6px;
	color: #fff;
	flex: none;
	font-size: 14px;
	font-weight: 600;
	margin: 0;
	min-height: 44px;
	padding: 0 16px;
}
.gt-assistant__send:hover {
	background: var(--gt-assistant-navy);
}
.gt-assistant__send:disabled {
	cursor: wait;
	opacity: .65;
}
.gt-assistant__hint {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}
.gt-assistant__actions {
	align-items: center;
	display: flex;
	flex: none;
	flex-wrap: wrap;
	font-size: 12px;
	gap: 4px 12px;
	justify-content: space-between;
	padding: 4px 14px 12px;
}
.gt-assistant__delete {
	background: transparent;
	border: 0;
	color: var(--gt-assistant-danger);
	font-size: 12px;
	font-weight: 600;
	margin: 0;
	padding: 4px 0;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Focus: the theme removes outlines globally (:focus { outline: 0 }). */
.gt-assistant a:focus-visible,
.gt-assistant button:focus-visible,
.gt-assistant textarea:focus-visible {
	outline: 3px solid var(--gt-assistant-navy);
	outline-offset: 2px;
}
.gt-assistant__launcher:focus-visible {
	box-shadow: 0 0 0 3px #fff; /* white gap keeps the ring visible on dark footers */
	outline-offset: 3px;
}
.gt-assistant__header button:focus-visible {
	outline-color: #fff;
	outline-offset: -3px;
}
.gt-assistant__input:focus {
	border-color: var(--gt-assistant-accent-text);
}

/* Short windows (640px tall or less): the panel drops to the bottom corner
   so it has the full height. Phones (480px wide or less, so 360px phones):
   it also spans the width as a bottom sheet with 8px gutters. Either way it
   covers the launcher and back-to-top only while open, and closes with the
   × button or Escape. */
@media (max-width: 30rem), (max-height: 40rem) {
	.gt-assistant__dialog {
		bottom: 8px;
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
		position: fixed;
		right: 8px;
	}
	.gt-assistant--left .gt-assistant__dialog {
		left: 8px;
		right: auto;
	}
	.gt-assistant__body {
		min-height: 7rem;
	}
}
@media (max-width: 30rem) {
	.gt-assistant__dialog,
	.gt-assistant--left .gt-assistant__dialog {
		left: 8px;
		max-width: none;
		right: 8px;
		width: auto;
	}
}

@media (forced-colors: active) {
	.gt-assistant__launcher,
	.gt-assistant__send,
	.gt-assistant__dialog {
		border: 2px solid ButtonText;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gt-assistant *,
	.gt-assistant *::before,
	.gt-assistant *::after {
		animation: none !important;
		scroll-behavior: auto !important;
		transition: none !important;
	}
}
