/*
 * News widget (inc/elementor/news-widget.php). No gold thread in this section.
 * This is Variation 1; Variation 2 is in news-grid.css.
 * Without .is-ready (no JavaScript) the paper is full width and each article has its own photo. With it,
 * assets/js/news.js opens the paper by --kl-open and changes the photograph beside the list. Colours come from tokens.css through data-theme.
 */

.kl-news {
	--kl-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--kl-paper: var(--bg-alt);
	--kl-inset: min(7vw, 104px);
	--kl-open: 1;
	position: relative;
	color: var(--fg);
}
.kl-news--white,
.kl-news--burgundy { --kl-paper: var(--bg); }

/* The paper opens out of the ground above, which news.js reads from that section. Clipped, not resized, so nothing below it moves. */
.kl-news__sheet {
	background: var(--kl-paper);
	padding-block: var(--space-6);
}
.kl-news.is-ready .kl-news__sheet {
	clip-path: inset(0 calc(var(--kl-inset) * (1 - var(--kl-open))));
}

.kl-news__inner {
	max-width: var(--wrap-max);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* Masthead */
.kl-news__masthead {
	display: grid;
	gap: var(--space-4);
	padding-bottom: var(--space-4);
}
.kl-news .kl-news__title {
	margin: 0;
	color: var(--heading);
	font-family: var(--font-serif);
}
.kl-news .kl-news__dateline {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--space-3);
	margin: 0;
	color: var(--eyebrow);
	font-size: var(--type-caption-size);
	line-height: var(--type-caption-line);
	letter-spacing: var(--type-caption-tracking);
	font-style: italic;
}
.kl-news .kl-news__text {
	max-width: 34em;
	margin: var(--space-2) 0 0;
	color: var(--fg);
}

.kl-news .kl-news__label {
	margin: 0;
	color: var(--eyebrow);
	font-size: var(--type-eyebrow-size);
	line-height: var(--type-eyebrow-line);
	font-weight: var(--type-eyebrow-weight);
	letter-spacing: var(--type-eyebrow-tracking);
	text-transform: uppercase;
}

/* Desk: the photograph and the articles */
.kl-news__desk { margin-top: var(--space-6); }
.kl-news__pane { display: none; }
.kl-news__list {
	margin: var(--space-3) 0 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--border-strong);
}
.kl-news__item {
	border-bottom: 1px solid var(--border);
	transition: opacity 0.4s linear;
}
.kl-news .kl-news__link {
	display: block;
	padding-block: var(--space-4);
	color: inherit;
	text-decoration: none;
}
.kl-news .kl-news__link:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}
.kl-news__thumb {
	display: block;
	aspect-ratio: 16 / 9;
	margin-bottom: var(--space-3);
	overflow: hidden;
	background: var(--ink);
}
.kl-news .kl-news__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: var(--radius-none);
	object-fit: cover;
}
/* On small screens the photo wipes in from the left when it comes into view, once */
.kl-news.is-ready .kl-news__item:not(.is-seen) .kl-news__thumb img { clip-path: inset(0 100% 0 0); }
.kl-news.is-live .kl-news__thumb img { transition: clip-path 1.1s var(--kl-ease); }

.kl-news__body { display: block; }
.kl-news .kl-news__kicker {
	display: block;
	margin-bottom: var(--space-2);
	color: var(--eyebrow);
	font-size: 12px;
	transition: transform 0.5s var(--kl-ease);
	line-height: var(--type-eyebrow-line);
	font-weight: var(--type-eyebrow-weight);
	letter-spacing: var(--type-eyebrow-tracking);
	text-transform: uppercase;
}
.kl-news .kl-news__headline {
	display: block;
	color: var(--heading);
	font-size: var(--type-h3-mobile-size);
	line-height: var(--type-h3-line);
	font-weight: 500;
	text-wrap: pretty;
	transition: color 0.3s linear, transform 0.5s var(--kl-ease);
}
.kl-news .kl-news__excerpt {
	display: block;
	margin-top: var(--space-2);
	color: var(--fg-muted);
	font-size: var(--type-body-mobile-size);
	line-height: 1.5;
	transition: color 0.3s linear, transform 0.5s var(--kl-ease);
}
.kl-news .kl-news__read {
	display: block;
	margin-top: var(--space-2);
	color: var(--fg-muted);
	font-size: var(--type-caption-size);
	line-height: var(--type-caption-line);
	font-style: italic;
	transition: transform 0.5s var(--kl-ease);
}

/* Closing: hands on to contact */
.kl-news__closing {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	margin-top: var(--space-6);
}
.kl-news .kl-news__closing-text {
	max-width: 30em;
	margin: 0;
	color: var(--heading);
	font-size: var(--type-lead-size);
	line-height: var(--type-lead-line);
	text-wrap: balance;
}
.kl-news__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
}

/* Tablet: photo beside each article */
@media (min-width: 768px) {
	.kl-news__sheet { padding-block: var(--space-7); }
	.kl-news__masthead {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
		align-items: end;
	}
	.kl-news .kl-news__link {
		display: grid;
		grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
		gap: var(--space-4);
	}
	.kl-news__thumb { margin: 0; }
	.kl-news .kl-news__headline { font-size: var(--type-h3-size); }
	.kl-news__closing {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}

/* Desktop: one photograph, kept in view, for the whole list */
@media (min-width: 1024px) {
	.kl-news__sheet { padding-block: var(--space-8); }
	.kl-news__desk {
		display: grid;
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		column-gap: var(--space-6);
		align-items: start;
		margin-top: var(--space-7);
	}
	.kl-news__pane {
		display: block;
		position: sticky;
		top: 112px;
	}
	.kl-news__stage {
		position: relative;
		aspect-ratio: 16 / 10;
		overflow: hidden;
		background: var(--ink);
	}
	.kl-news__frame {
		position: absolute;
		inset: 0;
		display: block;
		overflow: hidden;
		clip-path: inset(0 100% 0 0);
	}
	.kl-news__frame.is-active { clip-path: inset(0); }
	/* Only once .is-live: the first photograph does not wipe in on load */
	.kl-news.is-live .kl-news__frame { transition: clip-path 0.9s var(--kl-ease); }
	.kl-news__frame.is-under { clip-path: inset(0); z-index: 1; transition: none !important; }
	.kl-news__frame.is-active { z-index: 2; }
	.kl-news .kl-news__frame img {
		display: block;
		width: 100%;
		height: 100%;
		max-width: none;
		border-radius: var(--radius-none);
		object-fit: cover;
		transform: scale(1.05) translate3d(var(--kl-px, 0), var(--kl-py, 0), 0);
		transition: transform 0.8s var(--kl-ease);
	}

	.kl-news__caption {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--space-4);
		min-height: 72px;
		padding-top: var(--space-3);
	}
	.kl-news__people {
		position: relative;
		flex: 1;
		min-height: 56px;
	}
	.kl-news__who {
		position: absolute;
		inset: 0;
		opacity: 0;
		transition: opacity 0.5s linear;
	}
	.kl-news__who.is-active { opacity: 1; }
	.kl-news__person {
		display: flex;
		align-items: center;
		gap: var(--space-3);
	}
	.kl-news .kl-news__person-photo {
		flex: none;
		width: 56px;
		height: 56px;
		border-radius: var(--radius-none);
		object-fit: cover;
		object-position: top;
	}
	.kl-news__person-text { display: block; line-height: 1.25; }
	.kl-news__person-label {
		display: block;
		color: var(--eyebrow);
		font-size: 12px;
		font-weight: var(--type-eyebrow-weight);
		letter-spacing: var(--type-eyebrow-tracking);
		text-transform: uppercase;
	}
	.kl-news .kl-news__person-name {
		display: inline;
		color: var(--heading);
		font-size: var(--type-body-size);
	}
	.kl-news__person-role {
		color: var(--fg-muted);
		font-size: var(--type-caption-size);
		font-style: italic;
	}
	.kl-news__person-role::before { content: " · "; font-style: normal; }
	.kl-news__folio {
		flex: none;
		color: var(--fg-muted);
		font-size: var(--type-caption-size);
		font-style: italic;
		font-variant-numeric: lining-nums tabular-nums;
	}

	/* The photograph beside the list replaces each article's own */
	.kl-news .kl-news__thumb { display: none; }
	/* The padding is room for the step the active article takes to the right */
	.kl-news .kl-news__link {
		display: block;
		padding: var(--space-4) var(--space-3) var(--space-4) 0;
	}
	.kl-news .kl-news__headline { font-size: 23px; line-height: 1.22; }
	.kl-news .kl-news__excerpt { font-size: 16px; }

	/* The article being read comes forward and the rest stay quiet */
	.kl-news.is-ready .kl-news__item:not(.is-active) .kl-news__headline { color: var(--fg); }
	.kl-news.is-ready .kl-news__item.is-active .kl-news__kicker,
	.kl-news.is-ready .kl-news__item.is-active .kl-news__headline,
	.kl-news.is-ready .kl-news__item.is-active .kl-news__excerpt,
	.kl-news.is-ready .kl-news__item.is-active .kl-news__read { transform: translateX(var(--space-3)); }
	.kl-news.is-ready .kl-news__item.is-active .kl-news__excerpt { color: var(--fg); }
	.kl-news__item { position: relative; }
	.kl-news__item::before {
		content: "";
		position: absolute;
		inset: var(--space-4) auto var(--space-4) 0;
		width: 2px;
		background: var(--accent);
		transform: scaleY(0);
		transform-origin: top;
		transition: transform 0.5s var(--kl-ease);
	}
	.kl-news.is-ready .kl-news__item.is-active::before { transform: scaleY(1); }
	.kl-news__closing { margin-top: var(--space-7); }
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
	.kl-news__list:has(.kl-news__link:hover) .kl-news__item:not(:hover) { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
	.kl-news *,
	.kl-news *::before,
	.kl-news *::after {
		transition: none !important;
	}
}
