/* Post Cards block */

.pcards-grid {
	display: grid;
	gap: 1.25rem;
}

.pcards-grid.is-cols-1 { grid-template-columns: 1fr; }
.pcards-grid.is-cols-2 { grid-template-columns: repeat( 2, 1fr ); }
.pcards-grid.is-cols-3 { grid-template-columns: repeat( 3, 1fr ); }
.pcards-grid.is-cols-4 { grid-template-columns: repeat( 4, 1fr ); }
.pcards-grid.is-cols-5 { grid-template-columns: repeat( 5, 1fr ); }

.pcards-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 10px;
	/* Fallback so cards still read as "blocks" when no colour is chosen. */
	background: rgba( 0, 0, 0, 0.04 );
}

/* The square that holds the featured image. overflow:hidden guarantees the
   image can never spill past the square, whatever its shape. */
.pcards-media {
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var( --pcards-img-bg, transparent );
}

/* Contain: scale by the longest side so the whole image fits inside the
   square, then centre it. Works for portrait and landscape alike. */
.pcards-grid.is-fit-contain .pcards-media img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	display: block;
}

/* Cover: fill the square edge to edge, cropping the overflow. */
.pcards-grid.is-fit-cover .pcards-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pcards-body {
	padding: 1rem 1.15rem 1.15rem;
}

.pcards-title {
	margin: 0 0 0.4rem;
	font-size: 1.1rem;
	line-height: 1.3;
}

.pcards-title a {
	/* Inherit the heading's colour, size and line-height so the size setting
	   applies even when the theme styles heading links separately. */
	color: inherit;
	font-size: inherit;
	line-height: inherit;
	text-decoration: none;
}

.pcards-title a:hover {
	text-decoration: underline;
}

.pcards-excerpt {
	margin: 0 0 0.6rem;
}

.pcards-meta {
	margin: 0;
	font-size: 0.8rem;
	opacity: 0.7;
}

.pcards-meta .pcards-sep {
	margin: 0 0.4rem;
}

/* Responsive cascade: step columns down as the screen narrows.
   Rules are ordered widest-first so narrower widths win. */
@media ( max-width: 1024px ) {
	.pcards-grid.is-cols-4,
	.pcards-grid.is-cols-5 { grid-template-columns: repeat( 3, 1fr ); }
}

@media ( max-width: 782px ) {
	.pcards-grid.is-cols-3,
	.pcards-grid.is-cols-4,
	.pcards-grid.is-cols-5 { grid-template-columns: repeat( 2, 1fr ); }
}

@media ( max-width: 560px ) {
	.pcards-grid.is-cols-2,
	.pcards-grid.is-cols-3,
	.pcards-grid.is-cols-4,
	.pcards-grid.is-cols-5 { grid-template-columns: 1fr; }
}
