/**
 * Why Kitchen Basics — four columns (banner folder frame + optional decorative image).
 * Outer section: full viewport width so art can sit at the browser left (same idea as Banner).
 * Inner .kb-folder: constrained 80% / 90% like banner.css
 *
 * @package YaloFSE
 */

.wp-block-acf-why-kb.kb-imagewrapper {
	position: relative;
	margin-top: 12px;
	box-sizing: border-box;
}

/* Break out of theme content column to full viewport width */
.wp-block-acf-why-kb.kb-why-kb--bleed.kb-imagewrapper {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.wp-block-acf-why-kb .kb-folder--why-kb {
	padding: 48px 32px 56px;
}

.wp-block-acf-why-kb .kb-why-kb__inner {
	position: relative;
	z-index: 1;
}

/* Centered title + horizontal rules */
.wp-block-acf-why-kb .kb-why-kb__head {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(0.75rem, 2vw, 1.5rem);
	margin: 0 0 2rem;
	width: 100%;
}

.wp-block-acf-why-kb .kb-why-kb__rule {
	flex: 1 1 0;
	min-width: 1.5rem;
	height: 2px;
	background: var(--kb-brand-blue, #001489);
	border-radius: 1px;
}

.wp-block-acf-why-kb .kb-why-kb__title {
	margin: 0;
	flex: 0 1 auto;
	max-width: 100%;
	font-family: var(--font-primary);
	font-weight: 700;
	color: var(--kb-brand-blue, #001489);
	text-align: center;
	font-size: clamp(1.5rem, 3.5vw, 2.25rem);
	line-height: 1.15;
}

/* Four columns */
.wp-block-acf-why-kb .kb-why-kb__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(1rem, 2.5vw, 1.75rem);
	align-items: start;
	text-align: center;
}

.wp-block-acf-why-kb .kb-why-kb__col {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	min-width: 0;
}

.wp-block-acf-why-kb .kb-why-kb__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 120px;
	margin: 0 auto;
	aspect-ratio: 4/3;
}

.wp-block-acf-why-kb .kb-why-kb__icon img {
	display: block;
	width: 100%;
	max-width: 64px;;
	height: auto;
	max-height: 100px;
	object-fit: contain;
}

.wp-block-acf-why-kb .kb-why-kb__text {
	margin: 0;
	width: 100%;
	font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
	font-weight: 600;
	line-height: 1.35;
	color: var(--kb-brand-blue, #001489);
	text-align: center;
}

.wp-block-acf-why-kb .kb-why-kb__text p {
	margin: 0;
}

.wp-block-acf-why-kb .kb-why-kb__placeholder {
	margin: 0;
	font-style: italic;
	color: #666;
	text-align: center;
}

/* Decorative image — pinned to viewport left edge of full-bleed wrapper (banner pattern) */
.wp-block-acf-why-kb .kb-why-kb__media img {
	position: absolute;
	bottom: -40px;
	left: 0;
	right: auto;
	max-width: 372px;
	width: auto;
	height: auto;
	z-index: 0;
}

/* Desktop: folder width — same as banner */
@media (min-width: 901px) {
	.wp-block-acf-why-kb.kb-imagewrapper .kb-folder--why-kb {
		width: 80% !important;
		max-width: 80% !important;
		margin-top: 50px;
		margin-left: auto;
		margin-right: auto;
		box-sizing: border-box;
	}

	.wp-block-acf-why-kb .kb-folder--why-kb {
		padding: 56px 56px 96px;
	}

}

/* Mobile: match banner — simplified top bar, hide decorative image, 90% inner */
@media (max-width: 900px) {
	.wp-block-acf-why-kb.kb-imagewrapper .kb-folder--why-kb {
		width: 100% !important;
		max-width: 100% !important;
		margin-left: auto;
		margin-right: auto;
		border-right: 0 !important;
		border-bottom: 0 !important;
		border-left: 0 !important;
		border-top: 6px solid #001489;
		border-radius: 0 !important;
		padding: 48px 0 40px;
		box-sizing: border-box;
	}

	.wp-block-acf-why-kb.kb-imagewrapper .kb-folder--why-kb::before {
		display: none !important;
	}

	.wp-block-acf-why-kb.kb-imagewrapper .kb-folder--why-kb::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		top: 10px;
		height: 1px;
		background: #c1000b;
		z-index: 0;
	}

	.wp-block-acf-why-kb .kb-why-kb__media {
		display: none;
	}

	.wp-block-acf-why-kb .kb-why-kb__inner {
		width: 90%;
		max-width: 90%;
		margin-left: auto;
		margin-right: auto;
		padding-left: 0;
		padding-right: 0;
		text-align: center;
		box-sizing: border-box;
		position: relative;
		z-index: 1;
	}

	.wp-block-acf-why-kb .kb-why-kb__head {
		flex-wrap: wrap;
		margin-bottom: 1.5rem;
	}

	.wp-block-acf-why-kb .kb-why-kb__rule {
		display: none;
	}

	.wp-block-acf-why-kb .kb-why-kb__title {
		width: 100%;
		white-space: normal;
		overflow-wrap: anywhere;
	}

	.wp-block-acf-why-kb .kb-why-kb__grid {
		grid-template-columns: 1fr;
		gap: 2rem;
	}
}

/* Tablet: 2 columns */
@media (min-width: 601px) and (max-width: 900px) {
	.wp-block-acf-why-kb .kb-why-kb__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
