/**
 * Animated 4 Column Carousel for Elementor
 * All selectors are prefixed with a4cc- to avoid theme/plugin conflicts.
 *
 * Custom properties (set by the Elementor controls, with fallbacks here):
 *   --a4cc-gap, --a4cc-slide-height, --a4cc-radius, --a4cc-duration, --a4cc-overlay-opacity
 */

.a4cc-carousel {
	position: relative;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-template-rows: minmax(0, 1fr);
	gap: var(--a4cc-gap, 18px);
	width: 100%;
	max-width: 100%;
	height: 80vh;
	overflow: hidden;
	box-sizing: border-box;
}

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

/* One independent column */
.a4cc-carousel .a4cc-column {
	position: relative;
	display: block;
	min-width: 0;
	min-height: 0;
	height: 100%;
	overflow: hidden;
}

/* The moving track holds two identical groups; moving it by -50% = one full group = seamless loop. */
.a4cc-carousel .a4cc-track {
	display: block;
	margin: 0;
	padding: 0;
	will-change: transform;
	backface-visibility: hidden;
	transform: translate3d(0, 0, 0);
	animation-duration: calc(var(--a4cc-duration, 18s) * var(--a4cc-repeat, 1));
	animation-timing-function: linear;
	animation-iteration-count: infinite;
}

.a4cc-carousel .a4cc-track--down {
	animation-name: a4cc-move-down;
}

.a4cc-carousel .a4cc-track--up {
	animation-name: a4cc-move-up;
}

/* Flex (not block) so the last slide's bottom margin is part of the group height: no jump at the loop point. */
.a4cc-carousel .a4cc-group {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
}

/* Pause only the hovered column */
.a4cc-carousel.a4cc-pause-hover .a4cc-column:hover .a4cc-track {
	animation-play-state: paused;
}

/* Used by the mouse-wheel script while it controls the column manually */
.a4cc-carousel .a4cc-track.a4cc-is-manual {
	animation-name: none !important;
}

/* Paused by the script while the carousel is off-screen */
.a4cc-carousel.a4cc-is-offscreen .a4cc-track {
	animation-play-state: paused;
}

/* Slide */
.a4cc-carousel .a4cc-slide {
	position: relative;
	display: block;
	flex: 0 0 auto;
	width: 100%;
	height: var(--a4cc-slide-height, 260px);
	margin: 0 0 var(--a4cc-gap, 18px);
	padding: 0;
	overflow: hidden;
	border-radius: var(--a4cc-radius, 18px);
	background-color: #1d1d1f;
	color: #fff;
	text-decoration: none;
	isolation: isolate;
	box-shadow: none;
}

.a4cc-carousel a.a4cc-slide:hover,
.a4cc-carousel a.a4cc-slide:focus {
	color: #fff;
	text-decoration: none;
}

.a4cc-carousel .a4cc-slide .a4cc-image {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center;
	vertical-align: top;
}

/* Gradient: transparent -> rgba(0,0,0, overlay opacity) */
.a4cc-carousel .a4cc-slide .a4cc-overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(0, 0, 0, var(--a4cc-overlay-opacity, 0.85)) 0%, rgba(0, 0, 0, 0) 70%);
	pointer-events: none;
}

.a4cc-carousel .a4cc-slide .a4cc-content {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	padding: 18px 20px;
	text-align: left;
}

.a4cc-carousel .a4cc-slide .a4cc-title {
	margin: 0 0 6px;
	padding: 0;
	color: #fff;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
}

.a4cc-carousel .a4cc-slide .a4cc-description {
	margin: 0;
	padding: 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	line-height: 1.5;
}

.a4cc-carousel .a4cc-slide .a4cc-title:last-child {
	margin-bottom: 0;
}

/* Keyboard focus on linked slides */
.a4cc-carousel a.a4cc-slide:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

/* Editor placeholder */
.a4cc-empty-notice {
	padding: 24px;
	border: 1px dashed #b4b9be;
	border-radius: 6px;
	background: #f6f7f7;
	color: #50575e;
	font-size: 14px;
	text-align: center;
}

/* Elementor wrapper: never allow horizontal overflow */
.elementor-widget-a4cc_animated_carousel {
	max-width: 100%;
	min-width: 0;
}

.elementor-widget-a4cc_animated_carousel > .elementor-widget-container {
	max-width: 100%;
	overflow: hidden;
}

/* Same keyframes as the original design */
@keyframes a4cc-move-down {
	0% {
		transform: translate3d(0, -50%, 0);
	}

	100% {
		transform: translate3d(0, 0, 0);
	}
}

@keyframes a4cc-move-up {
	0% {
		transform: translate3d(0, 0, 0);
	}

	100% {
		transform: translate3d(0, -50%, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.a4cc-carousel .a4cc-track {
		animation: none;
		transform: none;
	}

	.a4cc-carousel .a4cc-column {
		overflow-y: auto;
		scrollbar-width: none;
	}

	.a4cc-carousel .a4cc-column::-webkit-scrollbar {
		display: none;
	}

	/* Show only the real set, not the duplicate. */
	.a4cc-carousel .a4cc-group[aria-hidden="true"] {
		display: none;
	}
}
