/**
 * Component: News list item
 * Usage: .news-list > .news-item (repeated) — template-parts/news-item.php.
 * Horizontal row: image left, title/meta/excerpt right. Single column —
 * used on the News archive (home.php) only, since the Home landing page's
 * preview section was removed.
 */

.news-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-5) var(--space-6);
}

.news-item {
	display: flex;
	gap: var(--space-4);
	padding-bottom: var(--space-5);
	border-bottom: 1px solid var(--color-border);
	/*
	 * .news-item is a grid item (child of .news-list, display: grid)
	 * that's also a flex container — grid items default to min-width:
	 * auto, which resolves to the content's min-content size. Since
	 * .news-item__media is flex: 0 0 25% (flex-shrink: 0, never
	 * shrinks), that set a hard floor wider than the actual grid
	 * track at narrow viewports, overflowing the whole row off the
	 * side of the page instead of the text wrapping inside it.
	 */
	min-width: 0;
}

.news-item__media {
	flex: 0 0 25%;
	display: block;
	aspect-ratio: 3 / 4;
	overflow: hidden;
}

.news-item__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 500ms ease-out;
}

/*
 * .news-item__media is itself the <a> for the plain (non-card) variant
 * (see news-item.php), so it's the hover/focus target directly; the
 * --card variant's whole article is the link instead, handled in the
 * .news-item--card rule below.
 */
.news-item__media:hover img,
.news-item__media:focus-visible img {
	transform: scale(1.01);
}

@media (prefers-reduced-motion: reduce) {
	.news-item__media img {
		transition: none;
	}

	.news-item__media:hover img,
	.news-item__media:focus-visible img {
		transform: none;
	}
}

.news-item__body {
	flex: 1;
	min-width: 0;
}

.news-item__title {
	margin: 0 0 var(--space-2);
	text-transform: uppercase;
}

.news-item__title a {
	color: inherit;
	text-decoration: none;
	transition: color var(--transition-base);
}

.news-item__title a:hover,
.news-item__title a:focus-visible {
	color: var(--color-primary);
}

.news-item__excerpt {
	font-size: var(--font-size-base);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/*
 * Card-bordered variant — same wide image-left layout as .news-item,
 * boxed like .card (border, shadow, hover lift) instead of News's plain
 * bottom-divider list style. Used for the search results Pages section
 * (template-parts/news-item-page.php).
 */
.news-item--card {
	padding-bottom: 0;
	border: 1px solid var(--color-border);
	background: var(--color-paper);
	box-shadow: var(--shadow-resting);
	overflow: hidden;
	transition: box-shadow var(--transition-elevation), transform var(--transition-elevation), border-color var(--transition-elevation);
}

.news-item--card:hover,
.news-item--card:focus-within {
	border-color: transparent;
	box-shadow: var(--shadow-raised);
	transform: translateY(-4px);
}

.news-item--card:hover .news-item__media img,
.news-item--card:focus-within .news-item__media img {
	transform: scale(1.01);
}

/*
 * The whole card is one link (template-parts/news-item-page.php) —
 * unlike the plain .news-item, where only the thumbnail and title
 * text are individually clickable. The border/shadow/hover-lift read
 * as a single clickable unit, so the click target should match.
 */
.news-item--card .news-item__link {
	display: flex;
	gap: var(--space-4);
	color: inherit;
	text-decoration: none;
}

.news-item--card .news-item__body {
	padding: var(--space-4) var(--space-4) var(--space-4) 0;
}

/*
 * No thumbnail sibling to open up space via the flex gap (e.g. the
 * Books page has none) — give the body its own left padding too, or
 * the text sits flush against the card's left border.
 */
.news-item--card .news-item__body:only-child {
	padding-left: var(--space-4);
}

@media (prefers-reduced-motion: reduce) {
	.news-item--card {
		transition: box-shadow var(--transition-elevation), border-color var(--transition-elevation);
	}

	.news-item--card:hover,
	.news-item--card:focus-within {
		transform: none;
	}

	.news-item--card:hover .news-item__media img,
	.news-item--card:focus-within .news-item__media img {
		transform: none;
	}
}
