/*
 * rekos/link-cards-split.
 * Figma home 92:1943 (1440 × 690) / 967:9380 (375 × 1052); "Susiję sektoriai" 831:15356
 * (1440 × 612) / 1052:5897 (375 × ~696).
 * Tokens only; literal values only for breakpoints, percentages, 1px hairlines,
 * unitless line-heights and icon geometry (36/20 px icons, 30/24 px arrow circles).
 * Rules that override theme.json element styles (h2, links) start with
 * .rk-link-cards-split so they beat the global styles whatever the load order.
 *
 * Desktop default (≥1200): padding 80; content column 592 (45.7 %) left, rows 563
 * (43.45 %) right, vertically centred; content: [H2, 24, text 16/24, 24, checklist]
 * 40 [note 14/20, 16, CTA]; text, checklist and note 498 wide (84.2 % of the column);
 * checklist rows 8 apart, 20px gradient check + 16 + bold 16/24; rows 8 apart, each
 * surface, radius 32 (Figma 30), padding 24, 36px gradient icon + 16 + H20/28, 30px arrow.
 * Desktop related: content 416 (32.1 %) + 96 (7.4 %) + rows 563, centred; no checklist
 * or note; 1px gradient outline behind (Figma vector 831:15357, ~50 % opacity), drawn once
 * from left to right as it scrolls in (§ Line draw at the end).
 * Mobile (≤767): padding 72; content then rows, 48 apart; text and checklist 14/20, note
 * 12/16, CTA full width; rows radius 12, padding 16, 20px icon + 8 + bold 14/20, 24px
 * arrow; related: heading 16 text, then rows, then CTA 24 below; no top padding right
 * after the client stories (one 72 gap between them, as in Figma).
 * Tablet (768–1199, derived): stacked like mobile, desktop type and rows, text column
 * limited to the prose width.
 */

.rk-link-cards-split {
	position: relative;
	isolation: isolate;
	padding-block: var(--wp--preset--spacing--80);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

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

/* ---------- Content column ---------- */

.rk-link-cards-split__content {
	display: flex;
	flex-direction: column;
	gap: calc(var(--wp--preset--spacing--60) + var(--wp--preset--spacing--20));
	min-width: 0;
}

.rk-link-cards-split__main {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--50);
}

.rk-link-cards-split .rk-link-cards-split__heading {
	margin: 0;
	color: inherit;
	text-wrap: balance; /* below 1200: even lines (pretty did not fix lone words in Chrome); 1400+: Figma breaks, see end */
}

.rk-link-cards-split__text {
	margin: 0;
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.43;
}

.rk-link-cards-split__checklist {
	display: grid;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0;
	list-style: none;
}

.rk-link-cards-split__check {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--base);
	font-weight: 700;
	line-height: 1.43;
}

.rk-link-cards-split__check .rk-icon {
	inline-size: 20px;
	block-size: 20px;
}

.rk-link-cards-split__check-text {
	min-width: 0;
}

.rk-link-cards-split__footer {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--wp--preset--spacing--40);
}

.rk-link-cards-split__note {
	margin: 0;
	font-size: var(--wp--preset--font-size--xs);
	line-height: 1.333;
}

/* Mobile: the ring button fills the column (stretch keeps the ring margins inside). */
.rk-link-cards-split .rk-link-cards-split__cta {
	display: flex;
}

/* ---------- Link rows ---------- */

.rk-link-cards-split__links {
	display: grid;
	gap: var(--wp--preset--spacing--20);
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rk-link-cards-split .rk-link-cards-split__row {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--custom--radius--input);
	background: var(--wp--preset--color--surface);
	color: inherit;
	text-decoration: none;
	transition: background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--ease);
}

.rk-link-cards-split .rk-link-cards-split__row:hover {
	color: inherit;
}

.rk-link-cards-split__icon.rk-icon {
	inline-size: 20px;
	block-size: 20px;
}

.rk-link-cards-split__label {
	flex: 1 1 auto;
	min-width: 0;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	line-height: 1.43;
	overflow-wrap: break-word;
}

.rk-link-cards-split__arrow {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: 24px;
	block-size: 24px;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	transition: background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--ease);
}

.rk-link-cards-split__arrow .rk-icon {
	inline-size: 12px;
	block-size: 12px;
	transition: transform var(--wp--custom--motion--duration) var(--wp--custom--motion--ease);
}

/* Hover and focus (derived, not drawn in Figma): darker row, indigo arrow, arrow nudge. */
.rk-link-cards-split a.rk-link-cards-split__row:hover,
.rk-link-cards-split a.rk-link-cards-split__row:focus-visible {
	background: var(--wp--preset--color--surface-2);
}

.rk-link-cards-split a.rk-link-cards-split__row:hover .rk-link-cards-split__arrow,
.rk-link-cards-split a.rk-link-cards-split__row:focus-visible .rk-link-cards-split__arrow {
	background: var(--wp--preset--color--primary);
}

.rk-link-cards-split a.rk-link-cards-split__row:hover .rk-link-cards-split__arrow .rk-icon {
	transform: translate(1px, -1px);
}

.rk-link-cards-split__empty {
	padding: var(--wp--preset--spacing--50);
	font-size: var(--wp--preset--font-size--sm);
}

/* ---------- Decorative outline ("related", desktop only) ---------- */

.rk-link-cards-split__frame {
	display: none;
}

/* ---------- Mobile: "related" puts the CTA under the rows (Figma 1052:5897) ---------- */

@media (max-width: 767px) {
	/*
	 * After the (white) client stories the heading starts right under their 72 px bottom
	 * padding (Figma 1052:5826 has no top padding): one gap, not 72 + 72.
	 */
	.rk-case-studies + .rk-link-cards-split--related {
		padding-block-start: 0;
	}

	.rk-link-cards-split--related .rk-link-cards-split__inner {
		gap: 0;
	}

	.rk-link-cards-split--related .rk-link-cards-split__content {
		display: contents;
	}

	.rk-link-cards-split--related .rk-link-cards-split__main {
		order: 1;
		gap: var(--wp--preset--spacing--40);
	}

	/* DOM order is content (main, footer), links; flex order shows main, links, footer. */
	.rk-link-cards-split--related .rk-link-cards-split__links {
		order: 2;
	}

	.rk-link-cards-split--related .rk-link-cards-split__content + .rk-link-cards-split__links {
		margin-block-start: calc(var(--wp--preset--spacing--60) + var(--wp--preset--spacing--40));
	}

	.rk-link-cards-split--related .rk-link-cards-split__footer {
		order: 3;
		margin-block-start: var(--wp--preset--spacing--50);
	}
}

/* ---------- Tablet (derived) and desktop type and rows ---------- */

@media (min-width: 768px) {
	.rk-link-cards-split__inner {
		gap: var(--wp--preset--spacing--70);
	}

	/* The prose cap applies to the running text only, so a short heading can use the full row
	   (Otilija 2026-10-08: no artificial heading width). */
	:is(.rk-link-cards-split__main > :not(.rk-link-cards-split__heading), .rk-link-cards-split__content > :not(.rk-link-cards-split__main)) {
		max-width: var(--wp--custom--layout--prose);
	}

	.rk-link-cards-split__text,
	.rk-link-cards-split__check {
		line-height: 1.5;
	}

	.rk-link-cards-split__check .rk-icon {
		margin-block-start: 2px;
	}

	.rk-link-cards-split__footer {
		align-items: flex-start;
	}

	/* Pill 200 wide as in Figma 831:15363 (nav button width + 32). */
	.rk-link-cards-split .rk-link-cards-split__cta {
		display: inline-flex;
		min-inline-size: calc(var(--wp--custom--button--nav-width) + var(--wp--preset--spacing--60));
	}

	.rk-link-cards-split__note {
		font-size: var(--wp--preset--font-size--sm);
		line-height: 1.43;
	}

	.rk-link-cards-split .rk-link-cards-split__row {
		gap: var(--wp--preset--spacing--40);
		padding: var(--wp--preset--spacing--50);
		border-radius: var(--wp--custom--radius--card);
	}

	.rk-link-cards-split__icon.rk-icon {
		inline-size: 36px;
		block-size: 36px;
	}

	.rk-link-cards-split__label {
		font-size: var(--wp--preset--font-size--lg);
		line-height: 1.4;
	}

	.rk-link-cards-split__arrow {
		inline-size: 30px;
		block-size: 30px;
	}

	.rk-link-cards-split__arrow .rk-icon {
		inline-size: 18px;
		block-size: 18px;
	}
}

/* ---------- Desktop: two columns ---------- */

@media (min-width: 1200px) {
	.rk-link-cards-split__inner {
		display: grid;
		grid-template-columns: minmax(0, 45.7%) minmax(0, 43.45%);
		align-items: center;
		justify-content: space-between;
		column-gap: var(--wp--preset--spacing--70);
	}

	.rk-link-cards-split__content {
		max-width: none;
	}

	.rk-link-cards-split--default :is(.rk-link-cards-split__text, .rk-link-cards-split__checklist, .rk-link-cards-split__note) {
		max-width: 84.2%;
	}

	.rk-link-cards-split--related .rk-link-cards-split__inner {
		grid-template-columns: minmax(0, 32.1%) minmax(0, 43.45%);
		justify-content: center;
		column-gap: 7.4%;
	}

	/* Only one of the two columns has content: use the full width. */
	.rk-link-cards-split--single .rk-link-cards-split__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.rk-link-cards-split__frame {
		/* Vertical lines 24px inside the content edges (Figma 98 / 1341 at 1440). */
		--rk-lcs-side: calc((100% - min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--style--root--padding-left))) / 2 + var(--wp--preset--spacing--50));
		--rk-lcs-radius: var(--wp--custom--radius--card);
		position: absolute;
		inset: 26.6% 0;
		z-index: -1;
		display: block;
		opacity: 0.5;
		pointer-events: none;
	}

	/* 1px strokes drawn as the border area of a masked box (the .rk-btn--ring technique). */
	.rk-link-cards-split__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 edge, curving down into the left vertical line. */
	.rk-link-cards-split__frame-start {
		top: 0;
		left: 0;
		width: calc(var(--rk-lcs-side) + 1px);
		height: var(--rk-lcs-radius);
		padding: 1px 1px 0 0;
		border-top-right-radius: var(--rk-lcs-radius);
		background: var(--wp--preset--color--accent);
	}

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

	/* Right vertical line curving up into the top line to the right edge. */
	.rk-link-cards-split__frame-end {
		top: 0;
		right: 0;
		width: calc(var(--rk-lcs-side) + 1px);
		height: var(--rk-lcs-radius);
		padding: 1px 0 0 1px;
		border-top-left-radius: var(--rk-lcs-radius);
		background: var(--wp--preset--color--primary);
	}
}

@media (prefers-reduced-motion: reduce) {
	.rk-link-cards-split .rk-link-cards-split__row,
	.rk-link-cards-split__arrow,
	.rk-link-cards-split__arrow .rk-icon {
		transition: none;
	}

	.rk-link-cards-split a.rk-link-cards-split__row:hover .rk-link-cards-split__arrow .rk-icon {
		transform: none;
	}
}

/*
 * ---------- Line draw (view.js) ----------
 * The decorative outline ("related", desktop) draws itself once from left to right when it
 * scrolls in (its top past 90 % of the window, as motion.js): 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 (inset 26.6 % 0), so its own box is the section: inset(… 100% … 0) →
 * inset(… 0 … 0). Same technique and timing as every background line of the theme
 * (problem-solution-cards § Motion).
 * Same contract as base.css § Motion: 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-link-cards-split__frame:not(.is-armed) {
		animation: rk-lcs-line-hold 2600ms;
	}

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

	html.has-motion .rk-link-cards-split__frame.is-drawn:not(.is-done) {
		animation: rk-lcs-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-lcs-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-lcs-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
   and balanced lines; from 1400 (near the 1440 design width) the Figma line breaks (greedy wrap); 1200–1399 stays balanced. */
@media (min-width: 1400px) {
	.rk-link-cards-split .rk-link-cards-split__heading {
		text-wrap: wrap;
	}
}
