/**
 * Insight Clinic Forms — front-end styling.
 *
 * Palette and typography derived from the live Insight Clinic site:
 * theme colour #e79d9d, body/heading #5a5a54, Montserrat, rounded buttons.
 * Body copy is deliberately larger than the theme's 13px, because these are
 * long clinical questionnaires that have to stay comfortable to read.
 */

.icf {
	/* Insight Clinic's brand rose (#e79d9d) is very light: white text on it
	   measures 2.16:1 and it reads 2.16:1 against white, so it cannot legally
	   carry text or convey state. It is kept for decorative surfaces, and a
	   deeper tone from the same hue family (5.7:1 both ways) is used wherever
	   contrast actually matters. */
	--icf-brand: #e79d9d;
	--icf-primary: #985252;
	--icf-primary-dark: #7e4444;
	--icf-primary-tint: #faeeee;
	--icf-ink: #4a4a45;
	--icf-heading: #5a5a54;
	--icf-muted: #716c67;
	--icf-line: #e6e2de;
	--icf-surface: #ffffff;
	--icf-canvas: #f7f5f3;
	--icf-error: #a8332a;
	--icf-error-tint: #fdf2f1;
	--icf-radius: 14px;
	--icf-radius-sm: 10px;
	--icf-gap: 26px;
	--icf-font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

	font-family: var(--icf-font);
	color: var(--icf-ink);
	font-size: 16px;
	line-height: 1.6;
	max-width: 780px;
	margin: 0 auto;
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
}

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

/* Any element inside the form that carries the `hidden` attribute must stay
   hidden even when its own rule sets a display value (flex, grid, inline-flex).
   Without this the user-agent `[hidden] { display: none }` loses on specificity
   and hidden chrome — error markers, the nav bar — renders as empty furniture. */
.icf [hidden] {
	display: none !important;
}

.icf__panel {
	background: var(--icf-surface);
	border: 1px solid var(--icf-line);
	border-radius: var(--icf-radius);
	padding: 26px 20px 22px;
	box-shadow: 0 1px 2px rgba(90, 90, 84, .04), 0 12px 28px -18px rgba(90, 90, 84, .28);
}

/* ------------------------------------------------------------------ header */

.icf__head {
	margin-bottom: 22px;
}

.icf__eyebrow {
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--icf-primary);
}

.icf__title {
	margin: 0 0 18px;
	font-family: var(--icf-font);
	font-size: 24px;
	line-height: 1.25;
	font-weight: 500;
	color: var(--icf-heading);
}

.icf__progress-label {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--icf-muted);
	letter-spacing: .02em;
}

.icf__progress-saved {
	font-weight: 500;
	color: var(--icf-primary);
	font-size: 12px;
}

.icf__progress-track {
	height: 6px;
	border-radius: 999px;
	background: var(--icf-primary-tint);
	overflow: hidden;
}

.icf__progress-bar {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 999px;
	background: var(--icf-primary);
	transition: width .32s cubic-bezier(.4, 0, .2, 1);
}

/* ------------------------------------------------------------------ alert */

.icf__alert {
	margin: 0 0 18px;
	padding: 12px 15px;
	border-radius: var(--icf-radius-sm);
	background: var(--icf-error-tint);
	border: 1px solid #f0d3d0;
	color: var(--icf-error);
	font-size: 14.5px;
}

/* ------------------------------------------------------------------ steps */

.icf__viewport {
	position: relative;
	overflow: hidden;
	transition: height .34s cubic-bezier(.4, 0, .2, 1);
}

.icf__track {
	display: flex;
	align-items: flex-start;
	width: 100%;
	transition: transform .34s cubic-bezier(.4, 0, .2, 1);
	will-change: transform;
}

.icf__step {
	flex: 0 0 100%;
	width: 100%;
	min-width: 100%;
	opacity: 0;
	transition: opacity .24s ease;
}

.icf__step.is-active {
	opacity: 1;
}

.icf__step-inner {
	padding: 2px 2px 4px;
}

.icf__step-title {
	margin: 0 0 6px;
	font-size: 19px;
	line-height: 1.3;
	font-weight: 600;
	color: var(--icf-heading);
}

.icf__step-title:focus {
	outline: none;
}

.icf__step-title:focus-visible {
	outline: 2px solid var(--icf-primary);
	outline-offset: 4px;
	border-radius: 4px;
}

.icf__step-intro,
.icf__step-desc {
	margin: 0 0 18px;
	color: var(--icf-muted);
	font-size: 15px;
}

.icf__step-intro + .icf__step-desc {
	margin-top: -10px;
}

/* ------------------------------------------------------------------ terms */

.icf__terms {
	max-height: 380px;
	overflow-y: auto;
	padding: 18px 18px 6px;
	margin: 0 0 var(--icf-gap);
	background: var(--icf-canvas);
	border: 1px solid var(--icf-line);
	border-radius: var(--icf-radius-sm);
	font-size: 15px;
	-webkit-overflow-scrolling: touch;
}

.icf__terms:focus-visible {
	outline: 2px solid var(--icf-primary);
	outline-offset: 2px;
}

.icf__terms h2 {
	margin: 0 0 12px;
	font-size: 17px;
	font-weight: 600;
	color: var(--icf-heading);
}

.icf__terms h3 {
	margin: 18px 0 8px;
	font-size: 15px;
	font-weight: 600;
	color: var(--icf-heading);
}

.icf__terms p {
	margin: 0 0 12px;
}

.icf__terms ul {
	margin: 0 0 12px;
	padding-left: 20px;
}

.icf__terms li {
	margin-bottom: 5px;
}

.icf__info {
	margin: 0 0 var(--icf-gap);
	padding: 14px 16px;
	background: var(--icf-primary-tint);
	border-radius: var(--icf-radius-sm);
	font-size: 15px;
	color: var(--icf-heading);
}

.icf__info p:last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------ fields */

.icf__field {
	margin-bottom: var(--icf-gap);
}

.icf__field:last-child {
	margin-bottom: 4px;
}

.icf__fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.icf__label {
	display: block;
	margin: 0 0 7px;
	padding: 0;
	font-size: 15.5px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--icf-heading);
}

legend.icf__label {
	float: left;
	width: 100%;
}

legend.icf__label + * {
	clear: both;
}

.icf__req {
	color: var(--icf-primary-dark);
	font-weight: 700;
}

.icf__desc {
	margin: -3px 0 9px;
	font-size: 14px;
	color: var(--icf-muted);
	line-height: 1.5;
}

.icf__sublabel {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 500;
	color: var(--icf-muted);
}

.icf__input {
	display: block;
	width: 100%;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 16px; /* 16px avoids iOS zoom-on-focus */
	line-height: 1.5;
	color: var(--icf-ink);
	background: var(--icf-surface);
	border: 1.5px solid var(--icf-line);
	border-radius: var(--icf-radius-sm);
	transition: border-color .16s ease, box-shadow .16s ease;
	-webkit-appearance: none;
	appearance: none;
}

select.icf__input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23716c67' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 12px;
	padding-right: 38px;
}

.icf__input:hover {
	border-color: #d8d2cc;
}

.icf__input:focus {
	outline: none;
	border-color: var(--icf-primary);
	box-shadow: 0 0 0 3px rgba(152, 82, 82, .20);
}

.icf__textarea {
	min-height: 120px;
	resize: vertical;
	line-height: 1.6;
}

.icf__input--inline {
	margin-top: 7px;
}

.icf__composite {
	display: grid;
	gap: 12px;
}

@media (min-width: 560px) {
	.icf__composite--name {
		grid-template-columns: 1fr 1fr;
	}
}

/* ------------------------------------------------------------------ options */

.icf__options {
	display: grid;
	gap: 9px;
}

@media (min-width: 620px) {
	.icf__options--horizontal {
		grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
		gap: 9px 14px;
	}
}

.icf__option {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: start;
	gap: 0 11px;
	padding: 11px 14px;
	background: var(--icf-surface);
	border: 1.5px solid var(--icf-line);
	border-radius: var(--icf-radius-sm);
	transition: border-color .16s ease, background-color .16s ease;
}

.icf__option:hover {
	border-color: #ddd6d0;
	background: #fdfcfb;
}

.icf__option:focus-within {
	border-color: var(--icf-primary);
	box-shadow: 0 0 0 3px rgba(152, 82, 82, .16);
}

.icf__option:has(.icf__choice:checked) {
	border-color: var(--icf-primary);
	background: var(--icf-primary-tint);
}

.icf__choice {
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
	flex: none;
	accent-color: var(--icf-primary);
	cursor: pointer;
}

.icf__option label {
	font-size: 15px;
	line-height: 1.45;
	color: var(--icf-ink);
	cursor: pointer;
	font-weight: 500;
}

.icf__option-text {
	grid-column: 1 / -1;
	margin-top: 2px;
}

/* ------------------------------------------------------------------ errors */

.icf__error {
	margin: 7px 0 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--icf-error);
	display: flex;
	align-items: flex-start;
	gap: 6px;
}

/* `display: flex` beats the user-agent `[hidden] { display: none }`, which would
   otherwise leave an empty error marker under every single question. */
.icf__error[hidden] {
	display: none;
}

.icf__error::before {
	content: "!";
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 17px;
	height: 17px;
	margin-top: 2px;
	border-radius: 50%;
	background: var(--icf-error);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

.icf__field.has-error .icf__input,
.icf__field.has-error .icf__option {
	border-color: #d9948d;
}

.icf__field.has-error .icf__label {
	color: var(--icf-error);
}

/* ------------------------------------------------------------------ nav */

.icf__nav {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 26px;
	padding-top: 20px;
	border-top: 1px solid var(--icf-line);
}

.icf__btn {
	appearance: none;
	-webkit-appearance: none;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	padding: 14px 26px;
	min-height: 50px;
	border-radius: 999px;
	border: 1.5px solid transparent;
	cursor: pointer;
	transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .1s ease;
}

.icf__btn:active {
	transform: translateY(1px);
}

.icf__btn:focus-visible {
	outline: 2px solid var(--icf-primary);
	outline-offset: 3px;
}

.icf__btn--primary {
	margin-left: auto;
	background: var(--icf-primary);
	color: #fff;
}

.icf__btn--primary:hover {
	background: var(--icf-primary-dark);
}

.icf__btn--primary[disabled] {
	opacity: .6;
	cursor: default;
}

.icf__btn--ghost {
	background: transparent;
	color: var(--icf-muted);
	border-color: var(--icf-line);
	padding-left: 20px;
	padding-right: 20px;
}

.icf__btn--ghost:hover {
	color: var(--icf-heading);
	border-color: #d8d2cc;
	background: var(--icf-canvas);
}

.icf__btn[hidden] {
	display: none;
}

.icf__privacy {
	margin: 16px 0 0;
	font-size: 12.5px;
	line-height: 1.55;
	color: var(--icf-muted);
}

/* ------------------------------------------------------------------ review */

.icf__review-section {
	margin-bottom: 22px;
	border: 1px solid var(--icf-line);
	border-radius: var(--icf-radius-sm);
	overflow: hidden;
}

.icf__review-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 11px 15px;
	background: var(--icf-canvas);
	border-bottom: 1px solid var(--icf-line);
}

.icf__review-head h4 {
	margin: 0;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--icf-heading);
}

.icf__edit {
	appearance: none;
	-webkit-appearance: none;
	flex: none;
	border: 1.5px solid var(--icf-line);
	background: var(--icf-surface);
	color: var(--icf-primary-dark);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 7px 15px;
	min-height: 36px;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color .16s ease, border-color .16s ease;
}

.icf__edit:hover {
	background: var(--icf-primary-tint);
	border-color: var(--icf-primary);
}

.icf__edit:focus-visible {
	outline: 2px solid var(--icf-primary);
	outline-offset: 2px;
}

.icf__review-list {
	margin: 0;
	padding: 4px 15px 10px;
}

.icf__review-row {
	padding: 9px 0;
	border-bottom: 1px solid #f1eeeb;
}

.icf__review-row:last-child {
	border-bottom: 0;
}

.icf__review-list dt {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--icf-muted);
	margin: 0 0 3px;
}

.icf__review-list dd {
	margin: 0;
	font-size: 15px;
	color: var(--icf-ink);
	overflow-wrap: anywhere;
}

.icf__review-empty {
	color: #a49d97;
	font-style: italic;
}

@media (min-width: 640px) {
	.icf__review-row {
		display: grid;
		grid-template-columns: 45% 1fr;
		gap: 14px;
		align-items: baseline;
	}

	.icf__review-list dt {
		margin-bottom: 0;
	}
}

/* ------------------------------------------------------------------ done */

.icf__done {
	text-align: center;
	padding: 26px 10px 18px;
}

.icf__done-mark {
	color: var(--icf-primary);
	margin-bottom: 14px;
}

.icf__done .icf__step-title {
	font-size: 21px;
}

.icf__done-message {
	color: var(--icf-muted);
	font-size: 15.5px;
	max-width: 46ch;
	margin: 0 auto 18px;
}

.icf__done-message p {
	margin: 0;
}

.icf__done-ref {
	display: inline-flex;
	flex-direction: column;
	gap: 3px;
	margin: 0;
	padding: 13px 28px;
	background: var(--icf-primary-tint);
	border-radius: var(--icf-radius-sm);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--icf-muted);
}

.icf__done-ref strong {
	font-size: 21px;
	letter-spacing: .04em;
	color: var(--icf-heading);
	text-transform: none;
}

/* ------------------------------------------------------------------ misc */

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

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

.icf__missing {
	padding: 12px 16px;
	background: #fff6f5;
	border: 1px solid #f0d3d0;
	border-radius: 8px;
	color: #a8332a;
}

/* ------------------------------------------------------------------ desktop */

@media (min-width: 720px) {
	.icf__panel {
		padding: 34px 38px 30px;
	}

	.icf__title {
		font-size: 28px;
	}

	.icf__step-title {
		font-size: 21px;
	}
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
	.icf__track,
	.icf__viewport,
	.icf__progress-bar,
	.icf__step {
		transition: none !important;
	}

	.icf__btn:active {
		transform: none;
	}
}

/* ------------------------------------------------------------------ contrast */

@media (forced-colors: active) {
	.icf__option,
	.icf__input,
	.icf__panel {
		border-color: CanvasText;
	}

	.icf__progress-bar {
		background: Highlight;
	}

	/* box-shadow is dropped in forced-colors, so the ring used for input focus
	   would disappear entirely. Restore a real outline instead. */
	.icf__input:focus,
	.icf__option:focus-within {
		outline: 2px solid Highlight;
		outline-offset: 2px;
	}

	.icf__field.has-error .icf__input {
		outline: 2px dashed CanvasText;
	}
}
