/*
 * BWG Guided Forms. Everything is scoped under .bwg-guided so theme and other
 * form styles are untouched. Override the custom properties to re-brand.
 */
.bwg-guided {
	--bgf-navy: #14213d;
	--bgf-heading: var(--bgf-navy);
	--bgf-teal: #0f766e;
	--bgf-teal-tint: #e7f4f2;
	--bgf-cream: #faf7f0;
	--bgf-amber: #b45309;
	--bgf-text: #1f2937;
	--bgf-muted: #556070;
	--bgf-border: #d5dbe3;
	--bgf-error: #b42318;
	--bgf-surface: #ffffff;
	--bgf-radius: 12px;
	--bgf-gap: 1rem;
	--bgf-max-width: 820px;
	/* The layout follows the form's own width, so it fits a narrow column too. */
	container: bwg-guided / inline-size;
	box-sizing: border-box;
	/* A width cap as well as max-width: themes often set max-width on everything in the page content, which would stretch the form. */
	width: min(100%, var(--bgf-max-width));
	max-width: var(--bgf-max-width);
	margin: 0 auto;
	color: var(--bgf-text);
	line-height: 1.5;
}

/*
 * Settings → Colors → Better Web Group blue, from the BWG design system:
 * primary blue for buttons, links and highlights (Astra's Accent and Links),
 * dark navy text (Astra's Heading and Body), light neutrals for panels.
 * The lighter #577aa2 and the orange #c97a2a are too faint for small text.
 */
.bwg-guided.bwg-guided--colors-bwg {
	--bgf-navy: #2d5d90;
	--bgf-heading: #10233b;
	--bgf-text: #10233b;
	--bgf-teal: #2d5d90;
	--bgf-teal-tint: #eaeff5;
	--bgf-cream: #f0f3fb;
}

.bwg-guided *,
.bwg-guided *::before,
.bwg-guided *::after {
	box-sizing: inherit;
}

.bwg-guided [hidden] {
	display: none !important;
}

.bwg-guided.has-guide {
	--bgf-max-width: 1180px;
}

.bwg-guided .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Intro and notices */
.bwg-guided__intro {
	margin-bottom: 1.25rem;
}

.bwg-guided__intro-title {
	margin: 0 0 0.35rem;
	color: var(--bgf-heading);
}

.bwg-guided__intro-text {
	margin: 0;
	color: var(--bgf-muted);
}

.bwg-guided__resume,
.bwg-guided__chooser {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1rem;
	padding: 0.85rem 1rem;
	background: var(--bgf-cream);
	border: 1px solid var(--bgf-border);
	border-radius: var(--bgf-radius);
}

/* Layout with the guide */
.bwg-guided.has-guide .bwg-guided__body {
	display: grid;
	grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
	gap: 2rem;
	align-items: start;
}

.bwg-guided__guide {
	position: sticky;
	top: 1.5rem;
	padding: 1rem;
	background: var(--bgf-navy);
	color: #fff;
	border-radius: var(--bgf-radius);
}

.bwg-guided__ai-label {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.85;
}

.bwg-guided__video-wrap {
	position: relative;
}

.bwg-guided__video {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #0b1324;
	border-radius: 8px;
	object-fit: cover;
}

.bwg-guided__guide.is-text-only .bwg-guided__video-wrap {
	display: none;
}

.bwg-guided__tap-play {
	position: absolute;
	inset: auto 0.75rem 0.75rem;
	min-height: 44px;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: var(--bgf-navy);
	font-weight: 600;
	cursor: pointer;
}

.bwg-guided__guide-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 0.6rem;
}

.bwg-guided__control {
	min-height: 36px;
	padding: 0.3rem 0.7rem;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
}

.bwg-guided__control[aria-pressed="true"] {
	background: rgba(255, 255, 255, 0.16);
}

.bwg-guided__transcript {
	margin: 0.75rem 0 0;
	font-size: 0.95rem;
	opacity: 0.95;
}

/* Progress */
.bwg-guided__progress {
	margin-bottom: 1.25rem;
}

.bwg-guided__progress-steps {
	display: flex;
	gap: 0.5rem;
	margin: 0 0 0.5rem;
	padding: 0;
	list-style: none;
	font-size: 0.85rem;
	color: var(--bgf-muted);
}

.bwg-guided__progress-steps li {
	flex: 1;
	padding-top: 0.35rem;
	border-top: 3px solid var(--bgf-border);
}

.bwg-guided__progress-steps li.is-done {
	border-top-color: var(--bgf-teal);
}

.bwg-guided__progress-steps li.is-current {
	border-top-color: var(--bgf-navy);
	color: var(--bgf-navy);
	font-weight: 600;
}

.bwg-guided__progress-num {
	font-variant-numeric: tabular-nums;
	opacity: 0.8;
}

.bwg-guided__progress-text {
	margin: 0;
	font-size: 0.9rem;
	color: var(--bgf-muted);
}

.bwg-guided__progress-bar {
	height: 4px;
	margin-top: 0.4rem;
	background: var(--bgf-border);
	border-radius: 2px;
	overflow: hidden;
}

.bwg-guided__progress-bar span {
	display: block;
	width: 0;
	height: 100%;
	background: var(--bgf-teal);
	transition: width 0.25s ease;
}

/* Steps and prompts: everything shows without JS; the script shows one screen at a time */
.bwg-guided__step {
	margin-bottom: 1.5rem;
}

.bwg-guided__step-title {
	margin: 0 0 0.75rem;
	color: var(--bgf-heading);
}

/* Headings get focus from the script so screen readers announce them; no box needed. */
.bwg-guided__step-title[tabindex="-1"]:focus {
	outline: none;
}

.bwg-guided__prompt {
	margin-bottom: 1.25rem;
	outline: none;
}

.bwg-guided__if {
	margin: 0 0 0.25rem;
	font-size: 0.85rem;
	color: var(--bgf-muted);
}

.bwg-guided--js .bwg-guided__step,
.bwg-guided--js .bwg-guided__if {
	display: none;
}

.bwg-guided--js .bwg-guided__step.is-current {
	display: block;
}

.bwg-guided--js.bwg-guided--prompt .bwg-guided__prompt {
	display: none;
}

.bwg-guided--js.bwg-guided--prompt .bwg-guided__prompt.is-current {
	display: block;
}

.bwg-guided--js .bwg-guided__prompt.is-hidden {
	display: none;
}

.bwg-guided--js.bwg-guided--prompt .bwg-guided__step-title {
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bgf-teal);
}

/* Fields */
.bwg-guided__field {
	margin-bottom: 1.1rem;
}

.bwg-guided__field fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.bwg-guided__label {
	display: block;
	margin-bottom: 0.35rem;
	padding: 0;
	font-weight: 600;
	font-size: 1.05rem;
	color: var(--bgf-heading);
}

.bwg-guided__req {
	color: var(--bgf-amber);
}

.bwg-guided__help {
	margin: -0.15rem 0 0.5rem;
	font-size: 0.9rem;
	color: var(--bgf-muted);
}

.bwg-guided__field input[type="text"],
.bwg-guided__field input[type="email"],
.bwg-guided__field input[type="tel"],
.bwg-guided__field input[type="url"],
.bwg-guided__field select,
.bwg-guided__field textarea,
.bwg-guided__save-later-form input {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 0.65rem 0.8rem;
	border: 1px solid var(--bgf-border);
	border-radius: 8px;
	background: var(--bgf-surface);
	color: var(--bgf-text);
	font: inherit;
	font-size: 1rem;
}

.bwg-guided__field textarea {
	min-height: 120px;
	resize: vertical;
}

.bwg-guided__field input:focus,
.bwg-guided__field select:focus,
.bwg-guided__field textarea:focus,
.bwg-guided__save-later-form input:focus {
	outline: 3px solid var(--bgf-teal);
	outline-offset: 1px;
	border-color: var(--bgf-teal);
}

.bwg-guided__options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 0.6rem;
}

.bwg-guided__group {
	grid-column: 1 / -1;
	margin: 0.6rem 0 0;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--bgf-teal);
}

.bwg-guided__option {
	display: flex;
	gap: 0.65rem;
	align-items: flex-start;
	min-height: 52px;
	padding: 0.75rem 0.85rem;
	border: 1px solid var(--bgf-border);
	border-radius: 10px;
	background: var(--bgf-surface);
	cursor: pointer;
}

.bwg-guided__option input {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	margin: 0.15rem 0 0;
	accent-color: var(--bgf-teal);
}

.bwg-guided__option:hover {
	border-color: var(--bgf-teal);
}

.bwg-guided__option:focus-within {
	outline: 3px solid var(--bgf-teal);
	outline-offset: 1px;
}

.bwg-guided__option:has(input:checked) {
	border-color: var(--bgf-teal);
	background: var(--bgf-teal-tint);
}

.bwg-guided__option-text {
	display: flex;
	flex-direction: column;
}

.bwg-guided__option-label {
	font-weight: 500;
}

.bwg-guided__option-desc {
	font-size: 0.85rem;
	color: var(--bgf-muted);
}

.bwg-guided__other {
	margin-top: 0.6rem;
}

.bwg-guided__other label {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.9rem;
}

.bwg-guided__consent {
	display: flex;
	gap: 0.65rem;
	align-items: flex-start;
	cursor: pointer;
}

.bwg-guided__consent input {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.2rem;
	accent-color: var(--bgf-teal);
}

.bwg-guided__notice-text {
	margin: 0;
	padding: 0.75rem 0.9rem;
	border-left: 4px solid var(--bgf-amber);
	background: var(--bgf-cream);
	border-radius: 0 8px 8px 0;
	font-size: 0.92rem;
}

.bwg-guided__error {
	margin: 0.4rem 0 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--bgf-error);
}

.bwg-guided__field.has-error input,
.bwg-guided__field.has-error select,
.bwg-guided__field.has-error textarea,
.bwg-guided__field.has-error .bwg-guided__option {
	border-color: var(--bgf-error);
}

.bwg-guided__explain {
	margin-top: 0.4rem;
	font-size: 0.92rem;
}

.bwg-guided__explain summary {
	cursor: pointer;
	color: var(--bgf-teal);
	font-weight: 600;
}

.bwg-guided__explain p {
	margin: 0.4rem 0 0;
	color: var(--bgf-muted);
}

/* Buttons and nav */
.bwg-guided__nav {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.bwg-guided__next {
	margin-left: auto;
}

.bwg-guided__button {
	min-height: 48px;
	padding: 0.7rem 1.4rem;
	border: 1px solid var(--bgf-navy);
	border-radius: 999px;
	background: var(--bgf-surface);
	color: var(--bgf-navy);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.bwg-guided__button--primary {
	background: var(--bgf-navy);
	color: #fff;
}

.bwg-guided__button:focus-visible,
.bwg-guided__link:focus-visible,
.bwg-guided__control:focus-visible,
.bwg-guided__tap-play:focus-visible {
	outline: 3px solid var(--bgf-amber);
	outline-offset: 2px;
}

.bwg-guided__button[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.bwg-guided__link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--bgf-teal);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.bwg-guided__guide-on {
	margin-top: 0.4rem;
	font-size: 0.9rem;
}

.bwg-guided__form-error {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--bgf-error);
	border-radius: 8px;
	color: var(--bgf-error);
	font-weight: 600;
}

.bwg-guided__save-later {
	margin-top: 1rem;
}

.bwg-guided__save-later-form {
	display: grid;
	gap: 0.5rem;
	margin-top: 0.6rem;
	max-width: 420px;
}

.bwg-guided__privacy-note {
	margin-top: 0.75rem;
	font-size: 0.85rem;
	color: var(--bgf-muted);
}

/* Review */
.bwg-guided__review-step {
	margin-bottom: 1rem;
	padding: 1rem;
	border: 1px solid var(--bgf-border);
	border-radius: var(--bgf-radius);
	background: var(--bgf-surface);
}

.bwg-guided__review-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
}

.bwg-guided__review-head h4 {
	margin: 0 0 0.5rem;
	color: var(--bgf-heading);
}

.bwg-guided__review-step dl {
	display: grid;
	grid-template-columns: minmax(140px, 40%) 1fr;
	gap: 0.35rem 1rem;
	margin: 0;
}

.bwg-guided__review-step dt {
	color: var(--bgf-muted);
	font-size: 0.9rem;
}

.bwg-guided__review-step dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.bwg-guided__turnstile {
	margin-top: 1rem;
}

/* Success */
.bwg-guided__success {
	padding: 1.5rem;
	border-radius: var(--bgf-radius);
	background: var(--bgf-cream);
	border: 1px solid var(--bgf-border);
	outline: none;
}

.bwg-guided__success-title {
	margin-top: 0;
	color: var(--bgf-heading);
}

.bwg-guided__handoffs {
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

.bwg-guided__handoffs li {
	margin-bottom: 0.75rem;
}

.bwg-guided__handoffs a {
	font-weight: 700;
	color: var(--bgf-teal);
}

.bwg-guided__handoffs p {
	margin: 0.15rem 0 0;
	color: var(--bgf-muted);
	font-size: 0.92rem;
}

/* Honeypot: off screen for people, still in the form for bots */
.bwg-guided__hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.bwg-guided-admin-error {
	padding: 0.75rem 1rem;
	border: 2px dashed #b42318;
	color: #b42318;
}

/* A narrow form (a phone, or a column on a wide screen): the guide stacks above the questions. */
@container bwg-guided (max-width: 760px) {
	.bwg-guided.has-guide .bwg-guided__body {
		display: block;
	}

	.bwg-guided__guide {
		position: sticky;
		top: 0;
		z-index: 5;
		display: grid;
		grid-template-columns: 40% 1fr;
		grid-template-areas:
			"label label"
			"video text"
			"controls controls";
		gap: 0.4rem 0.75rem;
		align-items: center;
		margin: 0 0 1rem;
		padding: 0.5rem 1rem 0.6rem;
	}

	.bwg-guided__ai-label {
		grid-area: label;
		margin: 0;
		font-size: 0.7rem;
	}

	.bwg-guided__video-wrap {
		grid-area: video;
	}

	.bwg-guided__transcript {
		grid-area: text;
		margin: 0;
		font-size: 0.85rem;
		line-height: 1.35;
		display: -webkit-box;
		-webkit-line-clamp: 5;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.bwg-guided__guide-controls {
		grid-area: controls;
		flex-wrap: nowrap;
		overflow-x: auto;
		margin: 0;
	}

	.bwg-guided__control {
		flex: none;
		min-height: 32px;
		padding: 0.2rem 0.6rem;
		font-size: 0.78rem;
	}

	.bwg-guided__guide.is-text-only {
		grid-template-areas:
			"label label"
			"text text"
			"controls controls";
	}

	.bwg-guided__tap-play {
		inset: auto 0.3rem 0.3rem;
		min-height: 36px;
		font-size: 0.8rem;
	}
}

/* On a phone the stacked guide runs edge to edge. */
@media (max-width: 760px) {
	.bwg-guided__guide {
		margin: 0 -1rem 1rem;
		border-radius: 0;
	}
}

/* Too narrow for step names beside each other, or labels beside answers. */
@container bwg-guided (max-width: 440px) {
	.bwg-guided__progress-label {
		display: none;
	}

	.bwg-guided__review-step dl {
		grid-template-columns: 1fr;
	}

	.bwg-guided__review-step dd {
		margin-bottom: 0.5rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bwg-guided__progress-bar span {
		transition: none;
	}
}
