/* ==========================================================================
   Case review form (lead modal): shell from inc/lead.php, content = CF7 form
   "Case review" (deploy/seed-lead-form.php), steps in components/lead.js
   ========================================================================== */

.lead {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: var(--c-overlay);
}

.lead__dialog {
	position: relative;
	width: 100%;
	max-width: 600px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow: auto;
	overscroll-behavior: contain;
	border-radius: var(--radius-xl);
	background: var(--c-surface);
	box-shadow: var(--shadow-modal);
}

.lead__dialog:focus {
	outline: 0;
}

.lead__close {
	position: absolute;
	top: 12px;
	right: 16px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--c-line);
	border-radius: 50%;
	background: var(--c-surface);
	color: var(--c-ink);
	cursor: pointer;
}

.lead__close:hover {
	background: var(--c-hover-bg);
}

/* CF7 resets
   ---------------------------------------------------------------------- */

.lead .wpcf7 form,
.lead-form {
	margin: 0;
}

.lead .wpcf7-form-control-wrap {
	display: block;
}

/* CF7's own tips (live checks on blur + server errors) would shift the buttons
   under the pointer; lead.js shows the message in .lead-error instead. */
.lead .wpcf7-not-valid-tip {
	display: none;
}

.lead .wpcf7-form .wpcf7-response-output {
	margin: 0 24px 16px;
	padding: 10px 12px;
	border: 0;
	border: 1px solid var(--c-accent);
	background: var(--c-accent-tint);
	color: var(--c-accent-dark);
	font-size: 14px;
}

.lead .wpcf7-form.sent .wpcf7-response-output {
	display: none;
}

.lead .wpcf7-turnstile {
	margin-top: 16px;
}

/* Header: step count + progress
   ---------------------------------------------------------------------- */

.lead-count {
	min-height: 40px;
	margin: 0;
	padding: 22px 72px 0 24px;
	color: var(--c-green);
	font-family: var(--f-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.lead-progress {
	height: 4px;
	margin: 14px 24px 0;
	overflow: hidden;
	border-radius: 2px;
	background: var(--c-line-2);
}

.lead-progress span {
	display: block;
	width: var(--lead-progress, 20%);
	height: 100%;
	background: var(--c-green);
	transition: width .3s;
}

/* Steps
   ---------------------------------------------------------------------- */

.lead-step,
.lead-done {
	padding: 22px 24px 8px;
}

.lead-title {
	margin: 0 0 6px;
	font-size: 27px;
	line-height: 1.15;
}

.lead-title:focus {
	outline: 0;
}

.lead-intro {
	margin: 0 0 20px;
	color: var(--c-text-2);
	font-size: 15px;
}

.lead-field {
	min-width: 0;
	margin: 0 0 20px;
	padding: 0;
	border: 0;
}

.lead-step > .lead-field:last-of-type,
.lead-row:last-child .lead-field {
	margin-bottom: 8px;
}

.lead-label {
	display: block;
	margin-bottom: 8px;
	padding: 0;
	color: var(--c-ink);
	font-size: 15px;
	font-weight: 600;
}

.lead-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0 14px;
}

.lead-date {
	max-width: 280px;
}

.lead-field.is-invalid input:not([type="radio"]):not([type="checkbox"]),
.lead-field.is-invalid select,
.lead-field.is-invalid textarea,
.lead .wpcf7-not-valid:not(span) {
	border-color: var(--c-accent);
}

.lead-note {
	margin: 6px 0 0;
	color: var(--c-muted);
	font-size: 13px;
}

.lead-hint {
	margin: 10px 0 0;
	padding: 10px 12px;
	border-radius: var(--radius);
	background: var(--c-sand);
	color: var(--c-text);
	font-size: 14px;
}

.lead-error {
	margin: 16px 0 0;
	padding: 10px 12px;
	border: 1px solid var(--c-accent);
	background: var(--c-accent-tint);
	color: var(--c-accent-dark);
	font-size: 14px;
}

/* Choice buttons (CF7 radio lists)
   ---------------------------------------------------------------------- */

.lead-choices {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.lead-choices--grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.lead .lead-choices .wpcf7-list-item {
	display: block;
	margin: 0;
}

.lead-choices label {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 12px 14px;
	border: 1.5px solid var(--c-line);
	border-radius: var(--radius);
	background: var(--c-surface);
	color: var(--c-ink);
	font-size: 15px;
	line-height: 1.3;
	cursor: pointer;
}

.lead-choices label:hover {
	border-color: var(--c-line-strong);
}

.lead-choices input[type="radio"] {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	margin: 0;
	border: 1.5px solid var(--c-line);
	border-radius: 50%;
	background: var(--c-surface);
	appearance: none;
	cursor: pointer;
}

.lead-choices input[type="radio"]:checked {
	border-color: var(--c-green);
	background: radial-gradient(circle, var(--c-green) 0 4px, transparent 4.5px);
}

.lead-choices input[type="radio"]:focus-visible {
	outline: 0;
}

.lead-choices label:has(input:checked) {
	border-color: var(--c-green);
	background: var(--c-green-tint);
}

.lead-choices label:has(input:focus-visible) {
	outline: 2px solid var(--c-green);
	outline-offset: 2px;
}

.lead-field.is-invalid .lead-choices label {
	border-color: var(--c-accent);
}

/* Consent
   ---------------------------------------------------------------------- */

.lead .lead-consent .wpcf7-list-item {
	display: block;
	margin: 0;
}

.lead-consent label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	color: var(--c-text-2);
	font-size: 13.5px;
	line-height: 1.45;
	cursor: pointer;
}

.lead-consent input[type="checkbox"] {
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
}

.lead-field.is-invalid.lead-consent input[type="checkbox"] {
	outline: 2px solid var(--c-accent);
	outline-offset: 1px;
}

/* Done screen
   ---------------------------------------------------------------------- */

.lead-done__icon {
	width: 48px;
	height: 48px;
	margin: 0 0 16px;
	border-radius: 50%;
	background: var(--c-green-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231F45A8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / 24px no-repeat;
}

.lead-done .lead-title {
	margin-bottom: 8px;
}

.lead-done .lead-intro {
	margin-bottom: 18px;
}

.lead-done .lead-intro strong {
	color: var(--c-ink);
	overflow-wrap: anywhere;
}

.lead-done__steps {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0 0 18px;
	padding: 0;
	list-style: none;
	counter-reset: lead-step;
}

.lead-done__steps li {
	position: relative;
	min-height: 26px;
	padding-left: 38px;
	font-size: 15px;
	line-height: 1.45;
	counter-increment: lead-step;
}

.lead-done__steps li::before {
	content: counter(lead-step);
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--c-green);
	color: var(--c-on-dark);
	font-family: var(--f-mono);
	font-size: 13px;
}

/* Actions + disclaimer
   ---------------------------------------------------------------------- */

.lead-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	padding: 16px 24px 22px;
}

.lead-back {
	min-height: 48px;
	margin-right: auto;
	padding: 0 4px;
	border: 0;
	background: none;
	color: var(--c-text-2);
	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
}

.lead-back:hover {
	color: var(--c-ink);
}

.lead-actions .wpcf7-spinner {
	order: -1;
	margin: 0;
}

.lead-actions .lead-submit[hidden] + .wpcf7-spinner {
	display: none;
}

.lead-actions .lead-submit {
	white-space: normal;
}

.lead-disclaimer {
	margin: 0;
	padding: 12px 24px 18px;
	border-top: 1px solid var(--c-line-2);
	color: var(--c-muted);
	font-size: 12.5px;
	line-height: 1.5;
}

/* Small phones: full screen
   ---------------------------------------------------------------------- */

@media (max-width: 520px) {
	.lead {
		padding: 0;
	}

	.lead__dialog {
		height: 100%;
		max-height: none;
		border-radius: 0;
	}

	.lead-title {
		font-size: 24px;
	}

	.lead-count {
		padding: 20px 64px 0 16px;
	}

	.lead-progress {
		margin: 12px 16px 0;
	}

	.lead-step,
	.lead-done {
		padding: 18px 16px 8px;
	}

	.lead-actions {
		padding: 12px 16px 18px;
	}

	.lead .wpcf7-form .wpcf7-response-output {
		margin: 0 16px 12px;
	}

	.lead-disclaimer {
		padding: 12px 16px 18px;
	}
}
