/**
 * Kubota Europe division products grid (WPBakery element `vc_kbeu_division_products`).
 *
 * Figma node 4481-1451 (card) on the Industries pages: a 3-column grid of
 * 602×506 cards (44px apart, 48px between rows @2560), then a centered teal
 * "More products" button. The grid fills the width its WPBakery row gives it
 * (the design's 1893px column is a row setting, not the element's). Each card is a rounded
 * (14px) light grey tile: title 32px bold, subtitle 20px light, an optional grey
 * badge pill, the product photo centered, and a footer in teal with the product's
 * catalog term (bulleted) on the left and its key spec on the right.
 *
 * Sizes are `clamp()`s whose maximum is the Figma value (the artboard is 2560px
 * wide). Font "Inter" comes from the plugin's fonts stylesheet
 * (this handle depends on `kbeu-fonts`), referenced through `--kbeu-font-principal`;
 * the button is the shared `.kbeu-btn .kbeu-btn--primary`.
 */

.kbeu-dp {
	--kbeu-dp-teal: var( --kbeu-color-teal );
	--kbeu-dp-ink: #000;
	--kbeu-dp-card-bg: var( --kbeu-color-surface-alt );
	--kbeu-dp-badge-bg: #979797;
	/* Desktop column count comes from the `data-columns` attribute (below), not
	   inline — an inline custom property would beat the responsive overrides. */
	--kbeu-dp-columns: 3;
	/* Design: 44px between columns, 48px between rows @2560. */
	--kbeu-dp-gap-x: clamp( 16px, 1.72vw, 44px );
	--kbeu-dp-gap-y: clamp( 20px, 1.875vw, 48px );
	/* Design: 47px inner padding (7.83% of 602) and 40px top. */
	--kbeu-dp-pad-x: clamp( 20px, 1.84vw, 47px );
	--kbeu-dp-pad-y: clamp( 18px, 1.56vw, 40px );

	/* Fills whatever width its WPBakery row/column gives it (no breakout, no
	   own max width): the row decides between site width and full width. */
	position: relative;
	width: 100%;
	font-family: var( --kbeu-font-principal );
	color: var( --kbeu-dp-ink );
}

.kbeu-dp[data-columns='2'] {
	--kbeu-dp-columns: 2;
}

.kbeu-dp[data-columns='4'] {
	--kbeu-dp-columns: 4;
}

.kbeu-dp__inner {
	width: 100%;
}

/* --- Grid ---------------------------------------------------------------------- */

.kbeu-dp__grid {
	display: grid;
	grid-template-columns: repeat( var( --kbeu-dp-columns ), minmax( 0, 1fr ) );
	gap: var( --kbeu-dp-gap-y ) var( --kbeu-dp-gap-x );
}

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

.kbeu-dp__card {
	min-width: 0;
}

.kbeu-dp__link {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	height: 100%;
	/* Design: 602×506; content may make it taller, never shorter. */
	min-height: clamp( 300px, 19.77vw, 506px );
	padding: var( --kbeu-dp-pad-y ) var( --kbeu-dp-pad-x ) clamp( 16px, 1.29vw, 33px );
	border-radius: 14px;
	background: var( --kbeu-dp-card-bg );
	color: var( --kbeu-dp-ink );
	text-decoration: none;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.kbeu-dp__link:hover,
.kbeu-dp__link:focus-visible {
	box-shadow: 0 12px 30px rgba( 0, 0, 0, 0.12 );
	transform: translateY( -2px );
	outline: none;
}

.kbeu-dp__link:focus-visible {
	box-shadow: 0 0 0 3px var( --kbeu-dp-teal );
}

/* Title 32px bold, subtitle 20px light (Figma). */
.kbeu-dp__title {
	margin: 0;
	font-size: clamp( 20px, 1.25vw, 32px );
	font-weight: 700;
	line-height: 1.37;
	color: var( --kbeu-dp-ink );
}

.kbeu-dp__subtitle {
	margin: clamp( 2px, 0.16vw, 4px ) 0 0;
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 300;
	line-height: 1.56;
	color: var( --kbeu-dp-ink );
}

/* Grey pill, white light text (Figma: 54px tall, 26px side padding, 15px radius). */
.kbeu-dp__badge {
	display: inline-block;
	margin-top: clamp( 8px, 0.63vw, 16px );
	padding: clamp( 6px, 0.55vw, 14px ) clamp( 14px, 1.02vw, 26px );
	border-radius: 15px;
	background: var( --kbeu-dp-badge-bg );
	color: #fff;
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 300;
	line-height: 1.3;
	white-space: nowrap;
}

/* The photo sits in the middle band, centered (72% of the card's width in the design). */
.kbeu-dp__media {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-height: clamp( 120px, 8.2vw, 211px );
	margin: clamp( 10px, 0.78vw, 20px ) 0;
}

.kbeu-dp__img {
	display: block;
	width: 80%;
	max-height: clamp( 160px, 11vw, 280px );
	object-fit: contain;
}

/* Pimcore's photos are JPGs on white: the card's colour shows through the white box. */
.kbeu-dp__card--white-photo .kbeu-dp__img {
	mix-blend-mode: multiply;
}

/* Footer: bulleted catalog term on the left, key spec on the right, both teal. */
.kbeu-dp__foot {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 300;
	line-height: 1.56;
	color: var( --kbeu-dp-teal );
}

.kbeu-dp__tag {
	position: relative;
	padding-left: 1.1em;
	min-width: 0;
}

.kbeu-dp__tag::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.62em;
	width: 0.36em;
	height: 0.36em;
	border-radius: 50%;
	background: currentColor;
}

/* Key spec: its short label, a colon, the value ("Power: 130 - 170 HP"). */
.kbeu-dp__spec {
	margin-left: auto;
	text-align: right;
	white-space: nowrap;
}

.kbeu-dp__spec-label::after {
	content: ':';
}

/* --- Filter states -------------------------------------------------------------- */

/* While the spec filter reloads the grid (`aria-busy`), the current cards dim. */
.kbeu-dp.is-loading .kbeu-dp__grid {
	opacity: 0.5;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

/* Empty result of a filter: same type as the card subtitle, on the card grey. */
.kbeu-dp__empty {
	margin: 0;
	padding: clamp( 24px, 1.875vw, 48px ) var( --kbeu-dp-pad-x );
	border-radius: 14px;
	background: var( --kbeu-dp-card-bg );
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 300;
	line-height: 1.56;
	text-align: center;
	color: var( --kbeu-dp-ink );
}

.kbeu-dp__empty[hidden],
.kbeu-dp__more[hidden] {
	display: none;
}

/* --- "More products" ------------------------------------------------------------- */

/* Design: 85px below the grid; 20px regular text, 20/26px padding, 15px radius. */
.kbeu-dp__more {
	display: flex;
	justify-content: center;
	margin-top: clamp( 32px, 3.3vw, 85px );
}

.kbeu-dp .kbeu-dp__more-btn {
	padding: clamp( 12px, 0.78vw, 20px ) clamp( 18px, 1.02vw, 26px );
	border-radius: 15px;
	font-family: inherit;
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 400;
	line-height: 1.2;
	cursor: pointer;
}

.kbeu-dp .kbeu-dp__more-btn:disabled {
	opacity: 0.6;
	cursor: progress;
}

/* --- Responsive ------------------------------------------------------------------- */

@media ( max-width: 1199px ) {
	.kbeu-dp,
	.kbeu-dp[data-columns='4'] {
		--kbeu-dp-columns: 2;
	}
}

@media ( max-width: 640px ) {
	.kbeu-dp,
	.kbeu-dp[data-columns='2'],
	.kbeu-dp[data-columns='4'] {
		--kbeu-dp-columns: 1;
	}

	.kbeu-dp__link {
		min-height: 0;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.kbeu-dp__link {
		transition: none;
	}

	.kbeu-dp__link:hover {
		transform: none;
	}
}
