/* ghn/category-section — loaded only when the block renders (Slice 2). */

/* Section spacing + top rule. First section has no top rule (Figma: no divider above News). */
.category-section {
	margin-block-end: 0;
	padding-block-start: 24px;
	padding-block-end: 24px;
}

/* Section top rule — Figma: 1px divider above every section except the first */
.category-section + .category-section {
	border-top: 1px solid var(--wp--preset--color--border-light);
}

/* Figma: 6px accent border, 48px tall, 20px gap, Merriweather Bold 34px */
.category-section__heading {
	border-left: 6px solid var(--ghn-category-color, var(--wp--preset--color--primary));
	padding-left: 20px;
	padding-block: 8px;
	margin-block: 0;
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: 1.25;
}

/* Category section grid — default 60:40 ratio for thumb-left (News) briefs. */
.category-section__grid {
	display: grid;
	grid-template-columns: minmax(0, 720fr) minmax(0, 440fr);
	gap: 40px;
	align-items: start;
	max-width: 1200px;
}

/* Thumb-above (stacked) sections: 780:380 ratio (~67:33) with 40px gap = 1200px.
   Slightly wider lead vs default so lead/brief bottom edges align better. */
.category-section--brief-thumb-above .category-section__grid {
	grid-template-columns: minmax(0, 780fr) minmax(0, 380fr);
}

@media (max-width: 768px) {

	.category-section__grid,
	.category-section--brief-thumb-above .category-section__grid {
		grid-template-columns: 1fr;
		gap: var(--wp--preset--spacing--25);
	}
}

/* Briefs column — vertical stack inside the 40% side. */
.category-section__briefs {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--25);
}

.category-section__more { margin-block-start: 0.75rem; margin-block-end: 0; text-align: right; }

/* ---------- lead card ---------- */
/* Figma: Merriweather Bold 34px, line-height 1.25 */
.post-card--lead .post-card__title {
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: 1.25;
}

/* ---------- brief card ---------- */
/* Figma thumb-left: Merriweather Bold 21px; thumb-above: 17px */
.post-card--brief .post-card__title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.35;
}

.category-section--brief-thumb-above .post-card--brief .post-card__title {
	font-size: 17px;
	line-height: normal;
}

/* thumbnail-left — Figma: 140x79 thumbnail (16:9) to the left of title/byline */
.category-section--brief-thumb-left .post-card--brief {
	display: grid;
	grid-template-columns: 140px 1fr;
	gap: 12px;
	align-items: center;
}

.category-section--brief-thumb-left .post-card--brief .post-card__body {
	padding-block-start: 0;
}

/* Brief separator — Figma: 1px solid #e1e1e1 between each brief card */
.category-section__brief-separator {
	border: none;
	border-top: 1px solid var(--wp--preset--color--border-light);
	margin: 0;
}

/* Under 1200px: force thumb-left briefs to thumb-above layout and hide
   extra briefs beyond 2 so the column doesn't overwhelm the lead card. */
@media (max-width: 1199px) {

	.category-section--brief-thumb-left .post-card--brief {
		grid-template-columns: 1fr;
	}

	/* Hide children beyond the 3rd in the briefs column (brief 1 + hr + brief 2 = 3).
	   Previous nth-child/nth-of-type selectors miscounted because articles and hrs
	   interleave, leaving orphan separators visible. This hides child 4+ cleanly. */
	.category-section--brief-thumb-left .category-section__briefs > :nth-child(n+4) {
		display: none;
	}
}

@media (max-width: 768px) {

	.category-section__grid,
	.category-section--brief-thumb-above .category-section__grid {
		grid-template-columns: 1fr;
	}
}

/* Mobile typography for category cards — must come AFTER the base rules above
   to win at equal specificity. */
@media (max-width: 768px) {

	.post-card--lead .post-card__title { font-size: var(--wp--preset--font-size--x-large); }

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

	.category-section__heading { font-size: 28px; }
}

/* ---------- post-card (shared base) ----------
   Duplicated in blocks/post-card.css for archive/author/search templates —
   ghn/category-section renders these same classes on the front page, which
   post-card.css's conditional (is_archive() || is_search()) doesn't cover. */
.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.
   FU-8: this raw <p class="post-card__byline"> is built via string
   concatenation in class-dynamic-blocks.php, not a parsed core/paragraph
   block, so it inherits WP core's global-styles default font-size instead
   of picking up a block-level override. That global rule is
   `:root :where(p) { font-size: var(--wp--preset--font-size--regular) }`
   (18px) — specificity (0,1,0), identical to a bare `.post-card__byline`
   class selector, and global-styles-inline-css loads after this block's
   inline CSS, so it won the tie-break. Scoping with the .category-section
   ancestor bumps specificity to (0,2,0), which reliably wins. */
.category-section .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,
.category-section__more-link:hover {
	color: var(--wp--preset--color--accent-2);
}

/* Figma: Roboto Regular 16px, primary teal, no underline */
.category-section__more-link {
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
}
