/* Visitor survey (PR-797). Built on the theme tokens from dist/css/main.min.css. */

/* The band above the footer */

.survey {
	--section-bg: var(--color-ground);
	--section-pt: var(--space-3xl);
	--section-pb: var(--space-3xl);
}

.survey__inner {
	display: flex;
	flex-direction: column;
	gap: var(--space-xl);
}

.survey__title {
	max-width: 50rem;
}

.survey__lede {
	color: var(--color-ink-55);
	margin: 0;
}

.survey__toggle {
	max-width: 100%;
	width: max-content;
}

/* White arrow on dark buttons. Inside a form the theme's "form .button .arrow-icon" draws it black, hence .survey-form. */
.survey__toggle .arrow-icon,
.survey-form .survey__next .arrow-icon,
.survey-cta .arrow-icon {
	background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.3584 4.94141L15.4167 9.99974L10.3584 15.0581M4.16669 9.9998L15.2084 9.99977' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
	display: inline-block;
	height: 1.25rem;
	vertical-align: middle;
	width: 1.25rem;
}

/* The popup */

.popup--survey {
	max-height: min(52rem, calc(100dvh - 2rem));
	max-width: 46rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0;
}

.popup--survey:focus,
.popup--survey:focus-visible {
	outline: none;
}

.popup--survey .popup__close {
	z-index: 3;
}

.survey-pop [hidden],
.survey-cta[hidden] {
	display: none !important;
}

.survey-pop__head {
	background-color: var(--color-white);
	border-bottom: var(--stroke-base);
	display: flex;
	flex-direction: column;
	gap: var(--space-s);
	padding: var(--space-lg) var(--space-lg) var(--space-m);
	position: sticky;
	top: 0;
	z-index: 2;
}

.survey-pop__title {
	font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
	font-weight: var(--font-bold);
	line-height: 1.2;
	margin: 0;
	padding-inline-end: var(--space-lg);
}

.survey-pop__progress {
	align-items: center;
	color: var(--color-ink-55);
	display: flex;
	font-size: var(--size-xs);
	gap: var(--space-s);
	line-height: var(--leading-xs);
}

.survey-pop__count {
	flex: none;
}

.survey-pop__bar {
	background-color: var(--color-ink-08);
	border-radius: var(--radius-pill);
	flex: 1;
	height: 0.25rem;
	overflow: hidden;
}

.survey-pop__bar > span {
	background-color: var(--color-primary);
	border-radius: inherit;
	display: block;
	height: 100%;
	transition: width 0.3s ease;
	width: 0;
}

.survey-pop__body {
	padding: var(--space-lg) var(--space-lg) 0;
}

.survey-pop__done {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: var(--space-s);
	padding: var(--space-2xl) var(--space-lg);
	text-align: center;
}

.survey-pop__icon {
	color: var(--color-success);
	display: inline-flex;
	height: 3rem;
	width: 3rem;
}

.survey-pop__icon svg {
	height: 100%;
	width: 100%;
}

.survey-pop__text {
	color: var(--color-ink-55);
	margin: 0 0 var(--space-m);
	max-width: 30rem;
}

/* Steps */

.survey__step {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
}

.survey__step:not(.is-current) {
	display: none;
}

.survey__step-title {
	font-size: var(--size-md);
	font-weight: var(--font-semibold);
	margin: 0;
}

.survey__block {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
}

.survey__block-title {
	display: none; /* the step title already says it */
}

.survey__q {
	border: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	margin: 0;
	min-width: 0;
	padding: 0;
}

.survey__q > legend {
	margin-bottom: var(--space-s);
	padding: 0;
}

.survey__hint {
	color: var(--color-ink-55);
	font-size: var(--size-xs);
	line-height: var(--leading-xs);
}

.survey__error {
	color: var(--color-error);
	font-size: var(--size-xs);
	line-height: var(--leading-xs);
	margin: var(--space-xs) 0 0;
}

/* Kept rendered (not display:none) so Turnstile can run in the background; shown on the last step only. */
.survey__captcha {
	height: 0;
	overflow: hidden;
	visibility: hidden;
}

.survey-form.is-last-step .survey__captcha {
	height: auto;
	margin-top: var(--space-lg);
	overflow: visible;
	visibility: visible;
}

.survey__captcha .wpcf7-turnstile {
	margin: 0;
}

.survey__nav {
	background-color: var(--color-white);
	border-top: var(--stroke-base);
	bottom: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-s);
	justify-content: space-between;
	margin: var(--space-lg) calc(-1 * var(--space-lg)) 0;
	padding: var(--space-m) var(--space-lg);
	position: sticky;
	z-index: 2;
}

.survey__next,
.survey__send {
	margin-inline-start: auto;
}

.survey-form .wpcf7-response-output {
	margin: 0 0 var(--space-m);
}

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

/* Choices as chips */

.survey-form .wpcf7-radio,
.survey-form .wpcf7-checkbox {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
}

.survey-form .wpcf7-radio .wpcf7-list-item,
.survey-form .wpcf7-checkbox .wpcf7-list-item {
	margin: 0;
}

.survey-form .wpcf7-radio label,
.survey-form .wpcf7-checkbox label {
	align-items: center;
	background-color: var(--color-white);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-pill);
	cursor: pointer;
	display: inline-flex;
	font-size: var(--size-sm);
	justify-content: center;
	line-height: 1.2;
	min-height: 2.5rem;
	padding: 0.5rem 0.875rem;
	position: relative;
	transition: var(--transition-base);
}

.survey-form .wpcf7-radio label:hover,
.survey-form .wpcf7-checkbox label:hover {
	border-color: var(--color-black);
}

/* The theme styles every input inside a CF7 wrap as a full-width field; the chip is the control here. */
.survey-form .wpcf7-radio input,
.survey-form .wpcf7-checkbox input {
	height: 1px;
	inset: 0;
	margin: 0;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.survey-form .wpcf7-radio label:has(input:checked),
.survey-form .wpcf7-checkbox label:has(input:checked) {
	background-color: var(--color-black);
	border-color: var(--color-black);
	color: var(--color-white);
}

.survey-form .wpcf7-radio label:has(input:focus-visible),
.survey-form .wpcf7-checkbox label:has(input:focus-visible) {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

/* 1-5 and 0-10 scales: equal square-ish chips */
.survey-form .survey__scale label {
	min-width: 2.75rem;
	padding-inline: 0.5rem;
}

/*
 * Buttons that close a popup are type="submit" (form method="dialog"), and the
 * theme's button[type=submit] rule paints every submit button green, over the
 * .button--dark / .button--outline variants. Restore the variants here.
 */
.popup--success button[type="submit"].button--outline {
	--button-bg: transparent;
	--button-text: var(--color-black);
	--button-border: var(--color-border);
}

.popup--survey button[type="submit"].button--dark,
.popup--success button[type="submit"].button--dark {
	--button-bg: var(--color-dark);
	--button-text: var(--color-white);
}

/* Call to action in the "request sent" popup */

.popup--success:has(.survey-cta:not([hidden])) {
	max-width: 32rem;
}

.survey-cta {
	background-color: var(--color-ground);
	border-radius: var(--radius-md);
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	margin-block-end: var(--space-s);
	padding: var(--space-m);
	text-align: start;
}

.survey-cta .eyebrow {
	align-self: start;
}

.survey-cta__title {
	font-size: var(--size-md);
	font-weight: var(--font-bold);
	line-height: var(--leading-md);
	margin: 0;
}

.survey-cta__text {
	color: var(--color-ink-55);
	font-size: var(--size-sm);
	line-height: var(--leading-sm);
	margin: 0;
}

.survey-cta__meta {
	color: var(--color-ink-55);
	font-size: var(--size-xs);
	line-height: var(--leading-xs);
	margin: 0 0 var(--space-xs);
}

.survey-cta .button {
	width: 100%;
}

@media (max-width: 768px) {
	.survey__toggle {
		width: 100%;
	}

	.popup--survey {
		border-radius: 0;
		height: 100dvh;
		margin: 0;
		max-height: 100dvh;
		max-width: 100%;
	}

	.survey-pop__head {
		padding: var(--space-m);
	}

	.survey-pop__body {
		padding: var(--space-m) var(--space-m) 0;
	}

	.survey__nav {
		margin-inline: calc(-1 * var(--space-m));
		padding: var(--space-s) var(--space-m);
	}
}
