/*
 * Driver Results — centred heading over a list of race results, with the
 * latest post from a News category beside it (wide screens) or below it.
 * Every piece of text in the results list is 16px.
 */

.driver-results,
.driver-results *,
.driver-results *::before,
.driver-results *::after {
	box-sizing: border-box;
}

.driver-results {
	/* Content caps at 1800px; the page gutters sit outside it. */
	--driver-results-container: calc( 1800px + 2 * var(--page-gutter) );
	--driver-results-type-width: 180px;
	--driver-results-row-gap: 4px;
	--driver-results-row-height: 76px;
	--driver-results-border: #d4d4d8;
	--driver-results-arrow: 32px;

	width: 100%;
	max-width: var(--driver-results-container) !important;
	margin: 0 auto;
	padding-inline: var(--page-gutter);
	display: grid;
	grid-template-columns: minmax( 0, 1fr );
	grid-template-areas:
		"heading"
		"list"
		"more"
		"news";
}

.driver-results__heading {
	grid-area: heading;
	max-width: 720px;
	margin: 0 auto 40px;
	color: var(--gray-8);
	font-size: clamp( 28px, calc( 1.6vw + 16px ), 48px );
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
}

/* Results list */

.driver-results__list {
	grid-area: list;
	display: grid;
	align-content: start;
	gap: var(--driver-results-row-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.driver-results__more {
	grid-area: more;
}

.driver-results__list--older {
	margin-top: var(--driver-results-row-gap);
}

.driver-results__list--older[hidden] {
	display: none;
}

.driver-results__row {
	display: grid;
	grid-template-columns: var(--driver-results-type-width) minmax( 0, 1fr );
	min-height: var(--driver-results-row-height);
	margin: 0;
	font-family: var(--font-forma-djr-micro);
	font-size: 16px;
	line-height: 1.4;
}

.driver-results__type {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background-color: var(--gray-6);
	color: var(--white);
	font-weight: 700;
}

/* Colour preset, set on the block wrapper (render.php / the editor). */
.driver-results__row--winner .driver-results__type {
	background-color: var(--driver-results-winner-bg, var(--red-1));
	color: var(--driver-results-winner-text, var(--white));
}

.driver-results__type-icon {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.driver-results__type-icon svg {
	display: block;
	max-width: 100%;
	max-height: 100%;
}

.driver-results__details {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	padding: 12px 18px;
	background-color: var(--gray-2);
}

.driver-results__meta,
.driver-results__description {
	margin: 0;
	font-size: 16px;
}

.driver-results__meta {
	color: var(--gray-8);
	font-weight: 700;
}

.driver-results__divider {
	margin: 0 8px;
	color: var(--driver-results-winner-bg, var(--red-1));
	font-weight: 400;
}

.driver-results__description {
	color: var(--gray-7);
	font-weight: 400;
}

/* Show / hide toggle */

.driver-results__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	margin: 0;
	padding: 20px 0 16px;
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--driver-results-winner-bg, var(--red-1));
	border-radius: 0;
	color: var(--gray-8);
	cursor: pointer;
	font-family: var(--font-forma-djr-micro);
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 2px;
	line-height: 1.2;
	text-align: left;
	text-transform: uppercase;
}

.driver-results__toggle-icon {
	display: flex;
	flex-shrink: 0;
	transition: transform 0.2s ease-in-out;
}

.driver-results__toggle[aria-expanded="true"] .driver-results__toggle-icon {
	transform: rotate( 180deg );
}

/* Latest news */

.driver-results__news {
	grid-area: news;
	display: grid;
	grid-template-columns: minmax( 0, 2fr ) minmax( 0, 1fr );
	align-items: start;
	column-gap: 32px;
	row-gap: 24px;
	margin-top: 72px;
}

.driver-results__card {
	position: relative;
	display: grid;
	grid-template-columns: minmax( 0, 43% ) 1fr;
	border: 1px solid var(--driver-results-border);
	color: inherit;
	text-decoration: none;
}

.driver-results__card--no-image {
	grid-template-columns: 1fr;
}

.driver-results__card-image {
	position: relative;
	overflow: hidden;
	background-color: var(--gray-2);
}

/* The ratio sets the card's minimum height; a long title makes the card taller
   and the photo stretches to fill it. On the box, it would widen it instead. */
.driver-results__card-image img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1.66;
	object-fit: cover;
}

.driver-results__card-content {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 1.5rem calc( var(--driver-results-arrow) + 1rem ) 1.5rem 2rem;
}

.driver-results__card-title {
	margin: 0 0 1rem;
	color: var(--gray-8);
	font-family: var(--font-forma-djr-micro);
	font-size: 20px;
	font-weight: 700;
	line-height: 120%;
}

.driver-results__card-date {
	margin: 0;
	color: var(--gray-8);
	font-family: var(--font-forma-djr-micro);
	font-size: 18px;
	font-weight: 500;
	line-height: 100%;
}

.driver-results__card-arrow {
	position: absolute;
	right: -1px;
	bottom: -1px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--driver-results-arrow);
	height: var(--driver-results-arrow);
	background-color: var(--white);
	border: 1px solid var(--driver-results-border);
	color: var(--gray-8);
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/*
 * Whole-card hover, matching Latest News: the photo's zoomed copy cross-fades
 * in (the scale never animates, only the blend), and the corner arrow goes red.
 */
.driver-results__card-image .driver-results__card-image-zoom {
	position: absolute;
	inset: 0;
	opacity: 0;
	transform: scale( 1.12 );
	transition: opacity .2s ease;
}

.driver-results__card:is( :hover, :focus-visible ) .driver-results__card-image-zoom {
	opacity: 1;
}

.driver-results__card:is( :hover, :focus-visible ) .driver-results__card-arrow {
	background-color: var(--red-1);
	border-color: var(--red-1);
	color: var(--white);
}

@media ( prefers-reduced-motion: reduce ) {
	.driver-results__card-image-zoom,
	.driver-results__card-arrow { transition: none; }
}

/* WIDE — news moves beside the results: the card aligns with the first row,
   the button with the last of the latest 5. */
@media ( min-width: 1441px ) {
	.driver-results--has-news {
		grid-template-columns: minmax( 0, 3fr ) minmax( 0, 2fr );
		grid-template-areas:
			"heading heading"
			"list    news"
			"more    .";
		column-gap: 56px;
	}

	.driver-results--has-news .driver-results__news {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		gap: 24px;
		margin-top: 0;
	}

	.driver-results--has-news .driver-results__news .kalitta-button {
		align-self: flex-end;
	}
}

/* TABLET — card and button stack, and the block supplies its own gutter. */
@media ( max-width: 1024px ) {
	.driver-results {
		padding-inline: 4%;
	}

	.driver-results__news {
		grid-template-columns: minmax( 0, 1fr );
		margin-top: 56px;
	}
}

/* PHONE — the type column narrows and stacks its icon over the label. */
@media ( max-width: 640px ) {
	.driver-results {
		--driver-results-type-width: 88px;
		--driver-results-row-height: 100px;
	}

	.driver-results__heading {
		margin-bottom: 28px;
	}

	.driver-results__type {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
		padding: 16px 12px;
		line-height: 1.25;
	}

	.driver-results__details {
		padding: 12px 16px;
	}

	.driver-results__card {
		grid-template-columns: minmax( 0, 47% ) 1fr;
	}

	.driver-results__card-content {
		padding: 1rem calc( var(--driver-results-arrow) + 0.5rem ) 1rem 1rem;
	}

	.driver-results__card-title {
		font-size: 16px;
	}

	.driver-results__card-date {
		font-size: 14px;
	}
}
