.portfolio-latest-posts {
	padding-block: var(--wp--preset--spacing--96);
	border-top: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
}

/* A card is not a layout container: its blocks keep their default margins. */
.portfolio-latest-posts .wp-block-post > * {
	margin-block: 0;
}

.portfolio-latest-posts .portfolio-latest-posts__inner {
	box-sizing: content-box;
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--gutter);
}

.portfolio-latest-posts .portfolio-latest-posts__header {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--24);
	align-items: flex-start;
	margin-bottom: var(--wp--preset--spacing--40);
}

.portfolio-latest-posts .portfolio-latest-posts__heading {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--10);
}

.portfolio-latest-posts .portfolio-latest-posts__intro {
	font-size: var(--wp--preset--font-size--17);
	color: var(--wp--preset--color--grey);
}

.portfolio-latest-posts .portfolio-latest-posts__all {
	font-size: var(--wp--preset--font-size--15);
}

.portfolio-latest-posts .portfolio-latest-posts__all a {
	font-weight: var(--wp--custom--font-weight--medium);
	color: var(--wp--preset--color--blue);
	text-decoration: none;
}

.portfolio-latest-posts .portfolio-latest-posts__posts {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	padding: 0;
}

.portfolio-latest-posts .wp-block-post {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--8);
	padding: var(--wp--preset--spacing--22) var(--wp--preset--spacing--56) var(--wp--preset--spacing--22) 0;
	border-bottom: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
}

.portfolio-latest-posts .wp-block-post:nth-child(2) {
	border-top: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
}

.portfolio-latest-posts .wp-block-post:first-child {
	gap: var(--wp--preset--spacing--14);
	margin-bottom: var(--wp--preset--spacing--32);
	padding: 0;
	border-bottom: 0;
}

.portfolio-latest-posts .wp-block-post:not(:first-child) .portfolio-latest-posts__cover,
.portfolio-latest-posts .wp-block-post:not(:first-child) .portfolio-latest-posts__excerpt {
	display: none;
}

.portfolio-latest-posts .portfolio-latest-posts__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--10);
	align-items: center;
	font-size: var(--wp--preset--font-size--13);
	color: var(--wp--preset--color--grey);
}

.portfolio-latest-posts .portfolio-latest-posts__meta > * + *::before {
	content: "·";
	margin-right: var(--wp--preset--spacing--10);
}

/* Above the card link, so the category stays its own link. */
.portfolio-latest-posts .portfolio-latest-posts__category {
	position: relative;
	z-index: 1;
	font-weight: var(--wp--custom--font-weight--medium);
}

.portfolio-latest-posts .portfolio-latest-posts__category a {
	color: var(--wp--preset--color--blue);
	text-decoration: none;
}

.portfolio-latest-posts .portfolio-latest-posts__post-title {
	font-size: var(--wp--preset--font-size--18);
	line-height: var(--wp--custom--line-height--title);
	transition: color var(--wp--custom--duration--fast) ease;
}

.portfolio-latest-posts .wp-block-post:first-child .portfolio-latest-posts__post-title {
	font-size: var(--wp--preset--font-size--24);
	line-height: var(--wp--custom--line-height--snug);
	letter-spacing: var(--wp--custom--letter-spacing--subheading);
}

.portfolio-latest-posts .portfolio-latest-posts__post-title a {
	color: inherit;
	text-decoration: none;
}

/* The title link covers the whole card. */
.portfolio-latest-posts .portfolio-latest-posts__post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.portfolio-latest-posts .portfolio-latest-posts__excerpt,
.portfolio-latest-posts .portfolio-latest-posts__excerpt p {
	margin: 0;
	font-size: var(--wp--preset--font-size--15);
	color: var(--wp--preset--color--grey);
}

.portfolio-latest-posts .wp-block-post:not(:first-child)::after,
.portfolio-latest-posts--related .wp-block-post:first-child::after {
	content: "→" / "";
	position: absolute;
	top: calc(50% - var(--wp--custom--control--sm) / 2);
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: var(--wp--custom--control--sm);
	height: var(--wp--custom--control--sm);
	border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--pill);
	transition:
		background-color var(--wp--custom--duration--fade) var(--wp--custom--easing--out),
		border-color var(--wp--custom--duration--fade) var(--wp--custom--easing--out),
		color var(--wp--custom--duration--fade) var(--wp--custom--easing--out),
		transform var(--wp--custom--duration--fade) var(--wp--custom--easing--out);
}

@media (hover: hover) and (pointer: fine) {

	.portfolio-latest-posts .wp-block-post:hover .portfolio-latest-posts__post-title {
		color: var(--wp--preset--color--blue);
	}

	.portfolio-latest-posts .wp-block-post:first-child:hover .portfolio-latest-posts__cover {
		transform: scale(0.985);
	}

	.portfolio-latest-posts .wp-block-post:not(:first-child):hover::after,
	.portfolio-latest-posts--related .wp-block-post:first-child:hover::after {
		border-color: var(--wp--preset--color--blue);
		background: var(--wp--preset--color--blue);
		color: var(--wp--preset--color--white);
		transform: rotate(-45deg);
	}
}

@media (min-width: 1001px) {

	.portfolio-latest-posts .portfolio-latest-posts__header {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
	}

	/* A flexible fifth row absorbs the featured post's extra height. */
	.portfolio-latest-posts .portfolio-latest-posts__posts {
		grid-template-rows: repeat(4, auto) 1fr;
		grid-template-columns: 1.1fr 1fr;
		column-gap: var(--wp--preset--spacing--48);
		align-items: start;
	}

	.portfolio-latest-posts .wp-block-post:first-child {
		grid-row: 1 / span 5;
		margin-bottom: 0;
	}

	.portfolio-latest-posts .wp-block-post:not(:first-child) {
		grid-column: 2;
	}
}

@media (prefers-reduced-motion: reduce) {

	.portfolio-latest-posts .portfolio-latest-posts__post-title,
	.portfolio-latest-posts .wp-block-post::after {
		transition: none;
	}
}

/* Related posts under an article: the same rows, as three bordered cards. */
.portfolio-latest-posts.portfolio-latest-posts--related {
	padding-block: var(--wp--preset--spacing--88);
}

.portfolio-latest-posts--related .portfolio-latest-posts__posts {
	gap: var(--wp--preset--spacing--20);
}

.portfolio-latest-posts--related .wp-block-post,
.portfolio-latest-posts--related .wp-block-post:first-child,
.portfolio-latest-posts--related .wp-block-post:nth-child(2) {
	gap: var(--wp--preset--spacing--8);
	margin-bottom: 0;
	padding: var(--wp--preset--spacing--22) var(--wp--preset--spacing--64) var(--wp--preset--spacing--22) var(--wp--preset--spacing--22);
	border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--20);
}

.portfolio-latest-posts--related .wp-block-post:first-child .portfolio-latest-posts__post-title {
	font-size: var(--wp--preset--font-size--18);
	line-height: var(--wp--custom--line-height--title);
	letter-spacing: 0;
}

.portfolio-latest-posts.portfolio-latest-posts--related .wp-block-post::after {
	right: var(--wp--preset--spacing--18);
}

@media (min-width: 1001px) {

	.portfolio-latest-posts--related .portfolio-latest-posts__posts {
		grid-template-rows: none;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		align-items: stretch;
	}

	.portfolio-latest-posts--related .wp-block-post:first-child,
	.portfolio-latest-posts--related .wp-block-post:not(:first-child) {
		grid-row: auto;
		grid-column: auto;
	}
}
