/* SJRA Hero Slider */

.chs-slider {
	--chs-heading-font: "DM Sans", "Helvetica Neue", Arial, sans-serif;
	--chs-body-font: "DM Sans", "Helvetica Neue", Arial, sans-serif;
	--chs-text: #222D68;
	--chs-heading-color: #222D68;
	--chs-subtext-color: #006394;
	--chs-tagline-color: #222D68;
	--chs-divider: #FFBE9F;
	--chs-gutter: max(24px, 3.2cqw);

	position: relative;
	width: 100%;
	container-type: inline-size;
	overflow: hidden;
	background: #fff;
	color: var(--chs-text);
	font-family: var(--chs-body-font);
}

/*
 * container-type gives the slider no intrinsic width, so inside a shrink-to-fit
 * wrapper (e.g. an Elementor widget in a flex container) it collapses to 0px.
 * Force the wrappers to fill the row.
 */
:where(.elementor-widget, .elementor-widget-container, .elementor-shortcode, .wp-block-shortcode):has(> .chs-slider),
.elementor-widget:has(.chs-slider) {
	width: 100%;
	max-width: 100%;
	flex-grow: 1;
	align-self: stretch;
}

.chs-slider *,
.chs-slider *::before,
.chs-slider *::after {
	box-sizing: border-box;
}

/* Slides are stacked in one grid cell and cross-faded. */
.chs-track {
	display: grid;
}

.chs-slide {
	grid-area: 1 / 1;
	position: relative;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

.chs-slide.is-active {
	z-index: 1;
	opacity: 1;
	visibility: visible;
	transition: opacity 0.8s ease, visibility 0s;
}

/* ---------- Media ---------- */

.chs-media {
	position: relative;
}

.chs-media picture,
.chs-image {
	display: block;
	width: 100%;
	height: 100%;
}

.chs-slider .chs-image {
	max-width: none;
	object-fit: cover;
	object-position: right center;
	height: 100%;
	min-height: 390px;
}

.chs-caption {
	position: absolute;
	right: var(--chs-gutter);
	bottom: max(16px, 2.6cqw);
	z-index: 2;
	margin: 0;
	color: #fff;
	text-align: right;
	line-height: 1.05;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
	padding: 12px 16px;
	border-radius: 8px;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chs-caption__name {
	display: block;
	font-size: clamp(18px, 1.9cqw, 28px);
	font-weight: 700;
}

.chs-caption__role {
	display: block;
	font-size: clamp(13px, 1.25cqw, 18px);
}

/* ---------- Content ---------- */

.chs-content {
	position: relative;
	z-index: 1;
}

.chs-slider .chs-heading {
	margin: 0;
	color: var(--chs-heading-color);
	font-family: var(--chs-heading-font);
	/* 46px at the 1512px design width. */
	font-size: clamp(28px, 3.05cqw, 46px);
	font-weight: 700 !important;
	line-height: 1.18;
	letter-spacing: -0.02em;
}

.chs-heading__accent {
	display: block;
	color: var(--chs-accent);
}

.chs-heading em {
	color: var(--chs-accent);
	font-style: italic;
}

.chs-divider {
	display: block;
	width: 100%;
	height: 2px;
	margin: max(14px, 1.6cqw) 0;
	background: var(--chs-divider);
}

.chs-slider .chs-subtext {
	margin: max(10px, 1.2cqw) 0 0;
	color: var(--chs-subtext-color);
	/* 28px / 38px at the 1512px design width. */
	font-size: clamp(17px, 1.85cqw, 28px);
	font-weight: 400;
	line-height: 1.357;
}

.chs-slider .chs-tagline--desktop {
	margin: 0;
	color: var(--chs-tagline-color);
	/* 20px / 30px at the 1512px design width. */
	font-size: clamp(14px, 1.32cqw, 20px);
	font-weight: 700;
	line-height: 1.5;
}

.chs-slider .chs-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: max(20px, 3.3cqw);
	padding: 1.3em 3.3em;
	border: 0;
	border-radius: 0;
	background: var(--chs-button);
	color: #fff;
	font-family: var(--chs-body-font);
	font-size: clamp(13px, 1.12cqw, 17px);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	transition: filter 0.2s ease;
}

.chs-slider .chs-button:hover,
.chs-slider .chs-button:focus-visible {
	color: #fff;
	filter: brightness(0.9);
}

.chs-slider .chs-button:focus-visible,
.chs-dot:focus-visible {
	outline: 2px solid var(--chs-text);
	outline-offset: 3px;
}

.chs-mobile-only {
	display: none;
}

/* ---------- Dots ---------- */

.chs-dots {
	position: absolute;
	left: var(--chs-gutter);
	bottom: calc(max(14px, 2cqw) + 20px);
	z-index: 3;
	display: flex;
	gap: 10px;
}

/* !important: themes/Elementor kits style every <button> globally. */
.chs-slider button.chs-dot {
	flex: none;
	width: 10px !important;
	height: 10px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: var(--chs-dot, rgba(28, 28, 28, 0.22)) !important;
	box-shadow: var(--chs-dot-shadow, none) !important;
	font-size: 0 !important;
	line-height: 0 !important;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.chs-slider button.chs-dot:hover {
	--chs-dot: rgba(28, 28, 28, 0.45);
}

.chs-slider button.chs-dot.is-active {
	--chs-dot: var(--chs-text);
	transform: scale(1.15);
}

/* ---------- Desktop / tablet ---------- */

@media (min-width: 768px) {
	.chs-slide {
		/* 1512×676 design ratio, but never shorter than 380px (aspect-ratio + min-height would widen the slide). */
		height: max(380px, 100cqw * 676 / 1512);
	}

	.chs-media {
		position: absolute;
		inset: 0;
	}

	.chs-content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		/* Design: 540px text column starting 90px from the left at 1512px wide. */
		width: calc(6cqw + 35.7cqw);
		height: 100%;
		padding: 0 0 max(24px, 2cqw) 6cqw;
		text-align: center;
	}

	.chs-content > .chs-heading,
	.chs-content > .chs-divider,
	.chs-content > .chs-subtext,
	.chs-content > .chs-tagline {
		width: 100%;
	}

	.chs-content > .chs-tagline {
		max-width: 34cqw;
		margin-top: 0.3cqw;
	}

	/* Design: caption sits beside the subject, not in the corner. */
	.chs-caption--beside {
		right: 15.2cqw;
		bottom: 7.3cqw;
	}

	.chs-caption--corner {
		right: auto;
		left: 75.6cqw;
		bottom: 4.6cqw;
		text-align: left;
		line-height: 1.35;
	}

	.chs-caption--corner .chs-caption__role {
		font-size: clamp(14px, 1.55cqw, 23px);
	}
}

/* Tablet: the image gets cropped by min-height, so keep a white wash behind the text. */
@media (min-width: 768px) and (max-width: 1100px) {
	.chs-media::after {
		content: "";
		position: absolute;
		inset: 0;
		background: linear-gradient(90deg, #fff 0%, #fff 34%, rgba(255, 255, 255, 0.85) 46%, rgba(255, 255, 255, 0) 62%);
		pointer-events: none;
	}

	.chs-content {
		width: 50%;
		padding-left: var(--chs-gutter);
	}
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
	/* Mobile images keep their own proportions (no cropping). */
	.chs-media {
		overflow: hidden;
	}

	.chs-slider .chs-image {
		height: auto;
	}

	/* Same content and order as desktop, centered. */
	.chs-content {
		padding: 26px 20px 24px;
		text-align: center;
	}

	.chs-slider .chs-subtext {
		font-size: 19px;
		line-height: 1.4;
	}

	.chs-slider .chs-tagline--desktop {
		font-size: 16px;
		line-height: 1.5;
	}

	.chs-slider .chs-heading {
		font-size: clamp(26px, 7.4cqw, 34px);
		line-height: 1.18;
	}

	.chs-slider .chs-heading--mobile {
		font-weight: 400;
	}

	.chs-heading--mobile em {
		font-weight: 500;
	}

	.chs-desktop-only {
		display: none;
	}

	.chs-mobile-only {
		display: block;
	}

	.chs-mobile-text {
		margin-top: 16px;
		color: #4C4C4C;
		font-size: 16px;
		line-height: 1.45;
	}

	.chs-mobile-text p {
		margin: 0 0 14px;
	}

	.chs-mobile-text .chs-tagline {
		margin: 0;
		font-weight: 700;
	}

	.chs-slider .chs-button {
		margin-top: 22px;
		padding: 1.15em 2.4em;
		font-size: 15px;
	}

	/*
	 * Slides have different text lengths on mobile, so take the hidden ones out
	 * of the flow: the slider height follows the active slide and the dots sit
	 * right below its button.
	 */
	.chs-track {
		position: relative;
	}

	.chs-slide:not(.is-active) {
		position: absolute;
		top: 0;
		right: 0;
		left: 0;
	}

	.chs-dots {
		position: static;
		justify-content: center;
		padding: 0 20px 28px;
	}

	.chs-caption {
		right: 16px;
		bottom: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chs-slide,
	.chs-slide.is-active,
	.chs-button {
		transition: none;
	}
}
