/* post-card-list (archive/author/search/obituaries-archive) + shared post-card
   base. Loaded on is_archive() || is_search(). Slice 4.

   The post-card base classes here are duplicated in blocks/category-section.css
   (see note there) because ghn/category-section renders the same classes on
   the front page, which this file's conditional doesn't cover. */

/* ---------- post-card-list (horizontal: thumbnail left, text right) ---------- */
/* Figma archive/author/search: post-card-list-desktop 800×177, 32px gap */
.post-card-list.wp-block-group {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 0 20px;
	align-items: center;
	padding: 25px 0;
	border-bottom: 1px solid var(--wp--preset--color--border-light);
}

.post-card-list__image {
	display: block;
	overflow: hidden;
	border-radius: 0;
}

.post-card-list__image img {
	display: block;
	width: 240px;
	height: 135px;
	object-fit: cover;
}

.post-card-list__body {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.post-card-list .post-card__excerpt {
	margin-block: 2px 4px;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Mobile: stack vertically */
@media (max-width: 767px) {

	.post-card-list.wp-block-group {
		grid-template-columns: 1fr;
		gap: 0.75rem 0;
	}
}

/* When a post has no featured image, PHP injects a per-category placeholder
   via ghn_fallback_featured_image(). Hide-and-span removed in favour of
   always showing a thumbnail to maintain consistent grid layout. */

/* ---------- category featured first post (category.html archive template) ---------- */
/* First child: full-width vertical layout with "FEATURED" label.
   FU-9: scoped to body:not(.paged) — WP core adds .paged automatically on
   page 2+ of any paginated archive — so this treatment only applies to the
   genuine first post on page 1, not to whatever happens to render first on
   later pages. */
body:not(.paged) .category-post-template > li:first-child .post-card-list.wp-block-group {
	grid-template-columns: 1fr;
	align-items: start;
	border-bottom: none;
	padding-bottom: 0;
	gap: 12px;
}

body:not(.paged) .category-post-template > li:first-child .post-card-list.wp-block-group::before {
	content: "FEATURED";
	font-family: var(--wp--preset--font-family--sans);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1.54px;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

body:not(.paged) .category-post-template > li:first-child .post-card-list__image img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

body:not(.paged) .category-post-template > li:first-child .post-card__title {
	font-size: 28px !important;
	line-height: 1.2;
}

body:not(.paged) .category-post-template > li:first-child .post-card__excerpt {
	font-size: var(--wp--preset--font-size--medium) !important;
	line-height: 1.55;
}

body:not(.paged) .category-post-template > li:first-child .post-card__byline,
body:not(.paged) .category-post-template > li:first-child .post-card__author,
body:not(.paged) .category-post-template > li:first-child .post-card__byline-sep,
body:not(.paged) .category-post-template > li:first-child .post-card__date {
	color: var(--wp--preset--color--primary) !important;
	font-size: var(--wp--preset--font-size--small) !important;
}

/* Remove gap/margin between li items — cards have their own padding/border separators */
.category-post-template,
.wp-block-post-template:has(.post-card-list) {
	gap: 0 !important;
}

.wp-block-post-template:has(.post-card-list) > li {
	margin-block: 0 !important;
}

/* First post: no top padding — aligns with sidebar top (60px container margin handles spacing) */
.wp-block-post-template:has(.post-card-list) > li:first-child .post-card-list.wp-block-group {
	padding-top: 0;
}

/* Hide category badge on category pages — redundant since user is already on that category */
.category-post-template .post-card__category {
	display: none;
}

/* Sponsor box injected by PHP after first post */
.category-sponsor-box-item {
	list-style: none;
}

.category-sponsor-box {
	margin-block: 32px;
}

/* ---------- post-card (shared) ---------- */
.post-card {
	display: flex;
	flex-direction: column;
}

.post-card__image {
	display: block;
	overflow: hidden;
}

.post-card__image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.post-card__body {
	padding-block-start: 0.75rem;
	flex: 1;
}

.post-card__title {
	margin-block: 0;
}

.post-card__title a {
	text-decoration: none;
}

.post-card__excerpt {
	font-size: var(--wp--preset--font-size--regular);
	line-height: 1.45;
	margin-block: 0.5rem 0.75rem;
}

/* Figma: Roboto Regular 14px, primary teal #2a8289 for lead/news briefs */
.post-card__byline {
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--primary);
	margin: 0;
}

.post-card__author a { text-decoration: none; }

.post-card__author::before { content: "By "; }

/* Separator dot: visible size, WCAG contrast compliant (#454545 = 9.7:1 on white) */
.post-card__byline-sep { margin-inline: 0.35rem; color: #454545; font-size: 1.3em; line-height: 1; }

.post-card__category a { text-decoration: none; }

.post-card__category:hover {
	color: var(--wp--preset--color--accent-2);
}

@media (max-width: 768px) {

	.post-card__excerpt { font-size: var(--wp--preset--font-size--medium); }
}
