/**
 * RSI Toolkit — Initiatives Cards Pro widget.
 *
 * Content-only horizontal carousel of cards (image on top + coloured body with
 * title & copy). The "active" card shows in the brand-blue gradient; the rest
 * are grey. Section background + padding come from the Elementor container.
 * Baked to the 2026 Figma "Year of Achievements" cards. Colours are driven by
 * CSS variables so the Style-tab controls can override them.
 */

.rsi-ipro {
	/* Base card colours (fallback when no fill image is set). */
	--ipro-card: #63656c;
	--ipro-active: #005cff;
	/* Card-fill background images — the Figma arc/swoosh "shadow" fills. Set per
	   instance (grey for inactive, blue/red for the active card). Default none,
	   so the solid colour shows if no image is chosen. */
	--ipro-card-img: none;
	--ipro-active-img: none;
	--ipro-title: #ffffff;
	--ipro-text: rgba(255, 255, 255, .82);
	position: relative;
}

/* Drag/scroll rail with a peek of the next card. The right edge bleeds to the
   viewport (0 right padding) so cards run off-screen and you scroll/drag left,
   like the home-page carousels. In RTL this flips to the left (see rtl.css). */
.rsi-ipro__rail {
	display: flex;
	align-items: stretch;
	gap: 24px;
	overflow-x: auto;
	scrollbar-width: none;
	scroll-snap-type: x mandatory;
	padding-bottom: 6px;
	margin-right: calc(50% - 50vw);
	-webkit-overflow-scrolling: touch;
}

.rsi-ipro__rail::-webkit-scrollbar {
	display: none;
}

.rsi-ipro__card {
	position: relative;
	flex: 0 0 400px;
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	border-radius: 12px;
	overflow: hidden;
	background-color: var(--ipro-card);
	background-image: var(--ipro-card-img);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Active card = brand-blue gradient, crossfaded over the grey via an overlay
   (a gradient can't transition directly). Toggled by the .is-active class the
   carousel JS moves to whichever card is at the leading edge. */
.rsi-ipro__card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-color: var(--ipro-active, #005cff);
	background-image: var(--ipro-active-img);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	/* Blue/active-ness is driven by --rsi-blue (0..1). Desktop toggles it 0/1
	   with the .4s crossfade; mobile drives it continuously with scroll. */
	opacity: var(--rsi-blue, 0);
	transition: opacity .4s ease;
	pointer-events: none;
}

.rsi-ipro__thumb {
	position: relative;
	z-index: 1;
	height: 245px;
	overflow: hidden;
	flex: 0 0 auto;
	background: rgba(255, 255, 255, .06);
}

/* width/height forced so Woodmart's `img { height: auto !important }` can't
   letterbox the photo (same fix as the other card widgets). */
.rsi-ipro__thumb img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	display: block;
}

/* Multi-image card: stack the slides and gently crossfade between them (JS
   toggles .is-shown on a timer). */
.rsi-ipro__thumb--slides {
	position: relative;
}

.rsi-ipro__thumb--slides img {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity .9s ease;
}

.rsi-ipro__thumb--slides img.is-shown {
	opacity: 1;
}

.rsi-ipro__body {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 15px;
	padding: 32px;
}

.rsi-ipro__title {
	font-family: 'Alexandria', sans-serif;
	font-weight: 700;
	font-size: 24px;
	line-height: 1.35;
	margin: 0;
	color: var(--ipro-title);
}

.rsi-ipro__text {
	font-family: 'Alexandria', sans-serif;
	font-weight: 400;
	font-size: 16px;
	line-height: 27px;
	letter-spacing: .5px;
	margin: 0;
	color: var(--ipro-text);
}

/* Controls row: optional pill button + scroll arrows. */
.rsi-ipro__controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-top: 28px;
}

.rsi-ipro__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: 'Alexandria', sans-serif;
	font-weight: 600;
	font-size: 15px;
	letter-spacing: .3px;
	color: #fff !important;
	background: #171c1f;
	border-radius: 999px;
	padding: 13px 26px;
	text-decoration: none !important;
	transition: filter .15s;
}

.rsi-ipro__btn:hover {
	filter: brightness(1.15);
	color: #fff !important;
}

.rsi-ipro__arrows {
	display: flex;
	align-items: center;
	gap: 12px;
}

.rsi-ipro__arrow {
	width: 46px;
	height: 46px;
	border-radius: 999px;
	background: #fff;
	border: 1px solid rgba(11, 18, 32, .14);
	color: #0a0a0a;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .15s, filter .15s;
}

.rsi-ipro__arrow:hover {
	transform: translateY(-1px);
	filter: brightness(.97);
}

.rsi-ipro__arrow svg {
	width: 22px;
	height: 22px;
}

/* Mobile: swap the horizontal carousel for a vertical scroll-stacking deck.
   Each card pins (position: sticky) at the same top, and the JS scales down
   each card as the next rises to cover it — a receding deck — while the last
   card stays full size so the stack ends on just that card. The infinite loop
   is desktop-only: it never clones here, and any clones made at a wider
   viewport are hidden/removed so the stack never repeats the cards. The JS
   marks the frontmost pinned card .is-active (blue); the rest stay grey. */
@media (max-width: 767px) {
	.rsi-ipro__rail {
		display: block;
		overflow: visible;
		margin: 0;
		padding-bottom: 0;
		scroll-snap-type: none;
	}

	/* Loop is desktop-only — never show clones in the mobile stack. */
	.rsi-ipro__rail .rsi-loop-clone {
		display: none !important;
	}

	.rsi-ipro__card {
		width: 100%;
		flex-basis: auto;
		position: sticky;
		top: 84px;
		margin-bottom: 20px;
		box-shadow: 0 -6px 20px rgba(0, 0, 0, .12);
		/* Scale toward the top so the pinned top edge stays at `top` and passed
		   cards tuck up behind the covering card. */
		transform-origin: top center;
		will-change: transform;
	}

	/* Mobile: the blue/grey crossfade is driven directly by scroll, so drop the
	   time-based transition to keep it locked to the finger. */
	.rsi-ipro__card::before {
		transition: none;
	}

	.rsi-ipro__arrows {
		display: none;
	}

	.rsi-ipro__controls {
		justify-content: center;
		margin-top: 12px;
	}
}
