/*
 * Blog overview, archives, post head and post cards.
 * Colours come from the palette roles (secondary, surface, outline, …), so a
 * child theme re-skins the blog through its theme.json.
 */

/* Hero (blog overview, archives, post head) */
.best-hero { position: relative; overflow: clip; }

.best-hero__lead { margin-block-start: var(--wp--preset--spacing--40); opacity: .88; }

.best-hero__lead:empty,
.best-hero .wp-block-term-description:empty { display: none; }

.best-hero .wp-block-term-description p { margin: 0; }

.best-post-hero__category { margin: 0; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.best-post-hero__category a { color: inherit; text-decoration: none; }

.best-post-hero__category a + a::before { content: "·"; margin: 0 .4rem; }

.best-post-hero__meta > * { margin: 0; }

.best-post-hero__meta .wp-block-post-author-name a { color: inherit; text-decoration: none; }

.best-post-hero__meta .wp-block-post-date,
.best-post-hero__meta .wp-block-post-time-to-read { opacity: .85; }

.best-post-hero__meta .wp-block-post-time-to-read::before { content: "·"; margin-inline-end: var(--wp--preset--spacing--30); }

.best-post-hero__image { margin: 0; }

.best-post-hero__image img { display: block; width: 100%; height: 100%; object-fit: cover; }

.single-post .best-post-hero .wp-block-post-title { line-height: 1.15; }

/* Category filter */
.best-blog-filter {
	list-style: none;
	margin: 0 0 var(--wp--preset--spacing--60);
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
}

.best-blog-filter li { margin: 0; padding: 0; }

.best-blog-filter a {
	display: block;
	padding: .3rem .85rem;
	border: 1px solid var(--wp--preset--color--outline);
	border-radius: var(--wp--custom--radius--pill);
	color: var(--wp--preset--color--on-surface);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	text-decoration: none;
	transition: background-color var(--wp--custom--transition--base), color var(--wp--custom--transition--base);
}

.best-blog-filter a:hover { background: var(--wp--preset--color--surface-variant); }

.best-blog-filter a:focus-visible { outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary); outline-offset: var(--wp--custom--focus--offset); }

.best-blog-filter .is-current a {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
}

/* Post card: equal height, whole card clickable */
.best-post-card {
	position: relative;
	height: 100%;
	display: flex;
	flex-direction: column;
	overflow: clip;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--on-surface-variant);
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--wp--custom--shadow--raised);
	transition: transform var(--wp--custom--transition--base), box-shadow var(--wp--custom--transition--base);
}

.best-post-card:hover,
.best-post-card:focus-within { transform: translateY(-2px); box-shadow: var(--wp--custom--shadow--modal); }

.best-post-card__image { margin: 0; overflow: hidden; background: var(--wp--preset--color--surface-variant); }

.best-post-card__image img { display: block; width: 100%; transition: transform var(--wp--custom--transition--slow); }

.best-post-card:hover .best-post-card__image img { transform: scale(1.03); }

.best-post-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: .6rem;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50) var(--wp--preset--spacing--50);
}

.best-post-card__body > * { margin: 0; }

.best-post-card__category { position: relative; z-index: 2; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.best-post-card__category a { color: var(--wp--preset--color--primary); text-decoration: none; }

.best-post-card .wp-block-post-title { line-height: 1.25; }

.best-post-card .wp-block-post-title a { color: var(--wp--preset--color--on-surface); text-decoration: none; }

.best-post-card .wp-block-post-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }

.best-post-card .wp-block-post-title a:focus-visible { outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary); outline-offset: calc(var(--wp--custom--focus--width) * -1); border-radius: var(--wp--custom--radius--lg); }

.best-post-card .wp-block-post-excerpt__excerpt { margin: 0; }

.best-post-card__meta { margin-top: auto !important; padding-top: .75rem; }

.best-post-card__meta > * { margin: 0; }

/* Related posts */
.best-related .wp-block-heading { margin-bottom: var(--wp--preset--spacing--50); }

/* Author box and post navigation: no double rule */
.wp-block-template-part + .wp-block-template-part > .wp-block-separator:first-child { display: none; }

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

	.best-post-card,
	.best-post-card__image img,
	.best-blog-filter a { transition: none; }

	.best-post-card:hover,
	.best-post-card:focus-within,
	.best-post-card:hover .best-post-card__image img { transform: none; }
}
