/*
 * blog-preview.css — S9, the Ajankohtaista rail.
 *
 * Cards carry photo, date, title, excerpt and a Lue lisää affordance. The
 * whole card is one link target, so the hover state belongs to the card.
 */

.blog-preview__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--s-6);
	margin-bottom: var(--s-12);
}

.blog-preview__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--fs-h2);
	font-weight: 500;
	line-height: var(--lh-heading);
	text-wrap: balance;
}

.post-card {
	height: 100%;
}

.post-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: var(--ink);
	text-decoration: none;
}

.post-card__media {
	overflow: hidden;
	border-radius: var(--radius);
	margin-bottom: var(--s-4);
}

.post-card__media img,
.post-card__placeholder {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	transition: transform 0.9s var(--ease);
}

/* Stand-in until a post has its own image: birch-tinted, never a grey box. */
.post-card__placeholder {
	background:
		radial-gradient(120% 90% at 20% 0%, rgba(115, 162, 32, 0.18), transparent 60%),
		linear-gradient(160deg, var(--paper), var(--card));
}

.post-card__link:hover .post-card__media img {
	transform: scale(1.04);
}

/*
 * Date, and the category when the post has a real one. A flex row rather than
 * two loose inline elements, so a long category name wraps under the date
 * instead of pushing the card wider.
 *
 * margin: 0 because this is a <p> and would otherwise inherit the prose
 * margin — the gap under it belongs to .post-card__title, which already owns it.
 */
.post-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--s-2);
	margin: 0;
}

.post-card__date {
	font-size: var(--fs-small);
	color: var(--text-muted);
}

/*
 * Deliberately NOT a link: the whole card is one anchor, and a link inside a
 * link is invalid and unreachable by keyboard. The clickable version of this
 * lives in the category row above the grid.
 *
 * Renders only when the post is in a real category — see koivu_post_category().
 */
.post-card__category {
	font-size: var(--fs-eyebrow);
	font-weight: 700;
	letter-spacing: var(--tracking-eyebrow);
	text-transform: uppercase;
	color: var(--koivu);
}

.post-card__category::before {
	content: "";
	display: inline-block;
	width: 3px;
	height: 3px;
	margin-right: calc(var(--s-2) - 1px);
	border-radius: 50%;
	background: var(--muted);
	vertical-align: middle;
}

.post-card__title {
	margin: var(--s-2) 0 var(--s-3);
	font-family: var(--font-display);
	font-size: 1.375rem;
	font-weight: 500;
	line-height: var(--lh-heading);
	text-wrap: balance;
}

.post-card__link:hover .post-card__title {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.post-card__excerpt {
	margin: 0 0 var(--s-4);
	color: var(--text-muted);
	font-size: var(--fs-body);
}

/* Pinned to the bottom so every card's link line sits on the same rule. */
.post-card__more {
	display: inline-flex;
	align-items: center;
	gap: var(--s-3);
	margin-top: auto;
	font-weight: 600;
	color: var(--koivu);
}

.post-card__arrow {
	transition: transform var(--dur-fast) var(--ease);
}

.post-card__link:hover .post-card__arrow {
	transform: translateX(4px);
}

.blog-preview__all {
	margin: var(--s-12) 0 0;
	max-width: none;
}

/*
 * Category row above a post grid (brief 05 §3). Hidden by absence, not by CSS:
 * template-parts/category-nav.php returns early while every post is still in
 * WordPress's default category, so this styles nothing today.
 */
.category-nav {
	margin-bottom: var(--s-6);
}

.category-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-2) var(--s-3);
	margin: 0;
	padding: 0;
	list-style: none;
	max-width: none; /* opt out of the global 65ch prose measure — this is layout, not prose */
}

.category-nav__link {
	display: inline-block;
	padding: var(--s-2) var(--s-4);
	border: 1px solid var(--line);
	border-radius: var(--radius-pill);
	font-size: var(--fs-small);
	color: var(--text);
	text-decoration: none;
	transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.category-nav__link:hover {
	border-color: var(--koivu);
}

.category-nav__link.is-current {
	background: var(--koivu);
	border-color: var(--koivu);
	color: #fff;
}
