/*
 * Blog post cards (bookshelf_post_card_markup(): blog, archives, search,
 * featured and related articles) and the Customize → Blog options, which
 * arrive as classes on the Query Loop.
 */
.bookshelf-post-card {
	block-size: 100%;
}

.bookshelf-post-card__body {
	flex: 1 1 auto;
}

.bookshelf-post-card :where(.wp-block-post-title, .wp-block-post-excerpt, .bookshelf-reading-time) {
	margin: 0;
}

.bookshelf-post-card .wp-block-post-title a {
	text-decoration: none;
}

.bookshelf-post-card .wp-block-post-title a:hover,
.bookshelf-post-card .wp-block-post-title a:focus-visible {
	text-decoration: underline;
}

.bookshelf-post-card__category a,
.bookshelf-post-category a {
	color: var(--wp--preset--color--primary);
	font-weight: 600;
	letter-spacing: 0.02em;
	text-decoration: none;
}

.bookshelf-post-card .wp-block-post-excerpt__more-text {
	margin-block-start: var(--wp--preset--spacing--20);
}

.bookshelf-post-card .wp-block-post-excerpt__more-link {
	color: var(--wp--preset--color--primary);
	font-weight: 600;
}

/* Featured article: image and text side by side on computers. */
@media (min-width: 782px) {

	.bookshelf-blog-featured .bookshelf-post-card {
		flex-direction: row;
		align-items: center;
		gap: var(--wp--preset--spacing--50);
	}

	.bookshelf-blog-featured .bookshelf-post-card__image {
		flex: 0 0 55%;
	}
}

.bookshelf-blog-featured {
	margin-block-start: var(--wp--preset--spacing--50);
}

/* Parts switched off. */
.bookshelf-posts--no-category .bookshelf-post-card__category,
.bookshelf-posts--no-excerpt .wp-block-post-excerpt__excerpt,
.bookshelf-posts--no-more .wp-block-post-excerpt__more-text,
.bookshelf-posts--no-author .bookshelf-post-card__author,
.bookshelf-posts--no-date .bookshelf-post-card__date,
.bookshelf-posts--no-reading .bookshelf-reading-time,
.bookshelf-posts--no-numbers .wp-block-query-pagination-numbers {
	display: none;
}

/* Columns (computers; tablets get at most 3, phones 1). */
@media (min-width: 782px) {

	.bookshelf-posts--columns-2 .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bookshelf-posts--columns-3 .wp-block-post-template.is-layout-grid,
	.bookshelf-posts--columns-4 .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {

	.bookshelf-posts--columns-4 .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 781px) {

	.bookshelf-posts:is(.bookshelf-posts--columns-2, .bookshelf-posts--columns-3, .bookshelf-posts--columns-4) .wp-block-post-template.is-layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Image shape: the block stores its ratio inline on the image. */
.bookshelf-posts--ratio-3-2 .bookshelf-post-card__image img {
	aspect-ratio: 3 / 2 !important;
}

.bookshelf-posts--ratio-16-9 .bookshelf-post-card__image img {
	aspect-ratio: 16 / 9 !important;
}

.bookshelf-posts--ratio-4-3 .bookshelf-post-card__image img {
	aspect-ratio: 4 / 3 !important;
}

.bookshelf-posts--ratio-1-1 .bookshelf-post-card__image img {
	aspect-ratio: 1 !important;
}

.bookshelf-post-card__image img {
	object-fit: cover;
}

/* Card styles. */
.bookshelf-posts--card-border .bookshelf-post-card,
.bookshelf-posts--card-filled .bookshelf-post-card {
	padding: var(--wp--preset--spacing--30);
	border-radius: var(--wp--custom--radius--medium, 16px);
}

.bookshelf-posts--card-border .bookshelf-post-card {
	border: 1px solid var(--wp--preset--color--border);
}

.bookshelf-posts--card-filled .bookshelf-post-card {
	background: var(--wp--preset--color--base-2);
}

/* Centred card text. */
.bookshelf-posts--align-center .bookshelf-post-card {
	align-items: center;
	text-align: center;
}

.bookshelf-posts--align-center .bookshelf-post-card__body {
	align-items: center;
}

.bookshelf-posts--align-center .bookshelf-post-card__meta {
	justify-content: center;
}
