/* Quiz CRM — front-end form styles */

.quiz-crm-form-wrap {
	max-width: 560px;
	margin: 0 auto;
	font-size: 16px;
	line-height: 1.5;
}

/* Steps: only the active one is shown. */
.quiz-crm-step {
	display: none;
}
.quiz-crm-step.is-active {
	display: block;
}

.quiz-crm-step-title {
	margin: 0 0 1rem;
	font-size: 1.25rem;
}

/* Progress bar */
.quiz-crm-progress {
	margin-bottom: 1.25rem;
}
.quiz-crm-progress-track {
	height: 8px;
	background: #e5e7eb;
	border-radius: 999px;
	overflow: hidden;
}
.quiz-crm-progress-bar {
	height: 100%;
	width: 0;
	background: #2563eb;
	transition: width 0.25s ease;
}
/* One quiet meta row under the bar: step count left, time hint right. */
.quiz-crm-progress-meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin-top: 0.4rem;
}
.quiz-crm-progress-text {
	font-size: 0.85rem;
	color: #6b7280;
}

/* Fields */
.quiz-crm-field {
	margin-bottom: 1rem;
}
.quiz-crm-label {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 600;
}
.quiz-crm-input {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font: inherit;
	box-sizing: border-box;
}
.quiz-crm-textarea {
	min-height: 110px;
	resize: vertical;
}
.quiz-crm-input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba( 37, 99, 235, 0.15 );
}

/* iOS Safari zooms the whole page in whenever a text control smaller than 16px
   gains focus, and doesn't cleanly zoom back out — which now shows on every
   step because we autofocus the next field. Force a 16px floor on the text
   controls for touch devices so focus never triggers that zoom. Scoped to a
   coarse pointer (and marked important) so it holds over a style preset/theme
   that shrank the input font, while desktop keeps the design's own sizing.
   (`.quiz-crm-input` is also on the select/textarea/"Other" controls.) */
@media ( pointer: coarse ) {
	.quiz-crm-form-wrap .quiz-crm-input {
		font-size: 16px !important;
	}
}

/* Friction-reducing microcopy: the completion-time line (in the progress meta
   row, or atop the first step when there's no progress bar) and the trust hint
   under phone fields. Small and muted — never competing with the question. */
.quiz-crm-time-hint {
	margin: 0;
	font-size: 0.85rem;
	color: #6b7280;
}
.quiz-crm-time-hint[hidden] {
	display: none;
}
.quiz-crm-step > .quiz-crm-time-hint {
	display: block;
	margin: 0 0 1rem;
}
.quiz-crm-field-hint {
	margin: 0.35rem 0 0;
	font-size: 0.8rem;
	color: #6b7280;
}
/* Served-area gate: the polite stop shown when a postal code is outside the
   form's allowed-FSA list. Inherits the form's text color and uses
   currentColor for the edge so every style preset (dark forms included)
   themes it automatically; presets can retarget .quiz-crm-area-notice-* for
   a custom look. */
.quiz-crm-area-notice {
	margin: 0.75rem 0 0;
	padding: 0.85rem 1rem;
	border: 1px solid;
	border-color: color-mix(in srgb, currentColor 25%, transparent);
	border-left: 4px solid currentColor;
	border-radius: 8px;
	background: color-mix(in srgb, currentColor 6%, transparent);
}
.quiz-crm-area-notice[hidden] {
	display: none;
}
.quiz-crm-area-notice-title {
	margin: 0 0 0.25rem;
	font-weight: 700;
	font-size: 0.95rem;
}
.quiz-crm-area-notice-text {
	margin: 0;
	font-size: 0.85rem;
	opacity: 0.85;
}
/* Auto-linked phone numbers (tap-to-call) inherit the surrounding text color
   so they stay readable on any style preset — dark forms and the green
   thank-you box alike. */
.quiz-crm-field-hint a.quiz-crm-tel,
.quiz-crm-thankyou-message a.quiz-crm-tel {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
	white-space: nowrap;
}

/* Radio / checkbox choices */
.quiz-crm-choices {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.quiz-crm-choice {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.7rem 0.85rem;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	cursor: pointer;
}
.quiz-crm-choice:hover {
	border-color: #9ca3af;
}
.quiz-crm-choice-input {
	margin: 0;
}
/* Write-in box for an "Other" radio choice (revealed by JS when selected). */
.quiz-crm-other-input {
	margin-top: 0.5rem;
}
.quiz-crm-other-input[hidden] {
	display: none;
}

/* Navigation */
.quiz-crm-nav {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 1.5rem;
}
.quiz-crm-btn {
	padding: 0.65rem 1.4rem;
	border: 0;
	border-radius: 8px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	background: #2563eb;
	color: #fff;
}
.quiz-crm-btn:hover {
	background: #1d4ed8;
}
.quiz-crm-back {
	background: #e5e7eb;
	color: #111827;
}
.quiz-crm-back:hover {
	background: #d1d5db;
}
.quiz-crm-btn[hidden] {
	display: none;
}

/* Messages */
.quiz-crm-message {
	margin-top: 1rem;
	font-weight: 600;
	color: #047857;
}
.quiz-crm-message:empty {
	display: none;
}
.quiz-crm-error {
	color: #b91c1c;
}

/* Entrance screen — a short branded opener (logo badge, value headline, trust
   chips) the JS reveals with `.is-intro` on the form for ~2.5s before step 1;
   any tap/keypress skips it. Rendered hidden and only ever shown by the JS, so
   a no-JS visitor opens straight on step 1. Text colors inherit from the form
   (style presets re-skin it for free); only the logo badge carries its own
   surface so the mark reads on any background. */
.quiz-crm-intro {
	display: none;
	text-align: center;
	padding: 1.25rem 1rem;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
/* Splash-screen space distribution: the JS stretches the opener to the
   form's natural height (height-neutral swap), and the two auto margins —
   above the logo and above the hint — split whatever free height exists into
   two equal breathing gaps: [gap] logo…points [gap] hint. The main content
   sits optically centered, the tap hint anchors the bottom edge like an app
   splash, and no single dead void ever forms. */
.quiz-crm-form.is-intro .quiz-crm-intro {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 340px;
}
.quiz-crm-form.is-intro .quiz-crm-intro-logo {
	margin-top: auto;
}
.quiz-crm-form.is-intro .quiz-crm-intro-hint {
	margin-top: auto;
	padding-top: 1.75rem;
}
/* !important so a style preset's own `.quiz-crm-step.is-active` (or similar)
   rule — which loads after this file — can't leak the form through the opener. */
.quiz-crm-form.is-intro .quiz-crm-progress,
.quiz-crm-form.is-intro .quiz-crm-step,
.quiz-crm-form.is-intro .quiz-crm-nav,
.quiz-crm-form.is-intro .quiz-crm-message {
	display: none !important;
}
.quiz-crm-form.is-intro-leaving .quiz-crm-intro {
	opacity: 0;
	transform: translateY( -6px );
	transition: opacity 0.28s ease, transform 0.28s ease;
}

/* Everything below is deliberately borderless — the design language is filled
   surfaces (like the form's option rows and buttons), never outlines. */
.quiz-crm-intro-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 88px;
	min-height: 88px;
	padding: 14px 18px;
	margin: 0;
	border-radius: 26px;
	background: #fff;
	/* The second shadow is a soft brand-orange halo that fills the panel's
	   top corners with designed light instead of void — a shadow (not a
	   pseudo-element) so it can never tint the badge's own surface. Brand
	   tokens hardcoded on purpose (same rationale as the invoice letterhead:
	   #FD5D14 / #030F27). */
	box-shadow:
		0 10px 30px rgba( 0, 0, 0, 0.16 ),
		0 0 72px 30px rgba( 253, 93, 20, 0.18 );
	box-sizing: border-box;
}
.quiz-crm-intro-logo img {
	display: block;
	max-height: 56px;
	max-width: 180px;
}
/* White/light logos (Settings "logo is light-coloured") get the navy backing
   panel, mirroring the invoice letterhead treatment. */
.quiz-crm-intro-logo.is-dark {
	background: #030f27;
}
.quiz-crm-intro-monogram {
	font-size: 2.1rem;
	font-weight: 800;
	color: #111827;
}
.quiz-crm-intro-logo.is-dark .quiz-crm-intro-monogram {
	color: #fff;
}
/* The business name under the badge — most logo files are a bare glyph, so
   the name anchors the mark to the business the ad promised. */
.quiz-crm-intro-brand {
	display: block;
	margin: 0.75rem 0 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	opacity: 0.7;
}

.quiz-crm-intro-title {
	margin: 1.4rem 0 0.6rem;
	font-size: 1.65rem;
	line-height: 1.22;
	font-weight: 700;
	color: inherit;
	max-width: 18ch;
}
.quiz-crm-intro-sub {
	max-width: 34ch;
	margin: 0 auto;
	font-size: 1rem;
	line-height: 1.55;
	opacity: 0.8;
}
/* Trust points: a full-width three-column icon band — icon disc above a
   short label. It spans the whole panel (no empty flanks beside a narrow
   list) and columns read as statements, never as tappable option rows. */
.quiz-crm-intro-points {
	list-style: none;
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 0.75rem;
	width: 100%;
	max-width: 420px;
	margin: 1.9rem auto 0;
	padding: 0;
}
.quiz-crm-intro-points li {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.55rem;
	font-size: 0.85rem;
	line-height: 1.35;
	text-align: center;
	opacity: 0.92;
}
.quiz-crm-intro-point-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 999px;
	background: rgba( 148, 163, 184, 0.16 );
}
.quiz-crm-intro-points svg {
	flex: none;
	opacity: 0.9;
}
.quiz-crm-intro-hint {
	margin: 1.5rem 0 0;
	font-size: 0.8rem;
	opacity: 0.6;
}

/* Staged entrance: logo pops, headline/subline rise, chips stagger in, then
   the tap hint. Small fades/translates only (200–500ms each, per standard
   motion guidance); everything has landed by ~1.2s — the rest of INTRO_MS is
   reading time. Scoped under `.is-intro` so the preview gallery's static card
   shows the settled state without animating. */
.quiz-crm-form.is-intro .quiz-crm-intro-logo {
	animation: quiz-crm-intro-pop 0.45s cubic-bezier( 0.2, 0.9, 0.3, 1.15 ) both;
}
.quiz-crm-form.is-intro .quiz-crm-intro-brand {
	animation: quiz-crm-intro-fade 0.4s ease 0.15s both;
}
.quiz-crm-form.is-intro .quiz-crm-intro-title {
	animation: quiz-crm-intro-rise 0.4s ease 0.22s both;
}
.quiz-crm-form.is-intro .quiz-crm-intro-sub {
	animation: quiz-crm-intro-rise 0.4s ease 0.36s both;
}
.quiz-crm-form.is-intro .quiz-crm-intro-points li {
	animation: quiz-crm-intro-rise 0.35s ease both;
}
.quiz-crm-form.is-intro .quiz-crm-intro-points li:nth-child( 1 ) {
	animation-delay: 0.55s;
}
.quiz-crm-form.is-intro .quiz-crm-intro-points li:nth-child( 2 ) {
	animation-delay: 0.67s;
}
.quiz-crm-form.is-intro .quiz-crm-intro-points li:nth-child( 3 ) {
	animation-delay: 0.79s;
}
/* The tap hint fades in last, then breathes softly — a quiet, ongoing
   invitation to skip ahead. */
.quiz-crm-form.is-intro .quiz-crm-intro-hint {
	animation:
		quiz-crm-intro-fade 0.5s ease 1s both,
		quiz-crm-intro-pulse 2.2s ease 2s infinite;
}
@keyframes quiz-crm-intro-pop {
	from {
		opacity: 0;
		transform: scale( 0.85 );
	}
	to {
		opacity: 1;
		transform: none;
	}
}
@keyframes quiz-crm-intro-rise {
	from {
		opacity: 0;
		transform: translateY( 8px );
	}
	to {
		opacity: 1;
		transform: none;
	}
}
/* No `to` frame on purpose: it settles at the element's own computed opacity
   (the hint's 0.6, the brand line's 0.7), not a hardcoded 1. */
@keyframes quiz-crm-intro-fade {
	from {
		opacity: 0;
	}
}
@keyframes quiz-crm-intro-pulse {
	50% {
		opacity: 0.35;
	}
}

/* Vestibular safety: with reduced motion the opener shows statically (the
   auto-advance timing and tap-to-skip are unchanged) and exits with a cut. */
@media ( prefers-reduced-motion: reduce ) {
	.quiz-crm-form.is-intro .quiz-crm-intro-logo,
	.quiz-crm-form.is-intro .quiz-crm-intro-brand,
	.quiz-crm-form.is-intro .quiz-crm-intro-title,
	.quiz-crm-form.is-intro .quiz-crm-intro-sub,
	.quiz-crm-form.is-intro .quiz-crm-intro-points li,
	.quiz-crm-form.is-intro .quiz-crm-intro-hint {
		animation: none;
	}
	.quiz-crm-form.is-intro-leaving .quiz-crm-intro {
		transition: none;
	}
	.quiz-crm-progress-bar {
		transition: none;
	}
}

/* Thank-you screen — shown after a successful submit. The form gets
   `.is-complete` (added by JS), which hides the working UI and reveals this
   panel for a cool-off window before the form resets to a fresh fill.

   It's a self-contained "success card" with its OWN surface and text colors
   (not inherited), so it stays legible on any style preset — light or dark —
   even one that never styles the thank-you itself. A preset can still override
   these (its scoped CSS loads after this file). The visual treatment lives on
   the base class (not under `.is-complete`) so the "All steps" gallery preview,
   which reveals the panel without the JS, looks identical. */
.quiz-crm-thankyou {
	display: none;
	text-align: center;
	padding: 2.5rem 1.5rem;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 14px;
	color: #14532d;
}
.quiz-crm-form.is-complete .quiz-crm-progress,
.quiz-crm-form.is-complete .quiz-crm-step,
.quiz-crm-form.is-complete .quiz-crm-nav,
.quiz-crm-form.is-complete .quiz-crm-message {
	display: none;
}
.quiz-crm-form.is-complete .quiz-crm-thankyou {
	display: block;
	animation: quiz-crm-thankyou-in 0.3s ease;
}
@keyframes quiz-crm-thankyou-in {
	from {
		opacity: 0;
		transform: translateY( 8px );
	}
	to {
		opacity: 1;
		transform: none;
	}
}
.quiz-crm-thankyou-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 1.25rem;
	border-radius: 999px;
	background: #16a34a;
	color: #fff;
}
.quiz-crm-thankyou-title {
	margin: 0 0 0.75rem;
	font-size: 1.5rem;
	line-height: 1.25;
	font-weight: 700;
	color: #14532d;
}
.quiz-crm-thankyou-message {
	max-width: 40ch;
	margin: 0 auto;
	color: #15803d;
}

/* Preview-only "All steps" gallery (admin form/style editors). When the editor
   renders the preview with `quiz-crm-preview-all` on the <body>, every step is
   force-shown stacked, each labelled "Step N" and carrying its own static nav
   snapshot (cloned by the public JS), with the thank-you panel at the end — so a
   style can be checked across all states at once. Production never carries this
   class, so the rules are inert on the live form. */
.quiz-crm-preview-all .quiz-crm-form {
	counter-reset: quiz-crm-step;
}
.quiz-crm-preview-all .quiz-crm-step {
	display: block !important;
	counter-increment: quiz-crm-step;
}
.quiz-crm-preview-all .quiz-crm-step::before {
	content: 'Step ' counter( quiz-crm-step );
	display: block;
	margin-bottom: 0.6rem;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #94a3b8;
}
/* When the editor supplies the builder's internal step names (via a body
   attribute the preview JS copies onto each step), the caption carries them:
   "Step 2 · Contact details". */
.quiz-crm-preview-all .quiz-crm-step[data-step-name]::before {
	content: 'Step ' counter( quiz-crm-step ) ' · ' attr( data-step-name );
}
.quiz-crm-preview-all .quiz-crm-step + .quiz-crm-step {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px dashed #cbd5e1;
}
.quiz-crm-preview-all .quiz-crm-progress,
.quiz-crm-preview-all .quiz-crm-nav,
.quiz-crm-preview-all .quiz-crm-message {
	display: none !important;
}
/* …except the per-step nav + progress snapshots the public JS clones into each
   step, so every step previews with the exact buttons and progress header it
   offers live. Display-only. */
.quiz-crm-preview-all .quiz-crm-nav.quiz-crm-preview-nav {
	display: flex !important;
	pointer-events: none;
}
.quiz-crm-preview-all .quiz-crm-progress.quiz-crm-preview-progress {
	display: block !important;
	pointer-events: none;
}
/* The thank-you is its own card, so it just needs spacing from the last step (no
   dashed divider — the card border already separates it) plus a small caption at
   the top of the card so the gallery labels it like the "Step N" headings. */
.quiz-crm-preview-all .quiz-crm-thankyou {
	display: block !important;
	margin-top: 1.5rem;
	animation: none;
}
.quiz-crm-preview-all .quiz-crm-thankyou::before {
	content: 'After submit';
	display: block;
	margin-bottom: 1rem;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #64748b;
}
/* The entrance screen previews as its own captioned card at the top of the
   gallery, in its settled (post-animation) state — the animations are scoped
   under `.is-intro`, which the gallery never sets. `!important` overrides the
   [hidden] attribute the renderer ships it with. */
.quiz-crm-preview-all .quiz-crm-intro {
	display: block !important;
	margin-bottom: 1.5rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px dashed #cbd5e1;
	cursor: default;
	pointer-events: none;
}
.quiz-crm-preview-all .quiz-crm-intro::before {
	content: 'Entrance';
	display: block;
	margin-bottom: 0.6rem;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #94a3b8;
}

/* Honeypot: kept in the DOM for bots but never shown to (or reachable by)
   humans. display:none is also the strongest hint to the browser NOT to
   autofill it, which would otherwise false-flag a real visitor. */
.quiz-crm-hp {
	display: none !important;
}
