/**
 * [featured_posts]
 * Separate from the listing styles (.elp). Every selector here starts with .elfp.
 * Fonts are set below; the font files must be loaded by the site (Adobe Fonts kit / theme).
 *
 * Desktop (3 posts): large lead card on the left spanning two rows, two cards stacked
 * on the right. Each card: image on top, dark panel below with topic label and title.
 * Hover / keyboard focus reveals the excerpt and button inside the panel.
 */

.elfp {
	--elfp-gap: 24px;
	--elfp-panel: #29303a;
	--elfp-text: #fff;
	--elfp-label: #c9ced6;
	--elfp-body: #e2e5ea;
	--elfp-placeholder: #cfd3da;
	--elfp-button-bg: #fff;
	--elfp-button-text: #000;
	--elfp-speed: 0.35s;

	/* Typography */
	--elfp-font-heading: "Big Caslon FB", serif, sans-serif;
	--elfp-font-text: adobe-caslon-pro, "Big Caslon FB", serif, sans-serif;
	--elfp-font-button: "Proxima Nova", proxima-nova, sans-serif;

	width: 100%;
	max-width: 100%;
	font-family: var(--elfp-font-text);
}

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

.elfp .elfp__heading {
	margin: 0 0 28px;
	font-family: var(--elfp-font-heading);
	font-size: clamp(1.875rem, 1.4rem + 1.4vw, 2.375rem);
	font-weight: 400;
	line-height: 1.15;
}

/* Grid (phone first: one column) ---------------------------------------- */

.elfp .elfp__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--elfp-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.elfp .elfp__item {
	display: flex;
	min-width: 0;
	margin: 0;
	padding: 0;
}

/* Card ------------------------------------------------------------------ */

.elfp .elfp-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;
	background: var(--elfp-panel);
	color: var(--elfp-text);
	box-shadow: 0 1px 2px rgba(20, 24, 31, 0.05), 0 6px 22px rgba(20, 24, 31, 0.08);
}

.elfp .elfp-card__media {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--elfp-placeholder);
}

.elfp .elfp-card__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border-radius: 0;
	transition: transform 0.6s ease;
}

.elfp .elfp-card__content {
	flex: 0 0 auto;
	padding: 18px 20px 20px;
	background: var(--elfp-panel);
}

.elfp .elfp-card__topic {
	margin: 0 0 6px;
	font-family: var(--elfp-font-text);
	color: var(--elfp-label);
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.elfp .elfp-card__title {
	margin: 0;
	font-family: var(--elfp-font-heading);
	color: var(--elfp-text);
	font-size: clamp(1.375rem, 1.2rem + 0.4vw, 1.5rem);
	font-weight: 400;
	line-height: 1.15;
}

.elfp .elfp-card__link,
.elfp .elfp-card__link:hover,
.elfp .elfp-card__link:visited {
	color: inherit;
	text-decoration: none;
}

/* The title link covers the whole card, so a click anywhere opens the article. */
.elfp .elfp-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* Reveal: collapses to zero height, expands smoothly on hover / keyboard focus. */
.elfp .elfp-card__reveal {
	display: grid;
	grid-template-rows: 0fr;
	opacity: 0;
	transition: grid-template-rows var(--elfp-speed) ease, opacity var(--elfp-speed) ease;
}

.elfp .elfp-card__reveal-inner {
	min-height: 0;
	overflow: hidden;
}

.elfp .elfp-card__excerpt {
	display: -webkit-box;
	margin: 10px 0 0;
	overflow: hidden;
	color: var(--elfp-body);
	font-family: var(--elfp-font-text);
	font-size: 1rem;
	line-height: 1.55;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.elfp .elfp-card__button {
	position: relative;
	z-index: 2; /* Above the card-wide title link. */
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	margin: 14px 0 2px;
	padding: 8px 18px;
	border: 1px solid var(--elfp-button-bg);
	background: var(--elfp-button-bg);
	color: var(--elfp-button-text);
	font-family: var(--elfp-font-button);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.elfp .elfp-card__button:hover,
.elfp .elfp-card__button:focus-visible {
	background: transparent;
	color: var(--elfp-text);
}

.elfp .elfp-card:hover .elfp-card__reveal,
.elfp .elfp-card:focus-within .elfp-card__reveal {
	grid-template-rows: 1fr;
	opacity: 1;
}

.elfp .elfp-card:hover .elfp-card__img {
	transform: scale(1.03);
}

/* Lead card: bigger type and padding */
.elfp .elfp-card--lead .elfp-card__content {
	padding: 26px 28px 26px;
}

.elfp .elfp-card--lead .elfp-card__title {
	font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.25rem);
	line-height: 1.12;
}

.elfp .elfp-card--lead .elfp-card__excerpt {
	max-width: 60ch;
	font-size: 1rem;
	-webkit-line-clamp: 3;
}

/* Focus */
.elfp .elfp-card:has(.elfp-card__link:focus-visible) {
	outline: 3px solid #000;
	outline-offset: 3px;
}

.elfp .elfp-card__link:focus-visible {
	outline: none;
}

.elfp .elfp-card__button:focus-visible {
	outline: 2px solid var(--elfp-text);
	outline-offset: 3px;
}

.elfp-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Touch screens can't hover: show the excerpt and button all the time. */
@media (hover: none) {
	.elfp .elfp-card__reveal {
		grid-template-rows: 1fr;
		opacity: 1;
	}
}

/* Tablet: lead card full width, the other two side by side ------------- */

@media (min-width: 768px) {
	.elfp--count-2 .elfp__grid,
	.elfp--count-3 .elfp__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.elfp--count-3 .elfp__item--lead {
		grid-column: 1 / -1;
	}

	.elfp--count-3 .elfp__item--lead .elfp-card__media,
	.elfp--count-1 .elfp-card__media {
		aspect-ratio: 16 / 8;
	}
}

/* Desktop: lead card on the left spanning both rows, two stacked on the right.
   The lead card's shape sets the height; the image area flexes so the panels
   always sit at the bottom and the image gives way when the excerpt appears. */

@media (min-width: 1025px) {
	.elfp--count-3 .elfp__grid {
		grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
		grid-template-rows: repeat(2, minmax(0, 1fr));
	}

	.elfp--count-3 .elfp__item--lead {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.elfp--count-3 .elfp__item--lead .elfp-card {
		aspect-ratio: 16 / 10;
	}

	.elfp--count-3 .elfp-card__media,
	.elfp--count-3 .elfp__item--lead .elfp-card__media {
		flex: 1 1 auto;
		min-height: 0;
		aspect-ratio: auto;
	}

	.elfp--count-3 .elfp-card__img {
		position: absolute;
		inset: 0;
	}

	.elfp--count-2 .elfp__grid {
		grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
	}

	.elfp--count-2 .elfp__item:not(.elfp__item--lead) .elfp-card__media {
		flex: 1 1 auto;
		aspect-ratio: auto;
		min-height: 160px;
	}

	.elfp--count-1 .elfp-card__media {
		aspect-ratio: 21 / 8;
	}
}

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

	.elfp .elfp-card:hover .elfp-card__img {
		transform: none;
	}
}
