/*
 * checklist pattern. Section wrapper around a core/list with
 * is-style-check-list. One or two columns depending on item count.
 */

.hk-checklist {
	padding-block: var(--section-y);
}

/* Container matches .hk-faq__inner exactly (max-width: --measure with
 * the shared inline padding), so the checklist heading and items sit
 * at the same left edge as the FAQ heading on service pages. */
.hk-checklist__inner {
	max-width: var(--measure);
	margin-inline: auto;
	padding-inline: clamp(var(--space-l), 4vw, var(--space-2xl));
}

.hk-checklist__header {
	margin-block-end: var(--space-2xl);
	max-width: var(--measure-narrow);
}

.hk-checklist__heading {
	font-family: var(--font-display);
	font-size: var(--step-4);
	line-height: var(--line-tight);
	color: var(--ink);
}

.hk-checklist__lede {
	font-family: var(--font-body);
	font-size: var(--step-1);
	line-height: var(--line-snug);
	color: var(--ink-muted);
	margin-block-start: var(--space-m);
}

/* Two-column list layout once there is enough viewport width. The list
 * itself handles its items via is-style-check-list; the pattern only
 * supplies the layout. */
.hk-checklist__body {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-xl);
}

@media (min-width: 48rem) {
	.hk-checklist__body.hk-checklist__body--two-col {
		grid-template-columns: 1fr 1fr;
		gap: var(--space-l) var(--space-3xl);
	}
	.hk-checklist__body.hk-checklist__body--two-col .wp-block-list {
		margin: 0;
	}
}

/* Side-image variant (v1.2.0). When the checklist has an image set,
 * the inner wrapper becomes a two-column grid: image on one side,
 * content stack (header + body) on the other. hk-checklist--image-right
 * swaps the column order so the image sits on the right. On narrow
 * viewports the layout collapses back to a single column with the
 * image above the content. */
.hk-checklist--has-image .hk-checklist__inner {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-xl);
	align-items: start;
}

.hk-checklist__image {
	margin: 0;
	border-radius: var(--radius-m);
	overflow: hidden;
	background: var(--paper-muted);
}

.hk-checklist__image img {
	display: block;
	width: 100%;
	height: auto;
}

@media (min-width: 48rem) {
	/* 2fr/3fr instead of 1fr/1fr — v1.4.0 fix for the narrow-list
	 * problem on Services. A 1:1 split with the default --space-3xl
	 * gap left the list column at ~half the viewport (minus padding
	 * and gutter), and a two-column list inside that landed near
	 * ~quarter-viewport each, which wrapped prose on every item.
	 * 2:3 gives the image a decent frame and leaves the content
	 * column wide enough to read without wrapping. */
	.hk-checklist--has-image .hk-checklist__inner {
		grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
		gap: var(--space-2xl);
	}
	/* columnRatio option: swap the default 2:3 image:list ratio. */
	.hk-checklist--has-image.hk-checklist--ratio-even .hk-checklist__inner {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--space-l);
	}
	.hk-checklist--has-image.hk-checklist--ratio-wider-image .hk-checklist__inner {
		grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
		gap: var(--space-2xl);
	}
	.hk-checklist--has-image.hk-checklist--image-right .hk-checklist__image {
		order: 2;
	}
	/* When a checklist carries an image, the body column is already
	 * narrow enough that splitting it into two sub-columns wraps text
	 * aggressively. Force the body back to a single column regardless
	 * of the `columns` attribute. Lists without an image keep the
	 * two-column body behavior from the base rule above. */
	.hk-checklist--has-image .hk-checklist__body--two-col {
		grid-template-columns: 1fr;
		gap: var(--space-s);
	}
	/* Even and wider-image ratios tighten the item spacing + bump the
	 * list indent so long items stay on one line in the narrower list
	 * column. Replaces Lago's `hk-checklist--has-image` child-theme
	 * override. */
	.hk-checklist--has-image.hk-checklist--ratio-even .hk-check-item,
	.hk-checklist--has-image.hk-checklist--ratio-even .wp-block-list.is-style-check-list > li {
		padding-inline-start: 1.4em;
	}
	.hk-checklist--has-image.hk-checklist--ratio-even .hk-checklist__list,
	.hk-checklist--has-image.hk-checklist--ratio-even .wp-block-list.is-style-check-list {
		gap: var(--space-xs);
	}
}

/* ---- Adjacent-sibling spacing ----
 * When two hk/checklist sections stack directly, the second one drops
 * its top padding to the small space-l rhythm so the two don't read
 * as separated by a full --section-y gutter. Previously a Lago-only
 * override; promoted to a base default. */
.hk-checklist + .hk-checklist {
	padding-block-start: var(--space-l);
}

/* ---- hk/check-item (v2.0.0 inner block) ----
 * The round check-mark badge comes from the shared variations/
 * check-list.css rule that targets both .wp-block-list.is-style-
 * check-list > li::before and .hk-check-item::before. Here we just
 * carry the item layout (indent + line height), matching the legacy
 * core/list-item layout so hk-checklist's two-column body + stagger
 * reveal keep working for both shapes. */
.hk-checklist__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-m);
}

.hk-check-item {
	position: relative;
	padding-inline-start: 2em;
	font-family: var(--font-body);
	font-size: var(--step-1);
	line-height: var(--line-snug);
	color: var(--ink);
}

.hk-check-item::before {
	content: "✓" / "";
	position: absolute;
	inset-inline-start: 0;
	inset-block-start: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4em;
	height: 1.4em;
	border-radius: 999px;
	background: var(--mark);
	color: var(--on-mark);
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 0.75em;
	line-height: 1;
	flex-shrink: 0;
	transform: translateY(0.15em);
}
