/*
 * DIAGNOSTIC SYSTEM MAP — layout + schematic motion.
 *
 * Port of the `.qff-loops` / `.qff-signal-run` / `.qff-fan-turn` / `.qff-area-pulse` /
 * `.qff-topo-in` / `.qff-scan-sweep` block and its keyframes from src/index.css. Values are
 * copied, not re-derived.
 *
 * SCOPING. Every selector sits under `.qff-k`, matching the Knowledge Center's own invariant, so
 * this file cannot reach a single element on any other template even if it is enqueued by mistake.
 *
 * SCHEMATIC MOTION. Transform, opacity and stroke-dash only — no layout property, no library. Each
 * one carries meaning (signal travelling, condensate falling, area under consideration) and the
 * reduced-motion rule at the foot of this file zeroes every one of them; the settled state carries
 * all of the information, so nothing is lost when they are off.
 */

/* ---------------------------------------------------------------- layout */

.qff-k .qff-k-map-figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.qff-k .qff-k-map-frame {
	background: var(--qff-offwhite, #f7f8fa);
	border: 1px solid rgba(11, 63, 120, 0.1);
	border-radius: 4px;
	padding: 0.5rem;
	overflow: hidden;
}

.qff-k .qff-k-map {
	display: block;
	width: 100%;
	height: auto;
}

.qff-k .qff-k-map-caption {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.qff-k .qff-k-map-eyebrow {
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(11, 63, 120, 0.6);
}

.qff-k .qff-k-map-area {
	font-weight: 600;
	color: var(--qff-navy, #0b3f78);
}

.qff-k .qff-k-map-system,
.qff-k .qff-k-map-companions {
	font-size: 0.8125rem;
	color: rgba(23, 26, 31, 0.7);
}

/*
 * STICKY LIVE MAP. On a wide screen the map holds its own column beside the questions, so the
 * customer sees the scan narrow while they answer. Below the two-column breakpoint it is a normal
 * block in the flow — a sticky element on a phone would eat the viewport the questions need.
 */
.qff-k .qff-k-diag-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
}

@media (min-width: 1024px) {
	.qff-k .qff-k-diag-layout {
		grid-template-columns: minmax(0, 1fr) 20rem;
		gap: 2rem;
		align-items: start;
	}

	.qff-k .qff-k-diag-map {
		position: sticky;
		/* Clear the fixed 68px header, plus breathing room. */
		top: calc(var(--qff-header-height, 68px) + 1rem);
	}
}

/*
 * MOBILE COMPACT. The map stays visible while the customer scrolls the questions, pinned under the
 * header at a reduced height so it costs a strip rather than a screen. `max-height` on the frame,
 * not a transform, so the caption underneath is never clipped or overlapped.
 */
@media (max-width: 1023px) {
	.qff-k .qff-k-diag-map {
		/*
		 * The map is AFTER the flow in the document, because that is the honest reading order: the
		 * questions are the content and the decorative diagram follows them. On a narrow screen it
		 * is pulled visually above the questions so the sticky strip is actually in front of the
		 * customer while they answer — a sticky panel below the questions only appears once you
		 * have already scrolled past them, which is no use at all. Visual order only; the reading
		 * order for a screen reader is unchanged, and the map is aria-hidden either way.
		 */
		order: -1;
		position: sticky;
		top: var(--qff-header-height, 68px);
		z-index: 2;
		background: #fff;
		padding-block: 0.5rem;
		margin-inline: calc(-1 * 0.25rem);
		padding-inline: 0.25rem;
	}

	.qff-k .qff-k-diag-map .qff-k-map-frame {
		max-height: 30vh;
	}

	.qff-k .qff-k-diag-map .qff-k-map {
		max-height: calc(30vh - 1.25rem);
	}

	.qff-k .qff-k-diag-map .qff-k-map-caption {
		font-size: 0.8125rem;
	}

	.qff-k .qff-k-diag-map .qff-k-map-system {
		display: none;
	}
}

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

/*
 * LOOP CYCLE. Every diagnostic loop shares one cycle length, so the signal travel, the area
 * breathing and the scan sweep stay phase-consistent instead of drifting into visual noise. The
 * cycle is: movement -> settle -> pause -> repeat, and the pause is built into the keyframes rather
 * than into a JS timer, so there is nothing to schedule, cancel or leak.
 *
 * `.qff-loops-calm` is the RESULT intensity: the same loop, longer and quieter, because a result
 * must read as identified rather than still searching. `.qff-loops-paused` is applied when the map
 * is offscreen or the tab is hidden.
 */
.qff-k .qff-loops {
	--qff-cycle: 3.6s;
}

.qff-k .qff-loops-calm {
	--qff-cycle: 5.4s;
}

.qff-k .qff-loops-paused,
.qff-k .qff-loops-paused * {
	animation-play-state: paused !important;
}

.qff-k .qff-signal-run {
	animation: qff-dash-run var(--qff-cycle, 3.6s) cubic-bezier(0.33, 0, 0.2, 1) infinite;
}

.qff-k .qff-flow-down {
	animation: qff-dash-fall var(--qff-cycle, 3.6s) cubic-bezier(0.4, 0, 0.5, 1) infinite;
}

.qff-k .qff-area-pulse {
	animation: qff-area var(--qff-cycle, 3.6s) ease-in-out infinite;
}

/* Component identification only — a slow part-turn, never a simulation of running speed. */
.qff-k .qff-fan-turn {
	animation: qff-turn calc(var(--qff-cycle, 3.6s) * 2.4) cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/*
 * DIAGNOSTIC SCAN LANGUAGE. A topology fading in when the system type is identified, and a soft
 * localised sweep over the area being examined.
 */
.qff-k .qff-topo-in {
	animation: qff-topo 300ms ease-out both;
}

.qff-k .qff-scan-sweep {
	animation: qff-sweep var(--qff-cycle, 3.6s) cubic-bezier(0.33, 0, 0.2, 1) infinite;
}

/*
 * The sweep and the cutaway are settled-state cues. While the scan sequence is still running they
 * are held back, so the map does not claim to have localised anything before it has.
 */
.qff-k .qff-k-map[data-phase="system"] .qff-scan-sweep,
.qff-k .qff-k-map[data-phase="zone"] .qff-scan-sweep,
.qff-k .qff-k-map[data-phase="path"] .qff-scan-sweep {
	opacity: 0;
	animation: none;
}

/*
 * SIGNAL TRAVEL. One controlled pulse crosses the path (0–42% of the cycle), fades as it arrives,
 * then the path is quiet until the cycle repeats — a diagnostic signal, not a neon chase.
 */
@keyframes qff-dash-run {
	0% { stroke-dashoffset: 92; opacity: 0; }
	8% { opacity: 1; }
	38% { opacity: 1; }
	42% { stroke-dashoffset: 0; opacity: 0; }
	100% { stroke-dashoffset: 0; opacity: 0; }
}

/* Condensate travel: same contract, slower and gravity-paced, with a longer settle. */
@keyframes qff-dash-fall {
	0% { stroke-dashoffset: 92; opacity: 0; }
	10% { opacity: 0.95; }
	46% { opacity: 0.95; }
	52% { stroke-dashoffset: 0; opacity: 0; }
	100% { stroke-dashoffset: 0; opacity: 0; }
}

/* Area focus: rises, settles, then holds quiet for the rest of the cycle. */
@keyframes qff-area {
	0% { opacity: 0.78; }
	26% { opacity: 1; }
	46% { opacity: 0.86; }
	100% { opacity: 0.78; }
}

/* Slow identification turn, then a still pause — a full revolution per cycle, never spinning. */
@keyframes qff-turn {
	0% { transform: rotate(0deg); }
	62% { transform: rotate(360deg); }
	100% { transform: rotate(360deg); }
}

@keyframes qff-topo {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Localised scan across the leading area, then a long pause before the next pass. */
@keyframes qff-sweep {
	0% { transform: translateX(0); opacity: 0; }
	6% { opacity: 0.9; }
	24% { transform: translateX(56px); opacity: 0; }
	100% { transform: translateX(56px); opacity: 0; }
}

/*
 * REDUCED MOTION. Every loop above is decoration on a settled state that is already complete and
 * already named in text beside the map, so switching them all off removes nothing. The sweep is
 * hidden rather than frozen mid-pass, and the map holds its settled frame.
 */
@media (prefers-reduced-motion: reduce) {
	.qff-k .qff-signal-run,
	.qff-k .qff-flow-down,
	.qff-k .qff-area-pulse,
	.qff-k .qff-fan-turn,
	.qff-k .qff-topo-in,
	.qff-k .qff-scan-sweep {
		animation: none !important;
	}

	.qff-k .qff-scan-sweep {
		opacity: 0;
	}

	.qff-k .qff-topo-in {
		transition: none !important;
	}
}

/*
 * EVIDENCE ROWS. A row the vocabulary recognises can re-point the map; one it does not is left as
 * plain text with no affordance, so the interaction never promises something it cannot deliver.
 */
.qff-k .qff-k-evidence .is-locatable {
	cursor: help;
	border-radius: 4px;
	transition: background-color 160ms ease-out;
}

.qff-k .qff-k-evidence .is-locatable:hover,
.qff-k .qff-k-evidence .is-locatable:focus-visible {
	background: rgba(245, 27, 42, 0.06);
}

.qff-k .qff-k-evidence .is-locatable:focus-visible {
	outline: 2px solid var(--qff-action, #f51b2a);
	outline-offset: 2px;
}

/* The final Fault Map sits under the ranked causes it visualises, never above them. */
.qff-k .qff-k-faultmap {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid rgba(11, 63, 120, 0.1);
	max-width: 34rem;
}

.qff-k .qff-k-faultmap__note {
	margin-top: 0.75rem;
	font-size: 0.875rem;
	line-height: 1.6;
	color: rgba(23, 26, 31, 0.75);
}

@media (prefers-reduced-motion: reduce) {
	.qff-k .qff-k-evidence .is-locatable {
		transition: none;
	}
}

/* ------------------------------------------------- the intake launcher */

.qff-k .qff-k-intake-card {
	border: 1px solid rgba(11, 63, 120, 0.12);
	border-radius: 4px;
	background: #fff;
	padding: 1.25rem;
}

@media (min-width: 640px) {
	.qff-k .qff-k-intake-card {
		padding: 1.75rem;
	}
}

.qff-k .qff-k-intake-progress {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid rgba(11, 63, 120, 0.1);
}

.qff-k .qff-k-intake-progress__subject {
	margin: 0;
	font-weight: 600;
	color: var(--qff-navy, #0b3f78);
	font-size: 0.9375rem;
}

.qff-k .qff-k-intake-progress .qff-k-flow__bar {
	flex: 1 1 8rem;
	min-width: 6rem;
}

.qff-k .qff-k-intake-progress__count {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(23, 26, 31, 0.55);
}

.qff-k .qff-k-intake-layout {
	margin-top: 1.25rem;
	display: grid;
	gap: 1.25rem;
}

@media (min-width: 640px) {
	.qff-k .qff-k-intake-layout {
		grid-template-columns: 15rem minmax(0, 1fr);
		gap: 1.75rem;
		align-items: start;
	}

	.qff-k .qff-k-intake-layout--full {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Desktop: the map is a sticky column beside the question. */
	.qff-k .qff-k-intake-map {
		position: sticky;
		top: calc(var(--qff-header-height, 68px) + 1rem);
	}
}

/*
 * Mobile: the map rides above the question rather than beside it, and is not sticky — a phone
 * needs the whole viewport for the answer cards.
 */
@media (max-width: 639px) {
	.qff-k .qff-k-intake-map .qff-k-map-frame {
		max-height: 26vh;
	}

	.qff-k .qff-k-intake-map .qff-k-map {
		max-height: calc(26vh - 1.25rem);
	}
}

.qff-k .qff-k-intake-options {
	margin-top: 1rem;
	display: grid;
	gap: 0.625rem;
}

@media (min-width: 640px) {
	.qff-k .qff-k-intake-options--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.qff-k .qff-k-intake-option {
	min-height: 56px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	border: 1px solid rgba(11, 63, 120, 0.15);
	border-radius: 4px;
	background: #fff;
	padding: 0.875rem 1rem;
	text-decoration: none;
	transition: border-color 200ms ease-out;
}

.qff-k .qff-k-intake-option:hover {
	border-color: var(--qff-navy, #0b3f78);
}

.qff-k .qff-k-intake-option svg {
	width: 1rem;
	height: 1rem;
	flex: none;
	color: rgba(11, 63, 120, 0.35);
	transition: color 200ms ease-out;
}

.qff-k .qff-k-intake-option:hover svg {
	color: var(--qff-action, #f51b2a);
}

.qff-k .qff-k-intake-option__label {
	display: block;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--qff-navy, #0b3f78);
}

.qff-k .qff-k-intake-option__note {
	display: block;
	margin-top: 0.125rem;
	font-size: 0.78125rem;
	line-height: 1.35;
	color: rgba(23, 26, 31, 0.55);
}

.qff-k .qff-k-intake-back,
.qff-k .qff-k-intake__aside a {
	font-weight: 600;
}

.qff-k .qff-k-intake-back {
	margin-top: 1.25rem;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.84375rem;
	color: rgba(11, 63, 120, 0.75);
	text-decoration: none;
}

.qff-k .qff-k-intake-back:hover {
	color: var(--qff-navy, #0b3f78);
}

.qff-k .qff-k-intake-back svg {
	width: 1rem;
	height: 1rem;
}

.qff-k .qff-k-intake__aside {
	margin-top: 1rem;
	font-size: 0.8125rem;
	line-height: 1.6;
	color: rgba(23, 26, 31, 0.6);
}

.qff-k .qff-k-intake__finder {
	margin-top: 1rem;
}

/* ------------------------------------------------- the handover */

.qff-k .qff-k-intake-handoff__map {
	margin-top: 1rem;
	max-width: 21.25rem;
}

.qff-k .qff-k-intake-handoff__context {
	margin-top: 1rem;
	border: 1px solid rgba(11, 63, 120, 0.12);
	border-radius: 4px;
	background: rgba(247, 248, 250, 0.6);
	padding: 1rem;
}

.qff-k .qff-k-intake-handoff__context dt {
	font-size: 0.65625rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(11, 63, 120, 0.55);
}

.qff-k .qff-k-intake-handoff__context dd {
	margin: 0.375rem 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

.qff-k .qff-k-intake-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.78125rem;
	font-weight: 600;
	color: rgba(23, 26, 31, 0.75);
	border: 1px solid rgba(11, 63, 120, 0.12);
	border-radius: 4px;
	background: #fff;
	padding: 0.25rem 0.625rem;
}

.qff-k .qff-k-intake-chip svg {
	width: 0.875rem;
	height: 0.875rem;
	color: var(--qff-action, #f51b2a);
}

.qff-k .qff-k-intake-handoff__cta {
	margin-top: 1rem;
	width: 100%;
	min-height: 56px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	border-radius: 4px;
	background: var(--qff-action, #f51b2a);
	padding: 0 1.5rem;
	font-size: 0.96875rem;
	font-weight: 600;
	color: #fff;
	text-decoration: none;
	transition: background-color 200ms ease-out;
}

.qff-k .qff-k-intake-handoff__cta:hover {
	background: var(--qff-action-hover, #d9101e);
}

.qff-k .qff-k-intake-handoff__cta svg {
	width: 1rem;
	height: 1rem;
}

.qff-k .qff-k-intake-handoff__caveat {
	margin-top: 0.75rem;
	font-size: 0.78125rem;
	line-height: 1.6;
	color: rgba(23, 26, 31, 0.55);
}

@media (prefers-reduced-motion: reduce) {
	.qff-k .qff-k-intake-option,
	.qff-k .qff-k-intake-option svg,
	.qff-k .qff-k-intake-handoff__cta {
		transition: none;
	}
}

/* =========================================================================
 * ACTIVE DIAGNOSTIC — MOBILE TASK-FIRST ENTRY  (approved UX restructure)
 *
 * MEASURED PROBLEM. On the guided-diagnosis page the first question sat at
 * y=983 on a 375x812 phone and y=937 on a 430x932 phone — below the fold at
 * every mainstream mobile size. The customer had to scroll before they could
 * answer anything, on a page whose entire purpose is answering. The stack
 * above the task measured ~915px: breadcrumb 76 + h1 67 + hero 393 +
 * map 213 + progress 111.
 *
 * WHAT THIS BLOCK DOES. Compacts the chrome and moves the decorative map
 * below the answers, scoped to `.qff-k-diag` (the active diagnostic) and to
 * mobile widths only. Nothing is removed from the DOM, no content becomes
 * JS-only, and every other Knowledge Center page keeps its normal hero and
 * breadcrumb presentation.
 * ===================================================================== */
@media (max-width: 1023px) {
	/* Breadcrumb: one compact line instead of a wrapped block. */
	.qff-k-diag .qff-breadcrumb,
	.qff-k-diag nav[aria-label="Breadcrumb"] {
		padding-block: 0.4rem;
		font-size: 12px;
		line-height: 1.3;
	}

	/* Hero: context, not a landing page. The h1 stays in the DOM and in the
	   accessibility tree — only its visual weight is reduced. */
	.qff-k-diag > .qff-k-hero {
		padding-block: 0.5rem 0.75rem;
	}
	.qff-k-diag > .qff-k-hero .qff-k-eyebrow {
		font-size: 11px;
		margin-bottom: 0.15rem;
	}
	.qff-k-diag > .qff-k-hero .qff-k-h1 {
		font-size: 1.25rem;
		line-height: 1.25;
		margin-bottom: 0.4rem;
	}

	/* "Narrow it down" duplicates the h1's context on a phone. Kept for
	   screen readers and crawlers, removed from the visual stack. */
	.qff-k-diag #qff-k-flow-h {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
		border: 0;
	}
	.qff-k-diag > section:first-of-type {
		padding-top: 0;
	}

	/*
	 * MOBILE ACTIVE-DIAGNOSIS ORDER (client-directed, 2026-08-22):
	 *
	 *   context -> progress -> SYSTEM MAP -> question -> answers -> Back/Start over
	 *
	 * The map belongs inside the active diagnostic context, not after the answer
	 * cards. Achieving that without moving the map in the DOM (which would break
	 * the accepted desktop 817/320 sticky right column) means flattening the two
	 * wrapper elements on mobile only, so the progress bar, the map and the
	 * question body become siblings in the same single-column grid and can be
	 * ordered independently.
	 *
	 * `.qff-k-diag-flow` carries no styling, so flattening it is free.
	 * `.qff-k-flow` DOES carry the card frame (border, radius, white background),
	 * so that frame is re-applied to the progress and body blocks below —
	 * giving the stacked, divider-separated blocks the requested layout shows,
	 * rather than silently losing the card.
	 *
	 * Reading order in the DOM is unchanged; this is visual order only, and the
	 * map remains aria-hidden decoration either way.
	 */
	.qff-k .qff-k-diag-flow,
	.qff-k .qff-k-flow:not([hidden]) {
		display: contents;
	}

	.qff-k .qff-k-flow__progress {
		order: 0;
		border: 1px solid var(--qff-navy-15);
		border-bottom: 0;
		border-radius: var(--qff-radius-sm) var(--qff-radius-sm) 0 0;
		background: #fff;
		/*
		 * One compact strip, as the approved layout shows: progress and Start over
		 * on a single row. It previously wrapped to two rows (111px) on a 375px
		 * phone, and with the map now above the question every row costs answers
		 * their place on screen. The 44px minimum touch target on Start over is
		 * deliberately NOT reduced — the saving comes from removing the wrap and
		 * tightening padding, not from shrinking a tap target.
		 */
		flex-wrap: nowrap;
		gap: 0.6rem;
		padding: 0.6rem 1rem;
	}
	.qff-k .qff-k-flow__bar { flex: 1 1 3rem; min-width: 0; }
	.qff-k .qff-k-flow__pct { flex: 0 0 auto; white-space: nowrap; }
	.qff-k .qff-k-flow__restart { flex: 0 0 auto; padding-inline: 0.7rem; }

	/* Hero on the active diagnostic is context, not a headline block. */
	.qff-k-diag > .qff-k-hero .qff-k-h1 { font-size: 1.1rem; margin-bottom: 0.3rem; }
	.qff-k-diag > .qff-k-hero .qff-k-verdict { margin-top: 0.35rem; padding: 0.4rem 0.6rem; font-size: 13px; }

	.qff-k .qff-k-diag-map {
		order: 1;
		position: static;
		z-index: auto;
		margin: 0;
		padding: 0.5rem 1rem 0.35rem;
		border: 1px solid var(--qff-navy-15);
		border-bottom: 0;
		background: #fff;
	}
	.qff-k .qff-k-diag-map .qff-k-map-frame {
		/*
		 * The map now sits ABOVE the question, so every pixel it takes pushes the
		 * answers down. Measured at 375x812: at 20vh the first answer landed at
		 * y=780, past the 743 usable fold (viewport minus the 69px sticky call
		 * bar). Capped here so the question and the first answers stay reachable
		 * without scrolling past them.
		 */
		max-height: 14vh;
	}
	/* Trim the map's own caption block — it repeats context already shown above. */
	.qff-k .qff-k-diag-map .qff-k-map-figure figcaption,
	.qff-k .qff-k-diag-map .qff-k-map-caption {
		margin-top: 0.3rem;
		font-size: 12px;
		line-height: 1.35;
	}

	/* Tighten the question block so the answers follow closely. */
	.qff-k .qff-k-flow__body { padding: 0.9rem 1rem 1rem; }
	.qff-k .qff-k-qcard__help { margin-top: 0.3rem; font-size: 13px; line-height: 1.5; }
	.qff-k .qff-k-answers { margin-top: 0.75rem; }

	/* Breadcrumb and hero: context, kept to a minimum on the active diagnostic. */
	.qff-k-diag .qff-breadcrumb,
	.qff-k-diag nav[aria-label="Breadcrumb"] { padding-block: 0.3rem; }
	.qff-k-diag > .qff-k-hero { padding-block: 0.4rem 0.5rem; }

	.qff-k .qff-k-flow__body {
		order: 2;
		border: 1px solid var(--qff-navy-15);
		border-radius: 0 0 var(--qff-radius-sm) var(--qff-radius-sm);
		background: #fff;
	}

	.qff-k .qff-k-flow__static {
		order: 3;
	}
}

/* Result: leading cause open, the rest behind a disclosure (see renderResult
   in qff-diagnostic.js). Presentation only — the engine's ranking is unchanged
   and every cause is still rendered. */
.qff-k .qff-k-causes-more {
	margin-top: 0.75rem;
}
.qff-k .qff-k-causes-more > summary {
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var(--qff-navy, #0B3F78);
	padding: 0.4rem 0;
}
.qff-k .qff-k-causes-more > summary:focus-visible {
	outline: 2px solid var(--qff-navy, #0B3F78);
	outline-offset: 2px;
}

/* Brand hub: jump straight to the code tables (see brand-hub.php D7 comment). */
.qff-k .qff-k-jump { margin: 0 0 0.5rem; }
.qff-k .qff-k-jump__link {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 13px;
	font-weight: 600;
	color: var(--qff-navy, #0B3F78);
	text-decoration: none;
	border-bottom: 1px solid rgba(11, 63, 120, 0.3);
	padding-bottom: 1px;
}
.qff-k .qff-k-jump__link::after { content: "\2193"; }
.qff-k .qff-k-jump__link:hover { border-bottom-color: currentColor; }
.qff-k .qff-k-jump__link:focus-visible {
	outline: 2px solid var(--qff-navy, #0B3F78);
	outline-offset: 3px;
}

/* Reference page: the route onward into the guided diagnostic (code-page.php D1). */
.qff-k .qff-k-nextstep { margin-top: 1.25rem; }
.qff-k .qff-k-nextstep__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0.625rem 1.25rem;
	border-radius: var(--qff-radius-sm, 4px);
	background: var(--qff-navy, #0B3F78);
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
}
.qff-k .qff-k-nextstep__btn:hover { background: var(--qff-navy-dark, #082D56); }
.qff-k .qff-k-nextstep__btn:focus-visible {
	outline: 2px solid var(--qff-navy, #0B3F78);
	outline-offset: 2px;
}
.qff-k .qff-k-nextstep__note {
	margin: 0.5rem 0 0;
	font-size: 13px;
	color: var(--qff-charcoal-70, #5a5f68);
}

/* Brand-hub code table: secondary "Diagnose" action inside the code cell (D2). */
.qff-k .qff-k-table__diag {
	display: block;
	margin-top: 0.25rem;
	font-size: 12px;
	font-weight: 600;
	color: var(--qff-navy, #0B3F78);
	text-decoration: none;
	white-space: nowrap;
}
.qff-k .qff-k-table__diag::after { content: " \2192"; }
.qff-k .qff-k-table__diag:hover { text-decoration: underline; }
.qff-k .qff-k-table__diag:focus-visible {
	outline: 2px solid var(--qff-navy, #0B3F78);
	outline-offset: 2px;
}

/* =========================================================================
 * MOBILE STICKY DIAGNOSTIC PANEL  (progress + live map)
 *
 * BEHAVIOUR. On load the progress row and the system map sit naturally in the
 * document, exactly where the accepted layout puts them. Once the customer
 * scrolls far enough that they would leave the viewport, both pin under the
 * fixed site header as one compact panel, and the questions keep scrolling
 * underneath. Scrolling back returns them to their original place.
 *
 * ARCHITECTURE. Stickiness is pure CSS `position: sticky` — no JS positioning,
 * no fixed-position hack, no scroll handler. Sticky keeps the element in flow,
 * so nothing below moves when it pins. JavaScript is used for one thing only:
 * an IntersectionObserver on a zero-height sentinel toggles `.is-stuck` so the
 * panel can COMPACT while pinned (CSS cannot detect its own sticky state).
 *
 * ZERO LAYOUT SHIFT ON COMPACTION. A sticky element still occupies its original
 * space, so shrinking it while pinned would pull everything below upward. The
 * height it gives up is therefore handed straight back as margin:
 *
 *     height 172px            -> height 96px + margin-bottom 76px
 *     flow space  = 172px        flow space = 172px   (unchanged)
 *     on screen   = 172px        on screen  = 96px    (compact)
 *
 * Both numbers are fixed constants here, so the compensation needs no JS
 * measurement and cannot drift.
 *
 * STABLE PANEL HEIGHT. The map box is given an explicit height rather than a
 * max-height, and the frame flexes to fill it, so a different topology SVG or a
 * longer caption as the diagnosis narrows can never grow or shrink the panel
 * and move the question underneath it.
 * ===================================================================== */
@media (max-width: 1023px) {
	.qff-k-diag {
		--qff-diag-map-h: 172px;
		--qff-diag-map-h-stuck: 96px;
	}

	/*
	 * FLEX, NOT GRID — this is what actually keeps the panel pinned.
	 *
	 * A sticky GRID ITEM is constrained to its own GRID AREA, not to the whole
	 * container. With the mobile stack as a grid the rows measured
	 * `0px 64px 172px 494px`, so the map could only travel within its own 172px
	 * row: it pinned briefly and then slid away upward while the question and
	 * its answers were still on screen. That is the reported symptom — the map
	 * abandoning the active question on longer steps, where the taller answer
	 * list means more scrolling before the step ends.
	 *
	 * A sticky FLEX ITEM is constrained by the flex CONTAINER's content box, so
	 * the panel can stay pinned for the full height of the diagnostic area — the
	 * whole time the question and answers are being read. `order` works
	 * identically in flex, so the approved sequence is unchanged, and desktop
	 * keeps its grid untouched (the two-column rule lives in its own
	 * min-width: 1024px block).
	 */
	.qff-k .qff-k-diag-layout {
		display: flex;
		flex-direction: column;
	}

	/*
	 * Sentinel: a 1px marker that leaves the viewport exactly when the panel is
	 * about to pin. It is 1px rather than 0 on purpose — an element with zero
	 * area is not reported as intersecting, so a zero-height sentinel makes the
	 * observer fire "not intersecting" on the very first callback and the panel
	 * pins itself at the top of the page before the customer has scrolled.
	 */
	.qff-k .qff-k-diag-sticky-sentinel {
		order: -1;
		height: 1px;
		margin: 0 0 -1px;
		padding: 0;
		pointer-events: none;
	}

	/* Stacked stickies: progress pins under the site header, the map pins
	   directly under the progress row. */
	.qff-k .qff-k-flow__progress {
		position: sticky;
		top: var(--qff-header-height, 68px);
		z-index: 3;
	}

	.qff-k .qff-k-diag-map {
		position: sticky;
		/* Under the header + the pinned progress row (64px at these widths). */
		top: calc(var(--qff-header-height, 68px) + 64px);
		z-index: 2;
		height: var(--qff-diag-map-h);
		display: flex;
		flex-direction: column;
		overflow: hidden;
		transition: height 0.18s ease;
	}
	.qff-k .qff-k-diag-map .qff-k-map-figure {
		flex: 1 1 auto;
		min-height: 0;
		display: flex;
		flex-direction: column;
		gap: 0.35rem;
	}
	.qff-k .qff-k-diag-map .qff-k-map-frame {
		flex: 1 1 auto;
		min-height: 0;
		max-height: none;
		display: flex;
	}
	.qff-k .qff-k-diag-map .qff-k-map {
		width: 100%;
		height: 100%;
	}
	/* Caption held to a predictable number of lines so it cannot change the
	   panel height as the wording narrows. */
	.qff-k .qff-k-diag-map figcaption,
	.qff-k .qff-k-diag-map .qff-k-map-caption {
		flex: 0 0 auto;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	/* ---- pinned + compact ---- */
	.qff-k-diag.is-stuck .qff-k-diag-map {
		height: var(--qff-diag-map-h-stuck);
		box-shadow: 0 6px 14px -10px rgba(11, 63, 120, 0.45);
	}
	/*
	 * The height the map gave up is handed back on the NEXT element, not as the
	 * map's own margin-bottom. Sticky travel is measured on the MARGIN box, so
	 * compensating on the map itself made its box 172px again and evicted it
	 * from the top of the screen ~76px early — the map abandoning the question
	 * while answers were still being read. Putting the space on the body keeps
	 * total flow height identical and gives the map its full travel.
	 */
	.qff-k-diag.is-stuck .qff-k-flow__body {
		margin-top: calc(var(--qff-diag-map-h) - var(--qff-diag-map-h-stuck));
	}
	.qff-k-diag.is-stuck .qff-k-flow__progress {
		box-shadow: 0 4px 10px -10px rgba(11, 63, 120, 0.4);
	}
	/* The eyebrow ("WHERE THE DIAGNOSIS IS LOOKING") is redundant once pinned —
	   the panel is obviously the diagnosis. The caption itself is kept. */
	.qff-k-diag.is-stuck .qff-k-diag-map .qff-k-map-eyebrow {
		display: none;
	}
	.qff-k-diag.is-stuck .qff-k-diag-map figcaption,
	.qff-k-diag.is-stuck .qff-k-diag-map .qff-k-map-caption {
		-webkit-line-clamp: 1;
		font-size: 11.5px;
	}

	/* Result mode releases the active-diagnosis panel entirely — no stale
	   "80% complete" strip left pinned above the result. */
	.qff-k-diag.is-result .qff-k-flow__progress,
	.qff-k-diag.is-result .qff-k-diag-map {
		position: static;
		height: auto;
		margin-bottom: 0;
		box-shadow: none;
	}

	@media (prefers-reduced-motion: reduce) {
		.qff-k .qff-k-diag-map { transition: none; }
	}
}

/* -------------------------------------------------- live error-code filter
 * Port of the source BrandCodeFinder's result list. Same tokens as the rest of
 * the Knowledge Center — no new visual language, no dropdown overlay: the
 * matches sit in the flow directly under the field so nothing is covered on a
 * phone and the list cannot be clipped by an ancestor's overflow.
 */
.qff-k .qff-k-finder__suggest { margin-top: 0.75rem; }

.qff-k .qff-k-finder__suggestions {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.qff-k .qff-k-finder__suggestion {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.6rem 0.75rem;
	border: 1px solid rgba(11, 63, 120, 0.15);
	border-radius: var(--qff-radius-sm, 4px);
	background: #fff;
	text-decoration: none;
	color: inherit;
}
.qff-k a.qff-k-finder__suggestion:hover { border-color: var(--qff-navy, #0b3f78); }
.qff-k a.qff-k-finder__suggestion:focus-visible {
	outline: 2px solid var(--qff-navy, #0b3f78);
	outline-offset: 2px;
}
.qff-k .qff-k-finder__suggestion strong {
	font-size: 15px;
	font-weight: 600;
	color: var(--qff-navy, #0b3f78);
}
.qff-k .qff-k-finder__suggestion span {
	font-size: 13px;
	line-height: 1.5;
	color: rgba(23, 26, 31, 0.72);
}

.qff-k .qff-k-finder__empty {
	margin: 0;
	padding: 0.75rem;
	border: 1px solid rgba(11, 63, 120, 0.12);
	border-radius: var(--qff-radius-sm, 4px);
	font-size: 13.5px;
	line-height: 1.6;
	color: rgba(23, 26, 31, 0.7);
}

/* Finder: dataset loading / failure status (see loadBrand in qff-diagnostic-map.js). */
.qff-k .qff-k-finder__status {
	margin: 0.6rem 0 0;
	padding: 0.5rem 0.7rem;
	border: 1px solid rgba(11, 63, 120, 0.12);
	border-radius: var(--qff-radius-sm, 4px);
	background: var(--qff-offwhite, #f7f8fa);
	font-size: 13px;
	line-height: 1.5;
	color: rgba(23, 26, 31, 0.72);
}
