/* Tuonetti AI chat ("Aloita tästä"): the full-screen chat page. The site's tokens (design/site/site.css :root) with
   fallbacks; navy ground with slow drifting blue glows (still under prefers-reduced-motion), the quiet line grid
   standing still on the right, white bot bubbles, blue visitor bubbles. No orange: its three places are fixed. No
   element rests at an opacity below 1 (the site's a11y check reads that as an animation that never ran): the glows'
   strength is in their colours. */

html.tt-chat-open,
html.tt-chat-open body,
body.tt-chat-page {
	overflow: hidden;
}

.tt-chat {
	--c-blue: var(--tuonetti-blue, #365CF6);
	--c-blue-light: var(--tuonetti-blue-light, #6A86FA);
	--c-navy: var(--tuonetti-navy, #011763);
	--c-ink: #000B3D;
	--c-white: var(--tuonetti-white, #FFFFFF);
	--c-text: var(--tuonetti-text-strong, #253237);
	--c-body: var(--tuonetti-text, #535454);
	--c-on-dark: var(--tuonetti-on-dark, #C5CDEB);
	--c-accent-dark: var(--tuonetti-accent-on-dark, #8FA6FF);
	--c-bg-light: var(--tuonetti-bg-light, #F5F7FF);
	--c-border: var(--tuonetti-border, #E3E8FA);
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	position: fixed;
	inset: 0;
	z-index: 9000;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	color: var(--c-white);
	background: var(--c-navy);
	font-family: var(--tuonetti-font, 'Aeonik', system-ui, -apple-system, 'Segoe UI', sans-serif);
	font-size: 17px;
	line-height: 1.6;
	isolation: isolate;
	overflow: hidden;
	/* clip, not just hidden: a hidden box can still be scrolled by a script or scrollIntoView, which slid the whole
	   chat up when the summary card appeared. */
	overflow: clip;
}

.admin-bar .tt-chat {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .tt-chat {
		top: 46px;
	}
}

/* Background: three soft glows that drift very slowly, and the line grid on the right. */
.tt-chat__bg {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	background:
		radial-gradient(120% 80% at 50% 0%, rgba(54, 92, 246, 0.28) 0%, rgba(1, 23, 99, 0) 60%),
		linear-gradient(180deg, #011763 0%, #00103F 100%);
}

.tt-chat__glow {
	position: absolute;
	border-radius: 50%;
	filter: blur(60px);
	will-change: transform;
}

.tt-chat__glow--a {
	width: 62vmax;
	height: 62vmax;
	left: -22vmax;
	top: -18vmax;
	background: radial-gradient(circle, rgba(54, 92, 246, 0.55) 0%, rgba(54, 92, 246, 0) 68%);
	animation: tt-chat-drift-a 38s ease-in-out infinite alternate;
}

.tt-chat__glow--b {
	width: 54vmax;
	height: 54vmax;
	right: -20vmax;
	bottom: -22vmax;
	background: radial-gradient(circle, rgba(106, 134, 250, 0.42) 0%, rgba(106, 134, 250, 0) 66%);
	animation: tt-chat-drift-b 46s ease-in-out infinite alternate;
}

.tt-chat__glow--c {
	width: 34vmax;
	height: 34vmax;
	right: 8vmax;
	top: 6vmax;
	background: radial-gradient(circle, rgba(143, 166, 255, 0.22) 0%, rgba(143, 166, 255, 0) 70%);
	animation: tt-chat-drift-c 30s ease-in-out infinite alternate;
}

.tt-chat__grid {
	position: absolute;
	top: 0;
	right: 0;
	width: 46vw;
	height: 100%;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
	background-size: 48px 48px;
	-webkit-mask-image: radial-gradient(60% 55% at 85% 45%, #000 0%, transparent 100%);
	mask-image: radial-gradient(60% 55% at 85% 45%, #000 0%, transparent 100%);
}

@keyframes tt-chat-drift-a {
	from { transform: translate3d(0, 0, 0) scale(1); }
	to { transform: translate3d(14vmax, 10vmax, 0) scale(1.12); }
}

@keyframes tt-chat-drift-b {
	from { transform: translate3d(0, 0, 0) scale(1.05); }
	to { transform: translate3d(-12vmax, -8vmax, 0) scale(0.92); }
}

@keyframes tt-chat-drift-c {
	from { transform: translate3d(0, 0, 0); }
	to { transform: translate3d(-10vmax, 12vmax, 0); }
}

/* Top bar */
.tt-chat__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 40px;
}

.tt-chat__logo {
	display: inline-flex;
	border-radius: 8px;
}

.tt-chat__logo img {
	display: block;
	width: 146px;
	height: auto;
}

.tt-chat__close {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: var(--c-white);
	background: rgba(255, 255, 255, 0.1);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
	transition: background-color 0.2s var(--ease);
}

.tt-chat__close svg {
	width: 22px;
	height: 22px;
}

.tt-chat__close:hover {
	background: rgba(255, 255, 255, 0.2);
}

.tt-chat a:focus-visible,
.tt-chat button:focus-visible,
.tt-chat textarea:focus-visible {
	outline: 3px solid var(--c-white);
	outline-offset: 3px;
}

/* The scrolling column */
.tt-chat__scroll {
	position: relative;
	overflow-y: auto;
	overscroll-behavior: contain;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.tt-chat__column {
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	padding: 24px 24px 40px;
}

.tt-chat__intro {
	display: grid;
	justify-items: center;
	gap: 14px;
	margin: 4vh 0 40px;
	text-align: center;
}

.tt-chat__badge {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	border-radius: 20px;
	color: var(--c-white);
	background: linear-gradient(145deg, rgba(106, 134, 250, 0.55), rgba(54, 92, 246, 0.25));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 18px 50px rgba(54, 92, 246, 0.45);
}

.tt-chat__badge svg {
	width: 32px;
	height: 32px;
}

.tt-chat__badge .tuonetti-icon__accent,
.tt-chat__avatar .tuonetti-icon__accent {
	stroke: var(--c-accent-dark);
}

/* His portrait with the AI badge on its corner: the chat is his assistant (critique of 20 November 2026). */
.tt-chat__person {
	position: relative;
	display: inline-block;
}

.tt-chat__portrait {
	display: block;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 0 0 3px var(--c-white), 0 18px 50px rgba(54, 92, 246, 0.45);
}

.tt-chat__badge--on-portrait {
	position: absolute;
	right: -10px;
	bottom: -6px;
	width: 32px;
	height: 32px;
	border-radius: 10px;
	background: var(--c-blue);
}

.tt-chat__badge--on-portrait svg {
	width: 18px;
	height: 18px;
}

.tt-chat__title {
	margin: 0;
	color: var(--c-white);
	font-size: 56px;
	font-weight: 900;
	line-height: 1.03;
	letter-spacing: -0.03em;
}

.tt-chat__lead {
	max-width: 34em;
	margin: 0;
	color: var(--c-on-dark);
	font-size: 18px;
}

/* What happens next, in three steps, and the plain form for those who prefer it (critique of 20 November 2026). */
.tt-chat__steps {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	width: fit-content;
	margin: 4px auto 0;
	text-align: left;
	padding: 0;
	list-style: none;
	color: var(--c-on-dark);
	font-size: 15px;
}

.tt-chat__steps li {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tt-chat__step-n {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: rgba(143, 166, 255, 0.2);
	color: var(--c-white);
	font-size: 13px;
	font-weight: 700;
}

.tt-chat__alt {
	margin: 0;
	color: var(--c-on-dark);
	font-size: 15px;
}

.tt-chat__alt a {
	color: var(--c-white);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* "En tiedä vielä" / "Not sure yet" is the way out of the quick replies, so it looks quieter than the topics. */
.tt-chat__choices .tt-chat__choice:last-child:not(:hover) {
	background: transparent;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
	font-weight: 500;
}

/* Messages */
.tt-chat__log {
	display: grid;
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tt-chat__log--after {
	margin-top: 20px;
}

.tt-chat__log--after:empty {
	display: none;
}

.tt-chat__msg {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	margin: 0;
	animation: tt-chat-in 0.42s var(--ease) both;
}

.tt-chat__msg--me {
	justify-content: flex-end;
}

.tt-chat__avatar {
	flex: none;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 12px;
	color: var(--c-white);
	background: rgba(255, 255, 255, 0.12);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.tt-chat__avatar svg {
	width: 20px;
	height: 20px;
}

.tt-chat__bubble {
	max-width: min(560px, 82%);
	padding: 14px 18px;
	border-radius: 18px;
	overflow-wrap: anywhere;
	white-space: pre-line;
}

.tt-chat__msg--bot .tt-chat__bubble {
	color: var(--c-text);
	background: var(--c-white);
	border-bottom-left-radius: 6px;
	box-shadow: 0 18px 48px rgba(0, 8, 48, 0.28);
}

.tt-chat__msg--me .tt-chat__bubble {
	color: var(--c-white);
	background: var(--c-blue);
	border-bottom-right-radius: 6px;
	box-shadow: 0 14px 40px rgba(0, 8, 48, 0.3);
}

.tt-chat__msg--error .tt-chat__bubble {
	box-shadow: inset 0 0 0 2px var(--c-blue-light), 0 18px 48px rgba(0, 8, 48, 0.28);
}

.tt-chat__bubble a {
	color: var(--c-blue);
	font-weight: 700;
}

.tt-chat__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.tt-chat__mini {
	min-height: 40px;
	padding: 8px 16px;
	border: 0;
	border-radius: 12px;
	color: var(--c-white);
	background: var(--c-blue);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
}

.tt-chat__mini:hover {
	background: var(--c-navy);
}

.tt-chat__mini--link {
	color: var(--c-blue);
	background: var(--c-bg-light);
}

.tt-chat__mini--link:hover {
	color: var(--c-navy);
	background: var(--c-border);
}

/* Typing indicator */
.tt-chat__dots {
	display: inline-flex;
	gap: 5px;
	padding: 6px 2px;
}

.tt-chat__dots span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--c-blue-light);
	animation: tt-chat-dot 1.2s ease-in-out infinite;
}

.tt-chat__dots span:nth-child(2) {
	animation-delay: 0.15s;
}

.tt-chat__dots span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes tt-chat-dot {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
	30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes tt-chat-in {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

/* Quick replies */
.tt-chat__choices {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0 0 48px;
	animation: tt-chat-in 0.42s var(--ease) both;
}

.tt-chat__choices[hidden] {
	display: none;
}

.tt-chat__choice {
	min-height: 44px;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	color: var(--c-white);
	background: rgba(255, 255, 255, 0.1);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	cursor: pointer;
	transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.tt-chat__choice:hover {
	color: var(--c-navy);
	background: var(--c-white);
}

.tt-chat__choice:active {
	transform: scale(0.97);
}

.tt-chat__status,
.tt-chat__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* The quote card: out of sight (but rendered, so the form's Turnstile loads) until the summary is ready. */
.tt-chat__quote[data-state='waiting'] {
	position: fixed;
	left: -10000px;
	top: 0;
	width: 700px;
	visibility: hidden;
}

.tt-chat__quote[data-state='ready'] {
	position: relative;
	scroll-margin-top: 16px;
	margin: 28px 0 0 48px;
	padding: 32px;
	border-radius: 24px;
	color: var(--c-body);
	background: var(--c-white);
	box-shadow: 0 30px 80px rgba(0, 8, 48, 0.4);
	animation: tt-chat-in 0.5s var(--ease) both;
}

.tt-chat__quote-title {
	margin: 0 0 6px;
	color: var(--c-navy);
	font-size: 28px;
	font-weight: 900;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.tt-chat__quote-lead {
	margin: 0 0 20px;
	font-size: 16px;
}

.tt-chat__summary {
	padding: 18px 20px;
	border-radius: 14px;
	color: var(--c-text);
	background: var(--c-bg-light);
	box-shadow: inset 0 0 0 1px var(--c-border);
	white-space: pre-line;
	font-size: 16px;
}

.tt-chat__summary-line {
	margin: 0;
}

.tt-chat__summary-line + .tt-chat__summary-line {
	margin-top: 6px;
}

.tt-chat__summary-line strong {
	color: var(--c-navy);
	font-weight: 700;
}

.tt-chat__services-title {
	margin: 24px 0 10px;
	color: var(--c-navy);
	font-size: 16px;
	font-weight: 900;
}

.tt-chat__services {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tt-chat__services[hidden],
.tt-chat__services-title[hidden] {
	display: none;
}

.tt-chat__service {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 16px;
	border-radius: 12px;
	color: var(--c-navy);
	background: var(--c-white);
	box-shadow: inset 0 0 0 1px var(--tuonetti-border-strong, #CBD5F6);
	font-weight: 700;
	text-decoration: none;
	transition: background-color 0.2s var(--ease);
}

.tt-chat__service:hover {
	background: var(--c-bg-light);
}

.tt-chat__service svg {
	width: 18px;
	height: 18px;
	color: var(--c-blue);
}

/* A card's name and, for a service sold at a listed price, its starting price under it (26 Nov 2026). */
.tt-chat__service-text {
	display: inline-flex;
	flex-direction: column;
	gap: 2px;
	padding: 2px 0;
}

.tt-chat__service-price {
	color: var(--c-body);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
}

/* The summary as a text field ("Muokkaa yhteenvetoa"): what the visitor writes is what the ticket gets. */
.tt-chat__edit {
	margin-top: 10px;
	color: var(--c-navy);
}

.tt-chat__edit[hidden] {
	display: none;
}

.tt-chat__summary-edit {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid var(--tuonetti-field-border, #7788C4);
	border-radius: 10px;
	color: var(--c-text);
	background: var(--c-white);
	font: inherit;
	font-size: 16px;
	line-height: 1.5;
	white-space: pre-wrap;
	resize: vertical;
}

.tt-chat__summary-edit:focus-visible {
	outline: 3px solid var(--c-blue);
	outline-offset: 2px;
}

/* Service cards in the conversation, under the reply that names them (aligned with the quick replies). */
.tt-chat__cards {
	margin: -8px 0 0 48px;
	animation: tt-chat-in 0.42s var(--ease) both;
}

.tt-chat__cards .tt-chat__service {
	box-shadow: inset 0 0 0 1px var(--tuonetti-border-strong, #CBD5F6), 0 14px 36px rgba(0, 8, 48, 0.22);
}

/* The quote form's text field, filled from the summary: a textarea (it keeps the line breaks), never shown. */
.tt-chat__quote .tt-chat__hidden-field {
	display: none;
}

.tt-chat__form {
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid var(--c-border);
}

.tt-chat__done {
	margin: 0;
	color: var(--c-text);
	font-weight: 700;
}

/* The dock: the composer and the note */
.tt-chat__dock {
	position: relative;
	padding: 12px 24px 18px;
	background: linear-gradient(180deg, rgba(0, 16, 63, 0) 0%, rgba(0, 16, 63, 0.85) 38%);
}

.tt-chat__composer[hidden] {
	display: none;
}

.tt-chat__composer {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	max-width: 760px;
	margin: 0 auto;
	padding: 8px 8px 8px 20px;
	border-radius: 20px;
	background: var(--c-white);
	box-shadow: 0 20px 60px rgba(0, 8, 48, 0.45);
}

.tt-chat__input {
	flex: 1;
	min-height: 44px;
	max-height: 160px;
	padding: 10px 0;
	border: 0;
	outline: 0;
	resize: none;
	color: var(--c-text);
	background: transparent;
	font: inherit;
	font-size: 17px;
	line-height: 1.45;
}

.tt-chat__input::placeholder {
	color: #6B7280;
}

.tt-chat .tt-chat__input:focus-visible {
	outline: 0;
}

.tt-chat__composer:focus-within {
	box-shadow: 0 0 0 3px var(--c-blue-light), 0 20px 60px rgba(0, 8, 48, 0.45);
}

.tt-chat__send {
	flex: none;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 14px;
	color: var(--c-white);
	background: var(--c-blue);
	cursor: pointer;
	transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.tt-chat__send svg {
	width: 22px;
	height: 22px;
}

.tt-chat__send:hover {
	background: var(--c-navy);
}

.tt-chat__send:disabled {
	color: #5B6478;
	background: #E4E7EF;
	cursor: default;
}

.tt-chat__left {
	max-width: 760px;
	margin: 8px auto 0;
	color: var(--c-on-dark);
	font-size: 14px;
	text-align: center;
}

.tt-chat__note {
	max-width: 760px;
	margin: 10px auto 0;
	color: var(--c-on-dark);
	font-size: 13px;
	line-height: 1.5;
	text-align: center;
}

.tt-chat__note a {
	color: var(--c-white);
}

.tt-chat__turnstile:empty {
	display: none;
}

.tt-chat__turnstile {
	display: flex;
	justify-content: center;
	margin-top: 8px;
}

/* Without JavaScript the note takes the dock's place at the foot of the page (the dock is hidden by a <noscript> style;
   audit 20 November 2026, P2-7: as an absolute box it covered the composer). */
.tt-chat__noscript {
	position: relative;
	max-width: 760px;
	margin: 12px 24px 18px;
	padding: 16px;
	border-radius: 14px;
	color: var(--c-text);
	background: var(--c-white);
}

@media (min-width: 808px) {
	.tt-chat__noscript {
		margin-inline: auto;
	}
}

@media (max-width: 1023px) {
	.tt-chat__grid {
		display: none;
	}

	.tt-chat__title {
		font-size: 44px;
	}
}

@media (max-width: 767px) {
	.tt-chat__top {
		padding: 14px 20px;
	}

	.tt-chat__logo img {
		width: 124px;
	}

	.tt-chat__column {
		padding: 12px 16px 28px;
	}

	.tt-chat__intro {
		margin: 2vh 0 28px;
	}

	.tt-chat__badge {
		width: 52px;
		height: 52px;
		border-radius: 16px;
	}

	.tt-chat__badge--on-portrait {
		width: 28px;
		height: 28px;
		border-radius: 9px;
	}

	.tt-chat__portrait {
		width: 60px;
		height: 60px;
	}

	.tt-chat__steps {
		gap: 6px;
		font-size: 14px;
	}

	.tt-chat__title {
		font-size: 38px;
	}

	.tt-chat__lead {
		font-size: 16px;
	}

	.tt-chat__avatar {
		display: none;
	}

	.tt-chat__bubble {
		max-width: 88%;
		font-size: 16px;
	}

	.tt-chat__choices,
	.tt-chat__cards,
	.tt-chat__quote[data-state='ready'] {
		margin-left: 0;
	}

	.tt-chat__quote[data-state='ready'] {
		padding: 22px 18px;
	}

	.tt-chat__dock {
		padding: 8px 12px 12px;
	}

	.tt-chat__note {
		font-size: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tt-chat__glow,
	.tt-chat__msg,
	.tt-chat__cards,
	.tt-chat__choices,
	.tt-chat__quote[data-state='ready'],
	.tt-chat__dots span {
		animation: none;
	}

	.tt-chat__scroll {
		scroll-behavior: auto;
	}
}
