/**
 * MSA Booking form styles.
 *
 * Everything is scoped under .msa so it cannot leak into the rest of the theme,
 * and every colour is a variable so the brand can be retuned in one place.
 */

.msa {
	--msa-ink: #16241d;
	--msa-muted: #5f6f68;
	--msa-line: #dde4e0;
	--msa-line-strong: #c3cec8;
	--msa-surface: #ffffff;
	--msa-tint: #f3f8f5;
	--msa-brand: #1f7a4d;
	--msa-brand-dark: #175e3b;
	--msa-brand-soft: #e6f2ec;
	--msa-danger: #a4291f;
	--msa-danger-soft: #fdeceb;
	--msa-warn-soft: #fdf5e3;
	--msa-radius: 10px;
	--msa-gap: 18px;

	max-width: 780px;
	margin: 0 auto;
	color: var(--msa-ink);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
	-webkit-text-size-adjust: 100%;
}

.msa *,
.msa *::before,
.msa *::after {
	box-sizing: border-box;
}

/* ---------- Banners ---------- */

.msa-banner {
	border: 1px solid var(--msa-line);
	border-left-width: 4px;
	border-radius: var(--msa-radius);
	padding: 18px 20px;
	margin-bottom: 28px;
	background: var(--msa-tint);
}

.msa-banner--good {
	border-left-color: var(--msa-brand);
	background: var(--msa-brand-soft);
}

.msa-banner--warn {
	border-left-color: #c99400;
	background: var(--msa-warn-soft);
}

.msa-banner h2 {
	margin: 0 0 6px;
	font-size: 1.15rem;
	line-height: 1.3;
	color: var(--msa-ink);
}

.msa-banner p {
	margin: 0;
	color: var(--msa-muted);
}

/* ---------- Layout ---------- */

.msa-section {
	padding: 0 0 26px;
	margin: 0 0 26px;
	border-bottom: 1px solid var(--msa-line);
}

.msa-section:last-of-type {
	border-bottom: 0;
	margin-bottom: 18px;
}

.msa-section__title {
	margin: 0 0 18px;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--msa-brand);
}

.msa-row {
	display: grid;
	gap: var(--msa-gap);
	margin-bottom: var(--msa-gap);
}

.msa-row--2 {
	grid-template-columns: 1fr 1fr;
}

.msa-row:last-child {
	margin-bottom: 0;
}

.msa-field {
	margin-bottom: var(--msa-gap);
	min-width: 0;
}

.msa-row .msa-field {
	margin-bottom: 0;
}

.msa-field--notes {
	margin-top: var(--msa-gap);
	margin-bottom: 0;
}

/* ---------- Inputs ---------- */

/* Scoped to field labels on purpose: .msa-service and .msa-tile are also
   <label> elements and need their own flex layout, which a bare `.msa label`
   rule would outrank. */
.msa-field > label,
.msa-hp > label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--msa-ink);
}

.msa-req {
	color: var(--msa-danger);
	font-weight: 400;
}

.msa input[type="text"],
.msa input[type="email"],
.msa input[type="tel"],
.msa input[type="number"],
.msa input[type="date"],
.msa textarea {
	display: block;
	width: 100%;
	padding: 12px 14px;
	font: inherit;
	font-size: 1rem; /* 16px stops iOS zooming on focus */
	color: var(--msa-ink);
	background: var(--msa-surface);
	border: 1px solid var(--msa-line-strong);
	border-radius: var(--msa-radius);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
}

.msa textarea {
	resize: vertical;
	min-height: 56px;
}

.msa input:focus,
.msa textarea:focus {
	outline: none;
	border-color: var(--msa-brand);
	box-shadow: 0 0 0 3px var(--msa-brand-soft);
}

.msa input[aria-invalid="true"],
.msa textarea[aria-invalid="true"] {
	border-color: var(--msa-danger);
}

/* Keep the native iOS date picker from collapsing to nothing. */
.msa input[type="date"] {
	min-height: 48px;
}

.msa-input-suffix {
	position: relative;
}

.msa-input-suffix span {
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	font-size: 0.9rem;
	color: var(--msa-muted);
	pointer-events: none;
}

.msa-input-suffix input {
	padding-right: 58px;
}

.msa-hint {
	margin: 6px 0 0;
	font-size: 0.85rem;
	color: var(--msa-muted);
}

.msa-error {
	margin: 6px 0 0;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--msa-danger);
}

.msa-error:empty {
	display: none;
}

.msa-alert {
	padding: 14px 16px;
	margin-bottom: 24px;
	border-radius: var(--msa-radius);
	background: var(--msa-danger-soft);
	border: 1px solid #f2c9c5;
	color: var(--msa-danger);
	font-weight: 600;
}

/* ---------- Service picker ---------- */

.msa-services {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.msa-service {
	position: relative;
	display: block;
	margin: 0;
	padding: 16px;
	border: 1px solid var(--msa-line-strong);
	border-radius: var(--msa-radius);
	background: var(--msa-surface);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.msa-service input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.msa-service__body {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.msa-service__name {
	font-weight: 600;
	font-size: 1rem;
	line-height: 1.25;
}

.msa-service__from {
	font-size: 0.85rem;
	color: var(--msa-muted);
	font-variant-numeric: tabular-nums;
}

.msa-service:hover {
	border-color: var(--msa-brand);
}

.msa-service:has(input:checked) {
	border-color: var(--msa-brand);
	background: var(--msa-brand-soft);
	box-shadow: inset 3px 0 0 var(--msa-brand);
}

.msa-service:has(input:focus-visible) {
	outline: 2px solid var(--msa-brand);
	outline-offset: 2px;
}

/* ---------- Priced option tiles ---------- */

.msa-options {
	margin-top: 26px;
	padding: 20px;
	border-radius: var(--msa-radius);
	background: var(--msa-tint);
	border: 1px solid var(--msa-line);
}

.msa-options[hidden] {
	display: none;
}

.msa-options__title {
	margin: 0 0 4px;
	font-size: 1rem;
	font-weight: 700;
}

.msa-options .msa-hint {
	margin-bottom: 12px;
}

.msa-tiles {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-top: 12px;
}

.msa-tile {
	position: relative;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin: 0;
	padding: 13px 15px;
	background: var(--msa-surface);
	border: 1px solid var(--msa-line-strong);
	border-radius: var(--msa-radius);
	cursor: pointer;
	font-weight: 500;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.msa-tile input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.msa-tile__label {
	font-size: 0.95rem;
	line-height: 1.3;
}

.msa-tile__price {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: var(--msa-brand-dark);
}

.msa-tile__note {
	font-size: 0.8rem;
	font-weight: 400;
	color: var(--msa-muted);
	text-align: right;
}

.msa-tile:hover {
	border-color: var(--msa-brand);
}

.msa-tile:has(input:checked) {
	border-color: var(--msa-brand);
	background: var(--msa-brand-soft);
	box-shadow: inset 3px 0 0 var(--msa-brand);
}

.msa-tile:has(input:focus-visible) {
	outline: 2px solid var(--msa-brand);
	outline-offset: 2px;
}

/* The follow-up question (how many bushes, how much area). Indented and
   rule-marked so it reads as a consequence of the tile above, not a peer. */
.msa-tiers {
	margin-top: 18px;
	padding: 16px 0 0 16px;
	border-top: 1px solid var(--msa-line);
	border-left: 2px solid var(--msa-brand);
}

.msa-tiers[hidden] {
	display: none;
}

.msa-tiers .msa-options__title {
	font-size: 0.95rem;
}

.msa-tiles--billing {
	grid-template-columns: repeat(2, 1fr);
}

.msa-tiles--billing .msa-tile {
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.msa-tiles--billing .msa-tile__note {
	text-align: left;
}

.msa-billing {
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--msa-line);
}

/* ---------- Honeypot ---------- */

.msa-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Total + submit ---------- */

.msa-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	border: 1px solid var(--msa-line-strong);
	border-radius: var(--msa-radius);
	background: var(--msa-surface);
}

.msa-summary__amount {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.msa-summary__label {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--msa-muted);
}

.msa-summary__value {
	font-size: 1.65rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	color: var(--msa-ink);
}

.msa-summary__value.is-quote {
	font-size: 1rem;
	font-weight: 600;
	color: var(--msa-muted);
}

.msa-summary__period {
	font-size: 0.9rem;
	color: var(--msa-muted);
}

.msa-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	padding: 0 26px;
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	color: #fff;
	background: var(--msa-brand);
	border: 0;
	border-radius: var(--msa-radius);
	cursor: pointer;
	transition: background 0.15s ease, transform 0.05s ease;
}

.msa-submit:hover:not(:disabled) {
	background: var(--msa-brand-dark);
}

.msa-submit:active:not(:disabled) {
	transform: translateY(1px);
}

.msa-submit:focus-visible {
	outline: 2px solid var(--msa-brand-dark);
	outline-offset: 3px;
}

.msa-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.msa-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: msa-spin 0.7s linear infinite;
}

.msa-form.is-busy .msa-spinner {
	display: block;
}

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

.msa-trust {
	margin: 14px 0 0;
	font-size: 0.85rem;
	color: var(--msa-muted);
	text-align: center;
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
	.msa-row--2 {
		grid-template-columns: 1fr;
	}

	.msa-services,
	.msa-tiles {
		grid-template-columns: 1fr;
	}

	.msa-options {
		padding: 16px;
	}

	/* The total stays in view while the visitor scrolls the options. */
	.msa-summary {
		position: sticky;
		bottom: 0;
		z-index: 20;
		margin: 0 -4px;
		padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
		border-radius: var(--msa-radius) var(--msa-radius) 0 0;
		box-shadow: 0 -6px 18px rgba(22, 36, 29, 0.12);
	}

	.msa-summary__amount {
		flex-direction: column;
		gap: 0;
		min-width: 0;
	}

	.msa-summary__value {
		font-size: 1.45rem;
	}

	.msa-submit {
		flex: 0 1 auto;
		padding: 0 18px;
		font-size: 0.95rem;
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.msa *,
	.msa *::before,
	.msa *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* JS mirrors :checked onto .is-selected, so older browsers without :has()
   still get the selected state. */
.msa-service.is-selected,
.msa-tile.is-selected {
	border-color: var(--msa-brand);
	background: var(--msa-brand-soft);
	box-shadow: inset 3px 0 0 var(--msa-brand);
}
