/* "Lively" contact / quote form (inc/form-lively.php, assets/js/form-lively.js). Loaded after the contact family
   (sol-svc.css, "WPForms Lite, restyled to the design") and, in the quote sheet's frame, before quote-sheet-frame.css.
   Everything hangs on `.cads-lively`, a class the script adds to the form: without the script none of this applies.
   Selectors carry `.wpforms-form.cads-lively` so they outrank the two stylesheets above in either order. */

.contact-form .wpforms-form.cads-lively {
	--lv-h: 48px;
	--lv-pt: 15px; /* WPForms pads every field 15px top and bottom; the label and icons are placed from the box's top edge */
	--lv-red: #c4303c;
}

/* ------------------------------------------------------------------ text fields: icon, floating label, tick */

.contact-form .wpforms-form.cads-lively .cads-lv-field {
	position: relative;
	padding-top: var(--lv-pt);
}

.contact-form .cads-lively .cads-lv-field--text input {
	height: var(--lv-h);
	padding: 14px 44px 0 44px;
	transition: border-color var(--motion-fast) var(--ease-morph), background-color var(--motion-fast) var(--ease-morph);
}

/* The real <label for>, lifted into the box: it sits where a placeholder would and floats up small. */
.contact-form .cads-lively .cads-lv-field > .wpforms-field-label {
	position: absolute;
	z-index: 1;
	top: calc(var(--lv-pt) + var(--lv-h) / 2);
	left: 44px;
	max-width: calc(100% - 88px);
	margin: 0;
	overflow: hidden;
	font: 400 14px/1.2 var(--font-body);
	letter-spacing: 0;
	text-overflow: ellipsis;
	text-transform: none;
	white-space: nowrap;
	color: var(--text-muted);
	pointer-events: none;
	transform: translateY(-50%);
	transform-origin: left center;
	transition: transform var(--motion) var(--ease-morph), color var(--motion-fast) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-field--area > .wpforms-field-label {
	left: 15px;
	max-width: calc(100% - 30px);
}

.contact-form .cads-lively .cads-lv-field.is-filled > .wpforms-field-label,
.contact-form .cads-lively .cads-lv-field:focus-within > .wpforms-field-label {
	font-weight: 600;
	color: var(--brand-dark);
	transform: translateY(calc(-50% - 11px)) scale(0.76);
}

.contact-form .cads-lively .cads-lv-field.is-invalid > .wpforms-field-label {
	color: var(--lv-red);
}

.contact-form .cads-lively .cads-lv-icon,
.contact-form .cads-lively .cads-lv-tick {
	position: absolute;
	top: calc(var(--lv-pt) + var(--lv-h) / 2);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	transform: translateY(-50%);
}

.contact-form .cads-lively .cads-lv-icon {
	left: 14px;
	color: var(--text-muted);
	transition: color var(--motion-fast) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-field:focus-within .cads-lv-icon,
.contact-form .cads-lively .cads-lv-field.is-valid .cads-lv-icon {
	color: var(--brand);
}

.contact-form .cads-lively .cads-lv-field.is-invalid .cads-lv-icon {
	color: var(--lv-red);
}

/* The valid tick pops in at the right of the box. */
.contact-form .cads-lively .cads-lv-tick {
	right: 12px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--brand);
	color: var(--text-invert);
	opacity: 0;
	transform: translateY(-50%) scale(0.4);
	transition: opacity var(--motion-fast) var(--ease-morph), transform var(--motion) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-tick .icon {
	width: 13px;
	height: 13px;
	stroke-width: 3;
}

.contact-form .cads-lively .cads-lv-field.is-valid .cads-lv-tick {
	opacity: 1;
	transform: translateY(-50%) scale(1);
}

/* Soft invalid, only after the visitor left the field. WPForms' own error line (red, below) wins over the hint. */
.contact-form .cads-lively .cads-lv-field.is-invalid input {
	border-color: #e3a3a8;
	background: #fffafa;
}

.contact-form .cads-lively .cads-lv-hint {
	margin: 6px 0 0;
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--lv-red);
}

.contact-form .cads-lively .cads-lv-hint:empty,
.contact-form .cads-lively .cads-lv-field:has(.wpforms-error:not(input)) .cads-lv-hint {
	display: none;
}

/* Browsers paint autofilled fields their own colour; the 1ms animation lets the script notice the fill. */
@keyframes cads-lv-autofill {
	from { opacity: 1; }
	to { opacity: 1; }
}

.contact-form .cads-lively input:-webkit-autofill {
	animation: cads-lv-autofill 1ms;
	-webkit-box-shadow: 0 0 0 40px var(--surface) inset;
	-webkit-text-fill-color: var(--text);
}

/* ------------------------------------------------------------------ message: floating label, auto-grow, quick chips */

.contact-form .cads-lively .cads-lv-field--area textarea {
	min-height: 120px;
	max-height: 360px;
	padding: 28px 14px 12px;
	overflow-y: auto;
	line-height: 1.5;
	resize: none;
}

/* The hint text shows once the label has floated out of the way. */
.contact-form .cads-lively .cads-lv-field--area textarea::placeholder {
	opacity: 0;
	transition: opacity var(--motion-fast) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-field--area textarea:focus::placeholder {
	opacity: 0.7;
}

.contact-form .cads-lively .cads-lv-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.contact-form .cads-lively .cads-lv-chip {
	padding: 6px 12px;
	border: 1px dashed var(--border-strong);
	border-radius: 999px;
	background: transparent;
	color: var(--text-muted);
	font: 500 12.5px/1.3 var(--font-body);
	cursor: pointer;
	transition: border-color var(--motion-fast) var(--ease-morph), color var(--motion-fast) var(--ease-morph), background-color var(--motion-fast) var(--ease-morph), transform var(--motion-fast) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-chip:hover {
	border-color: var(--brand);
	background: var(--brand-tint);
	color: var(--brand-dark);
}

.contact-form .cads-lively .cads-lv-chip:active {
	transform: scale(0.96);
}

/* ------------------------------------------------------------------ selects as cards (group) and chips (need) */

.contact-form .cads-lively .cads-lv-choicefield {
	position: relative;
	container-type: inline-size;
}

/* The real <select> stays in the form (value, validation, other scripts); only its look is gone. */
.contact-form .wpforms-form.cads-lively .cads-lv-native {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: hidden;
	opacity: 0;
	clip-path: inset(50%);
	pointer-events: none;
}

.contact-form .cads-lively .cads-lv-choice {
	display: grid;
	gap: 10px;
}

.contact-form .cads-lively .cads-lv-opt {
	position: relative;
	margin: 0;
	border: 1px solid var(--border-strong);
	background: var(--surface);
	color: var(--text);
	text-align: left;
	cursor: pointer;
	transition: border-color var(--motion-fast) var(--ease-morph), background-color var(--motion-fast) var(--ease-morph), color var(--motion-fast) var(--ease-morph), box-shadow var(--motion) var(--ease-morph), transform var(--motion) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-opt:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

/* Cards: the four product groups + "not sure". */
.contact-form .cads-lively .cads-lv-choice--cards {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	min-height: 88px;
	padding: 14px;
	border-radius: 10px;
	font: 700 14.5px/1.25 var(--font-head);
}

.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:last-child:nth-child(odd) {
	grid-column: 1 / -1;
	flex-direction: row;
	align-items: center;
	min-height: 0;
}

.contact-form .cads-lively .cads-lv-opt__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 38px;
	height: 38px;
	border-radius: 9px;
	background: var(--brand-tint);
	color: var(--brand-dark);
	transition: background-color var(--motion-fast) var(--ease-morph), color var(--motion-fast) var(--ease-morph), transform var(--motion) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-opt__icon .icon {
	width: 20px;
	height: 20px;
}

.contact-form .cads-lively .cads-lv-opt__badge {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--brand);
	color: var(--text-invert);
	opacity: 0;
	transform: scale(0.4);
	transition: opacity var(--motion-fast) var(--ease-morph), transform var(--motion) var(--ease-morph);
}

.contact-form .cads-lively .cads-lv-opt__badge .icon {
	width: 12px;
	height: 12px;
	stroke-width: 3;
}

.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:hover {
	border-color: var(--brand);
	box-shadow: 0 8px 20px rgba(11, 21, 18, 0.08);
	transform: translateY(-2px);
}

.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:hover .cads-lv-opt__icon {
	transform: scale(1.06);
}

.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt.is-on {
	border-color: var(--brand);
	background: var(--brand-tint);
	box-shadow: 0 0 0 1px var(--brand);
}

.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt.is-on .cads-lv-opt__icon {
	background: var(--brand);
	color: var(--text-invert);
}

.contact-form .cads-lively .cads-lv-opt.is-on .cads-lv-opt__badge {
	opacity: 1;
	transform: scale(1);
}

/* Chips: the need. */
.contact-form .cads-lively .cads-lv-choice--chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.contact-form .cads-lively .cads-lv-choice--chips .cads-lv-opt {
	padding: 9px 16px;
	border-radius: 999px;
	font: 500 13.5px/1.3 var(--font-body);
}

.contact-form .cads-lively .cads-lv-choice--chips .cads-lv-opt:hover {
	border-color: var(--brand);
	background: var(--brand-tint);
	color: var(--brand-dark);
}

.contact-form .cads-lively .cads-lv-choice--chips .cads-lv-opt.is-on {
	border-color: var(--brand);
	background: var(--brand);
	color: var(--text-invert);
}

/* Cards by the width of their own field (a full page column, or the narrower quote sheet). */
@container (min-width: 440px) {
	.contact-form .cads-lively .cads-lv-choice--cards {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}

	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt {
		grid-column: span 2;
	}

	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:nth-child(n + 4) {
		grid-column: span 3;
	}

	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:last-child:nth-child(odd) {
		grid-column: span 3;
		flex-direction: column;
		align-items: flex-start;
		min-height: 88px;
	}
}

@container (min-width: 640px) {
	.contact-form .cads-lively .cads-lv-choice--cards {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt,
	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:nth-child(n + 4),
	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:last-child:nth-child(odd) {
		grid-column: auto;
	}
}

/* ------------------------------------------------------------------ send button: arrow that nudges */

.contact-form .cads-lively .wpforms-submit {
	gap: 10px;
}

.contact-form .cads-lively .wpforms-submit::after {
	content: "";
	flex: none;
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform var(--motion) var(--ease-morph), opacity var(--motion-fast) var(--ease-morph);
}

.contact-form .cads-lively .wpforms-submit:hover::after,
.contact-form .cads-lively .wpforms-submit:focus-visible::after {
	transform: translateX(5px);
}

.contact-form .cads-lively .wpforms-submit:disabled::after {
	opacity: 0.4;
	transform: none;
}

/* ------------------------------------------------------------------ confirmation: a check circle that draws itself */

.contact-form .cads-lv-done {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 28px 24px;
	text-align: center;
}

.contact-form .cads-lv-done__mark {
	display: flex;
	color: var(--brand);
}

.contact-form .cads-lv-done__ring {
	stroke-dasharray: 145;
	stroke-dashoffset: 145;
	animation: cads-lv-draw 600ms var(--ease-morph) forwards;
}

.contact-form .cads-lv-done__tick {
	stroke-dasharray: 36;
	stroke-dashoffset: 36;
	animation: cads-lv-draw 360ms var(--ease-morph) 420ms forwards;
}

@keyframes cads-lv-draw {
	to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.contact-form .cads-lively .cads-lv-field > .wpforms-field-label,
	.contact-form .cads-lively .cads-lv-icon,
	.contact-form .cads-lively .cads-lv-tick,
	.contact-form .cads-lively .cads-lv-chip,
	.contact-form .cads-lively .cads-lv-opt,
	.contact-form .cads-lively .cads-lv-opt__icon,
	.contact-form .cads-lively .cads-lv-opt__badge,
	.contact-form .cads-lively .wpforms-submit::after,
	.contact-form .cads-lively .cads-lv-field--text input,
	.contact-form .cads-lively .cads-lv-field--area textarea::placeholder {
		transition: none;
	}

	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:hover,
	.contact-form .cads-lively .cads-lv-choice--cards .cads-lv-opt:hover .cads-lv-opt__icon,
	.contact-form .cads-lively .wpforms-submit:hover::after,
	.contact-form .cads-lively .wpforms-submit:focus-visible::after {
		transform: none;
	}

	.contact-form .cads-lv-done__ring,
	.contact-form .cads-lv-done__tick {
		stroke-dashoffset: 0;
		animation: none;
	}
}
