/**
 * TMT Carousel
 *
 * Every selector below is scoped inside `.tmt-carousel`, and every custom
 * property is prefixed `--tmt-carousel-`. Nothing here can reach Elementor's
 * own carousel, Swiper, Slick or any other slider on the site.
 *
 * Two things about specificity, both deliberate:
 *
 * 1. Rules that style a button, link, image or heading are written as
 *    `.tmt-carousel .tmt-carousel__x` (two classes). A theme or an Elementor
 *    global kit styles bare elements as `.elementor-kit-12 button`, which is
 *    one class plus one element -- weaker than two classes, so the carousel
 *    keeps its own look instead of inheriting site button chrome.
 * 2. Those rules still lose to the widget's own controls, because Elementor
 *    writes them as `.elementor-element.elementor-element-ID .tmt-carousel...`,
 *    which is stronger again. Admin settings always win.
 *
 * The values on `.tmt-carousel` are only defaults; the controls re-declare the
 * same custom properties on the widget wrapper.
 */

.tmt-carousel {
	/* Frame */
	--tmt-carousel-height: 620px;
	--tmt-carousel-max-width: 100%;
	--tmt-carousel-align: center;
	--tmt-carousel-transition: 600ms;
	--tmt-carousel-stage-bg: #e8eef2;
	--tmt-carousel-focus: #007cbd;

	/* Image */
	--tmt-carousel-object-fit: cover;
	--tmt-carousel-object-position: center center;
	--tmt-carousel-overlay-from: rgba(19, 33, 45, 0);
	--tmt-carousel-overlay-to: rgba(19, 33, 45, 0);

	/* Slide content */
	--tmt-carousel-content-items: flex-start;
	--tmt-carousel-content-justify: flex-end;
	--tmt-carousel-content-width: 58%;
	--tmt-carousel-content-pad-top: 48px;
	--tmt-carousel-content-pad-right: 48px;
	--tmt-carousel-content-pad-bottom: 40px;
	--tmt-carousel-content-pad-left: 48px;
	--tmt-carousel-content-gap: 12px;
	--tmt-carousel-title-color: #ffffff;
	--tmt-carousel-text-color: rgba(255, 255, 255, 0.82);
	--tmt-carousel-link-color: #ffffff;
	--tmt-carousel-link-accent: #007cbd;

	/* Navigation bar */
	--tmt-carousel-nav-offset: 20px;
	--tmt-carousel-nav-inline: 0px;
	--tmt-carousel-nav-gap: 14px;
	--tmt-carousel-nav-bg: transparent;
	--tmt-carousel-nav-pad-block: 0px;

	/* Indicators */
	--tmt-carousel-dot-color: #b6c7d9;
	--tmt-carousel-dot-active-color: #007cbd;
	--tmt-carousel-dot-track: #d9e4ec;
	--tmt-carousel-dot-hover-color: #8fa9c0;
	--tmt-carousel-dot-size: 8px;
	--tmt-carousel-dot-active-width: 30px;
	--tmt-carousel-dot-gap: 8px;

	/* Arrows */
	--tmt-carousel-arrow-size: 26px;
	--tmt-carousel-arrow-icon: 16px;
	--tmt-carousel-arrow-gap: 10px;
	--tmt-carousel-arrow-radius: 50%;
	--tmt-carousel-arrow-border-width: 0px;
	--tmt-carousel-arrow-color: #213747;
	--tmt-carousel-arrow-bg: transparent;
	--tmt-carousel-arrow-border: transparent;
	--tmt-carousel-arrow-hover-color: #007cbd;
	--tmt-carousel-arrow-hover-bg: transparent;
	--tmt-carousel-arrow-hover-border: transparent;

	/* Play / pause */
	--tmt-carousel-play-size: 22px;
	--tmt-carousel-play-icon: 15px;
	--tmt-carousel-play-radius: 50%;
	--tmt-carousel-play-color: #213747;
	--tmt-carousel-pause-color: #213747;
	--tmt-carousel-play-bg: transparent;
	--tmt-carousel-play-border: transparent;
	--tmt-carousel-play-hover-color: #007cbd;
	--tmt-carousel-play-hover-bg: transparent;
	--tmt-carousel-play-hover-border: transparent;

	display: flex;
	justify-content: var(--tmt-carousel-align);
	max-width: 100%;
}

.tmt-carousel *,
.tmt-carousel *::before,
.tmt-carousel *::after {
	box-sizing: border-box;
}

.tmt-carousel .tmt-carousel__frame {
	position: relative;
	width: 100%;
	max-width: min(100%, var(--tmt-carousel-max-width));
	min-width: 0;
}

/* ---------------------------------------------------------------------------
 * Stage
 * ------------------------------------------------------------------------ */

.tmt-carousel .tmt-carousel__wrapper {
	position: relative;
	height: var(--tmt-carousel-height);
	max-width: 100%;
	overflow: hidden;
	background-color: var(--tmt-carousel-stage-bg);
}

.tmt-carousel .tmt-carousel__slides {
	position: absolute;
	inset: 0;
	/*
	 * pan-y hands vertical gestures back to the browser, so a swipe on the
	 * carousel never blocks normal page scrolling; the script only reacts to
	 * horizontal movement.
	 */
	touch-action: pan-y;
}

.tmt-carousel .tmt-carousel__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	z-index: 1;
	transition:
		opacity var(--tmt-carousel-transition) ease,
		visibility var(--tmt-carousel-transition) ease;
}

.tmt-carousel .tmt-carousel__slide.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	z-index: 2;
}

.tmt-carousel .tmt-carousel__media {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.tmt-carousel .tmt-carousel__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image: linear-gradient(
		to top,
		var(--tmt-carousel-overlay-from) 0%,
		var(--tmt-carousel-overlay-to) 100%
	);
	pointer-events: none;
}

.tmt-carousel .tmt-carousel__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: var(--tmt-carousel-object-fit);
	object-position: var(--tmt-carousel-object-position);
	/*
	 * No idle transform here on purpose. A `transform: scale(1.015)` with a
	 * transition used to sit on every image to smooth the crossfade, but a
	 * transformed image is promoted to its own compositor layer and rasterised
	 * at that layer's scale, which is what made photographs look soft next to
	 * the live site. Drawing the image untransformed lets the browser sample
	 * the source at its native resolution.
	 */
}

/*
 * Slide effect. Parked slides sit one frame-width to the right, opaque but
 * clipped away by the wrapper's overflow; the script moves the incoming one to
 * the correct side before activating it, so Next enters from the right and
 * Previous from the left. `is-leaving` keeps the outgoing slide on screen for
 * the length of the transition while it travels the other way.
 */
.tmt-carousel--effect-slide .tmt-carousel__slide {
	opacity: 1;
	visibility: visible;
	transform: translateX(100%);
	transition: transform var(--tmt-carousel-transition) cubic-bezier(0.45, 0, 0.15, 1);
}

.tmt-carousel--effect-slide .tmt-carousel__slide.is-active {
	transform: translateX(0);
}

.tmt-carousel--effect-slide .tmt-carousel__slide.is-leaving {
	z-index: 1;
	pointer-events: none;
}

/* Fade effect: the outgoing slide simply stays visible while it fades. */
.tmt-carousel--effect-fade .tmt-carousel__slide.is-leaving {
	opacity: 0;
	visibility: visible;
	z-index: 1;
	pointer-events: none;
}

/* Optional slow drift on the visible slide only. */
.tmt-carousel--zoom .tmt-carousel__slide.is-active .tmt-carousel__image {
	animation: tmt-carousel-zoom 14s ease-out forwards;
}

@keyframes tmt-carousel-zoom {
	from {
		transform: scale(1);
	}

	to {
		transform: scale(1.08);
	}
}

/* ---------------------------------------------------------------------------
 * Slide content
 * ------------------------------------------------------------------------ */

.tmt-carousel__content {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: var(--tmt-carousel-content-items);
	justify-content: var(--tmt-carousel-content-justify);
	gap: var(--tmt-carousel-content-gap);
	padding:
		var(--tmt-carousel-content-pad-top)
		var(--tmt-carousel-content-pad-right)
		var(--tmt-carousel-content-pad-bottom)
		var(--tmt-carousel-content-pad-left);
	text-align: left;
	opacity: 0;
	transform: translateY(14px);
	transition:
		opacity var(--tmt-carousel-transition) ease,
		transform var(--tmt-carousel-transition) ease;
}

.tmt-carousel .tmt-carousel__slide.is-active .tmt-carousel__content {
	opacity: 1;
	transform: none;
	transition-delay: calc(var(--tmt-carousel-transition) * 0.25);
}

/* The content already travels with the slide, so it does not need its own
 * entrance -- and a delayed fade would arrive after the movement had finished. */
.tmt-carousel--effect-slide .tmt-carousel__content {
	opacity: 1;
	transform: none;
	transition: none;
}

/*
 * Room for the navigation bar when it is overlaid: without this the last line
 * of a description can sit underneath the indicators on short frames. When the
 * bar sits below the image there is nothing to clear.
 */
.tmt-carousel--bar-overlay .tmt-carousel__content {
	padding-bottom: calc(
		var(--tmt-carousel-content-pad-bottom) + var(--tmt-carousel-nav-offset) +
		max(var(--tmt-carousel-arrow-size), var(--tmt-carousel-play-size), 24px)
	);
}

.tmt-carousel .tmt-carousel__title,
.tmt-carousel .tmt-carousel__text,
.tmt-carousel .tmt-carousel__link {
	max-width: var(--tmt-carousel-content-width);
}

.tmt-carousel .tmt-carousel__title {
	margin: 0;
	color: var(--tmt-carousel-title-color);
}

/* Sizing sits at lower specificity on purpose, so the Typography control --
 * and a site heading scale, if there is one -- can take over. */
.tmt-carousel__title {
	font-size: clamp(1.5rem, 2.6vw, 2.5rem);
	line-height: 1.16;
}

.tmt-carousel .tmt-carousel__text {
	margin: 0;
	color: var(--tmt-carousel-text-color);
}

.tmt-carousel__text {
	line-height: 1.6;
}

.tmt-carousel .tmt-carousel__text > *:first-child {
	margin-top: 0;
}

.tmt-carousel .tmt-carousel__text > *:last-child {
	margin-bottom: 0;
}

.tmt-carousel .tmt-carousel__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	color: var(--tmt-carousel-link-color);
	font-weight: 600;
	text-decoration: none;
	border-bottom: 2px solid var(--tmt-carousel-link-accent);
	padding-bottom: 3px;
	transition: color 0.25s ease, gap 0.25s ease;
}

.tmt-carousel .tmt-carousel__link:hover,
.tmt-carousel .tmt-carousel__link:focus-visible {
	color: var(--tmt-carousel-link-accent);
	gap: 12px;
}

.tmt-carousel .tmt-carousel__link-arrow {
	display: inline-flex;
	color: var(--tmt-carousel-link-accent);
}

.tmt-carousel .tmt-carousel__link-arrow .tmt-carousel__icon {
	width: 16px;
	height: 16px;
}

/* ---------------------------------------------------------------------------
 * Navigation bar
 * ------------------------------------------------------------------------ */

.tmt-carousel .tmt-carousel__navbar {
	z-index: 5;
}

.tmt-carousel--bar-overlay .tmt-carousel__navbar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: var(--tmt-carousel-nav-offset);
}

.tmt-carousel--bar-below .tmt-carousel__navbar {
	margin-top: var(--tmt-carousel-nav-offset);
}

.tmt-carousel .tmt-carousel__navbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tmt-carousel-nav-gap);
	min-width: 0;
	background-color: var(--tmt-carousel-nav-bg);
}

/* Padding is its own rule so the Bar Border Radius control, which writes a
 * different property to the same element, cannot collide with it. */
.tmt-carousel__navbar-inner {
	padding: var(--tmt-carousel-nav-pad-block) var(--tmt-carousel-nav-inline);
}

/* Play/Pause first, then the indicators, both flush left -- the reference
 * layout. `order` does the swap so the DOM keeps indicators before controls,
 * which is the better reading order for assistive technology. */
.tmt-carousel--arrange-compact .tmt-carousel__navbar-inner {
	justify-content: flex-start;
}

.tmt-carousel--arrange-compact .tmt-carousel__controls {
	order: -1;
}

.tmt-carousel--arrange-center .tmt-carousel__navbar-inner {
	flex-wrap: wrap;
	justify-content: center;
}

.tmt-carousel--arrange-right .tmt-carousel__navbar-inner {
	flex-direction: row-reverse;
}

.tmt-carousel .tmt-carousel__navigation {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	min-width: 0;
}

/*
 * Button reset. Two classes deep so a theme's or an Elementor kit's `button`
 * styling -- background, border, padding, radius -- cannot leak in and turn
 * these into site buttons.
 */
.tmt-carousel .tmt-carousel__dot,
.tmt-carousel .tmt-carousel__control {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font: inherit;
	color: inherit;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	min-width: 0;
	min-height: 0;
	width: auto;
	height: auto;
	cursor: pointer;
}

/*
 * The reset above is state-less and only two classes deep, so a theme or an
 * Elementor kit that styles `button:hover` -- `.elementor-kit-12 button:hover`,
 * which counts as two classes plus an element -- outranks it and paints site
 * button chrome behind these controls on hover, focus and while pressed.
 *
 * Repeating the neutral values per state, qualified by the element name, puts
 * this at the same three-class weight and lets it win on document order. Only
 * the properties a theme actually leaks are repeated; sizing, radius and
 * spacing stay in the blocks below so nothing else shifts.
 *
 * The widget's own colours are re-asserted further down at the same weight,
 * and Elementor writes panel settings higher again, so admin choices still win.
 */
.tmt-carousel button.tmt-carousel__dot:hover,
.tmt-carousel button.tmt-carousel__dot:focus,
.tmt-carousel button.tmt-carousel__dot:focus-visible,
.tmt-carousel button.tmt-carousel__dot:active,
.tmt-carousel button.tmt-carousel__control:hover,
.tmt-carousel button.tmt-carousel__control:focus,
.tmt-carousel button.tmt-carousel__control:focus-visible,
.tmt-carousel button.tmt-carousel__control:active {
	background: none;
	background-color: transparent;
	background-image: none;
	box-shadow: none;
	border-color: transparent;
	color: inherit;
	text-decoration: none;
}

.tmt-carousel :focus-visible {
	outline: 2px solid var(--tmt-carousel-focus);
	outline-offset: 3px;
}

/* Indicators -------------------------------------------------------------- */

/* Only the bar that actually animates gets its own layer. */
.tmt-carousel .tmt-carousel__dot.is-active .tmt-carousel__progress-bar {
	will-change: transform;
}

.tmt-carousel .tmt-carousel__dots {
	gap: var(--tmt-carousel-dot-gap);
	row-gap: 8px;
}

.tmt-carousel .tmt-carousel__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* Padding, not size, gives the larger touch target without fattening the dot. */
	padding: 7px 2px;
}

.tmt-carousel .tmt-carousel__dot-shape {
	display: block;
	position: relative;
	overflow: hidden;
	width: var(--tmt-carousel-dot-size);
	height: var(--tmt-carousel-dot-size);
	border-radius: 999px;
	background-color: var(--tmt-carousel-dot-color);
	transition: width 0.35s ease, background-color 0.3s ease;
}

.tmt-carousel button.tmt-carousel__dot:hover .tmt-carousel__dot-shape {
	background-color: var(--tmt-carousel-dot-hover-color);
}

.tmt-carousel .tmt-carousel__dot.is-active {
	cursor: default;
}

.tmt-carousel .tmt-carousel__dot.is-active .tmt-carousel__dot-shape {
	width: var(--tmt-carousel-dot-active-width);
}

/* Plain dots: the active one simply takes the active colour. */
.tmt-carousel--nav-dots .tmt-carousel__dot.is-active .tmt-carousel__dot-shape {
	background-color: var(--tmt-carousel-dot-active-color);
}

/*
 * Progress dots: the active dot becomes the track, and the bar inside it is
 * scaled from the same clock that advances the slides -- one source of truth,
 * so the fill and the transition cannot drift apart.
 */
.tmt-carousel--nav-dots-progress .tmt-carousel__dot.is-active .tmt-carousel__dot-shape {
	background-color: var(--tmt-carousel-dot-track);
}

.tmt-carousel .tmt-carousel__dot-shape .tmt-carousel__progress-bar {
	display: block;
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-color: var(--tmt-carousel-dot-active-color);
	transform: scaleX(0);
	transform-origin: left center;
}

/* Controls --------------------------------------------------------------- */

.tmt-carousel .tmt-carousel__controls {
	display: flex;
	align-items: center;
	gap: var(--tmt-carousel-arrow-gap);
	flex-shrink: 0;
}

.tmt-carousel .tmt-carousel__arrows {
	display: flex;
	align-items: center;
	gap: var(--tmt-carousel-arrow-gap);
}

.tmt-carousel .tmt-carousel__control {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border-style: solid;
	border-width: var(--tmt-carousel-arrow-border-width);
	transition:
		color 0.25s ease,
		background-color 0.25s ease,
		border-color 0.25s ease,
		transform 0.2s ease;
}

.tmt-carousel button.tmt-carousel__control:active {
	transform: scale(0.94);
}

.tmt-carousel button.tmt-carousel__arrow {
	width: var(--tmt-carousel-arrow-size);
	height: var(--tmt-carousel-arrow-size);
	border-radius: var(--tmt-carousel-arrow-radius);
	color: var(--tmt-carousel-arrow-color);
	background-color: var(--tmt-carousel-arrow-bg);
	border-color: var(--tmt-carousel-arrow-border);
}

.tmt-carousel .tmt-carousel__arrow .tmt-carousel__icon {
	width: var(--tmt-carousel-arrow-icon);
	height: var(--tmt-carousel-arrow-icon);
}

.tmt-carousel button.tmt-carousel__arrow:hover,
.tmt-carousel button.tmt-carousel__arrow:focus-visible {
	color: var(--tmt-carousel-arrow-hover-color);
	background-color: var(--tmt-carousel-arrow-hover-bg);
	border-color: var(--tmt-carousel-arrow-hover-border);
}

.tmt-carousel button.tmt-carousel__playpause {
	width: var(--tmt-carousel-play-size);
	height: var(--tmt-carousel-play-size);
	border-radius: var(--tmt-carousel-play-radius);
	background-color: var(--tmt-carousel-play-bg);
	border-color: var(--tmt-carousel-play-border);
}

.tmt-carousel button.tmt-carousel__playpause:hover,
.tmt-carousel button.tmt-carousel__playpause:focus-visible {
	background-color: var(--tmt-carousel-play-hover-bg);
	border-color: var(--tmt-carousel-play-hover-border);
	color: var(--tmt-carousel-play-hover-color);
}

.tmt-carousel .tmt-carousel__playpause .tmt-carousel__icon {
	width: var(--tmt-carousel-play-icon);
	height: var(--tmt-carousel-play-icon);
}

/*
 * Only one of the two icons is ever in the flow; the `is-playing` class on the
 * root is the single visual source of truth and is set by the same code that
 * starts and stops the timer.
 */
.tmt-carousel .tmt-carousel__play,
.tmt-carousel .tmt-carousel__pause {
	display: none;
	align-items: center;
	justify-content: center;
}

.tmt-carousel.is-playing .tmt-carousel__pause {
	display: inline-flex;
	color: var(--tmt-carousel-pause-color);
}

.tmt-carousel:not(.is-playing) .tmt-carousel__play {
	display: inline-flex;
	color: var(--tmt-carousel-play-color);
}

.tmt-carousel .tmt-carousel__playpause:hover .tmt-carousel__play,
.tmt-carousel .tmt-carousel__playpause:hover .tmt-carousel__pause,
.tmt-carousel .tmt-carousel__playpause:focus-visible .tmt-carousel__play,
.tmt-carousel .tmt-carousel__playpause:focus-visible .tmt-carousel__pause {
	color: var(--tmt-carousel-play-hover-color);
}

.tmt-carousel .tmt-carousel__icon {
	display: block;
	flex-shrink: 0;
}

/* Editor helper ---------------------------------------------------------- */

.tmt-carousel--empty {
	display: block;
}

.tmt-carousel .tmt-carousel__placeholder {
	margin: 0;
	padding: 32px;
	border: 1px dashed rgba(33, 55, 71, 0.35);
	border-radius: 8px;
	color: #213747;
	text-align: center;
}

/* ---------------------------------------------------------------------------
 * Responsive
 *
 * Sizes themselves are Elementor per-device controls; these rules only handle
 * layout reflow and overflow safety, which no control can express.
 * ------------------------------------------------------------------------ */

@media (max-width: 767px) {
	.tmt-carousel .tmt-carousel__navbar-inner {
		flex-wrap: wrap;
		row-gap: 12px;
	}

	/* The compact bar is narrow enough to stay on one line; the others are
	 * centred rather than pushed apart on a phone. */
	.tmt-carousel--arrange-split .tmt-carousel__navbar-inner,
	.tmt-carousel--arrange-right .tmt-carousel__navbar-inner {
		justify-content: center;
	}

	.tmt-carousel--arrange-split .tmt-carousel__navigation,
	.tmt-carousel--arrange-right .tmt-carousel__navigation,
	.tmt-carousel--arrange-center .tmt-carousel__navigation,
	.tmt-carousel--arrange-split .tmt-carousel__controls,
	.tmt-carousel--arrange-right .tmt-carousel__controls,
	.tmt-carousel--arrange-center .tmt-carousel__controls {
		justify-content: center;
		width: 100%;
	}

	/* Two rows of bar to clear when it is overlaid. */
	.tmt-carousel--bar-overlay.tmt-carousel--arrange-split .tmt-carousel__content,
	.tmt-carousel--bar-overlay.tmt-carousel--arrange-right .tmt-carousel__content,
	.tmt-carousel--bar-overlay.tmt-carousel--arrange-center .tmt-carousel__content {
		padding-bottom: calc(
			var(--tmt-carousel-content-pad-bottom) + var(--tmt-carousel-nav-offset) + 12px +
			max(var(--tmt-carousel-arrow-size), var(--tmt-carousel-play-size), 24px) * 2
		);
	}

	.tmt-carousel .tmt-carousel__title,
	.tmt-carousel .tmt-carousel__text,
	.tmt-carousel .tmt-carousel__link {
		max-width: 100%;
	}
}

/* ---------------------------------------------------------------------------
 * Reduced motion: transitions collapse, the drift stops. Timing, progress and
 * every control keep working -- the progress bar is information, not decoration.
 * ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.tmt-carousel .tmt-carousel__slide,
	.tmt-carousel .tmt-carousel__content,
	.tmt-carousel .tmt-carousel__image,
	.tmt-carousel .tmt-carousel__dot-shape,
	.tmt-carousel .tmt-carousel__control,
	.tmt-carousel .tmt-carousel__link {
		transition-duration: 1ms !important;
		transition-delay: 0ms !important;
	}

	.tmt-carousel--zoom .tmt-carousel__slide.is-active .tmt-carousel__image {
		animation: none;
	}

	.tmt-carousel button.tmt-carousel__control:active {
		transform: none;
	}
}
