/*
 * CARD-4: mixed-size tiles.
 * Tiles of three sizes in one grid: the first of every six is large, the
 * second, fifth and sixth are wide, the two between are small. Whatever the
 * number of tiles, the last line is filled.
 */

.wprk-section.wprk-card-4 .wprk-card-4__list {
	gap: var(--wp--preset--spacing--30);
	grid-template-columns: minmax(0, 1fr);
}

.wprk-card-4 .wprk-card__icon {
	color: var(--wprk-accent-text);
	display: block;
}

.wprk-card-4 .wprk-card__icon :where(svg) {
	display: block;
	fill: currentColor;
	height: 2rem;
	width: 2rem;
}

.wprk-card-4 .wprk-card-4__tile > .wprk-card__icon + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.wprk-card-4 .wprk-card-4__tile :where(h3) {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
}

.wprk-card-4 .wprk-card-4__tile :where(p) {
	color: var(--wprk-muted);
	max-width: 34rem;
}

/* Two columns: the large tile and the sixth run across, and so does a tile left alone on the last line. */
@media (min-width: 600px) and (max-width: 1023px) {
	.wprk-section.wprk-card-4 .wprk-card-4__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.wprk-card-4 .wprk-card-4__tile:is(:nth-child(6n + 1), :nth-child(6n), :nth-child(6n + 2):last-child, :nth-child(6n + 4):last-child) {
		grid-column: 1 / -1;
	}
}

/* Four columns. */
@media (min-width: 1024px) {
	.wprk-section.wprk-card-4 .wprk-card-4__list {
		grid-auto-flow: dense;
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.wprk-card-4 .wprk-card-4__tile:nth-child(6n + 1) {
		grid-column: span 2;
		grid-row: span 2;
	}

	.wprk-card-4 .wprk-card-4__tile:is(:nth-child(6n + 2), :nth-child(6n + 5), :nth-child(6n)) {
		grid-column: span 2;
	}

	/* The last line: a tile that would leave a gap grows into it. */
	.wprk-card-4 .wprk-card-4__tile:is(:nth-child(6n + 1), :nth-child(6n + 5)):last-child {
		grid-column: 1 / -1;
		grid-row: auto;
	}

	.wprk-card-4 .wprk-card-4__tile:nth-child(6n + 2):last-child {
		grid-row: span 2;
	}

	.wprk-card-4 .wprk-card-4__tile:nth-child(6n + 3):last-child {
		grid-column: span 2;
	}

	/* The large tile speaks a little louder. Its wider padding is kept light, so a theme whose cards have no box keeps its own. */
	.wprk-card-4 .wprk-card-4__tile:where(:nth-child(6n + 1):not(:last-child)) {
		padding: var(--wp--preset--spacing--50);
	}

	.wprk-card-4 .wprk-card-4__tile:nth-child(6n + 1):not(:last-child) :where(h3) {
		font-size: var(--wp--preset--font-size--x-large);
		line-height: 1.2;
	}

	.wprk-card-4 .wprk-card-4__tile:nth-child(6n + 1):not(:last-child) :where(p) {
		font-size: var(--wp--preset--font-size--medium);
	}

	.wprk-card-4 .wprk-card-4__tile:nth-child(6n + 1):not(:last-child) .wprk-card__icon :where(svg) {
		height: 2.75rem;
		width: 2.75rem;
	}
}
