/* InquiryFlow — front-end styles.
 * Inherits the theme's font on purpose: a form should feel native to the site it lives on.
 * Override any token on .ifl (or a custom class) to restyle. */

.ifl {
	/* Tokens — set per form from the admin (accent, radius, width) */
	--ifl-accent: #0f766e;
	--ifl-on-accent: #ffffff;
	--ifl-radius: 10px;
	--ifl-max: 680px;

	--ifl-surface: #ffffff;
	--ifl-surface-2: #f2f6f5;
	--ifl-text: #14201f;
	--ifl-muted: #4b5a58;
	--ifl-line: #7d8b89;      /* input borders: 3.5:1 on surface */
	--ifl-hairline: #dfe6e5;  /* decorative dividers only */
	--ifl-danger: #b42318;
	--ifl-star: #b45309;
	--ifl-focus: var(--ifl-accent);

	--ifl-s1: .25rem; --ifl-s2: .5rem; --ifl-s3: .75rem; --ifl-s4: 1rem; --ifl-s5: 1.5rem; --ifl-s6: 2rem;
	--ifl-ease: cubic-bezier(.2, .7, .2, 1);

	container-type: inline-size;
	max-width: var(--ifl-max);
	margin-inline: auto;
	color: var(--ifl-text);
	font: inherit;
	line-height: 1.5;
	-webkit-text-size-adjust: 100%;
}
.ifl[data-ifl-theme="dark"] {
	--ifl-surface: #111917; --ifl-surface-2: #1a2422; --ifl-text: #e8efee; --ifl-muted: #a9b7b5;
	--ifl-line: #5f6f6d; --ifl-hairline: #2a3634; --ifl-danger: #f97066; --ifl-star: #fbbf24;
}
@media (prefers-color-scheme: dark) {
	.ifl[data-ifl-theme="auto"] {
		--ifl-surface: #111917; --ifl-surface-2: #1a2422; --ifl-text: #e8efee; --ifl-muted: #a9b7b5;
		--ifl-line: #5f6f6d; --ifl-hairline: #2a3634; --ifl-danger: #f97066; --ifl-star: #fbbf24;
	}
}

.ifl *, .ifl *::before, .ifl *::after { box-sizing: border-box; }
.ifl [hidden] { display: none !important; }

.ifl-card {
	background: var(--ifl-surface);
	border: 1px solid var(--ifl-hairline);
	border-radius: calc(var(--ifl-radius) + 4px);
	padding: clamp(var(--ifl-s4), 5cqi, var(--ifl-s6));
	position: relative;
	overflow: hidden;
}
.ifl-title { margin: 0 0 var(--ifl-s4); font-size: 1.375rem; line-height: 1.25; color: var(--ifl-text); }

/* Progress ---------------------------------------------------------------- */
.ifl-progress { margin: 0 0 var(--ifl-s5); }
.ifl:not(.is-js) .ifl-progress { display: none; }
.ifl-steps {
	list-style: none; margin: 0 0 var(--ifl-s3); padding: 0;
	display: flex; gap: var(--ifl-s2); counter-reset: none;
}
.ifl-steps__item {
	flex: 1 1 0; min-width: 0;
	display: flex; align-items: center; gap: var(--ifl-s2);
	font-size: .875rem; color: var(--ifl-muted);
}
.ifl-steps__dot {
	flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%;
	display: grid; place-items: center; font-size: .8125rem; font-weight: 700;
	border: 2px solid var(--ifl-line); color: var(--ifl-muted); background: var(--ifl-surface);
	transition: background-color .25s var(--ifl-ease), border-color .25s var(--ifl-ease), color .25s var(--ifl-ease);
}
.ifl-steps__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ifl-steps__item.is-current { color: var(--ifl-text); font-weight: 600; }
.ifl-steps__item.is-current .ifl-steps__dot { border-color: var(--ifl-accent); color: var(--ifl-accent); }
.ifl-steps__item.is-done .ifl-steps__dot { background: var(--ifl-accent); border-color: var(--ifl-accent); color: var(--ifl-on-accent); }
@container (max-width: 420px) {
	.ifl-steps__item:not(.is-current) .ifl-steps__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.ifl-steps__item:not(.is-current) { flex: 0 0 auto; }
}
.ifl-bar { height: 6px; border-radius: 999px; background: var(--ifl-surface-2); overflow: hidden; }
.ifl-bar__fill {
	display: block; height: 100%; width: 100%;
	background: var(--ifl-accent); border-radius: inherit;
	transform: scaleX(.02); transform-origin: left center;
	transition: transform .45s var(--ifl-ease);
}

.ifl-progress__text { margin: var(--ifl-s2) 0 0; font-size: .875rem; color: var(--ifl-muted); min-height: 1.3em; }
.ifl.is-cheer .ifl-progress__text { animation: ifl-pop .5s var(--ifl-ease); }

/* Steps & grid ------------------------------------------------------------ */
.ifl.is-js .ifl-step:not(.is-active) { display: none; }
.ifl:not(.is-js) .ifl-step + .ifl-step { margin-top: var(--ifl-s6); padding-top: var(--ifl-s5); border-top: 1px solid var(--ifl-hairline); }
.ifl.is-js .ifl-step.is-active { animation: ifl-in .35s var(--ifl-ease); }
.ifl-step__title { margin: 0 0 var(--ifl-s1); font-size: 1.25rem; line-height: 1.3; color: var(--ifl-text); outline: none; }
.ifl-step__lead { margin: 0 0 var(--ifl-s5); color: var(--ifl-muted); }

.ifl-grid { display: grid; grid-template-columns: 1fr; gap: var(--ifl-s5) var(--ifl-s4); }
@container (min-width: 520px) {
	.ifl-grid { grid-template-columns: 1fr 1fr; }
	.ifl-w-full { grid-column: 1 / -1; }
}

/* Fields ------------------------------------------------------------------ */
.ifl-field { min-width: 0; }
.ifl-label { display: block; margin: 0 0 var(--ifl-s2); padding: 0; font-weight: 600; font-size: 1rem; color: var(--ifl-text); }
.ifl-req { color: var(--ifl-danger); }
.ifl-opt { font-weight: 400; font-size: .875rem; color: var(--ifl-muted); }
.ifl-help { margin: calc(-1 * var(--ifl-s1)) 0 var(--ifl-s2); font-size: .875rem; color: var(--ifl-muted); }
.ifl-help a, .ifl-choice a { color: var(--ifl-accent); }

.ifl-input {
	display: block; width: 100%; min-height: 48px;
	padding: var(--ifl-s3) var(--ifl-s4);
	font: inherit; font-size: 1rem; /* ≥16px: prevents iOS zoom */
	color: var(--ifl-text); background: var(--ifl-surface);
	border: 1px solid var(--ifl-line); border-radius: var(--ifl-radius);
	box-shadow: none; appearance: none; -webkit-appearance: none;
	transition: border-color .15s var(--ifl-ease), box-shadow .15s var(--ifl-ease);
}
.ifl-input::placeholder { color: var(--ifl-muted); opacity: .8; }
textarea.ifl-input { min-height: 8.5rem; resize: vertical; line-height: 1.5; }
select.ifl-input {
	padding-inline-end: 2.5rem; cursor: pointer;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; /* mirrored for RTL below */
	background-size: 5px 5px; background-repeat: no-repeat;
}
.ifl-input:hover { border-color: var(--ifl-text); }
.ifl-input:focus { outline: none; }
.ifl-input:focus-visible, .ifl-input:focus {
	border-color: var(--ifl-focus);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ifl-focus) 28%, transparent);
}
.ifl-field.has-error .ifl-input { border-color: var(--ifl-danger); }
.ifl-error { margin: var(--ifl-s2) 0 0; font-size: .875rem; color: var(--ifl-danger); font-weight: 500; }

/* Choices */
.ifl-choices, .ifl-rating { border: 0; margin: 0; padding: 0; min-width: 0; }
.ifl-choices__list { display: grid; gap: var(--ifl-s2); }
@container (min-width: 520px) { .ifl-w-full .ifl-choices__list { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); } }
.ifl-choice {
	margin: 0; font-size: 1rem; font-weight: 400; line-height: 1.4; color: var(--ifl-text);
	display: flex; align-items: flex-start; gap: var(--ifl-s3);
	padding: var(--ifl-s3) var(--ifl-s4); min-height: 48px;
	border: 1px solid var(--ifl-line); border-radius: var(--ifl-radius);
	cursor: pointer; background: var(--ifl-surface);
	transition: border-color .15s var(--ifl-ease), background-color .15s var(--ifl-ease);
}
.ifl-choice:hover { border-color: var(--ifl-text); }
.ifl-choice input {
	flex: none; width: 1.25rem; height: 1.25rem; margin: .125rem 0 0;
	accent-color: var(--ifl-accent); cursor: pointer;
}
.ifl-choice input:focus-visible { outline: 3px solid var(--ifl-focus); outline-offset: 2px; }
.ifl-choice:has(input:checked) { border-color: var(--ifl-accent); background: color-mix(in srgb, var(--ifl-accent) 8%, var(--ifl-surface)); }
.ifl-consent { border-style: dashed; }
.ifl-field.has-error .ifl-choice { border-color: var(--ifl-danger); }

/* Rating */
.ifl-rating__stars { display: flex; gap: var(--ifl-s1); flex-wrap: wrap; }
.ifl-star { cursor: pointer; padding: var(--ifl-s1); border-radius: 8px; line-height: 0; color: var(--ifl-line); transition: transform .15s var(--ifl-ease), color .15s var(--ifl-ease); }
.ifl-star svg { width: 2.25rem; height: 2.25rem; fill: currentColor; }
.ifl-star:hover, .ifl-star.is-on, .ifl-rating__stars input:checked + .ifl-star { color: var(--ifl-star); }
.ifl-star:hover { transform: scale(1.08); }
.ifl-rating__stars input:focus-visible + .ifl-star { outline: 3px solid var(--ifl-focus); outline-offset: 1px; }

/* Answer-quality meter (gamification) */
.ifl-meter { height: 4px; margin-top: var(--ifl-s2); border-radius: 999px; background: var(--ifl-surface-2); overflow: hidden; }
.ifl-meter__bar { display: block; height: 100%; width: 100%; transform: scaleX(.04); transform-origin: left; background: var(--ifl-muted); transition: transform .3s var(--ifl-ease), background-color .3s; }
.ifl-field[data-ifl-level="1"] .ifl-meter__bar { background: var(--ifl-star); }
.ifl-field[data-ifl-level="2"] .ifl-meter__bar { background: var(--ifl-accent); }
.ifl-meter__text { margin: var(--ifl-s1) 0 0; font-size: .8125rem; color: var(--ifl-muted); min-height: 1.2em; }
.ifl:not(.is-js) .ifl-meter, .ifl:not(.is-js) .ifl-meter__text { display: none; }

.ifl-heading__title { margin: 0; font-weight: 700; font-size: 1.0625rem; }

/* Buttons ----------------------------------------------------------------- */
.ifl-nav { display: flex; flex-wrap: wrap; gap: var(--ifl-s3); justify-content: flex-end; margin-top: var(--ifl-s6); }
.ifl-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--ifl-s2);
	min-height: 48px; padding: var(--ifl-s3) var(--ifl-s5);
	font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none;
	border-radius: var(--ifl-radius); border: 1px solid transparent; cursor: pointer;
	transition: background-color .15s var(--ifl-ease), transform .1s var(--ifl-ease), box-shadow .15s var(--ifl-ease);
}
.ifl-btn:focus-visible { outline: 3px solid var(--ifl-focus); outline-offset: 3px; }
.ifl-btn:active { transform: translateY(1px); }
.ifl-btn--primary { background: var(--ifl-accent); color: var(--ifl-on-accent); }
.ifl-btn--primary:hover { background: color-mix(in srgb, var(--ifl-accent) 86%, #000); color: var(--ifl-on-accent); }
.ifl-btn--ghost { background: transparent; color: var(--ifl-text); border-color: var(--ifl-line); }
.ifl-btn--ghost:hover { background: var(--ifl-surface-2); }
.ifl-btn[disabled] { opacity: .65; cursor: progress; }
.ifl-btn svg { width: 1.125rem; height: 1.125rem; fill: currentColor; flex: none; }
.ifl.is-js .ifl-nav .ifl-back { margin-inline-end: auto; }
.ifl:not(.is-js) .ifl-next, .ifl:not(.is-js) .ifl-back { display: none; }
@container (max-width: 420px) {
	.ifl-nav { flex-direction: column-reverse; }
	.ifl-nav .ifl-btn { width: 100%; }
}

.ifl-alert { margin: var(--ifl-s4) 0 0; padding: var(--ifl-s3) var(--ifl-s4); border-radius: var(--ifl-radius); font-size: .9375rem; }
.ifl-alert--error { color: var(--ifl-danger); background: color-mix(in srgb, var(--ifl-danger) 9%, var(--ifl-surface)); border: 1px solid color-mix(in srgb, var(--ifl-danger) 35%, transparent); }

/* Done + Preferred Source ------------------------------------------------- */
.ifl-done { outline: none; text-align: center; position: relative; }
.ifl-done__badge {
	width: 4rem; height: 4rem; margin: 0 auto var(--ifl-s4);
	border-radius: 50%; display: grid; place-items: center;
	background: var(--ifl-accent); color: var(--ifl-on-accent);
}
.ifl-done__badge svg { width: 2rem; height: 2rem; fill: currentColor; }
.ifl-done__title { margin: 0 0 var(--ifl-s2); font-size: 1.5rem; line-height: 1.25; color: var(--ifl-text); }
.ifl-done__text { margin: 0 auto var(--ifl-s5); max-width: 32rem; color: var(--ifl-muted); }

/* The signature moment: the badge lands with a ring burst */
.ifl-done.is-celebrate .ifl-done__badge { animation: ifl-land .6s var(--ifl-ease) both; }
.ifl-done.is-celebrate .ifl-done__badge::after {
	content: ""; position: absolute; left: 50%; top: 2rem; width: 4rem; height: 4rem; margin-left: -2rem; margin-top: -2rem;
	border-radius: 50%; border: 3px solid var(--ifl-accent); pointer-events: none;
	animation: ifl-ring .9s .15s var(--ifl-ease) both;
}

.ifl-ps {
	text-align: start;
	margin-top: var(--ifl-s2);
	padding: var(--ifl-s5);
	border-radius: var(--ifl-radius);
	background: var(--ifl-surface-2);
	border-inline-start: 4px solid var(--ifl-accent);
	transition: opacity .3s var(--ifl-ease);
}
.ifl-done.is-celebrate .ifl-ps { animation: ifl-in .45s .35s var(--ifl-ease) both; }
.ifl-ps__eyebrow { margin: 0 0 var(--ifl-s1); font-size: .8125rem; font-weight: 600; letter-spacing: .02em; color: var(--ifl-muted); }
.ifl-ps__title { margin: 0 0 var(--ifl-s2); font-size: 1.125rem; line-height: 1.3; color: var(--ifl-text); }
.ifl-ps__text { margin: 0 0 var(--ifl-s4); color: var(--ifl-muted); }
.ifl-ps__actions { display: flex; flex-wrap: wrap; gap: var(--ifl-s3); align-items: center; }
.ifl-ps__img { display: inline-block; line-height: 0; border-radius: var(--ifl-radius); }
.ifl-ps__img img { max-width: 100%; height: auto; max-height: 56px; }
.ifl-ps__img:focus-visible { outline: 3px solid var(--ifl-focus); outline-offset: 3px; }
.ifl-ps__note { margin: var(--ifl-s3) 0 0; font-size: .875rem; color: var(--ifl-muted); min-height: 1.2em; }
.ifl-ps.is-dismissed { opacity: .7; }
.ifl-btn--quiet { background: transparent; color: var(--ifl-accent); border-color: var(--ifl-line); }
@container (max-width: 420px) { .ifl-ps__actions .ifl-btn { width: 100%; } }

/* ===== 1.1 =================================================================== */

/* RTL: everything above uses logical properties; these are the physical leftovers. */
.ifl[dir="rtl"] { line-height: 1.7; }
.ifl[dir="rtl"] .ifl-bar__fill,
.ifl[dir="rtl"] .ifl-meter__bar { transform-origin: right center; }
.ifl[dir="rtl"] select.ifl-input { background-position: 15px 55%, 20px 55%; }
.ifl[dir="rtl"] .ifl-ps__eyebrow,
.ifl[dir="rtl"] .ifl-final__title { letter-spacing: 0; } /* letter-spacing breaks Arabic-script joining */
.ifl[dir="rtl"] .ifl-final__link svg,
.ifl[dir="rtl"] .ifl-ps__btn svg { transform: scaleX(-1); }
.ifl input[dir="ltr"] { text-align: start; }
/* Mixed-direction text (an untranslated English label, a brand name) keeps correct punctuation inside RTL. */
.ifl[dir="rtl"] :is(.ifl-label [data-ifl-t], .ifl-help, .ifl-step__title, .ifl-step__lead, .ifl-choice span, .ifl-ps__title, .ifl-ps__text, .ifl-final__title, .ifl-final__text, .ifl-final__link span, .ifl-news__label, .ifl-heading__title, .ifl-done__title, .ifl-done__text, .ifl-error, .ifl-btn span) { unicode-bidi: plaintext; }
.ifl[dir="rtl"] :is(.ifl-help, .ifl-step__title, .ifl-step__lead, .ifl-ps__title, .ifl-ps__text, .ifl-final__title, .ifl-final__text, .ifl-news__label, .ifl-heading__title, .ifl-error) { text-align: right; }
.ifl[dir="rtl"] input[dir="ltr"]::placeholder { text-align: right; }

/* Browser-language mode: hold the card invisible for a moment so visitors don't see a language flash.
   Falls back to visible after 1.2 s if JavaScript never runs. */
.ifl[data-ifl-lang-mode="browser"]:not(.is-lang-ready) .ifl-card { visibility: hidden; animation: ifl-show 0s 1.2s forwards; }
@keyframes ifl-show { to { visibility: visible; } }

/* Language switcher */
.ifl-langbar { display: flex; justify-content: flex-end; margin: calc(-1 * var(--ifl-s2)) 0 var(--ifl-s3); }
.ifl-lang {
	font: inherit; font-size: .875rem; color: var(--ifl-text); background: var(--ifl-surface);
	border: 1px solid var(--ifl-line); border-radius: 999px; padding: .3rem .9rem; min-height: 36px; cursor: pointer;
}
.ifl-lang:focus-visible { outline: 3px solid var(--ifl-focus); outline-offset: 2px; }

/* Conditional reveal */
.ifl-field.is-revealed, .ifl-heading.is-revealed, .ifl-final.is-revealed { animation: ifl-in .3s var(--ifl-ease); }

/* Preferred source inside the form (before / required) */
.ifl-ps--before, .ifl-ps--required { margin-top: var(--ifl-s5); }
.ifl-ps--required { border-inline-start-color: var(--ifl-star); }
.ifl-ps.is-done { border-inline-start-color: var(--ifl-accent); }
.ifl-ps.is-done .ifl-ps__btn { background: transparent; color: var(--ifl-accent); border-color: var(--ifl-accent); }
.ifl-ps.is-done .ifl-ps__note::before { content: "✓ "; font-weight: 700; color: var(--ifl-accent); }
.ifl.is-js .ifl-ps__confirm { display: none; }
.ifl-ps__confirm { margin-top: var(--ifl-s3); }
.ifl-ps__error { margin-top: var(--ifl-s3); }

/* Final page */
.ifl-final-next-wrap { margin: var(--ifl-s5) 0 0; text-align: center; }
.ifl:not(.is-js) .ifl-final-next-wrap { display: none; }
.ifl.is-js .ifl-final.is-pending { display: none; }
.ifl-final { outline: none; text-align: start; margin-top: var(--ifl-s5); padding-top: var(--ifl-s5); border-top: 1px solid var(--ifl-hairline); }
.ifl-final__title { margin: 0 0 var(--ifl-s1); font-size: 1.25rem; line-height: 1.3; color: var(--ifl-text); }
.ifl-final__text { margin: 0 0 var(--ifl-s4); color: var(--ifl-muted); }
.ifl-final__links { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--ifl-s2); }
@container (min-width: 520px) { .ifl-final__links { grid-template-columns: 1fr 1fr; } }
.ifl-final__link {
	display: flex; align-items: center; gap: var(--ifl-s3); min-height: 52px;
	padding: var(--ifl-s3) var(--ifl-s4); border: 1px solid var(--ifl-line); border-radius: var(--ifl-radius);
	color: var(--ifl-text); background: var(--ifl-surface); text-decoration: none; font-weight: 600;
	transition: border-color .15s var(--ifl-ease), background-color .15s var(--ifl-ease), transform .1s var(--ifl-ease);
}
.ifl-final__link:hover { border-color: var(--ifl-accent); background: color-mix(in srgb, var(--ifl-accent) 6%, var(--ifl-surface)); color: var(--ifl-text); }
.ifl-final__link:focus-visible { outline: 3px solid var(--ifl-focus); outline-offset: 2px; }
.ifl-final__link svg { width: 1.25rem; height: 1.25rem; flex: none; fill: var(--ifl-accent); }
.ifl-final__link--google_review svg { fill: var(--ifl-star); }
.ifl-news { margin-top: var(--ifl-s4); padding: var(--ifl-s4); border-radius: var(--ifl-radius); background: var(--ifl-surface-2); }
.ifl-news__label { display: block; margin: 0 0 var(--ifl-s2); font-weight: 600; color: var(--ifl-text); }
.ifl-news__row { display: flex; gap: var(--ifl-s2); flex-wrap: wrap; }
.ifl-news__row .ifl-input { flex: 1 1 14rem; }
.ifl-news__done { margin: var(--ifl-s2) 0 0; color: var(--ifl-muted); min-height: 1.2em; }
.ifl-news .ifl-btn svg { fill: currentColor; }

/* Utilities */
.ifl-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ifl-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@keyframes ifl-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ifl-pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); color: var(--ifl-accent); } 100% { transform: scale(1); } }
@keyframes ifl-land { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes ifl-ring { from { transform: scale(1); opacity: .7; } to { transform: scale(2.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.ifl *, .ifl *::before, .ifl *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
	.ifl-bar__fill, .ifl-meter__bar { background: Highlight; }
	.ifl-choice:has(input:checked) { outline: 2px solid Highlight; }
}
