/**
 * Kubota Europe history timeline (WPBakery element `vc_kbeu_history_timeline`).
 *
 * Based on the "Heritage & history" section of the About us design (Figma node
 * 4978-3650, 2560px artboard): a grey line runs across the whole block with a teal
 * ring per milestone (~255px apart); every milestone is a white rounded (14px) card
 * with a teal bar along its top, a teal bold year (40px) over a light paragraph
 * (24px), and the cards alternate below / above the line starting below. Under the
 * track sit a grey scroll progress bar (~78% of the width) and the shared prev/next
 * discs (`.kbeu-nav-arrow`, light variant: the idle disc is white with a grey ring).
 *
 * The track is a native horizontal scroller (the design reference in
 * docs/mockup/kubota-about-us-page-mockup.html, `#tlScroll`), so it scrolls by touch,
 * trackpad and keyboard on its own; its scrollbar is hidden because the progress bar
 * replaces it. Every item is a 3-row grid (`1fr auto 1fr`, the ring in the middle):
 * as the flex track stretches every item to the tallest one, both `1fr` rows come out
 * equal in every item and the line stays centered whatever each card's height.
 *
 * The block takes the width its container gives it (no breakout, no own max-width).
 * Sizes are `clamp()`s whose maximum is the Figma value at 2560px.
 * Font family "Inter" comes from the plugin's fonts stylesheet
 * (`--kbeu-font-principal`); the bundled 300 / 700 weights match the design's
 * Light / Bold weights.
 */

.kbeu-history-timeline {
	--kbeu-tl-teal: var( --kbeu-color-teal );
	--kbeu-tl-ink: var( --kbeu-color-ink );
	--kbeu-tl-line: var( --kbeu-color-line );
	--kbeu-tl-thumb: var( --kbeu-color-muted );
	--kbeu-tl-pitch: clamp( 173px, 10vw, 255px );        /* distance between two rings   */
	--kbeu-tl-card: clamp( 270px, 15.5vw, 397px );       /* card width                   */
	--kbeu-tl-ring: clamp( 32px, 2.35vw, 60px );         /* ring diameter                */
	--kbeu-tl-ring-border: clamp( 3px, 0.2vw, 5px );
	--kbeu-tl-line-size: clamp( 6px, 0.42vw, 11px );     /* line and progress bar height */
	--kbeu-tl-gap: clamp( 40px, 3.4vw, 86px );           /* line -> card distance        */
	--kbeu-tl-gutter: clamp( 16px, 1vw, 25px );          /* inset of the first/last card */
	--kbeu-tl-shadow-room: 24px;                         /* keeps card shadows unclipped */
	width: 100%;
	font-family: var( --kbeu-font-principal );
	color: var( --kbeu-tl-ink );
}

/* --- Subtitle ---------------------------------------------------------- */

.kbeu-history-timeline__subtitle {
	margin: 0 0 clamp( 40px, 5vw, 128px );
	font-weight: 700;
	font-size: clamp( 20px, 1.3vw, 33px );
	line-height: 1.3;
	text-align: center;
	color: var( --kbeu-tl-ink );
}

/* --- Scroller + line ----------------------------------------------------- */

.kbeu-history-timeline__scroller {
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.kbeu-history-timeline__scroller::-webkit-scrollbar {
	display: none;
}

.kbeu-history-timeline__scroller:focus-visible {
	outline: 2px solid var( --kbeu-tl-teal );
	outline-offset: -2px;
}

/* --- Track and items ----------------------------------------------------- */

.kbeu-history-timeline__track {
	position: relative;
	display: flex;
	align-items: stretch;
	min-width: max-content;
	margin: 0;
	padding: var( --kbeu-tl-shadow-room ) calc( ( var( --kbeu-tl-card ) - var( --kbeu-tl-pitch ) ) / 2 + var( --kbeu-tl-gutter ) );
	list-style: none;
}

/* The line is drawn on the track — never on the scroller: an absolutely positioned
   child of a scroll container scrolls along with the content and only measures the
   visible width, so it would cover the first view alone. The track is at least as
   wide as the scroller and as wide as all the milestones, so the line runs the whole
   scrollable width. It sits at the rings' row: the track's vertical padding is
   symmetric, so that row is exactly its middle. */
.kbeu-history-timeline__track::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: var( --kbeu-tl-line-size );
	transform: translateY( -50% );
	border-radius: 999px;
	background: var( --kbeu-tl-line );
	pointer-events: none;
}

/* One explicit column as wide as the slot: an implicit `auto` column would grow to
   the (wider) card and push both the card and the ring off the slot's center. */
.kbeu-history-timeline__item {
	position: relative;
	display: grid;
	grid-template-columns: 100%;
	grid-template-rows: 1fr auto 1fr;
	flex: 0 0 var( --kbeu-tl-pitch );
	width: var( --kbeu-tl-pitch );
	margin: 0;
	padding: 0;
}

.kbeu-history-timeline__dot {
	grid-row: 2;
	justify-self: center;
	box-sizing: border-box;
	width: var( --kbeu-tl-ring );
	height: var( --kbeu-tl-ring );
	border: var( --kbeu-tl-ring-border ) solid var( --kbeu-tl-teal );
	border-radius: 50%;
	background: #fff;
}

/* --- Card ---------------------------------------------------------------- */

/* Wider than the item's slot, centered on the ring: it overflows the slot on both
   sides, which is fine because the neighbours sit on the other side of the line. */
.kbeu-history-timeline__card {
	--kbeu-tl-card-pad-x: clamp( 18px, 1.1vw, 28px );
	position: relative;
	box-sizing: border-box;
	justify-self: center;
	width: var( --kbeu-tl-card );
	padding: 0 var( --kbeu-tl-card-pad-x ) clamp( 20px, 1.37vw, 35px );
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.09 );
	overflow: hidden;
}

/* Teal bar along the top edge (a rounded pill in the design, cut by the card): it
   reaches the card's sides through negative margins and its bottom margin is the
   distance to the year. */
.kbeu-history-timeline__card::before {
	content: '';
	display: block;
	height: clamp( 8px, 0.68vw, 17px );
	margin: 0 calc( -1 * var( --kbeu-tl-card-pad-x ) ) clamp( 16px, 1.05vw, 27px );
	border-radius: 14px;
	background: var( --kbeu-tl-teal );
}

/* Odd milestones hang below the line, even ones stand above it (design: 1890 below,
   1922 above, ...). */
.kbeu-history-timeline__item:nth-child( odd ) .kbeu-history-timeline__card {
	grid-row: 3;
	align-self: start;
	margin-top: var( --kbeu-tl-gap );
}

.kbeu-history-timeline__item:nth-child( even ) .kbeu-history-timeline__card {
	grid-row: 1;
	align-self: end;
	margin-bottom: var( --kbeu-tl-gap );
}

/* The type scales at the card's own rate (the vw term reaches the Figma size at
   2560px), so a narrower card keeps the design's proportions instead of getting
   crammed with large text. */
.kbeu-history-timeline__year {
	margin: 0 0 clamp( 10px, 0.9vw, 23px );
	font-weight: 700;
	font-size: clamp( 26px, 1.56vw, 40px );
	line-height: 1.37;
	color: var( --kbeu-tl-teal );
}

.kbeu-history-timeline__text {
	margin: 0;
	font-weight: 300;
	font-size: clamp( 15px, 0.94vw, 24px );
	line-height: 1.55;
	color: var( --kbeu-tl-ink );
}

.kbeu-history-timeline__text strong,
.kbeu-history-timeline__text b {
	font-weight: 700;
}

/* --- Progress bar -------------------------------------------------------- */

.kbeu-history-timeline__progress {
	position: relative;
	width: 78.5%;
	height: var( --kbeu-tl-line-size );
	margin: clamp( 24px, 1.9vw, 48px ) auto 0;
	border-radius: 999px;
	background: var( --kbeu-tl-line );
	overflow: hidden;
}

/* Its size and position mirror the visible share of the track (set by the script). */
.kbeu-history-timeline__thumb {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	border-radius: 999px;
	background: var( --kbeu-tl-thumb );
	transition: left 0.2s ease, width 0.2s ease;
}

/* --- Arrows -------------------------------------------------------------- */

.kbeu-history-timeline__control {
	display: flex;
	justify-content: center;
	gap: 14px;
	margin-top: clamp( 20px, 1.7vw, 43px );
}

.kbeu-history-timeline__progress[hidden],
.kbeu-history-timeline__control[hidden] {
	display: none;
}

/* --- Editor placeholder -------------------------------------------------- */

.kbeu-history-timeline__placeholder {
	margin: 0;
	padding: 24px;
	border: 1px dashed #b5b5b5;
	border-radius: 14px;
	color: #6d6d6d;
	text-align: center;
}

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

@media ( max-width: 720px ) {
	.kbeu-history-timeline {
		--kbeu-tl-pitch: 150px;
		--kbeu-tl-card: 230px;
		--kbeu-tl-ring: 28px;
		--kbeu-tl-gap: 32px;
	}

	.kbeu-history-timeline__progress {
		width: 100%;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.kbeu-history-timeline__thumb {
		transition: none;
	}
}
