/*
 * Post cards (H-10 latest news, and the listing templates; Phase 9). The
 * `latest-news` pattern (core Query Loop) and parts/post-card.php share these
 * classes. Ported from the redesign PoC (css/site.css @ ed0ab9f7, "News",
 * ".post", ".chip", ".meta") using theme.json tokens and base.css aliases
 * only.
 *
 * Each card has one link, its title; the link covers the whole card, and the
 * card shows the focus ring when the link has focus. Hover outlines the card
 * (G-12); the lift runs only when motion is allowed. Breakpoints: the PoC's
 * 960px and 640px become md (900px) and sm (760px), docs/05 §3.1. Literal
 * values kept from the PoC: 1px borders.
 */

/* As the PoC's `.split` head: two columns, the link at the end; one column
   below md. */
.sc-latest-news-head {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--custom--gap--split);
	align-items: end;
	margin-bottom: var(--wp--custom--sections--split-head-offset);
}

.sc-latest-news-head > .is-style-arrow-link {
	justify-self: end;
}

.sc-latest-news-head > * {
	margin: 0;
}

.sc-latest-news-head .sc-section-head {
	margin-bottom: 0;
}

.sc-post-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--custom--post-card--grid-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.sc-post-grid > li {
	display: flex;
	margin: 0;
}

.sc-post-card {
	position: relative;
	display: flex;
	flex: 1;
	flex-direction: column;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--line-soft);
	border-radius: var(--r-card);
	background: var(--c-panel);
}

.sc-post-card > * {
	margin: 0;
}

.sc-post-card:hover {
	border-color: var(--c-orange);
}

.sc-post-card:has(a:focus-visible) {
	outline: 2px solid var(--c-orange-hover);
	outline-offset: 3px;
}

.sc-post-card-media {
	aspect-ratio: 16 / 10;
	margin: 0;
	overflow: hidden;
	background: var(--c-black);
}

.sc-post-card-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sc-post-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--wp--custom--post-card--body-gap);
	padding: var(--wp--custom--post-card--body-padding);
}

.sc-post-card-body > * {
	margin: 0;
}

.sc-post-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--custom--post-card--meta-gap);
	margin: 0;
	font-size: var(--wp--custom--font-size--label);
	color: var(--c-faint);
}

.sc-post-meta > * {
	margin: 0;
}

.sc-post-meta .wp-block-post-terms {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--custom--post-card--meta-gap);
}

.sc-chip {
	display: inline-flex;
	align-items: center;
	padding: var(--wp--custom--post-card--chip-padding);
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	font-family: var(--f-display);
	font-size: var(--wp--preset--font-size--micro);
	font-weight: 600;
	letter-spacing: var(--wp--custom--letter-spacing--micro);
	text-transform: uppercase;
	color: var(--c-orange);
}

.sc-post-card-title {
	font-size: var(--wp--custom--font-size--post-card-title);
	line-height: 1.35;
}

.sc-post-card-title a {
	color: var(--c-text);
	text-decoration: none;
}

/* The title link covers the card; the card shows its focus ring. */
.sc-post-card-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.sc-post-card-title a:focus-visible {
	outline: none;
}

@media (prefers-reduced-motion: no-preference) {

	.sc-post-card {
		transition: border-color var(--motion-fast), transform var(--motion-fast);
	}

	.sc-post-card:hover {
		transform: translateY(var(--wp--custom--post-card--lift));
	}
}

/* md (PoC: 960px; the head's split: 900px) */
@media (max-width: 900px) {

	.sc-latest-news-head {
		grid-template-columns: 1fr;
	}

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

/* sm (PoC: 640px) */
@media (max-width: 760px) {

	.sc-post-grid {
		grid-template-columns: 1fr;
	}
}
