/**
 * Featured Recipes Block Styles
 *
 * @package YaloFSE
 */

.wp-block-acf-featured-recipes.kb-featured-recipes {
	--kb-fr-gap: 12px;
	--kb-fr-gap-desktop: 32px;
	/* Terracotta accent under navy rule (matches desktop mockup) */
	--kb-fr-rule-accent: #c4593f;
	margin-bottom:48px;
}

/* —— Heading with double rules —— */
.kb-featured-recipes__heading-row {
	display: flex;
	align-items: center;
	gap: clamp(12px, 3vw, 28px);
	margin: 60px 0 clamp(24px, 4vw, 36px);
}

.kb-featured-recipes__rules {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	min-width: 24px;
}

.kb-featured-recipes__rule {
	display: block;
	width: 100%;
	border-radius: 0;
}

.kb-featured-recipes__rule--primary {
	height: 2px;
	background: var(--kb-brand-blue, #001489);
}

.kb-featured-recipes__rule--accent {
	height: 1px;
	background: var(--kb-fr-rule-accent);
}

.kb-featured-recipes__heading {
	flex: 0 1 auto;
	margin: 0;
	max-width: min(100%, 22ch);
	font-family: var(--font-primary);
	font-size: clamp(2rem, 4.5vw, 3rem);
	font-weight: 400;
	font-style: normal;
	line-height: var(--line-height-tight, 1.1);
	color: var(--kb-brand-blue, #001489);
	text-align: center;
}

@media (min-width: 992px) {
	.kb-featured-recipes__heading {
		font-size: clamp(2.25rem, 3.2vw, 3rem);
		max-width: none;
	}
}

/* —— Grid & cards —— */
.kb-featured-recipes__grid {
	display: flex;
	flex-direction: column;
	gap: var(--kb-fr-gap);
	margin: 0;
}

.kb-featured-recipes__secondary {
	display: flex;
	flex-direction: column;
	gap: var(--kb-fr-gap);
	min-width: 0;
}

.kb-featured-recipes__card {
	position: relative;
	display: block;
	overflow: hidden;
	color: inherit;
	text-decoration: none;
	outline-offset: 2px;
}

.kb-featured-recipes__card:focus-visible {
	outline: 2px solid var(--kb-brand-blue, #001489);
}

.kb-featured-recipes__media {
	position: relative;
	display: block;
	width: 100%;
	background: var(--color-grey-100, #ededed);
}

/* Mobile: all recipe tiles use the same landscape ratio */
.kb-featured-recipes__card .kb-featured-recipes__media {
	aspect-ratio: 3 / 2;
}

.kb-featured-recipes__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.kb-featured-recipes__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 120px;
	background: var(--color-grey-200, #c8c8c8);
}

/* Bottom gradient + title region */
.kb-featured-recipes__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.75) 0%,
		rgba(0, 0, 0, 0.35) 42%,
		transparent 72%
	);
	pointer-events: none;
}

.kb-featured-recipes__title {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: var(--spacing-md, 16px) var(--spacing-md, 16px) var(--spacing-lg, 24px);
	font-family: var(--font-primary);
	font-size: 32px;
	font-style: italic;
	font-weight: 400;
	line-height: var(--line-height-snug, 1.2);
	color: var(--color-white, #fff);
	pointer-events: none;
	z-index: 1;
}

/* Mobile / coarse pointers: always show overlay + title */
.kb-featured-recipes__overlay,
.kb-featured-recipes__title {
	opacity: 1;
	transition: opacity var(--transition-normal, 0.3s ease-in-out);
}

/* Desktop with hover: hide overlay and title until hover/focus */
@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
	.kb-featured-recipes__overlay,
	.kb-featured-recipes__title {
		opacity: 0;
	}

	.kb-featured-recipes__card:hover .kb-featured-recipes__overlay,
	.kb-featured-recipes__card:hover .kb-featured-recipes__title,
	.kb-featured-recipes__card:focus-visible .kb-featured-recipes__overlay,
	.kb-featured-recipes__card:focus-visible .kb-featured-recipes__title {
		opacity: 1;
	}
}

/* Desktop: 50/50 columns, ~20px gutters; right tiles 3:2; left fills height */
@media (min-width: 992px) {
	.kb-featured-recipes__grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		align-items: stretch;
		gap: var(--kb-fr-gap-desktop);
	}

	.kb-featured-recipes__secondary {
		gap: var(--kb-fr-gap-desktop);
		align-self: stretch;
	}

	.kb-featured-recipes__secondary .kb-featured-recipes__card--compact {
		aspect-ratio: 3 / 2;
		width: 100%;
	}

	.kb-featured-recipes__secondary .kb-featured-recipes__card--compact .kb-featured-recipes__media {
		position: absolute;
		inset: 0;
		aspect-ratio: unset;
		height: 100%;
	}

	.kb-featured-recipes__card--feature {
		align-self: stretch;
		min-height: 0;
	}

	.kb-featured-recipes__card--feature .kb-featured-recipes__media {
		position: absolute;
		inset: 0;
		aspect-ratio: unset;
		height: 100%;
	}

	/* Single full-width banner when only one recipe */
	.kb-featured-recipes__grid > .kb-featured-recipes__card--feature:only-child {
		grid-column: 1 / -1;
		aspect-ratio: 3 / 2;
		max-width: 100%;
	}

	.kb-featured-recipes__grid > .kb-featured-recipes__card--feature:only-child .kb-featured-recipes__media {
		position: absolute;
		inset: 0;
		aspect-ratio: unset;
		height: 100%;
	}
}

.kb-featured-recipes--empty .kb-featured-recipes__preview-msg {
	margin: 0;
	padding: var(--spacing-md, 16px);
	font-family: var(--font-secondary);
	font-size: var(--font-size-sm, 14px);
	color: var(--color-grey-400, #5a5a5a);
	border: 1px dashed var(--color-grey-200, #c8c8c8);
}
