/*
 * CareBridge guided inquiry form.
 * Large tappable choices, calm progress, clear focus and error states.
 */
.cb-form-wrap {
	--f-ivory: var(--cb-ivory, #fbf8f2);
	--f-oat: var(--cb-oat, #f3ecdf);
	--f-sand: var(--cb-sand, #e2d6c1);
	--f-navy: var(--cb-navy, #263749);
	--f-ink: var(--cb-ink, #1b2a39);
	--f-slate: var(--cb-slate, #3f4d5b);
	--f-muted: var(--cb-muted, #55626f);
	--f-gold: var(--cb-gold, #bea87e);
	--f-bronze: var(--cb-bronze, #715830);
	--f-error: #9b2c2c;
	/* Edges of things a person types in or taps: at least 3:1 against white and ivory. */
	--f-field: #8a7d70;
	background: #fff;
	border: 1px solid var(--f-sand);
	border-radius: 1.75rem;
	box-shadow: 0 2rem 4rem -2.25rem rgba(27, 42, 57, 0.35);
	/* The padding and border count inside the width, so the card can never be
	   wider than the screen (it was, between phone and desktop widths). */
	box-sizing: border-box;
	margin-inline: auto;
	max-width: 58rem;
	min-width: 0;
	overflow-x: clip;
	padding: clamp(1.35rem, 0.8rem + 2.6vw, 3rem);
	text-align: start;
	width: 100%;
}

.cb-form {
	display: grid;
	gap: 1.5rem;
	/* One column that may shrink: without this the column grows to its widest
	   child and pushes the card off the side of a phone screen. */
	grid-template-columns: minmax(0, 1fr);
	margin: 0;
	min-width: 0;
}

.cb-form * {
	box-sizing: border-box;
}

.cb-hp {
	height: 1px;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	top: auto;
	width: 1px;
}

/* Progress */
.cb-progress {
	counter-reset: none;
	display: none;
	gap: 0;
	list-style: none;
	margin: 0 0 0.5rem;
	padding: 0;
}

.cb-form.is-js .cb-progress {
	display: flex;
}

.cb-progress__item {
	align-items: center;
	color: var(--f-muted);
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	font-size: 0.875rem;
	min-width: 0;
	overflow-wrap: anywhere;
	font-weight: 600;
	gap: 0.45rem;
	line-height: 1.25;
	margin: 0;
	position: relative;
	text-align: center;
}

/* The steps of the inquiry as a deck: one thin line through the numbers, gold
   as far as the visitor has come (the same line as "Bridge the Journey"). */
.cb-progress__item::before {
	background: var(--f-sand);
	content: "";
	height: 1.5px;
	left: -50%;
	position: absolute;
	top: calc(1rem - 0.75px);
	width: 100%;
}

.cb-progress__item:first-child::before {
	display: none;
}

.cb-progress__item.is-done::before,
.cb-progress__item.is-current::before {
	background: var(--f-gold);
}

.cb-progress__dot {
	align-items: center;
	background: #fff;
	border: 2px solid var(--f-sand);
	border-radius: 999px;
	color: var(--f-muted);
	display: flex;
	font-size: 0.875rem;
	height: 2rem;
	justify-content: center;
	position: relative;
	transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
	width: 2rem;
	z-index: 1;
}

.cb-progress__item.is-current .cb-progress__dot {
	background: var(--f-navy);
	border-color: var(--f-navy);
	box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px var(--f-gold);
	color: #fff;
}

.cb-progress__item.is-done .cb-progress__dot {
	background: var(--f-gold);
	border-color: var(--f-gold);
	color: var(--f-ink);
}

.cb-progress__item.is-current {
	color: var(--f-ink);
}

@media (max-width: 40rem) {
	.cb-progress__label {
		display: none;
	}

	.cb-progress__item.is-current .cb-progress__label {
		display: block;
		left: 50%;
		position: absolute;
		top: 2.6rem;
		transform: translateX(-50%);
		max-width: 12rem;
		white-space: normal;
		width: max-content;
	}

	.cb-form.is-js .cb-progress {
		margin-bottom: 1.75rem;
	}

	.cb-progress__item:first-child.is-current .cb-progress__label {
		left: 0;
		transform: none;
	}

	.cb-progress__item:last-child.is-current .cb-progress__label {
		left: auto;
		right: 0;
		transform: none;
	}
}

/* Steps */
.cb-panel-step {
	display: grid;
	gap: 1.5rem;
	min-width: 0;
}

.cb-form.is-js .cb-panel-step:not(.is-active) {
	display: none;
}

.cb-form:not(.is-js) .cb-panel-step + .cb-panel-step {
	border-top: 1px solid var(--f-sand);
	padding-top: 2rem;
}

@media (prefers-reduced-motion: no-preference) {
	.cb-form.is-js .cb-panel-step.is-active {
		animation: cb-step-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	@keyframes cb-step-in {
		from {
			opacity: 0;
			transform: translateY(0.5rem);
		}

		to {
			opacity: 1;
			transform: none;
		}
	}
}

.cb-form .cb-step-title {
	color: var(--f-ink);
	font-family: var(--cb-serif, Georgia, serif);
	font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.125rem);
	font-weight: 400;
	letter-spacing: -0.01em;
	line-height: 1.15;
	margin: 0;
	outline: none;
}

.cb-step-intro {
	color: var(--f-slate);
	margin: -0.9rem 0 0;
}

/* Fields */
.cb-group {
	border: 0;
	margin: 0;
	min-width: 0;
	padding: 0;
}

.cb-label,
.cb-group > legend {
	color: var(--f-ink);
	display: block;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.35;
	margin: 0 0 0.6rem;
	padding: 0;
}

.cb-optional {
	color: var(--f-muted);
	font-weight: 400;
}

.cb-hint {
	color: var(--f-muted);
	font-size: 0.9375rem;
	line-height: 1.45;
	margin: -0.3rem 0 0.6rem;
}

.cb-field {
	min-width: 0;
}

.cb-hint--after {
	margin: 0.45rem 0 0;
}

.cb-row {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
	.cb-row {
		gap: 1.25rem;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.cb-choices,
.cb-choices > *,
.cb-row,
.cb-row > * {
	min-width: 0;
}

.cb-input {
	appearance: none;
	background: var(--f-ivory);
	border: 1.5px solid var(--f-field);
	border-radius: 0.85rem;
	color: var(--f-ink);
	display: block;
	font: inherit;
	font-size: 1.0625rem;
	line-height: 1.4;
	min-height: 3.25rem;
	padding: 0.75rem 1rem;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
	width: 100%;
}

textarea.cb-input {
	min-height: 7rem;
	resize: vertical;
}

select.cb-input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2a39' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-position: right 0.9rem center;
	background-repeat: no-repeat;
	background-size: 1.1rem;
	padding-inline-end: 2.75rem;
}

.cb-input:hover {
	border-color: var(--f-gold);
}

.cb-input:focus {
	background: #fff;
	border-color: var(--f-navy);
	box-shadow: 0 0 0 3px rgba(38, 55, 73, 0.18);
	outline: none;
}

.cb-input[aria-invalid="true"] {
	border-color: var(--f-error);
}

.cb-error {
	color: var(--f-error);
	font-size: 0.9375rem;
	font-weight: 600;
	margin: 0.5rem 0 0;
}

.cb-error::before {
	content: "! ";
}

/* Choices */
.cb-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.cb-choices--cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 36rem) {
	.cb-choices--cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.cb-choice {
	cursor: pointer;
	display: block;
	margin: 0;
	position: relative;
}

.cb-choice input {
	appearance: none;
	border: 0;
	height: 100%;
	inset: 0;
	margin: 0;
	opacity: 0;
	position: absolute;
	width: 100%;
	cursor: pointer;
}

.cb-choice__box {
	align-items: center;
	background: var(--f-ivory);
	border: 1.5px solid var(--f-field);
	border-radius: 999px;
	color: var(--f-ink);
	display: flex;
	font-weight: 500;
	gap: 0.6rem;
	line-height: 1.3;
	min-height: 3rem;
	padding: 0.6rem 1.15rem;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.cb-choices--cards .cb-choice__box {
	align-items: flex-start;
	border-radius: 1.1rem;
	flex-direction: column;
	gap: 0.3rem;
	height: 100%;
	min-height: 5.25rem;
	padding: 1.05rem 3rem 1.05rem 1.2rem;
	position: relative;
}

.cb-choices--cards .cb-choice__label {
	font-family: var(--cb-serif, Georgia, serif);
	font-size: 1.3125rem;
	font-weight: 400;
	line-height: 1.2;
}

.cb-choice__desc {
	color: var(--f-muted);
	font-size: 0.9375rem;
	font-weight: 400;
	line-height: 1.4;
}

.cb-choices--cards .cb-choice__box::after {
	border: 1.5px solid var(--f-field);
	border-radius: 999px;
	content: "";
	height: 1.35rem;
	position: absolute;
	right: 1.1rem;
	top: 1.1rem;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	width: 1.35rem;
}

.cb-choice:hover .cb-choice__box {
	border-color: var(--f-gold);
}

.cb-choice input:checked + .cb-choice__box {
	background: var(--f-navy);
	border-color: var(--f-navy);
	color: #fff;
}

.cb-choice input:checked + .cb-choice__box .cb-choice__desc {
	color: #dfe5ea;
}

.cb-choices--cards .cb-choice input:checked + .cb-choice__box::after {
	background: var(--cb-gold-light, #e7d0a4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2a39' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 12.5 3.6 3.6 7.4-7.8'/%3E%3C/svg%3E") center / 0.9rem no-repeat;
	border-color: var(--cb-gold-light, #e7d0a4);
}

.cb-choice input:focus-visible + .cb-choice__box {
	outline: 3px solid var(--f-bronze);
	outline-offset: 3px;
}

.cb-choice input[type="checkbox"] + .cb-choice__box::before {
	border: 1.5px solid currentColor;
	border-radius: 0.3rem;
	content: "";
	flex: none;
	height: 1.05rem;
	opacity: 0.6;
	width: 1.05rem;
}

.cb-choice input[type="checkbox"]:checked + .cb-choice__box::before {
	background: var(--cb-gold-light, #e7d0a4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2a39' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-8.5'/%3E%3C/svg%3E") center / 0.8rem no-repeat;
	border-color: var(--cb-gold-light, #e7d0a4);
	opacity: 1;
}

.cb-group.has-error .cb-choice__box {
	border-color: var(--f-error);
}

/*
 * Windows contrast themes replace the navy fill and the white text with
 * system colours, so a chosen card or chip looked the same as the others.
 * Here the choice is shown by shape instead: a thick Highlight border, an
 * outline, and a solid mark that keeps its system colour.
 */
@media (forced-colors: active) {
	.cb-choice input:checked + .cb-choice__box {
		border: 4px solid Highlight;
		outline: 2px solid CanvasText;
		outline-offset: 2px;
	}

	.cb-choices--chips .cb-choice input[type="radio"]:checked + .cb-choice__box::before {
		background: Highlight;
		border-radius: 999px;
		content: "";
		flex: none;
		forced-color-adjust: none;
		height: 0.85rem;
		width: 0.85rem;
	}

	.cb-choices--cards .cb-choice__box::after,
	.cb-choice input[type="checkbox"] + .cb-choice__box::before {
		border-color: CanvasText;
		opacity: 1;
	}

	.cb-choices--cards .cb-choice input:checked + .cb-choice__box::after,
	.cb-choice input[type="checkbox"]:checked + .cb-choice__box::before {
		background: Highlight;
		border-color: Highlight;
		forced-color-adjust: none;
	}
}

/* Plain checkboxes (consent, flexibility) */
.cb-check {
	align-items: flex-start;
	color: var(--f-slate);
	cursor: pointer;
	display: flex;
	font-size: 1rem;
	gap: 0.8rem;
	line-height: 1.5;
	margin: 0;
}

.cb-check input {
	accent-color: var(--f-navy);
	flex: none;
	height: 1.4rem;
	margin: 0.1rem 0 0;
	width: 1.4rem;
}

.cb-consent {
	background: var(--f-ivory);
	border: 1px solid var(--f-sand);
	border-radius: 1rem;
	display: grid;
	gap: 0.9rem;
	padding: 1.1rem 1.2rem;
}

.cb-consent.has-error {
	border-color: var(--f-error);
}

.cb-consent a {
	color: var(--f-navy);
	font-weight: 600;
}

/* Status and navigation */
.cb-form__status {
	background: #fdf3f1;
	border: 1px solid #e7b9b3;
	border-inline-start: 4px solid var(--f-error);
	border-radius: 0.75rem;
	color: #6f1d1d;
	font-weight: 600;
	padding: 0.9rem 1.1rem;
}

.cb-form__nav {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: space-between;
	margin-top: 0.5rem;
}

.cb-form:not(.is-js) [data-cb-back],
.cb-form:not(.is-js) [data-cb-next] {
	display: none;
}

.cb-btn {
	align-items: center;
	border: 1.5px solid var(--f-navy);
	border-radius: 999px;
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-size: 1.0625rem;
	font-weight: 600;
	justify-content: center;
	line-height: 1.2;
	min-height: 3.25rem;
	padding: 0.85rem 1.75rem;
	text-align: center;
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.cb-btn[hidden] {
	display: none;
}

.cb-btn--primary {
	background: var(--f-navy);
	color: #fff;
	margin-inline-start: auto;
}

.cb-btn--primary:hover {
	background: var(--f-ink);
	box-shadow: 0 0.9rem 1.8rem -1rem rgba(27, 42, 57, 0.6);
}

.cb-btn--ghost {
	background: transparent;
	color: var(--f-navy);
}

.cb-btn--ghost:hover {
	background: var(--f-oat);
}

.cb-btn:focus-visible {
	outline: 3px solid var(--f-bronze);
	outline-offset: 3px;
}

.cb-btn[disabled] {
	cursor: progress;
	opacity: 0.7;
}

@media (max-width: 30rem) {
	.cb-btn--primary {
		flex: 1 1 100%;
		order: -1;
	}

	.cb-btn--ghost {
		flex: 1 1 100%;
	}
}

.cb-form__note {
	color: var(--f-muted);
	font-size: 0.9375rem;
	margin: 0;
	text-align: center;
}

.cb-turnstile:empty {
	display: none;
}

/* Reference code on the thank-you page */
.cb-ref {
	background: #fff;
	border: 1px solid var(--cb-sand, #e2d6c1);
	border-radius: 999px;
	color: var(--cb-ink, #1b2a39);
	display: inline-block;
	margin: 1.5rem auto 0;
	padding: 0.7rem 1.4rem;
}

.cb-ref[hidden] {
	display: none;
}

.cb-ref strong {
	font-size: 1.125rem;
	letter-spacing: 0.06em;
	margin-inline-start: 0.35rem;
}
