/**
 * Kubota Europe Stories slider (WPBakery element `vc_kbeu_stories_slider`).
 *
 * The slider mechanics (viewport / track / item, the teal prev/next + dots control
 * below and the crossfade) are the shared carousel component: the element's root
 * carries the `kbeu-carousel` class, so `kbeu-carousel.js` initializes it and
 * `kbeu-carousel.css` styles the track and the control. This file does two things
 * on top of that:
 *
 *   1. Sets the per-view token for THREE cards per view on desktop, two on tablet
 *      and one on mobile. The breakpoints (1100px / 720px) match the `data-kbeu-bp-*`
 *      attributes the root declares, so the CSS layout and the JS pager agree on how
 *      many cards make a page. The selectors are more specific than the shared
 *      `.kbeu-carousel` token rules (including its 860px mobile override), so they
 *      win the cascade regardless of source order.
 *   2. Restyles the item content into the story card of the Figma design
 *      (node 4595-1853): a rounded photo with a subtle dark overlay, then a
 *      "Kubota | <topic>" brand line with a grey category pill on its right, the
 *      story title, an excerpt and a teal "View Story" button.
 *
 * Font family "Inter" comes from the plugin's fonts stylesheet (this
 * handle depends on `kbeu-fonts`) and is referenced via `--kbeu-font-principal`.
 */

.kbeu-stories-slider {
	--kbeu-stories-slider-radius: 14px;
	/* Card photo proportion from Figma (581.373 × 408.435). */
	--kbeu-stories-slider-ratio: 581 / 408;
}

/* Configurable content width (element param "Content max width", default 1780px):
   the inner wrapper is centered and capped, shrinking on narrower viewports. */
.kbeu-stories-slider__inner {
	margin: 0 auto;
	max-width: var( --kbeu-stories-slider-max-width, 1780px );
}

/* Three cards per view on desktop, two on tablet, one on mobile. Breakpoints mirror
   the root's `data-kbeu-bp-tablet` / `data-kbeu-bp-mobile` so the pager and layout
   stay in sync. */
.kbeu-carousel.kbeu-stories-slider {
	--kbeu-carousel-per-view: 3;
}

@media ( max-width: 1100px ) {
	.kbeu-carousel.kbeu-stories-slider {
		--kbeu-carousel-per-view: 2;
	}
}

@media ( max-width: 720px ) {
	.kbeu-carousel.kbeu-stories-slider {
		--kbeu-carousel-per-view: 1;
	}
}

/* The story card fills its slider item. */
.kbeu-stories-slider__item {
	display: flex;
}

.kbeu-stories-slider__card {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
}

/* Story photo: rounded, with a subtle dark overlay for a consistent look across the
   varied feed imagery. */
.kbeu-stories-slider__figure {
	position: relative;
	aspect-ratio: var( --kbeu-stories-slider-ratio );
	border-radius: var( --kbeu-stories-slider-radius );
	overflow: hidden;
	background: var( --kbeu-color-border );
}

.kbeu-stories-slider__figure::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.2 );
	pointer-events: none;
}

.kbeu-stories-slider__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.kbeu-stories-slider__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding-top: clamp( 16px, 1.6vw, 24px );
}

/* Brand line + category pill on one row. */
.kbeu-stories-slider__meta {
	--kbeu-ss-tag-h: clamp( 26px, 1.8vw, 30px );
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: clamp( 10px, 1.2vw, 18px );
	/* The row is as tall as the pill even on a story without one, so every
	   card's title starts at the same height. */
	min-height: var( --kbeu-ss-tag-h );
}

.kbeu-stories-slider__eyebrow {
	font-family: var( --kbeu-font-principal );
	font-weight: 300;
	line-height: 1.4;
	font-size: clamp( 15px, 1.5vw, 20px );
	color: var( --kbeu-color-ink );
}

.kbeu-stories-slider__tag {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	height: var( --kbeu-ss-tag-h );
	margin-left: auto;
	padding: 0 clamp( 12px, 1vw, 16px );
	border-radius: 7px;
	background: var( --kbeu-color-gray );
	font-family: var( --kbeu-font-principal );
	font-weight: 300;
	line-height: 1.2;
	font-size: clamp( 13px, 1.1vw, 16px );
	color: #fff;
	white-space: nowrap;
}

.kbeu-stories-slider__title {
	margin: clamp( 12px, 1.3vw, 20px ) 0 0;
	font-family: var( --kbeu-font-principal );
	font-weight: 700;
	line-height: 1.37;
	font-size: clamp( 22px, 2.2vw, 32px );
	color: #000;
}

.kbeu-stories-slider__text {
	margin: clamp( 10px, 1vw, 16px ) 0 0;
	font-family: var( --kbeu-font-principal );
	font-weight: 300;
	line-height: 1.55;
	font-size: clamp( 16px, 1.6vw, 24px );
	color: var( --kbeu-color-ink );
}

/* Teal "View Story" button, pinned to the bottom so cards with shorter excerpts keep
   their buttons aligned. The shared `.kbeu-btn` is very wide (72px side padding);
   inside a card it hugs its label instead. */
.kbeu-stories-slider__btn {
	align-self: flex-start;
	margin-top: clamp( 18px, 2vw, 30px );
	padding-left: clamp( 22px, 2vw, 30px );
	padding-right: clamp( 22px, 2vw, 30px );
}

/* The whole card is the link: trigger the button's hover fill on card hover/focus. */
.kbeu-stories-slider__card:hover .kbeu-btn--primary,
.kbeu-stories-slider__card:focus-visible .kbeu-btn--primary {
	background-color: var( --kbeu-btn-primary-bg-hover );
	border-color: var( --kbeu-btn-primary-bg-hover );
	color: #fff;
}

.kbeu-stories-slider__card:focus-visible {
	outline: 3px solid var( --kbeu-color-teal );
	outline-offset: 3px;
}
