.latest-news,
.latest-news *,
.latest-news *::before,
.latest-news *::after {
	box-sizing: border-box;
}

.latest-news {
	--latest-news-accent: #da1f25;
	--latest-news-border: #d4d4d8;
	--latest-news-container: 1800px;
	--latest-news-arrow: 56px;
	/* Same inset as the next event block, widening to centre the 1800px
	   container on very wide screens. vw, so the ribbon can reuse it. */
	--latest-news-gutter: max( clamp( 16px, 3.5vw, 72px ), calc( ( 100vw - var(--latest-news-container) ) / 2 ) );

	width: 100%;
	/* !important: core's constrained layout caps block widths otherwise. */
	max-width: none !important;
	margin: 0 auto;
	padding-inline: var(--latest-news-gutter);
	display: grid;
	/* minmax(0, …): a bare 1fr grows to the news grid's min-content and shoves
	   the button off the right edge on tablet. */
	grid-template-columns: minmax( 0, 1fr ) auto;
	grid-template-areas:
		"ribbon button"
		"grid   grid";
	align-items: center;
	row-gap: 1.5rem;
	column-gap: 1rem;
}

/* Space from the block above (--section-gap). Doubled class to outrank core's blockGap. */
* + .latest-news.latest-news {
	margin-block-start: var(--section-gap);
}

/* Used when embedded as the "More Team Kalitta News" related-posts
   section on a single News article (see blocks/news-article/render.php)
   — a black ribbon instead of this block's default red one. */
.latest-news--related {
	--latest-news-accent: #18181b;
}

/*
 * Section Ribbon — shape/typography defaults live in
 * src/components/section-ribbon.scss (compiled globally); this block
 * only overrides the custom properties it needs to differ.
 */
.latest-news .section-ribbon {
	--section-ribbon-accent: var(--latest-news-accent);
	--section-ribbon-justify: flex-end;
	--section-ribbon-padding-left: 0px;
	--section-ribbon-padding-right: 56px;
	grid-area: ribbon;
	justify-self: start;
	margin-left: calc( -1 * var(--latest-news-gutter) ); /* Bleeds to the page edge. */
}

/* Matches the 44px buttons at laptop widths. */
@media ( max-width: 1440px ) {
	.latest-news .section-ribbon {
		--section-ribbon-height: 44px;
	}
}

/* The component declares these on the text itself, so they're set here.
   20px on desktop, 18px from laptop down. */
.latest-news .section-ribbon-text {
	--section-ribbon-font-family: guildhall-wide, sans-serif;
	--section-ribbon-font-weight: 500;
	--section-ribbon-font-size: 20px;
}

/* The shared render_button() output; it carries no block class of its own. */
.latest-news > .kalitta-button {
	grid-area: button;
	justify-self: end;
}

.latest-news__grid {
	grid-area: grid;
	display: grid;
	gap: 18px;
}

.latest-news__featured,
.latest-news__card {
	position: relative;
	border: 1px solid var(--latest-news-border);
}

.latest-news__featured {
	display: grid;
	grid-template-columns: minmax( 0, 40% ) minmax( 0, 1fr );
}

/* The text sets each row's height; the photo just fills its side. */
.latest-news__featured-image,
.latest-news__card-image {
	position: relative;
	overflow: hidden;
}

.latest-news__featured-image img,
.latest-news__card-image img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.latest-news__featured-content {
	padding: 2.5rem 2.5rem calc( var(--latest-news-arrow) + 1.5rem );
	border-left: 1px solid var(--latest-news-border);
}

.latest-news__featured--no-image {
	grid-template-columns: 1fr;
}

.latest-news__featured--no-image .latest-news__featured-content {
	border-left: 0;
}

.latest-news__secondary {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 18px;
}

.latest-news__card {
	display: grid;
	grid-template-columns: minmax( 0, 45% ) minmax( 0, 1fr );
}

.latest-news__card--no-image {
	grid-template-columns: 1fr;
}

.latest-news__card-content {
	/* Centred top to bottom. Equal padding both ends, so clearing the corner
	   arrow doesn't push the text off-centre. */
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: calc( var(--latest-news-arrow) + 1rem ) 1.5rem;
}

.latest-news__title {
	margin: 0 0 1rem;
	font-weight: 800;
	line-height: 1.2;
}

.latest-news__card .latest-news__title {
	color: var(--gray-8);
	font-family: var(--font-forma-djr-micro);
	font-size: 20px;
	font-style: normal;
	font-weight: 700;
	line-height: 120%; /* 24px */
}

.latest-news__date {
	margin: 0 0 1rem;
	color: var(--gray-8);
	font-family: var(--font-forma-djr-micro);
	font-size: 18px;
	font-style: normal;
	font-weight: 500;
	line-height: 100%; /* 18px */
}

.latest-news__excerpt {
	margin: 0;
	color: var(--gray-6);
	font-family: var(--font-forma-djr-micro);
	font-size: 16px;
	font-style: normal;
	font-weight: 400;
	line-height: 120%; /* 19.2px */
}

/* The title link stretches over its whole card, so the card is one click
   target; the arrow is painted above it and goes to the same place. */
.latest-news__link {
	color: inherit;
	text-decoration: none;
}

.latest-news__link::after {
	content: '';
	position: absolute;
	inset: 0;
}

.latest-news__read-more {
	font-style: italic;
	color: var(--gray-6);
}

/* The featured story's type, per the desktop comp. */
.latest-news__featured .latest-news__title {
	color: var(--gray-8);
	font-family: var(--font-forma-djr-micro);
	font-size: 40px;
	font-weight: 700;
	line-height: 120%;
}

.latest-news__featured .latest-news__date {
	font-size: 24px;
}

.latest-news__featured .latest-news__excerpt {
	font-size: 20px;
}

.latest-news__featured .latest-news__title,
.latest-news__featured .latest-news__date {
	margin-bottom: 2rem;
}

.latest-news__arrow {
	position: absolute;
	right: -1px;
	bottom: -1px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--latest-news-arrow);
	height: var(--latest-news-arrow);
	background-color: #fff;
	border: 1px solid var(--latest-news-border);
	color: #18181b;
	text-decoration: none;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/*
 * Whole-card hover, matching the site navigation: the photo's zoomed copy
 * cross-fades in (the scale never animates, only the blend), and the corner
 * arrow goes red.
 */
.latest-news__image-zoom {
	opacity: 0;
	transform: scale( 1.12 );
	transition: opacity .2s ease;
}

.latest-news__featured:is( :hover, :focus-within ) .latest-news__image-zoom,
.latest-news__card:is( :hover, :focus-within ) .latest-news__image-zoom {
	opacity: 1;
}

.latest-news__featured:is( :hover, :focus-within ) .latest-news__arrow,
.latest-news__card:is( :hover, :focus-within ) .latest-news__arrow {
	background-color: var(--red-1);
	border-color: var(--red-1);
	color: var(--white);
}

@media ( prefers-reduced-motion: reduce ) {
	.latest-news__image-zoom,
	.latest-news__arrow { transition: none; }
}

/* LAPTOP and down: smaller ribbon type and arrows; the featured photo takes a
   bigger share. */
@media ( max-width: 1400px ) {
	.latest-news { --latest-news-arrow: 40px; }

	.latest-news .section-ribbon-text { --section-ribbon-font-size: 18px; }

	.latest-news__featured .latest-news__title { font-size: 24px; }
	.latest-news__featured .latest-news__date { font-size: 20px; }
	.latest-news__featured .latest-news__excerpt { font-size: 18px; }

	.latest-news__card .latest-news__title { font-size: 18px; }
	.latest-news__card .latest-news__date,
	.latest-news__card .latest-news__excerpt { font-size: 15px; }

	.latest-news__featured {
		grid-template-columns: minmax( 0, 45% ) minmax( 0, 1fr );
	}
}

/* TABLET and down: tighter padding and arrows; the smaller stories drop their
   excerpt. */
@media ( max-width: 1024px ) {
	.latest-news { --latest-news-arrow: 32px; }

	.latest-news__featured .latest-news__title { font-size: 20px; }
	.latest-news__featured .latest-news__date,
	.latest-news__featured .latest-news__excerpt { font-size: 16px; }

	.latest-news__featured .latest-news__title,
	.latest-news__featured .latest-news__date {
		margin-bottom: 1rem;
	}

	.latest-news__card .latest-news__title { font-size: 16px; }
	.latest-news__card .latest-news__date { font-size: 14px; }

	.latest-news__card .latest-news__excerpt {
		display: none;
	}

	/* The date ends the card now; its gap to the excerpt would sit it high. */
	.latest-news__card .latest-news__date {
		margin-bottom: 0;
	}

	.latest-news__featured-content {
		padding: 1.5rem 1.5rem calc( var(--latest-news-arrow) + 1rem );
	}

	.latest-news__card-content {
		padding: calc( var(--latest-news-arrow) + .5rem ) 1rem;
	}
}

/* MOBILE: featured stacks; the smaller stories run one per row, photo left. */
@media ( max-width: 767px ) {
	.latest-news {
		grid-template-columns: minmax( 0, 1fr ); /* Or the 860px ribbon widens it. */
		grid-template-areas:
			"ribbon"
			"grid"
			"button";
	}

	/* Centred at its own width, clear of the edges, per the mobile comp. */
	.latest-news > .kalitta-button {
		justify-self: center;
	}

	.latest-news__featured {
		grid-template-columns: 1fr;
	}

	/* Stacked, the photo has no row to fill, so it gets its own shape. */
	.latest-news__featured-image {
		aspect-ratio: 16 / 10;
	}

	.latest-news__featured-content {
		border-left: 0;
		border-top: 1px solid var(--latest-news-border);
	}

	.latest-news__secondary {
		grid-template-columns: 1fr;
	}
}
