/* How It Works page (patterns/hiw-*.php). */

/* ---------- Hero ---------- */
.fx-hiw-hero { padding-block: clamp(56px, 7vw, 88px); }
/* The five-step strip below the signature line */
.fx-hiw-hero .fx-steps-block { margin-top: clamp(32px, 4vw, 48px); }
.fx-hiw-hero__title {
	font-size: clamp(34px, 4.6vw, 54px);
	line-height: 1.06;
}
.fx-hiw-hero .fx-lede { margin-top: 22px; max-width: none; }
/* The signature line: the five step words in white, the rest as the lede */
.fx-hiw-hero__steps {
	margin-top: 18px;
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.6;
}
.fx-hiw-hero__steps strong { color: var(--wp--preset--color--white); font-weight: 600; }

/* ---------- Five steps (layers) ---------- */
.fx-hiw-layers { padding-block: clamp(40px, 5vw, 64px); }

.fx-hiw-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 40px;
}
.fx-hiw-tab {
	min-height: 40px;
	padding: 0 18px;
	border-radius: var(--wp--custom--radius--md);
	border: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--fg-2);
	font: 500 14px/1 var(--wp--preset--font-family--sans);
	cursor: pointer;
	transition: background-color 200ms var(--wp--custom--easing), border-color 200ms var(--wp--custom--easing), color 200ms var(--wp--custom--easing);
}
.fx-hiw-tab:hover { border-color: var(--wp--preset--color--ink); }
.fx-hiw-tab[aria-selected="true"] {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
}

.fx-hiw-layer {
	display: flex;
	flex-wrap: wrap;
	gap: 48px;
	align-items: flex-start;
}
/* Without JS (and in the editor) every layer is listed, separated by a rule */
.fx-hiw-layer + .fx-hiw-layer {
	margin-top: 56px;
	padding-top: 56px;
	border-top: 1px solid var(--wp--preset--color--border);
}
.fx-hiw-layer-set.is-tabbed .fx-hiw-layer + .fx-hiw-layer { margin-top: 0; padding-top: 0; border-top: 0; }
.fx-hiw-layer[hidden] { display: none; }

.fx-hiw-layer__copy { flex: 1 1 360px; min-width: 0; }
.fx-hiw-layer__index {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--brand);
}
.fx-hiw-layer__title {
	margin-top: 16px;
	font-size: var(--wp--preset--font-size--h-2);
	line-height: 1.12;
}
.fx-hiw-layer__body {
	margin-top: 18px;
	font-size: var(--wp--preset--font-size--body-lg);
	line-height: 1.6;
	color: var(--wp--preset--color--fg-2);
}

.fx-hiw-points {
	list-style: none;
	margin: 28px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	counter-reset: fx-hiw-point;
}
.fx-hiw-points > li {
	display: flex;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--wp--preset--color--border);
	font-size: 15px;
	line-height: 1.55;
	color: var(--wp--preset--color--ink);
	counter-increment: fx-hiw-point;
}
.fx-hiw-points > li::before {
	content: counter(fx-hiw-point, decimal-leading-zero);
	flex: 0 0 auto;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	font-weight: 500;
	line-height: 1.6;
	color: var(--wp--preset--color--fg-3);
}

.fx-hiw-panel {
	flex: 1 1 340px;
	min-width: 0;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
	padding: 24px;
}
.fx-hiw-panel__rows {
	list-style: none;
	margin: 16px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.fx-hiw-panel__rows > li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 11px 0;
	border-bottom: 1px solid var(--wp--preset--color--mute);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	color: var(--wp--preset--color--ink);
}
.fx-hiw-panel__rows code {
	flex: 0 0 auto;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	padding: 5px 8px;
	border-radius: var(--wp--custom--radius--pill);
	/* Health status, like a health report: green (healthy) by default, yellow for is-warn, red for is-bad.
	   Tints of the success, signal and danger tokens; each text color is at least 5.3:1 on its tint. */
	background: rgba(47, 148, 97, 0.12);
	color: #1d6b44; /* no token: dark green text on the success chip */
	border: 1px solid rgba(47, 148, 97, 0.35);
}
.fx-hiw-panel__rows > li.is-warn code {
	background: rgba(240, 168, 48, 0.14);
	color: #8a5a06; /* no token: dark amber text on the signal chip */
	border-color: rgba(240, 168, 48, 0.4);
}
.fx-hiw-panel__rows > li.is-bad code {
	background: rgba(193, 67, 46, 0.12);
	color: #9b2f1d; /* no token: dark red text on the danger chip */
	border-color: rgba(193, 67, 46, 0.35);
}
.fx-hiw-panel__note {
	margin-top: 16px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	line-height: 1.5;
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--fg-3);
}
.fx-hiw-panel .fx-mono-label .fx-illustrative { margin-left: 8px; vertical-align: 1px; }
/* Observe carries two panels (tracking checks, funnel health) in the panel column */
.fx-hiw-panel-stack {
	flex: 1 1 340px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.fx-hiw-panel-stack > .fx-hiw-panel { flex: none; }

/* The products that deliver each step */
.fx-hiw-layer__products {
	margin-top: 22px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--fg-3);
}
.fx-hiw-layer__products a {
	color: var(--wp--preset--color--brand);
	text-decoration: underline;
	text-decoration-color: rgba(122, 79, 224, 0.35);
	text-underline-offset: 3px;
	text-transform: none;
	letter-spacing: 0.02em;
}
.fx-hiw-layer__products a:hover { text-decoration-color: currentColor; }

/* Analyze: the single-touch contrast, set apart above the body */
.fx-hiw-layer__contrast {
	margin-top: 16px;
	padding-left: 16px;
	border-left: 2px solid var(--wp--preset--color--signal);
	font-size: var(--wp--preset--font-size--body-lg);
	font-weight: 500;
	line-height: 1.55;
	color: var(--wp--preset--color--ink);
}

/* ---------- Diagrams: Universal ID (Stitch), activation loop (Act) ----------
 * Same panel as the funnel trace blocks (blocks/trace/style.css). The SVGs come from assets/images/diagrams/:
 * a wide layout and a narrow one for phones; .fx-when-lit / .fx-when-off groups crossfade on .is-lit.
 */
.fx-hiw-layer > .fx-hiw-diagram { flex: 1 1 100%; }
.fx-hiw-diagram {
	min-width: 0;
	margin: 0;
	border: 1px solid var(--wp--preset--color--ink-700);
	border-radius: var(--wp--custom--radius--lg);
	background: var(--wp--preset--color--ink-800);
	padding: 20px 20px 16px;
}
.fx-hiw-diagram__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.fx-hiw-diagram__label {
	margin: 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--fg-on-dark-3);
}
.fx-hiw-diagram .fx-illustrative { margin-left: 8px; }
/* Without JS the diagram stays lit and there is nothing to toggle */
.fx-hiw-diagram:not(.is-ready) .fx-hiw-diagram__toggle { display: none; }
.fx-hiw-diagram__svg { display: block; width: 100%; height: auto; }
.fx-hiw-diagram__svg--narrow { display: none; max-width: 420px; margin-inline: auto; }
.fx-hiw-diagram .fx-when-lit { opacity: 0; }
.fx-hiw-diagram .fx-when-off { opacity: 1; }
.fx-hiw-diagram.is-lit .fx-when-lit { opacity: 1; }
.fx-hiw-diagram.is-lit .fx-when-off { opacity: 0; }
.fx-hiw-diagram [class^="fx-when-"] { transition: opacity 700ms var(--wp--custom--easing); }
.fx-hiw-diagram__foot {
	display: block;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--wp--preset--color--ink-700);
}
.fx-hiw-diagram__readout {
	display: block;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--mono-sm);
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.06em;
	color: var(--wp--preset--color--signal);
}
/* Lights on is the good state: its readout is violet; amber stays for problems. */
.fx-hiw-diagram.is-lit .fx-hiw-diagram__readout { color: var(--wp--preset--color--lit); }
.fx-hiw-diagram__caption { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--wp--preset--color--fg-on-dark-2); }
@media (prefers-reduced-motion: reduce) {
	.fx-hiw-diagram [class^="fx-when-"] { transition: none; }
}

/* ---------- Why this shape ---------- */
.fx-hiw-why__title { margin-top: 16px; }
.fx-hiw-why .fx-lede { margin-top: 18px; max-width: none; color: var(--wp--preset--color--fg-2); }
.fx-hiw-compare {
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	margin-top: 44px;
}
.fx-hiw-compare .fx-card h3 { margin-top: 12px; font-size: 18px; line-height: 1.3; letter-spacing: 0; }
.fx-hiw-compare .fx-card p:not(.fx-mono-label) {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.55;
	color: var(--wp--preset--color--fg-2);
}
.fx-hiw-compare .fx-hiw-card--ink {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
}
.fx-hiw-card--ink .fx-mono-label { color: var(--wp--preset--color--lit); }
.fx-hiw-card--ink h3 { color: var(--wp--preset--color--white); }
.fx-hiw-compare .fx-hiw-card--ink p:not(.fx-mono-label) { color: var(--wp--preset--color--fg-on-dark-2); }
.fx-hiw-compare .fx-hiw-card--ink p.fx-hiw-card__close {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--wp--preset--color--ink-700);
	color: var(--wp--preset--color--white);
	font-weight: 500;
}

/* ---------- Final CTA ---------- */
.fx-hiw-cta .fx-measure {
	max-width: 24ch;
	/* Explicit size: theme.json's "h2" font-size slug is emitted as --wp--preset--font-size--h-2, so the element default resolves to nothing. */
	font-size: clamp(28px, 3.6vw, 44px);
	line-height: 1.12;
}
.fx-hiw-cta .fx-lede { max-width: 58ch; }

@media (max-width: 880px) {
	.fx-hiw-tab { min-height: 48px; }
	.fx-hiw-diagram { padding: 16px 16px 14px; }
}
/* Phones and narrow tablets: the vertical layout of each diagram */
@media (max-width: 700px) {
	.fx-hiw-diagram__svg--wide { display: none; }
	.fx-hiw-diagram__svg--narrow { display: block; }
	.fx-hiw-diagram__head { align-items: flex-start; }
}
