/**
 * Component: check list (check icon + text), used by the dark banners.
 *
 *     <ul class="check-list check-list--cards check-list--outline" role="list">
 *       <li class="check-list__item">…</li>
 *     </ul>
 *
 * Icons: --outline (circle outline with a check, cards banner) or --filled
 * (filled disc with a dark check, title-list banner). Layouts: --cards
 * (translucent bordered cards, two columns from --bp-md) or --divided
 * (stacked with divider lines). Colours follow the text colour and tokens.
 *
 * @package cartrack
 */

.check-list {
	display: grid;
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: var(--font-body);
	font-size: var(--check-list-size);
	line-height: var(--line-height-body);
}

.check-list__item {
	position: relative;
	padding-inline-start: calc(var(--check-list-icon-size) + var(--check-list-icon-gap));
}

.check-list__item::before {
	content: "";
	position: absolute;
	top: calc((1lh - var(--check-list-icon-size)) / 2);
	left: 0;
	width: var(--check-list-icon-size);
	height: var(--check-list-icon-size);
	background-color: var(--check-list-icon-colour);
	-webkit-mask: var(--check-list-icon) center / contain no-repeat;
	mask: var(--check-list-icon) center / contain no-repeat;
}

.check-list--outline {
	--check-list-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M8 12.5l2.7 2.7L16 9.5'/%3E%3C/svg%3E");
}

/* Filled disc; the check is cut out, so the icon colour is the disc. */
.check-list--filled {
	--check-list-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm4.7 7.3a1 1 0 0 0-1.4-1.4L10.7 12.5l-2-2a1 1 0 0 0-1.4 1.4l2.7 2.7a1 1 0 0 0 1.4 0z'/%3E%3C/svg%3E");
}

/* ---------- Cards ---------- */

.check-list--cards {
	gap: var(--check-list-card-gap-y) var(--check-list-card-gap-x);
}

.check-list--cards .check-list__item {
	padding: var(--check-list-card-padding) var(--check-list-card-padding) var(--check-list-card-padding) calc(var(--check-list-card-padding) + var(--check-list-icon-size) + var(--check-list-icon-gap));
	border: 1px solid var(--check-list-card-border);
	border-radius: var(--radius-sm);
	background-color: var(--check-list-card-bg);
	-webkit-backdrop-filter: blur(var(--check-list-card-blur));
	backdrop-filter: blur(var(--check-list-card-blur));
}

.check-list--cards .check-list__item::before {
	top: calc(var(--check-list-card-padding) + (1lh - var(--check-list-icon-size)) / 2);
	left: var(--check-list-card-padding);
}

/* ---------- Divided ---------- */

.check-list--divided .check-list__item {
	padding-block: var(--check-list-divided-padding);
	border-bottom: 1px solid var(--check-list-divider);
}

.check-list--divided .check-list__item:first-child {
	padding-top: 0;
}

.check-list--divided .check-list__item::before {
	top: calc(var(--check-list-divided-padding) + (1lh - var(--check-list-icon-size)) / 2);
}

.check-list--divided .check-list__item:first-child::before {
	top: calc((1lh - var(--check-list-icon-size)) / 2);
}

@media (min-width: 48em) { /* --bp-md */
	.check-list--cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.check-list--cards .check-list__item {
		min-height: var(--check-list-card-min-height);
	}
}
