/*
 * Icon list (ADR 0040): lines with an icon at their start, in 1–3 columns (one on phones). Icons are
 * the Icon element's glyph and circle (icon/style.css) at text-relative sizes, in the accent chain.
 * Its Background (sv-card-*, utilities.css) boxes the whole list, or each line (ADR 0173).
 */
.sv-icon-list {
	--sv-icon-list-gap: 0.75rem;
	--sv-icon-list-icon: 1.25em;
	display: grid;
	grid-template-columns: repeat(var(--sv-icon-list-columns, 1), minmax(0, 1fr));
	gap: var(--sv-icon-list-gap) var(--sv-space-md);
	margin: 0;
	padding: 0;
	list-style: none;
}

.sv-icon-list--columns-2 {
	--sv-icon-list-columns: 2;
}

.sv-icon-list--columns-3 {
	--sv-icon-list-columns: 3;
}

@media (max-width: 767px) {
	.sv-icon-list {
		--sv-icon-list-columns: 1;
	}
}

.sv-icon-list--gap-sm {
	--sv-icon-list-gap: 0.4rem;
}

.sv-icon-list--gap-lg {
	--sv-icon-list-gap: 1.25rem;
}

.sv-icon-list--text-size-sm {
	font-size: var(--sv-size-small);
}

.sv-icon-list--text-size-lg {
	font-size: var(--sv-size-large);
}

/* A size of one's own (ADR 0194); in Tags, each line's pill takes it too. */
.sv-icon-list--text-size-custom {
	font-size: var(--sv-custom-text-size);
}

.sv-icon-list--text-size-custom .sv-badge--size-custom .sv-badge__pill {
	font-size: var(--sv-custom-text-size);
}

/* Alignment (--sv-justify, per device): each line placed there, its icon still at its start. */
.sv-icon-list__item {
	display: flex;
	gap: 0.65em;
	align-items: flex-start;
	justify-content: var(--sv-justify, start);
	min-inline-size: 0;
}

/*
 * A thin line between rows (ADR 0040, 0173): under every line but the last row's, so it runs across the whole row above
 * the next — the columns have no gap, each line keeps that room at its end instead (none in one column). Not with a box
 * for each line.
 */
.sv-icon-list--dividers-lines:not(.sv-icon-list--boxes-each, .sv-icon-list--arrange-tags) {
	gap: 0;
}

.sv-icon-list--dividers-lines:not(.sv-icon-list--boxes-each, .sv-icon-list--arrange-tags) > .sv-icon-list__item {
	padding-block: calc(var(--sv-icon-list-gap) / 2 + 0.2rem);
	padding-inline-end: calc(var(--sv-space-md) * min(1, var(--sv-icon-list-columns, 1) - 1));
	border-block-end: 1px solid var(--sv-icon-list-line, var(--sv-color-border));
}

/*
 * The last row draws no line: a row's first line among the last 2 or 3, and the lines after it, as the list has
 * columns on that screen (Columns; Per row on tablets and phones; phones one). One specificity for all, so each
 * screen size's rules replace the wider one's.
 */
.sv-icon-list__item:where(
	.sv-icon-list > :last-child,
	.sv-icon-list--columns-2 > :nth-child(2n + 1):nth-last-child(-n + 2),
	.sv-icon-list--columns-2 > :nth-child(2n + 1):nth-last-child(-n + 2) ~ *,
	.sv-icon-list--columns-3 > :nth-child(3n + 1):nth-last-child(-n + 3),
	.sv-icon-list--columns-3 > :nth-child(3n + 1):nth-last-child(-n + 3) ~ *
) {
	--sv-icon-list-line: transparent;
}

@media (max-width: 1024px) {
	.sv-icon-list__item:where(.sv-icon-list:is(.sv-t-prow-1, .sv-t-prow-2, .sv-t-prow-3) > *) {
		--sv-icon-list-line: initial;
	}

	.sv-icon-list__item:where(
		.sv-icon-list.sv-t-prow-1 > :last-child,
		.sv-icon-list.sv-t-prow-2 > :nth-child(2n + 1):nth-last-child(-n + 2),
		.sv-icon-list.sv-t-prow-2 > :nth-child(2n + 1):nth-last-child(-n + 2) ~ *,
		.sv-icon-list.sv-t-prow-3 > :nth-child(3n + 1):nth-last-child(-n + 3),
		.sv-icon-list.sv-t-prow-3 > :nth-child(3n + 1):nth-last-child(-n + 3) ~ *
	) {
		--sv-icon-list-line: transparent;
	}
}

/* Phones: one column, unless Per row says otherwise for phones (or for tablets, which phones follow). */
@media (max-width: 767px) {
	.sv-icon-list__item:where(.sv-icon-list:not(.sv-t-prow-2, .sv-t-prow-3) > *, .sv-icon-list:is(.sv-m-prow-1, .sv-m-prow-2, .sv-m-prow-3) > *) {
		--sv-icon-list-line: initial;
	}

	.sv-icon-list__item:where(
		.sv-icon-list:not(.sv-t-prow-2, .sv-t-prow-3, .sv-m-prow-1, .sv-m-prow-2, .sv-m-prow-3) > :last-child,
		.sv-icon-list.sv-m-prow-1 > :last-child,
		.sv-icon-list.sv-m-prow-2 > :nth-child(2n + 1):nth-last-child(-n + 2),
		.sv-icon-list.sv-m-prow-2 > :nth-child(2n + 1):nth-last-child(-n + 2) ~ *,
		.sv-icon-list.sv-m-prow-3 > :nth-child(3n + 1):nth-last-child(-n + 3),
		.sv-icon-list.sv-m-prow-3 > :nth-child(3n + 1):nth-last-child(-n + 3) ~ *
	) {
		--sv-icon-list-line: transparent;
	}
}

/*
 * A box for each line (ADR 0173): the list's Background, Rounded corners, Shadow and Space inside go to every line, the
 * list itself draws none of them (its text colors stay, so each line reads on its box). Lines of a row share its height.
 * Without a Background, nothing changes.
 */
.sv-icon-list--boxes-each {
	--sv-icon-list-room: var(--sv-space-sm);
}

.sv-icon-list--boxes-each.sv-inset-none { --sv-icon-list-room: 0px; }
.sv-icon-list--boxes-each.sv-inset-sm { --sv-icon-list-room: var(--sv-space-step-sm, var(--sv-space-sm)); }
.sv-icon-list--boxes-each.sv-inset-md { --sv-icon-list-room: var(--sv-space-step-md, var(--sv-space-md)); }
.sv-icon-list--boxes-each.sv-inset-lg { --sv-icon-list-room: var(--sv-space-step-lg, var(--sv-space-lg)); }
.sv-icon-list--boxes-each.sv-inset-xl { --sv-icon-list-room: var(--sv-space-step-xl, var(--sv-space-xl)); }
.sv-icon-list--boxes-each.sv-inset-custom { --sv-icon-list-room: var(--sv-custom-inset); }

@media (max-width: 1024px) {
	.sv-icon-list--boxes-each:is(.sv-t-inset-none, .sv-t-inset-sm, .sv-t-inset-md, .sv-t-inset-lg, .sv-t-inset-xl, .sv-t-inset-custom) { --sv-icon-list-room: var(--sv-inset-d); }
}

@media (max-width: 767px) {
	.sv-icon-list--boxes-each:is(.sv-m-inset-none, .sv-m-inset-sm, .sv-m-inset-md, .sv-m-inset-lg, .sv-m-inset-xl, .sv-m-inset-custom) { --sv-icon-list-room: var(--sv-inset-d); }
}

.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags):is(.sv-card-soft, .sv-card-light, .sv-card-dark, .sv-card-outlined, .sv-card-primary, .sv-card-secondary, .sv-card-custom) {
	gap: var(--sv-icon-list-gap);
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags):is(.sv-card-soft, .sv-card-light, .sv-card-dark, .sv-card-outlined, .sv-card-primary, .sv-card-secondary, .sv-card-custom) > * {
	--sv-drop: inherit;
	--sv-custom-edge: inherit;
	--sv-custom-glass: inherit;
	--sv-custom-gradient: inherit;
	padding: var(--sv-icon-list-room);
	border-radius: inherit;
	box-shadow: var(--sv-custom-edge, 0 0 #0000), var(--sv-drop, 0 0 #0000);
	-webkit-backdrop-filter: var(--sv-custom-glass);
	backdrop-filter: var(--sv-custom-glass);
}

.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-soft > * { background-color: var(--sv-color-surface); }
.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-light > * { border: 1px solid var(--sv-color-border); background-color: var(--sv-color-background); box-shadow: var(--sv-custom-edge, 0 0 #0000), var(--sv-drop, 0 1px 2px rgb(16 24 40 / 5%)); }
.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-outlined > * { border: 1px solid var(--sv-color-border); }
.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-dark > * { background-color: var(--sv-color-inverse); }
.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-primary > * { background-color: var(--sv-color-primary); }
.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-secondary > * { background-color: var(--sv-color-secondary); }
.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-custom > * { background-color: var(--sv-custom-card); }

.sv-icon-list--boxes-each:not(.sv-icon-list--arrange-tags).sv-card-custom[style*="--sv-custom-gradient"] > * {
	background-image: var(--sv-custom-gradient);
	background-origin: border-box;
}

.sv-icon-list__icon {
	display: inline-grid;
	flex: none;
	place-items: center;
	block-size: calc(1em * 1.6 * var(--sv-leading-body, 1));
	color: var(--sv-accent, var(--sv-color-primary));
	line-height: 0;
}

.sv-icon-list__icon .sv-icon__glyph {
	inline-size: var(--sv-icon-list-icon);
	block-size: var(--sv-icon-list-icon);
}

.sv-icon-list--icon-size-sm {
	--sv-icon-list-icon: 1em;
}

.sv-icon-list--icon-size-lg {
	--sv-icon-list-icon: 1.6em;
}

/* In a circle: the Icon element's soft circle, 1.75 times the icon; the line centers on it. */
.sv-icon-list__icon .sv-icon__circle {
	inline-size: calc(var(--sv-icon-list-icon) * 1.75);
	block-size: calc(var(--sv-icon-list-icon) * 1.75);
}

.sv-icon-list__icon:has(.sv-icon__circle) {
	block-size: auto;
}

.sv-icon-list__item:has(.sv-icon__circle) {
	align-items: center;
}

.sv-icon-list__text {
	min-inline-size: 0;
	overflow-wrap: break-word;
}

.sv-icon-list__link {
	color: var(--sv-accent, var(--sv-color-link));
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.sv-icon-list__link:hover {
	text-decoration-thickness: 2px;
}

/*
 * Tags (ADR 0181): the lines side by side, wrapping, placed by Alignment; each line is the Badge's pill (badge/style.css:
 * its look from Tag look, its size from Text size), with only its own icon. Columns, Per row, lines between rows and a
 * box for each line don't apply; the list's own Background still boxes the whole list.
 */
.sv-icon-list.sv-icon-list--arrange-tags {
	--sv-icon-list-gap: 0.6rem;
	display: flex;
	flex-wrap: wrap;
	gap: var(--sv-icon-list-gap);
	justify-content: var(--sv-justify, flex-start);
}

.sv-icon-list.sv-icon-list--arrange-tags.sv-icon-list--gap-sm {
	--sv-icon-list-gap: 0.35rem;
}

.sv-icon-list.sv-icon-list--arrange-tags.sv-icon-list--gap-lg {
	--sv-icon-list-gap: 1rem;
}

.sv-icon-list__item.sv-icon-list__tag {
	gap: 0;
	min-inline-size: auto;
}

/* A line with a link: the whole pill, in the pill's own colors, a little fuller when pointed at. */
.sv-icon-list__tag-link {
	text-decoration: none;
	transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.sv-icon-list__tag-link:hover {
	box-shadow: inset 0 0 0 100vmax color-mix(in srgb, currentColor 8%, transparent);
}
