/*
 * rekos/hero-product.
 * Figma: Profit People 1201:6880 (1440 × 800) / 1201:6691 (375 × 965);
 *        Profit Finance 1201:7075 (1440 × 800) / 1201:7257 (375 mobile).
 * Tokens only. Literal values are the Figma geometry of this one illustration (stage px,
 * chip and ring sizes) and are declared once as --rk-hp-* properties; plus breakpoints,
 * percentages, 0, 1px hairlines and unitless line heights.
 * Profit Finance colours come only from settings.custom.product.pf (D3: only in this block).
 *
 * Desktop ≥1200 (1440 frame): the section is 800 high and runs under the transparent header
 *   (92). Copy column 585 at the content edge: H1 36/1.4, 24, checklist 498 wide (rows 8
 *   apart, 20 px Edrana-gradient check, 16, 16/24), 24, ring CTA (pill 200 × 44). Copy
 *   centre ≈ 417 (PP) / 434 (PF) from the top. Visual "stage" 659 wide, 18 right of the
 *   copy column: label (JetBrains Mono 700 13/18, +0.06em, navy 75 %) above the chips; rings,
 *   connectors (Figma SVG, assets/img/products/hero-hub-*.svg) and the 184 navy logo circle
 *   on the left; chips on the right (PP 348 × 52, 10 apart, radius 14, 34 icon tile, 19 icon,
 *   Open Sans 600 15/22; PF 364 × 64, 14 apart, radius 16, 40 tile, 22 icon, 600 16/24).
 *   Behind it a 1 px Edrana-gradient outline at 30 %: 377 high, centred 13.5 (PP) / 0.5 (PF)
 *   below the middle, vertical lines 26.6 inside the content edges, radius 30 (→ card 32).
 *   Motion: drawn once from left to right on page load (§ Line draw at the end).
 * Mobile ≤767 (375 frame): header 64, 10 to the H1 (30/1.4), 24, checklist 14/20, 24, full-
 *   width CTA (343 × 50), 48, visual 343 wide: label 12/16 centred, 6, hub (dashed ring 108,
 *   gradient ring 100, navy circle 88, logo 32 % of it), a curve from the ring's bottom to a
 *   rail 8 from the left edge, branches (14) into chips 22 from both edges (PP 31 high, PF
 *   40; 4 apart; radius 10; tile 23 / 26; 600 13/18). 16 to the section end (PF 28).
 * Tablet (derived): 768–1199 copy, then the desktop stage centred below it (scaled to fit);
 *   ≥1200 two columns 585 : 711 (stage scaled with the column below 1440).
 * The stage scales through --u = min(1px, column / Figma width); every stage length is
 *   "Figma px × --u". Stage geometry that depends on the number of chips comes from
 *   render.php as unitless --rk-hp-top/-cy/-h/-chips-x/-label-x/-chip-h/-gap/-art-w/-art-cy.
 */

.rk-hero-product {
	--rk-hp-pad-top: var(--wp--preset--spacing--30);
	--rk-hp-pad-bottom: var(--wp--preset--spacing--40);
	--rk-hp-copy-width: 585px;
	--rk-hp-check-width: 498px;
	--rk-hp-min-height: 800px;
	--rk-hp-frame-height: 377px;
	--rk-hp-frame-inset: 26.6px;
	--rk-hp-frame-shift: 13.5px;
	--rk-hp-ring: calc(var(--wp--custom--button--ring-gap) + var(--wp--custom--button--ring-width));

	/* Mobile illustration geometry (Figma 1201:6691 / 1201:7257). */
	--rk-hp-m-hub: 108px;
	--rk-hp-m-ring: 100px;
	--rk-hp-m-circle: 88px;
	--rk-hp-m-rail: 14px;
	--rk-hp-m-inset: 22px;
	--rk-hp-m-gap: var(--wp--preset--spacing--10);
	--rk-hp-m-chip-h: 31px;
	--rk-hp-m-tile: 23px;
	--rk-hp-m-glyph: 13px;

	/* Desktop chip geometry in Figma px (unitless, × --u). */
	--rk-hp-chip-w: 348;
	--rk-hp-chip-pad: 10;
	--rk-hp-chip-inner: 12;
	--rk-hp-chip-r: 14;
	--rk-hp-chip-font: 15;
	--rk-hp-chip-lh: 22;
	--rk-hp-tile: 34;
	--rk-hp-tile-r: 10;
	--rk-hp-glyph: 19;

	/* Profit People colours (Edrana / PP tokens). */
	--rk-hp-bg: var(--wp--preset--gradient--hero-pp);
	--rk-hp-line: var(--wp--preset--gradient--edrana);
	--rk-hp-icon: var(--wp--preset--gradient--edrana);
	--rk-hp-dot: var(--wp--preset--color--accent);
	--rk-hp-dash: color-mix(in srgb, var(--wp--preset--color--accent) 20%, var(--wp--preset--color--border));
	--rk-hp-tile-bg: color-mix(in srgb, var(--wp--preset--color--border) 30%, var(--wp--preset--color--surface-2));
	--rk-hp-shadow: color-mix(in srgb, var(--wp--preset--color--primary) 6%, transparent);
	--rk-hp-stop-start: var(--wp--preset--color--accent);
	--rk-hp-stop-end: var(--wp--preset--color--primary);
	--rk-hp-glow: var(--wp--preset--color--accent); /* Motion: chip highlight colour. */

	position: relative;
	isolation: isolate;
	overflow-x: clip;
	padding-block: var(--rk-hp-pad-top) var(--rk-hp-pad-bottom);
	background: var(--rk-hp-bg);
	color: var(--wp--preset--color--contrast);
}

/* Profit Finance: its own colours, only here (D3); bigger chips. */
.rk-hero-product--pf {
	--rk-hp-frame-shift: 0.5px;
	--rk-hp-m-chip-h: 40px;
	--rk-hp-m-tile: 26px;
	--rk-hp-m-glyph: 15px;
	--rk-hp-chip-w: 364;
	--rk-hp-chip-pad: 12;
	--rk-hp-chip-inner: 14;
	--rk-hp-chip-r: 16;
	--rk-hp-chip-font: 16;
	--rk-hp-chip-lh: 24;
	--rk-hp-tile: 40;
	--rk-hp-tile-r: 12;
	--rk-hp-glyph: 22;
	--rk-hp-bg: var(--wp--custom--product--pf--hero);
	--rk-hp-line: var(--wp--custom--product--pf--gradient);
	--rk-hp-icon: var(--wp--custom--product--pf--gradient);
	--rk-hp-dot: var(--wp--custom--product--pf--violet);
	--rk-hp-dash: color-mix(in srgb, var(--wp--custom--product--pf--orange) 60%, var(--wp--preset--color--base));
	--rk-hp-tile-bg: color-mix(in srgb, var(--wp--custom--product--pf--violet) 5%, color-mix(in srgb, var(--wp--custom--product--pf--orange) 5%, var(--wp--preset--color--base)));
	--rk-hp-shadow: color-mix(in srgb, var(--wp--custom--product--pf--violet) 7%, transparent);
	--rk-hp-stop-start: var(--wp--custom--product--pf--orange);
	--rk-hp-stop-end: var(--wp--custom--product--pf--violet);
	--rk-hp-glow: var(--wp--custom--product--pf--orange);
}

/*
 * First block of the post content: the section starts at the top of the page, behind the
 * header (which has no background and a higher z-index). 0-3-0 beats base.css's 0-1-1
 * "margin-block: 0" for sections. The editor canvas has no .wp-block-post-content parent.
 */
.wp-block-post-content > .rk-hero-product:first-child {
	margin-block-start: calc(-1 * var(--rk-header-height));
	padding-block-start: calc(var(--rk-header-height) + var(--rk-hp-pad-top));
}

.rk-hero-product__inner {
	display: flex;
	flex-direction: column;
	gap: calc(var(--wp--preset--spacing--60) + var(--wp--preset--spacing--40));
}

/* ---------- Copy: heading, checklist, CTA ---------- */

.rk-hero-product__content {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--50);
	min-width: 0;
}

/* .rk-hero-product prefix: beats the 0-0-1 theme.json h1 element styles. */
.rk-hero-product .rk-hero-product__heading {
	margin: 0;
	color: inherit;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--3-xl);
	font-weight: 800;
	line-height: 1.4;
	text-transform: uppercase;
	overflow-wrap: break-word;
	text-wrap: balance; /* below 1200: even lines (pretty did not fix lone words in Chrome); 1400+: Figma breaks, see end */
}

.rk-hero-product__checklist {
	display: grid;
	gap: var(--wp--preset--spacing--20);
	align-self: stretch;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rk-hero-product__check {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.43;
}

.rk-hero-product__check .rk-icon {
	inline-size: 20px;
	block-size: 20px;
}

.rk-hero-product__check-text {
	min-width: 0;
	overflow-wrap: break-word;
}

/* Mobile: full width (stretch keeps the ring margins inside the column). */
.rk-hero-product .rk-hero-product__cta {
	align-self: stretch;
}

/* ---------- Visual, mobile layout (Figma 1201:6771 / 1201:7337) ---------- */

.rk-hero-product__media {
	min-width: 0;
}

.rk-hero-product__visual {
	position: relative;
	display: flex;
	flex-direction: column;
}

.rk-hero-product .rk-hero-product__list-label {
	margin: 0 0 6px;
	color: color-mix(in srgb, var(--wp--preset--color--contrast) 75%, transparent);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	line-height: 1.333;
	letter-spacing: 0.06em;
	text-align: center;
	text-transform: uppercase;
}

/* Rings and connectors of the desktop stage. */
.rk-hero-product__art {
	display: none;
}

/* Hub row: full width, so the curve can run from the hub centre to the rail on the left. */
.rk-hero-product__hub {
	position: relative;
	flex: none;
	block-size: var(--rk-hp-m-hub);
}

/* Dashed outer ring. */
.rk-hero-product__hub::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	inline-size: var(--rk-hp-m-hub);
	block-size: var(--rk-hp-m-hub);
	margin-inline-start: calc(var(--rk-hp-m-hub) / -2);
	border: 1px dashed var(--rk-hp-dash);
	border-radius: var(--wp--custom--radius--pill);
}

/* 1.5 px gradient ring: a masked box (the .rk-btn--ring technique). */
.rk-hero-product__hub::after {
	content: "";
	position: absolute;
	top: calc((var(--rk-hp-m-hub) - var(--rk-hp-m-ring)) / 2);
	left: 50%;
	inline-size: var(--rk-hp-m-ring);
	block-size: var(--rk-hp-m-ring);
	margin-inline-start: calc(var(--rk-hp-m-ring) / -2);
	padding: 1.5px;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--rk-hp-line);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask-composite: exclude;
}

.rk-hero-product__logo-circle {
	position: absolute;
	top: calc((var(--rk-hp-m-hub) - var(--rk-hp-m-circle)) / 2);
	left: 50%;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	inline-size: var(--rk-hp-m-circle);
	block-size: var(--rk-hp-m-circle);
	margin-inline-start: calc(var(--rk-hp-m-circle) / -2);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--contrast);
}

/* Logo height = 32 % of the circle (Figma 58.88 / 184 and 28.16 / 88). */
.rk-hero-product .rk-hero-product__logo {
	display: block;
	inline-size: auto;
	max-inline-size: 84%;
	block-size: 32%;
	object-fit: contain;
}

/* Start of the curve, on the gradient ring's bottom (Figma r 3, 2 px stroke). */
.rk-hero-product__origin {
	position: absolute;
	top: calc((var(--rk-hp-m-hub) + var(--rk-hp-m-ring)) / 2 - 4px);
	left: 50%;
	z-index: 2;
	inline-size: 8px;
	block-size: 8px;
	margin-inline-start: -4px;
	border: 2px solid var(--rk-hp-dot);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--base);
}

/* Curve from the hub centre down-left to the rail (8 from the left edge, 12 high). */
.rk-hero-product .rk-hero-product__curve {
	position: absolute;
	top: calc((var(--rk-hp-m-hub) + var(--rk-hp-m-ring)) / 2);
	left: calc(var(--rk-hp-m-inset) - var(--rk-hp-m-rail));
	inline-size: calc(50% - var(--rk-hp-m-inset) + var(--rk-hp-m-rail));
	max-inline-size: none;
	block-size: 12px;
	overflow: visible;
}

.rk-hero-product__stop-start {
	stop-color: var(--rk-hp-stop-start);
}

.rk-hero-product__stop-end {
	stop-color: var(--rk-hp-stop-end);
}

/* ---------- Benefit chips (mobile) ---------- */

.rk-hero-product__benefits {
	display: flex;
	flex-direction: column;
	gap: var(--rk-hp-m-gap);
	margin: 10px var(--rk-hp-m-inset) 0;
	padding: 0;
	list-style: none;
}

/* The border is an inset shadow, so the rail and branch measure from the chip's outer edge. */
.rk-hero-product__benefit {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-block-size: var(--rk-hp-m-chip-h);
	padding: var(--wp--preset--spacing--10) 10px var(--wp--preset--spacing--10) 6px;
	border-radius: 10px;
	background: var(--wp--preset--color--base);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--border);
	font-size: calc(var(--wp--preset--font-size--sm) - 1px);
	font-weight: 600;
	line-height: 1.385;
}

.rk-hero-product__benefit-icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: var(--rk-hp-m-tile);
	block-size: var(--rk-hp-m-tile);
	border-radius: 7px;
	background: var(--rk-hp-tile-bg);
}

/* Product gradient instead of currentColor (.rk-icon draws the icon as a mask). */
.rk-hero-product .rk-hero-product__benefit-icon .rk-icon {
	inline-size: var(--rk-hp-m-glyph);
	block-size: var(--rk-hp-m-glyph);
	background: var(--rk-hp-icon);
}

.rk-hero-product__benefit-text {
	min-width: 0;
	overflow-wrap: break-word;
}

/* Rail: a 1.5 px line 14 left of the chips, from the gap above each chip down to the next. */
.rk-hero-product__benefit::before {
	content: "";
	position: absolute;
	top: calc(-1 * var(--rk-hp-m-gap));
	bottom: 0;
	left: calc(-1 * var(--rk-hp-m-rail) - 0.75px);
	inline-size: 1.5px;
	background: var(--rk-hp-line);
}

.rk-hero-product__benefit:last-child::before {
	bottom: auto;
	block-size: calc(50% + var(--rk-hp-m-gap));
}

/* Branch into the chip's middle, ending in a ring dot on its edge (r 2.25, 1.5 px stroke). */
.rk-hero-product__benefit::after {
	content: "";
	position: absolute;
	top: 50%;
	left: calc(-1 * var(--rk-hp-m-rail));
	inline-size: calc(var(--rk-hp-m-rail) + 3px);
	block-size: 6px;
	margin-block-start: -3px;
	background:
		radial-gradient(circle at var(--rk-hp-m-rail) 50%, var(--wp--preset--color--base) 0 1.5px, var(--rk-hp-dot) 1.75px 3px, transparent 3.25px),
		var(--rk-hp-line) 0 50% / var(--rk-hp-m-rail) 1.5px no-repeat;
	pointer-events: none;
}

/* ---------- Decorative outline (desktop only) ---------- */

.rk-hero-product__frame {
	display: none;
}

/* ---------- Editor ---------- */

.rk-hero-product__notice {
	margin: 0 0 var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	border: 1px dashed var(--wp--preset--color--accent-2);
	background: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--sm);
}

.rk-hero-product__empty {
	margin: 0;
	padding: var(--wp--preset--spacing--50);
	border: 1px dashed var(--wp--preset--color--border);
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--sm);
}

@media (forced-colors: active) {
	.rk-hero-product__benefit {
		border: 1px solid CanvasText;
	}
}

/* Phones: the PF frame (1201:7257) leaves 28 under the chips, the PP frame (1201:6691) 17. */
@media (max-width: 767px) {
	.rk-hero-product--pf {
		--rk-hp-pad-bottom: calc(var(--wp--preset--spacing--40) + var(--wp--preset--spacing--30));
	}
}

/* ---------- Tablet (derived) and desktop: the Figma desktop stage ---------- */

@media (min-width: 768px) {
	.rk-hero-product {
		--rk-hp-pad-top: var(--wp--preset--spacing--60);
		--rk-hp-pad-bottom: var(--wp--preset--spacing--80);
	}

	.rk-hero-product__inner {
		gap: var(--wp--preset--spacing--70);
	}

	.rk-hero-product .rk-hero-product__heading {
		max-width: var(--rk-hp-copy-width);
	}

	.rk-hero-product__checklist {
		max-width: var(--rk-hp-check-width);
	}

	.rk-hero-product__check {
		line-height: 1.5;
	}

	.rk-hero-product__check .rk-icon {
		margin-block-start: 2px;
	}

	/* Pill 200 wide as in Figma (nav button width + 32). */
	.rk-hero-product .rk-hero-product__cta {
		align-self: flex-start;
		min-inline-size: calc(var(--wp--custom--button--nav-width) + var(--wp--preset--spacing--60));
	}

	/* The column is the size container the stage scales against. */
	.rk-hero-product__media {
		container-type: inline-size;
	}

	.rk-hero-product__visual {
		--u: min(1px, 100cqi / 659);
		display: block;
		inline-size: calc(659 * var(--u));
		block-size: calc(var(--rk-hp-h) * var(--u));
		margin-inline: auto;
	}

	.rk-hero-product .rk-hero-product__list-label {
		position: absolute;
		top: calc(var(--rk-hp-top) * var(--u));
		left: calc(var(--rk-hp-label-x) * var(--u));
		margin: 0;
		font-size: calc(13 * var(--u));
		line-height: calc(18 * var(--u));
		text-align: start;
		white-space: nowrap;
	}

	/* Figma hub SVG: its ring centre sits on the chips' vertical middle. */
	.rk-hero-product .rk-hero-product__art {
		position: absolute;
		top: calc((var(--rk-hp-cy) - var(--rk-hp-art-cy)) * var(--u));
		left: 0;
		display: block;
		inline-size: calc(var(--rk-hp-art-w) * var(--u));
		max-inline-size: none;
		block-size: auto;
		pointer-events: none;
	}

	/* Inline SVG (other chip counts) uses the whole stage as its viewBox. */
	.rk-hero-product .rk-hero-product__art--inline {
		top: 0;
		inline-size: 100%;
		block-size: 100%;
		overflow: visible;
	}

	.rk-hero-product__art-dash {
		stroke: var(--rk-hp-dash);
	}

	.rk-hero-product__art-dot,
	.rk-hero-product__art-origin {
		fill: var(--wp--preset--color--base);
	}

	.rk-hero-product__art-dot {
		stroke: var(--rk-hp-dot);
	}

	/* Hub box = the dashed ring's square (262); the navy circle is 184, 39 in from its edge. */
	.rk-hero-product__hub {
		position: absolute;
		top: calc((var(--rk-hp-cy) - 131) * var(--u));
		left: 0;
		inline-size: calc(262 * var(--u));
		block-size: calc(262 * var(--u));
		margin: 0;
	}

	.rk-hero-product__hub::before,
	.rk-hero-product__hub::after,
	.rk-hero-product__origin,
	.rk-hero-product .rk-hero-product__curve {
		display: none;
	}

	.rk-hero-product__logo-circle {
		top: calc(39 * var(--u));
		left: calc(39 * var(--u));
		inline-size: calc(184 * var(--u));
		block-size: calc(184 * var(--u));
		margin: 0;
	}

	.rk-hero-product__benefits {
		position: absolute;
		top: calc((var(--rk-hp-top) + 32) * var(--u));
		left: calc(var(--rk-hp-chips-x) * var(--u));
		gap: calc(var(--rk-hp-gap) * var(--u));
		margin: 0;
	}

	.rk-hero-product__benefit {
		gap: calc(var(--rk-hp-chip-inner) * var(--u));
		block-size: calc(var(--rk-hp-chip-h) * var(--u));
		min-block-size: 0;
		min-inline-size: calc(var(--rk-hp-chip-w) * var(--u));
		padding: 0 calc(14 * var(--u)) 0 calc(var(--rk-hp-chip-pad) * var(--u));
		border-radius: calc(var(--rk-hp-chip-r) * var(--u));
		box-shadow:
			inset 0 0 0 1px var(--wp--preset--color--border),
			0 calc(8 * var(--u)) calc(24 * var(--u)) calc(-8 * var(--u)) var(--rk-hp-shadow);
		font-size: calc(var(--rk-hp-chip-font) * var(--u));
		line-height: calc(var(--rk-hp-chip-lh) * var(--u));
		white-space: nowrap;
	}

	.rk-hero-product__benefit::before,
	.rk-hero-product__benefit::after {
		display: none;
	}

	.rk-hero-product__benefit-icon {
		inline-size: calc(var(--rk-hp-tile) * var(--u));
		block-size: calc(var(--rk-hp-tile) * var(--u));
		border-radius: calc(var(--rk-hp-tile-r) * var(--u));
	}

	.rk-hero-product .rk-hero-product__benefit-icon .rk-icon {
		inline-size: calc(var(--rk-hp-glyph) * var(--u));
		block-size: calc(var(--rk-hp-glyph) * var(--u));
	}
}

/* ---------- Desktop (1200 and wider, Figma 1201:6880 / 1201:7075) ---------- */

@media (min-width: 1200px) {
	/* 800 high with the header; copy centred ≈ 417 (PP) / 434 (PF) from the top. */
	.rk-hero-product {
		--rk-hp-pad-top: var(--wp--preset--spacing--50);
		display: flex;
		flex-direction: column;
		justify-content: center;
		min-height: var(--rk-hp-min-height);
	}

	.rk-hero-product--pf {
		--rk-hp-pad-top: var(--wp--preset--spacing--60);
		--rk-hp-pad-bottom: var(--wp--preset--spacing--70);
	}

	.rk-hero-product__inner {
		display: grid;
		grid-template-columns: minmax(0, 585fr) minmax(0, 711fr);
		align-items: center;
		gap: 0;
	}

	.rk-hero-product--single .rk-hero-product__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	/* The visual's centre sits ≈ 8 above the copy's centre (Figma: 9 PP, 4 PF). */
	.rk-hero-product__media {
		margin-block-end: var(--wp--preset--spacing--40);
	}

	/* Stage 659 starts 18 right of the copy column (x 675 at 1440). */
	.rk-hero-product__visual {
		--u: min(1px, 100cqi / 711);
		margin-inline: calc(18 * var(--u)) 0;
	}

	.rk-hero-product--single .rk-hero-product__visual {
		margin-inline: auto;
	}

	.rk-hero-product__frame {
		/* Vertical lines 26.6 inside the content edges (Figma x 98.6 / 1341.4 at 1440). */
		--rk-hp-side: calc((100% - min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--style--root--padding-left))) / 2 + var(--rk-hp-frame-inset));
		--rk-hp-radius: var(--wp--custom--radius--card);
		position: absolute;
		top: calc(50% - var(--rk-hp-frame-height) / 2 + var(--rk-hp-frame-shift));
		right: 0;
		left: 0;
		z-index: -1;
		display: block;
		block-size: var(--rk-hp-frame-height);
		opacity: 0.3;
		pointer-events: none;
	}

	/* 1px strokes drawn as the border area of a masked box (the .rk-btn--ring technique). */
	.rk-hero-product__frame > span {
		position: absolute;
		-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
		-webkit-mask-composite: xor;
		mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
		mask-composite: exclude;
	}

	/* Top line from the left screen edge, curving down into the left vertical line. */
	.rk-hero-product__frame-start {
		top: 0;
		left: 0;
		inline-size: calc(var(--rk-hp-side) + 1px);
		block-size: var(--rk-hp-radius);
		padding: 1px 1px 0 0;
		border-top-right-radius: var(--rk-hp-radius);
		background: var(--wp--preset--color--accent);
	}

	/* The U: both vertical lines and the bottom line, rounded at the bottom. */
	.rk-hero-product__frame-mid {
		top: var(--rk-hp-radius);
		right: var(--rk-hp-side);
		bottom: 0;
		left: var(--rk-hp-side);
		padding: 0 1px 1px;
		border-radius: 0 0 var(--rk-hp-radius) var(--rk-hp-radius);
		background: var(--wp--preset--gradient--edrana);
	}

	/* Right vertical line curving up into the top line to the right screen edge. */
	.rk-hero-product__frame-end {
		top: 0;
		right: 0;
		inline-size: calc(var(--rk-hp-side) + 1px);
		block-size: var(--rk-hp-radius);
		padding: 1px 0 0 1px;
		border-top-left-radius: var(--rk-hp-radius);
		background: var(--wp--preset--color--primary);
	}
}

/* ---------- Motion (D22 option a): one calm sequence when the page loads ---------- */

/*
 * Start states exist only under html.has-motion (assets/js/head.js adds it only when
 * prefers-reduced-motion does not match) and inside the no-preference query, so without
 * JS or with reduced motion everything shows its final state (the chip highlights do not
 * exist). CSS animations only: they run once when the
 * hero first renders (it is the top of the page), with no script and no per-request state
 * (LiteSpeed page cache), and each one ends on the element's own (final) style. Only opacity,
 * transform, clip-path and stroke-dashoffset change: no
 * layout shift; all text stays in the DOM and the a11y tree.
 * --rk-i (each connector, end dot and chip) and --rk-hp-n (number of chips) come from render.php.
 * Desktop stage (≥768), PP 7 chips ≈ 4 s:
 *   0 logo circle → 150 rings → 300 label → 450 origin dot → from 600 one chip at a time, top to
 *   bottom, 200 ms apart: its connector draws from the hub (600 ms) and the chip rises in as
 *   the line arrives (380 ms later, 550 ms). When the last chip is in, every chip gets a
 *   short, faint outline glow at the same moment (from 3.27 s, 700 ms).
 * Phones (≤767): logo circle, rings, the curve wipes to the rail, then the chips one at a time
 *   (each with its rail segment growing down and its branch drawing in); then the same faint
 *   glow runs over the chips from top to bottom.
 * Fill mode "backwards": the start state holds during each delay; after the end the element
 * is back to its own style.
 * The decorative outline behind the section draws separately (view.js, § Line draw at the end).
 */
@media (prefers-reduced-motion: no-preference) {
	html.has-motion .rk-hero-product__visual {
		--rk-hp-ease: var(--wp--custom--motion--ease); /* Brand ease-out, as base.css reveals. */
		--rk-hp-step: 200ms; /* Between chips. */
		--rk-hp-lines-at: 600ms; /* First connector (desktop). */
		--rk-hp-draw: 600ms; /* Each connector. */
		--rk-hp-chip-lag: 380ms; /* A chip starts this long after its connector (line ≈ 93 % drawn). */
		--rk-hp-chip-ms: 550ms;
		--rk-hp-chips-at: 950ms; /* First chip (phones: after the curve). */
		--rk-hp-glow-ms: 700ms; /* Chip highlight. */
		/* Highlight timing (kept from the removed light ball): after the last chip is in, all chips at once on desktop; a top-to-bottom wave on phones. */
		--rk-hp-wave-at: calc(var(--rk-hp-chips-at) + (var(--rk-hp-n, 7) - 1) * var(--rk-hp-step) + var(--rk-hp-chip-ms));
		--rk-hp-wave-ms: 800ms; /* Desktop: the highlights start at 68 % of it. */
		--rk-hp-rail-at: calc(var(--rk-hp-wave-at) + 250ms); /* Phones: the wave reaches the first chip. */
		--rk-hp-rail-ms: calc(var(--rk-hp-n, 7) * 110ms); /* Phones: down the list, even speed. */
	}

	html.has-motion .rk-hero-product__logo-circle {
		animation: rk-hero-product-pop 600ms var(--rk-hp-ease) backwards;
	}

	html.has-motion .rk-hero-product__hub::before,
	html.has-motion .rk-hero-product__hub::after,
	html.has-motion .rk-hero-product__art-ring {
		animation: rk-hero-product-fade 700ms var(--rk-hp-ease) 150ms backwards;
	}

	html.has-motion .rk-hero-product__list-label {
		animation: rk-hero-product-fade 600ms var(--rk-hp-ease) 300ms backwards;
	}

	html.has-motion .rk-hero-product__origin,
	html.has-motion .rk-hero-product__art-origin {
		animation: rk-hero-product-fade 300ms var(--rk-hp-ease) 450ms backwards;
	}

	/* Phones: the curve is revealed from the hub (right) to the rail (left). */
	html.has-motion .rk-hero-product__curve {
		animation: rk-hero-product-wipe 450ms var(--rk-hp-ease) 500ms backwards;
	}

	/* Phones: each chip fades in (no rise: its rail segment and branch stay on the rail). */
	html.has-motion .rk-hero-product__benefit {
		animation: rk-hero-product-fade 500ms var(--rk-hp-ease) calc(var(--rk-hp-chips-at) + var(--rk-i, 0) * var(--rk-hp-step)) backwards;
	}

	/* Phones: its rail segment grows down to it, then the branch draws into it. */
	html.has-motion .rk-hero-product__benefit::before {
		transform-origin: 50% 0;
		animation: rk-hero-product-grow 400ms var(--rk-hp-ease) calc(var(--rk-hp-chips-at) + var(--rk-i, 0) * var(--rk-hp-step)) backwards;
	}

	html.has-motion .rk-hero-product__benefit::after {
		transform-origin: 0 50%;
		animation: rk-hero-product-grow-x 300ms var(--rk-hp-ease) calc(var(--rk-hp-chips-at) + var(--rk-i, 0) * var(--rk-hp-step) + 150ms) backwards;
	}

	/* Connectors have pathLength 1: a dash of 1 slides in from the ring to the chip. */
	html.has-motion .rk-hero-product__art-line {
		stroke-dasharray: 1;
		animation: rk-hero-product-draw var(--rk-hp-draw) var(--rk-hp-ease) calc(var(--rk-hp-lines-at) + var(--rk-i, 0) * var(--rk-hp-step)) backwards;
	}

	html.has-motion .rk-hero-product__art-end {
		animation: rk-hero-product-fade 250ms var(--rk-hp-ease) calc(var(--rk-hp-lines-at) + var(--rk-i, 0) * var(--rk-hp-step) + 400ms) backwards;
	}

	/* Chip highlight: a faint product-coloured outline and glow, in and out (opacity only). */
	html.has-motion .rk-hero-product__benefit-text::after {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: 10px;
		box-shadow:
			inset 0 0 0 1px color-mix(in srgb, var(--rk-hp-glow) 55%, transparent),
			0 0 14px color-mix(in srgb, var(--rk-hp-glow) 30%, transparent);
		opacity: 0;
		pointer-events: none;
		animation: rk-hero-product-flash var(--rk-hp-glow-ms) linear calc(var(--rk-hp-rail-at) + var(--rk-hp-rail-ms) * (var(--rk-i, 0) + 0.75) / (var(--rk-hp-n, 7) + 0.05) - 100ms) backwards;
	}
}

/* Desktop stage: a chip starts as its connector arrives; the highlights come all together. */
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
	html.has-motion .rk-hero-product__visual {
		--rk-hp-chips-at: calc(var(--rk-hp-lines-at) + var(--rk-hp-chip-lag));
	}

	html.has-motion .rk-hero-product__benefit {
		animation-name: rk-hero-product-rise;
		animation-duration: var(--rk-hp-chip-ms);
	}

	html.has-motion .rk-hero-product__benefit-text::after {
		border-radius: calc(var(--rk-hp-chip-r) * var(--u));
		box-shadow:
			inset 0 0 0 1px color-mix(in srgb, var(--rk-hp-glow) 55%, transparent),
			0 0 calc(16 * var(--u)) color-mix(in srgb, var(--rk-hp-glow) 30%, transparent);
		animation-delay: calc(var(--rk-hp-wave-at) + var(--rk-hp-wave-ms) * 0.68);
	}
}

@keyframes rk-hero-product-fade {
	from {
		opacity: 0;
	}
}

@keyframes rk-hero-product-pop {
	from {
		opacity: 0;
		transform: scale(0.94);
	}
}

@keyframes rk-hero-product-rise {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

@keyframes rk-hero-product-grow {
	from {
		transform: scaleY(0);
	}
}

@keyframes rk-hero-product-grow-x {
	from {
		transform: scaleX(0);
	}
}

@keyframes rk-hero-product-wipe {
	from {
		clip-path: inset(-2px -2px -2px calc(100% + 2px));
	}

	to {
		clip-path: inset(-2px);
	}
}

@keyframes rk-hero-product-draw {
	from {
		stroke-dashoffset: 1;
	}

	to {
		stroke-dashoffset: 0;
	}
}

/* In, hold, out (chip highlights; the element's own opacity is 0). */
@keyframes rk-hero-product-flash {
	0% {
		opacity: 0;
	}

	25%,
	70% {
		opacity: 1;
	}

	100% {
		opacity: 0;
	}
}

/*
 * ---------- Line draw (view.js, second part) ----------
 * The decorative outline (desktop ≥1200) draws itself once from left to right as the page loads
 * (the hero is on screen): a clip-path inset() wipe over the whole outline (top lines, U and
 * corners) from the section's left edge to its right edge, 2400 ms, ease-in-out; the vertical
 * lines appear as the wipe passes them. The outline is as wide as the section (left 0, right 0),
 * so its own box is the section: inset(… 100% … 0) → inset(… 0 … 0). Same technique, timing and
 * contract as every background line of the theme (hero-split § Line draw,
 * problem-solution-cards § Motion). It runs beside the stage sequence above and touches none of
 * its elements.
 * Everything needs html.has-motion (head.js: JS and no prefers-reduced-motion) on screen.
 * view.js sets .is-armed when it takes over, .is-drawn when the wipe starts and .is-done at the
 * end; it never removes a class. Before .is-armed a hold keeps the outline hidden 2 s and then
 * shows it (script missing, late or failed). The wipe ends on the whole section, then the
 * outline's own value (no clip): the static design. Only clip-path and visibility change: no
 * layout shift. Below 1200 px there is no outline.
 */
@media screen and (prefers-reduced-motion: no-preference) {
	html.has-motion .rk-hero-product__frame:not(.is-armed) {
		animation: rk-hero-product-line-hold 2600ms;
	}

	html.has-motion .rk-hero-product__frame.is-armed:not(.is-drawn):not(.is-done) {
		clip-path: inset(-1px 100% -1px 0);
	}

	html.has-motion .rk-hero-product__frame.is-drawn:not(.is-done) {
		animation: rk-hero-product-line-draw 2400ms cubic-bezier(0.45, 0, 0.55, 1) backwards; /* Otilija 2026-10-08: slower, even draw (was 2400 ms, ease-in-out) */
	}
}

/* No 100 % keyframe: it ends on the outline's own value (visible), at 2 s. */
@keyframes rk-hero-product-line-hold {
	0%,
	77% {
		visibility: hidden;
	}
}

/* From the section's left edge to its right edge; then the outline's own value (no clip). */
@keyframes rk-hero-product-line-draw {
	from {
		clip-path: inset(-1px 100% -1px 0);
	}

	to {
		clip-path: inset(-1px 0 -1px 0);
	}
}

/* Headings (Otilija 2026-10-08): stacked layouts (768–1199) use the full column instead of the 585 px desktop cap
   and balanced lines; from 1400 (near the 1440 design width) the Figma line breaks (greedy wrap); 1200–1399 stays balanced. */
@media (min-width: 768px) and (max-width: 1199px) {
	.rk-hero-product .rk-hero-product__heading {
		max-width: none;
	}
}

@media (min-width: 1400px) {
	.rk-hero-product .rk-hero-product__heading {
		text-wrap: wrap;
	}
}
