/**
 * Kubota Europe rounded image (WPBakery element `vc_kbeu_rounded_image`).
 *
 * Based on the Figma design 4221-1760 ("Produc 2", OK Kubota Care page): a photo
 * with 15px rounded corners fitted into a 941×511 area on the 2560 artboard,
 * cropped to cover it (`object-fit: cover`, centred).
 *
 * The block takes the width of its WPBakery column (width rule: the design's 941px
 * is a column setting, not the element's). Its height follows from the
 * `data-ratio` preset: the design's 941 / 511 by default, a few common ratios, or
 * `auto` — the picture's own proportions, nothing cropped. The `--fit-contain`
 * modifier shows the whole picture inside the area instead of cropping it.
 */

.kbeu-rounded-image {
	--kbeu-ri-radius: 15px;
	--kbeu-ri-ratio: 941 / 511;

	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 0;
}

.kbeu-rounded-image[data-ratio='16x9'] { --kbeu-ri-ratio: 16 / 9; }
.kbeu-rounded-image[data-ratio='21x9'] { --kbeu-ri-ratio: 21 / 9; }
/* The campaign page's 932 × 654 photos (Figma 4978-5135 / 4978-5139). */
.kbeu-rounded-image[data-ratio='10x7'] { --kbeu-ri-ratio: 10 / 7; }
.kbeu-rounded-image[data-ratio='4x3']  { --kbeu-ri-ratio: 4 / 3; }
.kbeu-rounded-image[data-ratio='3x2']  { --kbeu-ri-ratio: 3 / 2; }
.kbeu-rounded-image[data-ratio='1x1']  { --kbeu-ri-ratio: 1 / 1; }

.kbeu-rounded-image__frame {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var( --kbeu-ri-ratio );
	border-radius: var( --kbeu-ri-radius );
	overflow: hidden;
}

/* Scoped with the block class so the theme's generic `img` sizing (max-width /
   height: auto) cannot win over the fit. */
.kbeu-rounded-image .kbeu-rounded-image__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	border-radius: var( --kbeu-ri-radius );
	object-fit: cover;
	object-position: center;
}

.kbeu-rounded-image--fit-contain .kbeu-rounded-image__img {
	object-fit: contain;
}

/* Own ratio: the picture sets the height, nothing is cropped. */
.kbeu-rounded-image[data-ratio='auto'] .kbeu-rounded-image__frame {
	aspect-ratio: auto;
}

.kbeu-rounded-image[data-ratio='auto'] .kbeu-rounded-image__img {
	height: auto;
}

a.kbeu-rounded-image__frame:focus-visible {
	outline: 2px solid var( --kbeu-color-teal );
	outline-offset: 3px;
}

@media ( max-width: 767px ) {
	.kbeu-rounded-image {
		--kbeu-ri-radius: 12px;
	}

	/* A 21:9 band in a phone-width (often stacked) column would be a thin strip. */
	.kbeu-rounded-image[data-ratio='21x9'] {
		--kbeu-ri-ratio: 16 / 9;
	}
}
