/**
 * Blanky Nordic — post lists.
 *
 * .nordic-cards is the Post Template of the home, archive, search and related
 * lists; .nordic-card is the card inside each item (patterns/post-card.php).
 * The Post Template keeps core's default layout: a core grid layout would add
 * an inline column count that only !important could override. Columns are
 * set here instead, which core's grid cannot do at breakpoints anyway.
 *
 * The lead post and list layouts are in block-styles.css.
 *
 * @package Blanky_Nordic
 * @since   3.7
 */

/* --- Grid ----------------------------------------------------------------- */

.nordic-cards {
	display: grid;
	gap: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
	grid-template-columns: minmax(0, 1fr);
	margin: 0;
	padding: 0;
}

@media (width >= 600px) {

	.nordic-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (width >= 1024px) {

	.nordic-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* Items stretch to the row height, and the card fills the item, so author rows line up. */
.nordic-cards > .wp-block-post {
	display: flex;
	margin: 0;
}

/* --- Card ----------------------------------------------------------------- */

.nordic-card {
	border-top: var(--nordic-divider);
	display: flex;
	flex: 1;
	flex-direction: column;
	padding-top: var(--wp--preset--spacing--30);
}

.nordic-card__image {
	aspect-ratio: 4 / 5;
	background: var(--wp--preset--color--surface);
	margin: 0;
	overflow: hidden;
}

.nordic-card__image a {
	display: block;
	height: 100%;
}

.nordic-card__image img {
	height: 100%;
	object-fit: cover;
	transition: opacity var(--nordic-ease);
	width: 100%;
}

@media (hover: hover) {

	.nordic-card__image a:hover img {
		opacity: 0.88;
	}
}

.nordic-card__meta {
	color: var(--wp--preset--color--muted);
	gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
}

.nordic-card__term {
	color: var(--wp--preset--color--foreground);
}

.nordic-card__date {
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.08em;
}

.nordic-card__title {
	font-size: var(--wp--preset--font-size--xxl);
	font-style: italic;
	margin: 0;
}

.nordic-card__title a {
	text-decoration: none;
}

@media (hover: hover) {

	.nordic-card__title a:hover {
		text-decoration: underline;
		text-decoration-color: var(--nordic-line);
	}
}

.nordic-card__excerpt {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--sm);
}

.nordic-card__excerpt .wp-block-post-excerpt__excerpt {
	margin: 0;
}

/* Pushed to the bottom of the card (flex column). */
.nordic-card > .nordic-card__author {
	align-items: center;
	font-size: var(--wp--preset--font-size--sm);
	margin-block-start: auto;
	padding-block-start: var(--wp--preset--spacing--30);
}

.nordic-card__author .wp-block-avatar img {
	border-radius: 50%;
	display: block;
}

.nordic-card__author a {
	text-decoration: none;
}

/* --- Compact (related posts) ------------------------------------------------ */

.nordic-cards--compact .nordic-card__image {
	aspect-ratio: 3 / 2;
}

.nordic-cards--compact .nordic-card__title {
	font-size: var(--wp--preset--font-size--xl);
}

/* --- Pagination and empty state --------------------------------------------- */

.nordic-pagination {
	gap: var(--wp--preset--spacing--20);
	margin-block-start: var(--wp--preset--spacing--70);
}

.nordic-pagination .page-numbers,
.nordic-pagination .wp-block-query-pagination-previous,
.nordic-pagination .wp-block-query-pagination-next {
	align-items: center;
	border: var(--nordic-frame);
	display: inline-flex;
	font-size: var(--wp--preset--font-size--sm);
	justify-content: center;
	margin: 0;
	min-height: 2.75rem;
	min-width: 2.75rem;
	padding-inline: var(--wp--preset--spacing--30);
	text-decoration: none;
}

.nordic-pagination .page-numbers.current {
	background: var(--wp--preset--color--foreground);
	border-color: var(--wp--preset--color--foreground);
	color: var(--wp--preset--color--background);
}

.nordic-pagination .page-numbers.dots {
	border-color: transparent;
}

@media (hover: hover) {

	.nordic-pagination a:hover {
		border-color: var(--wp--preset--color--foreground);
	}
}

.nordic-no-results {
	color: var(--wp--preset--color--muted);
	text-align: center;
}
