/**
 * Kubota Europe news grid (WPBakery element `vc_kbeu_news_grid`).
 *
 * Figma node 3727-7588 (2560 artboard): three columns of 602px cards, 47px
 * apart, rows 71px apart. A card is the featured image (602 × 300, radius
 * 15px), then a line with the grey sector tag (#979797 pill, 7px radius, 20px
 * light white) and the date (18px / 700, bullet) at the right, the title
 * (32px / 700, #202024, line-height 1.37, three lines at most) and a teal
 * "Read More" button; the buttons of a row line up at the bottom. An optional
 * heading ("Latest news") sits above; a centered outlined "More news" button
 * below.
 *
 * 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`.
 */

.kbeu-ng {
	--kbeu-ng-teal: var( --kbeu-color-teal );
	--kbeu-ng-ink: var( --kbeu-color-ink-alt );
	--kbeu-ng-tag-bg: #979797;
	--kbeu-ng-columns: 3;
	--kbeu-ng-gap-x: clamp( 16px, 1.84vw, 47px );
	--kbeu-ng-gap-y: clamp( 32px, 2.77vw, 71px );
	--kbeu-ng-radius: 15px;
	position: relative;
	width: 100%;
	font-family: var( --kbeu-font-principal );
	color: var( --kbeu-ng-ink );
}

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

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

.kbeu-ng__inner {
	width: 100%;
}

/* Optional heading above the cards ("Latest news"). */
.kbeu-ng__title {
	margin: 0 0 clamp( 24px, 3vw, 77px );
	font-family: var( --kbeu-font-principal );
	font-weight: 400;
	line-height: 1.1;
	font-size: clamp( 32px, 2.5vw, 64px );
	color: var( --kbeu-ng-ink );
}

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

/* Card: a column whose button sticks to the bottom, so a row's buttons align. */
.kbeu-ng__card {
	display: flex;
	min-width: 0;
}

.kbeu-ng__link {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	box-sizing: border-box;
	width: 100%;
	color: var( --kbeu-ng-ink );
	text-decoration: none;
}

.kbeu-ng__link:focus-visible {
	outline: 3px solid var( --kbeu-ng-teal );
	outline-offset: 4px;
	border-radius: var( --kbeu-ng-radius );
}

/* Featured image (602 × 300). */
.kbeu-ng__media {
	width: 100%;
	aspect-ratio: 602 / 300;
	border-radius: var( --kbeu-ng-radius );
	overflow: hidden;
	background: var( --kbeu-color-surface-alt );
}

.kbeu-ng__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

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

/* Sector tag + date line, 39px under the image. */
.kbeu-ng__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	margin-top: clamp( 16px, 1.52vw, 39px );
}

.kbeu-ng__tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: clamp( 120px, 10vw, 256px );
	height: clamp( 22px, 1.06vw, 27px );
	padding: 0 clamp( 12px, 0.78vw, 20px );
	border-radius: 7px;
	background: var( --kbeu-ng-tag-bg );
	font-size: clamp( 13px, 0.78vw, 20px );
	font-weight: 300;
	line-height: 1;
	color: #fff;
	white-space: nowrap;
}

.kbeu-ng__date {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	font-size: clamp( 13px, 0.7vw, 18px );
	font-weight: 700;
	line-height: 1.5;
	color: #000;
	white-space: nowrap;
}

.kbeu-ng__date::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

/* Title: three lines at most; grows so the button stays at the bottom. */
.kbeu-ng__card-title {
	flex: 1 0 auto;
	width: 100%;
	margin: clamp( 16px, 1.52vw, 39px ) 0 0;
	font-family: var( --kbeu-font-principal );
	font-weight: 700;
	line-height: 1.37;
	font-size: clamp( 20px, 1.25vw, 32px );
	color: var( --kbeu-ng-ink );
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* "Read More" (design node 3727-7614): the shared `.kbeu-btn .kbeu-btn--primary`,
   sized as designed — a 182 × 54 box (15px corners) with the 20px / Roman label
   centred in it. Figma trims the label to its cap height (20px above the caps,
   20px below the baseline), so the box is a fixed height rather than padding
   around a line box: in the Roman face the content area's centre falls on the
   middle of the caps, so a flex-centred line puts the ink exactly there. Sizes
   are in em, so the whole button follows the font's clamp(); the border of
   `.kbeu-btn` (same colour as the fill) is inside the box. */
.kbeu-ng .kbeu-ng__btn {
	box-sizing: border-box;
	min-width: 9.09em;
	height: 2.7em;
	margin-top: clamp( 20px, 1.52vw, 39px );
	padding: 0 1.3em;
	font-family: var( --kbeu-font-principal );
	font-size: clamp( 15px, 0.782vw, 20px );
	font-weight: 400;
	line-height: 1;
	white-space: nowrap;
}

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

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

.kbeu-ng__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-ng-ink );
}

.kbeu-ng__empty[hidden],
.kbeu-ng__more[hidden] {
	display: none;
}

/* Centered "More news" below the grid: the shared `.kbeu-btn .kbeu-btn--outline`,
   sized as designed (a thin 1px outline). */
.kbeu-ng__more {
	display: flex;
	justify-content: center;
	margin-top: clamp( 40px, 5.27vw, 135px );
}

.kbeu-ng .kbeu-ng__more-btn {
	padding: clamp( 10px, 0.63vw, 16px ) clamp( 20px, 1.56vw, 40px );
	border-width: 1px;
	font-family: var( --kbeu-font-principal );
	font-size: clamp( 15px, 0.78vw, 20px );
	font-weight: 400;
	line-height: 1.5;
	cursor: pointer;
}

.kbeu-ng .kbeu-ng__more-btn:disabled {
	opacity: 0.6;
	cursor: progress;
}

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

/* Phones: one column. */
@media ( max-width: 640px ) {
	.kbeu-ng,
	.kbeu-ng[data-columns='2'],
	.kbeu-ng[data-columns='4'] {
		--kbeu-ng-columns: 1;
	}

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

@media ( prefers-reduced-motion: reduce ) {
	.kbeu-ng__img,
	.kbeu-ng.is-loading .kbeu-ng__grid {
		transition: none;
	}

	.kbeu-ng__link:hover .kbeu-ng__img,
	.kbeu-ng__link:focus-visible .kbeu-ng__img {
		transform: none;
	}
}
