/**
 * Kubota Europe image CTA (WPBakery element `vc_kbeu_image_cta`).
 *
 * Based on the Figma design 4961-2673 ("The Journey — Case studies from Kubota"):
 * a full-width rounded artwork (1588×802 on the 2560 artboard, 15px radius) with a
 * frosted-glass card floating at its bottom-right corner — 565×244, 29px radius,
 * `rgba(73,70,70,0.27)` fill under a ~3.5px backdrop blur with a faint dark
 * outline, inset 92px from the right edge and 73px from the bottom, padded 42px
 * vertically and 55px on the left. Inside, from top to bottom: a light eyebrow
 * (18px / Light, white), a bold heading (32px / Bold, white) and the turquoise
 * call-to-action button (20px / Roman, 15px radius, 26px side padding).
 *
 * The big lettering of the design ("The JOURNEY / Case studies from KUBOTA") is
 * part of the artwork itself, so nothing but the card is drawn over the picture.
 *
 * Font family "Inter" is provided by the plugin's fonts stylesheet
 * (this handle depends on `kbeu-fonts`), referenced via `--kbeu-font-principal`.
 * The bundled family ships the 300 / 400 / 500 / 700 weights, so the design's 400 (Roman)
 * button matches exactly. The button is the shared
 * `.kbeu-btn--primary` (this handle depends on `kbeu-buttons`), whose fill already
 * is the design's turquoise; only its size is tweaked here.
 *
 * The whole card is clickable, as the design marks it: the button is the only
 * anchor and its `::after` is stretched over the card, so a click anywhere on the
 * card follows the link and keyboard users get a single focus stop. Hovering or
 * focusing the card therefore lights the button up.
 *
 * The element takes the width its WPBakery row gives it (no breakout, no inner
 * max-width): the height follows from the artwork's aspect ratio. Below 768px
 * there is no design to follow: the frame is cropped to a portrait ratio (the
 * element's optional mobile image is meant for it) and the card spans the whole
 * width, still pinned to the bottom.
 */

.kbeu-image-cta {
	--kbeu-ic-radius: 15px;
	--kbeu-ic-card-radius: 29px;
	--kbeu-ic-card-bg: rgba( 73, 70, 70, 0.27 );
	--kbeu-ic-card-border: rgba( 0, 0, 0, 0.13 );

	width: 100%;
	font-family: var( --kbeu-font-principal );
}

/* The card's size and insets are the design's own measurements, so paddings and
   borders have to stay inside them whatever the theme's box model. */
.kbeu-image-cta,
.kbeu-image-cta *,
.kbeu-image-cta *::before,
.kbeu-image-cta *::after {
	box-sizing: border-box;
}

/* --- Frame + artwork --------------------------------------------------- */

/* The artwork's ratio gives the block its height; the flat dark colour is what
   shows while the picture loads or when none is set. */
.kbeu-image-cta__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 1588 / 802;
	border-radius: var( --kbeu-ic-radius );
	background-color: #0a0a0a;
	overflow: hidden;
}

/* Browsers without `aspect-ratio`: the classic padding-top box (802 / 1588). */
@supports not ( aspect-ratio: 1 / 1 ) {
	.kbeu-image-cta__frame {
		height: 0;
		padding-top: 50.5%;
	}
}

.kbeu-image-cta__media {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

/* Scoped with the block class so the theme's generic `img` sizing (max-width /
   height: auto) cannot win over the cover fit. */
.kbeu-image-cta .kbeu-image-cta__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	pointer-events: none;
}

/* --- Frosted card ------------------------------------------------------- */

/* The card's geometry is proportional to the FRAME, not to the viewport: the
   artwork carries its own composition (the design's lettering on the left), so
   the card has to keep the same share of the picture whatever width the row
   gives the block — 565 / 1588 of the width, inset 92 / 1588 from the right and
   73 / 802 from the bottom, padded 42 and 55 / 1588. Percentages do that (padding
   and `right` resolve against the frame's width, `bottom` against its height);
   the text sizes stay viewport clamps like the sibling elements. */
.kbeu-image-cta__card {
	position: absolute;
	right: clamp( 16px, 5.8%, 92px );
	bottom: clamp( 16px, 9.1%, 73px );
	width: clamp( 280px, 35.6%, 565px );
	max-width: calc( 100% - 2 * clamp( 16px, 5.8%, 92px ) );
	padding: clamp( 20px, 2.65%, 42px ) clamp( 20px, 3.45%, 55px );
	border: 1px solid var( --kbeu-ic-card-border );
	border-radius: var( --kbeu-ic-card-radius );
	background: var( --kbeu-ic-card-bg );
	-webkit-backdrop-filter: blur( 3.5px );
	backdrop-filter: blur( 3.5px );
	color: #fff;
}

/* Without a backdrop blur the translucent grey is too faint for white text over
   a busy picture, so the fill goes darker instead. */
@supports not ( backdrop-filter: blur( 1px ) ) {
	.kbeu-image-cta__card {
		background: rgba( 20, 20, 20, 0.6 );
	}
}

/* Keyboard focus lands on the button, whose own ring would outline only its own
   box while the click target is the whole card, so the ring is drawn on the card. */
.kbeu-image-cta__card:focus-within {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.kbeu-image-cta__eyebrow {
	margin: 0 0 clamp( 6px, 0.6vw, 8px );
	font-size: clamp( 15px, 1.3vw, 18px );
	font-weight: 300;
	line-height: 1.5;
	color: #fff;
}

.kbeu-image-cta__title {
	margin: 0;
	font-size: clamp( 24px, 2.4vw, 32px );
	font-weight: 700;
	line-height: 1.37;
	color: #fff;
}

/* --- Button ------------------------------------------------------------- */

/* Context tweaks over `.kbeu-btn--primary`: the design's button is a 54px pill
   with 26px side padding and a 20px label (the shared button is wider and
   smaller). `position: static` on purpose — the stretched `::after` below must
   resolve against the card, not against the button. */
.kbeu-image-cta__btn {
	position: static;
	margin-top: clamp( 12px, 1.2vw, 18px );
	padding: clamp( 10px, 0.9vw, 13px ) clamp( 20px, 1.8vw, 26px );
	font-family: var( --kbeu-font-principal );
	font-size: clamp( 16px, 1.4vw, 20px );
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
}

/* Stretched link: covers the card so a click anywhere on it follows the button. */
.kbeu-image-cta__btn::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: var( --kbeu-ic-card-radius );
}

/* The card being the click target, hovering any part of it lights the button up
   with the shared primary hover colours. */
.kbeu-image-cta__card:hover .kbeu-image-cta__btn {
	background-color: var( --kbeu-btn-primary-bg-hover );
	border-color: var( --kbeu-btn-primary-bg-hover );
	color: #fff;
}

/* The ring is on the card (`:focus-within` above). */
.kbeu-image-cta__btn:focus,
.kbeu-image-cta__btn:focus-visible {
	outline: none;
}

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

@media ( max-width: 767px ) {
	/* Portrait crop (the mobile image swaps in here) with the card across the
	   whole width, still pinned to the bottom so a band of artwork stays visible. */
	.kbeu-image-cta__frame {
		aspect-ratio: 4 / 5;
		border-radius: 12px;
	}

	@supports not ( aspect-ratio: 1 / 1 ) {
		.kbeu-image-cta__frame {
			padding-top: 125%;
		}
	}

	.kbeu-image-cta__card {
		right: 12px;
		bottom: 12px;
		left: 12px;
		width: auto;
		max-width: none;
		padding: 22px 24px;
		border-radius: 20px;
	}

	.kbeu-image-cta__btn {
		white-space: normal;
	}
}
