/**
 * Blog post card — shared component.
 *
 * One card used by the blog index (home.php), category/tag archives
 * (archive.php), author archive (author.php), search results
 * (search.php), and the "related posts" block on single.php. Mirrors
 * the visual language of .pkgc-electro-card (product-card.css) so the
 * blog feels like part of the same site, without sharing markup —
 * posts and products are structurally different (no price/add-to-cart,
 * excerpt instead of price).
 *
 * @package PackagingCommerce
 */

/* ── Grid — post index/archive/author/search results ─────────────── */

.pkgc-post-grid {
	display: grid;
	width: 100%;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
}

@media (min-width: 30rem) {
	.pkgc-post-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 75rem) {
	.pkgc-post-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 20px;
	}
}

/* Related-posts block on single.php is narrower (no sidebar), so 2
   columns reads better than 3 even at desktop widths. */
.pkgc-post-grid--related {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
	.pkgc-post-grid--related {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 75rem) {
	.pkgc-post-grid--related {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* ── Card ──────────────────────────────────────────────────────────── */

.pkgc-post-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	background-color: var(--brand-color-surface);
	border: 1px solid var(--brand-color-border);
	border-radius: var(--brand-radius-md);
	overflow: hidden;
	transition: box-shadow var(--brand-transition-fast),
		transform var(--brand-transition-fast);
}

.pkgc-post-card:hover,
.pkgc-post-card:focus-within {
	box-shadow: var(--brand-shadow-md);
	transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
	.pkgc-post-card {
		transition: box-shadow var(--brand-transition-fast);
	}

	.pkgc-post-card:hover,
	.pkgc-post-card:focus-within {
		transform: none;
	}
}

.pkgc-post-card__img-wrap {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background-color: var(--brand-color-surface-alt);
	flex-shrink: 0;
}

.pkgc-post-card__img-link {
	display: block;
	width: 100%;
	height: 100%;
}

.pkgc-post-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform var(--brand-transition-base);
}

.pkgc-post-card:hover .pkgc-post-card__img {
	transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
	.pkgc-post-card__img {
		transition: none;
	}

	.pkgc-post-card:hover .pkgc-post-card__img {
		transform: none;
	}
}

.pkgc-post-card__img-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--brand-color-border);
	background-color: var(--brand-color-surface-alt);
}

.pkgc-post-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--brand-space-2);
	padding: var(--brand-space-4);
	flex: 1;
}

.pkgc-post-card__cat {
	font-size: var(--brand-text-xs);
	color: var(--brand-color-primary);
	text-decoration: none;
	font-weight: var(--brand-weight-medium);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	display: block;
}

.pkgc-post-card__cat:hover {
	text-decoration: underline;
}

.pkgc-post-card__title {
	font-size: var(--brand-text-md);
	font-weight: var(--brand-weight-semibold);
	line-height: var(--brand-leading-snug);
	color: var(--brand-color-ink);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pkgc-post-card__title a {
	color: var(--brand-color-ink);
	text-decoration: none;
}

.pkgc-post-card__title a:hover {
	color: var(--brand-color-primary);
}

.pkgc-post-card__excerpt {
	font-size: var(--brand-text-sm);
	line-height: var(--brand-leading-normal);
	color: var(--brand-color-muted);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pkgc-post-card__meta {
	margin-block-start: auto;
	padding-block-start: var(--brand-space-2);
	border-block-start: 1px solid var(--brand-color-border);
	font-size: var(--brand-text-xs);
	color: var(--brand-color-muted);
	display: flex;
	align-items: center;
	gap: var(--brand-space-2);
}
