/**
 * Kubota Europe case studies grid (WPBakery element `vc_kbeu_case_study_grid`).
 *
 * Figma node 3727-9565 (2560 artboard): three columns of 598 × 741 cards, 44px
 * apart, rows 49px apart. A card is the featured photo filling a 29px-rounded
 * box, with a frosted "glass" panel (rgba(73,70,70,.27) + 3.475px backdrop blur,
 * 1px rgba(0,0,0,.13) border, 29px radius) 35px in from the sides and 52px up
 * from the bottom, holding the pre-title (18px / 300, white), the title
 * (32px / 700, white, line-height 1.37) and a teal "View more" button
 * (20px / 400, 20px × 26px padding). Below, two 48px disc arrows 67px apart,
 * 108px under the cards (node 3727-9718) page the grid.
 *
 * Columns: `data-columns` (2–4) on the root, two on tablets and one on phones
 * regardless (the attribute, not an inline custom property, so the responsive
 * rules below win). The grid takes the width its WPBakery row gives it. Sizes
 * are `clamp()`s whose maximum is the Figma value (vw = px / 25.6). Font
 * "Inter" comes from the plugin's fonts stylesheet (this
 * handle depends on `kbeu-fonts`), via `--kbeu-font-principal`. The arrows
 * are the shared `.kbeu-nav-arrow` (`kbeu-nav-arrow.css`, on-light variant).
 */

.kbeu-csg {
	--kbeu-csg-teal: var( --kbeu-color-teal );
	--kbeu-csg-ink: var( --kbeu-color-ink-alt );
	--kbeu-csg-columns: 3;
	--kbeu-csg-gap-x: clamp( 16px, 1.72vw, 44px );
	--kbeu-csg-gap-y: clamp( 24px, 1.91vw, 49px );
	--kbeu-csg-radius: clamp( 16px, 1.13vw, 29px );
	/* Card proportion from Figma (598 × 741). */
	--kbeu-csg-ratio: 598 / 741;
	position: relative;
	width: 100%;
	font-family: var( --kbeu-font-principal );
	color: var( --kbeu-csg-ink );
}

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

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

.kbeu-csg__inner {
	width: 100%;
}

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

/* Card: the photo fills a tall rounded box; the glass panel floats over it. */
.kbeu-csg__card {
	min-width: 0;
}

.kbeu-csg__link {
	position: relative;
	display: block;
	aspect-ratio: var( --kbeu-csg-ratio );
	border-radius: var( --kbeu-csg-radius );
	overflow: hidden;
	background: var( --kbeu-color-near-black );
	color: #fff;
	text-decoration: none;
}

.kbeu-csg__link:focus-visible {
	outline: 3px solid var( --kbeu-csg-teal );
	outline-offset: 4px;
}

.kbeu-csg__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	transition: transform 0.35s ease;
}

.kbeu-csg__img--empty {
	display: block;
	background: linear-gradient( 135deg, #2a2a2a, #141414 );
}

.kbeu-csg__link:hover .kbeu-csg__img,
.kbeu-csg__link:focus-visible .kbeu-csg__img {
	transform: scale( 1.03 );
}

/* Frosted "glass" panel over the lower part of the card: 35px in from both
   sides (5.9% of the 598px card) and 52px up from the bottom; its content
   48px / 29px inside. */
.kbeu-csg__glass {
	position: absolute;
	left: 5.9%;
	right: 5.9%;
	bottom: clamp( 14px, 2.03vw, 52px );
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	box-sizing: border-box;
	padding: clamp( 18px, 1.875vw, 48px ) clamp( 16px, 1.13vw, 29px ) clamp( 20px, 1.875vw, 48px );
	border: 1px solid rgba( 0, 0, 0, 0.13 );
	border-radius: var( --kbeu-csg-radius );
	background: rgba( 73, 70, 70, 0.27 );
	-webkit-backdrop-filter: blur( 3.475px );
	backdrop-filter: blur( 3.475px );
}

/* Pre-title: who and where, a light line above the title. */
.kbeu-csg__pretitle {
	margin: 0 0 clamp( 4px, 0.4vw, 10px );
	font-family: var( --kbeu-font-principal );
	font-weight: 300;
	line-height: 1.5;
	font-size: clamp( 13px, 0.7vw, 18px );
	color: #fff;
}

/* Title: three lines at most. */
.kbeu-csg__title {
	margin: 0;
	font-family: var( --kbeu-font-principal );
	font-weight: 700;
	line-height: 1.37;
	font-size: clamp( 18px, 1.25vw, 32px );
	color: #fff;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* "View more" (node 3727-9581): the shared `.kbeu-btn .kbeu-btn--primary`,
   sized as designed, 30px under the title. */
.kbeu-csg .kbeu-csg__btn {
	margin-top: clamp( 14px, 1.17vw, 30px );
	padding: clamp( 12px, 0.78vw, 20px ) clamp( 18px, 1.02vw, 26px );
	font-family: var( --kbeu-font-principal );
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 400;
	line-height: 1.5;
}

/* The whole card is the link, so mirror the button's hover on card hover/focus. */
.kbeu-csg__link:hover .kbeu-csg__btn,
.kbeu-csg__link:focus-visible .kbeu-csg__btn {
	background-color: var( --kbeu-btn-primary-bg-hover );
	border-color: var( --kbeu-btn-primary-bg-hover );
}

/* Filter / loading states. */
.kbeu-csg.is-loading .kbeu-csg__grid {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.kbeu-csg__empty {
	margin: 0;
	padding: clamp( 24px, 2.5vw, 64px ) clamp( 16px, 1.5vw, 40px );
	border-radius: 14px;
	background: var( --kbeu-color-surface-alt );
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 300;
	line-height: 1.5;
	text-align: center;
	color: var( --kbeu-csg-ink );
}

.kbeu-csg__empty[hidden],
.kbeu-csg__pager[hidden] {
	display: none;
}

/* Prev / next pager: two shared disc arrows, centered, 67px apart, 108px under
   the cards. */
.kbeu-csg__pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp( 24px, 2.62vw, 67px );
	margin-top: clamp( 40px, 4.22vw, 108px );
}

/* Tablet: two columns (also for the four-column preset). */
@media ( max-width: 1199px ) {
	.kbeu-csg,
	.kbeu-csg[data-columns='4'] {
		--kbeu-csg-columns: 2;
	}
}

/* Phones: one column, a slightly shorter card. */
@media ( max-width: 640px ) {
	.kbeu-csg,
	.kbeu-csg[data-columns='2'],
	.kbeu-csg[data-columns='4'] {
		--kbeu-csg-columns: 1;
		--kbeu-csg-ratio: 4 / 5;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.kbeu-csg__img,
	.kbeu-csg.is-loading .kbeu-csg__grid {
		transition: none;
	}

	.kbeu-csg__link:hover .kbeu-csg__img,
	.kbeu-csg__link:focus-visible .kbeu-csg__img {
		transform: none;
	}
}
