/*
 * Recent work grid.
 * Type and color come from the theme. The newest project takes the large slot,
 * so every import visibly refreshes the page. No dates, no category chips.
 * Layout responds to the width of the column it sits in, not the whole window.
 */

.kmp-recent {
	container-type: inline-size;
	margin: 0;
}

.kmp-recent .kmp-recent__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(12px, 2.2vw, 24px);
	margin: 0;
	padding: 0;
}

.kmp-recent .kmp-recent__item {
	display: flex;
	min-width: 0;
}

.kmp-recent a.kmp-recent__link {
	display: flex;
	flex-direction: column;
	width: 100%;
	color: inherit;
	text-decoration: none;
}

.kmp-recent .kmp-recent__image {
	position: relative;
	display: block;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: rgba(127, 127, 127, 0.12);
}

.kmp-recent .kmp-recent__image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.kmp-recent .kmp-recent__title {
	display: block;
	padding: 0.6em 0 0;
	font-weight: 600;
	line-height: 1.3;
}

.kmp-recent a.kmp-recent__link:hover .kmp-recent__title,
.kmp-recent a.kmp-recent__link:focus-visible .kmp-recent__title {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.kmp-recent a.kmp-recent__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

.kmp-recent .kmp-recent__more {
	margin: 1.25em 0 0;
	padding: 0;
}

/* Two columns: newest spans the full row. */
@container (min-width: 480px) {
	.kmp-recent .kmp-recent__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kmp-recent .kmp-recent__item--feature,
	.kmp-recent .kmp-recent__item:last-child:nth-child(even) {
		grid-column: span 2;
	}
}

/* Three columns: newest takes a two-by-two block. Counts of 3, 6, or 9 fill evenly. */
@container (min-width: 860px) {
	.kmp-recent .kmp-recent__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.kmp-recent .kmp-recent__item:last-child:nth-child(even) {
		grid-column: auto;
	}

	.kmp-recent .kmp-recent__item--feature {
		grid-column: span 2;
		grid-row: span 2;
	}

	.kmp-recent .kmp-recent__item--feature .kmp-recent__image {
		flex: 1 1 auto;
		min-height: 0;
		aspect-ratio: auto;
	}

	.kmp-recent .kmp-recent__item--feature .kmp-recent__title {
		font-size: 1.2em;
	}
}
