/* ============================================================
 * MW Content Carousel Widget
 *
 * Carousel wrapper, navigation, dots, and animation.
 *
 * Card-level CSS classes are reused from:
 *   - post-carousel-widget.css  (for .mw-post-carousel__card)
 *   - video-carousel-widget.css (for .mw-video-carousel__card)
 *
 * Because those CSS files set custom properties on their own
 * wrapper selectors (.mw-post-carousel / .mw-video-carousel),
 * we must re-declare the same custom properties here so child
 * cards inherit correct values from .mw-content-carousel.
 * ============================================================ */

/* ── Custom Properties ── */
.mw-content-carousel {
	/* Post-card custom properties (mirrors .mw-post-carousel) */
	--mw-pc-card-bg: #ffffff;

	--mw-pc-cat-color: #2F31FC;
	--mw-pc-cat-font-size: 18px;

	--mw-pc-heading-color: #1a1a1a;
	--mw-pc-heading-hover-color: #2F31FC;
	--mw-pc-heading-font-size: 24px;
	--mw-pc-heading-line-height: 1.2;

	--mw-pc-excerpt-color: #555555;
	--mw-pc-excerpt-font-size: 0.875rem;
	--mw-pc-excerpt-line-height: 1.55;

	--mw-pc-cta-color: #2F31FC;
	--mw-pc-cta-font-size: 18px;
	--mw-pc-cta-hover-color: #2F31FC;

	--mw-pc-body-padding: 1.25rem;
	--mw-pc-transition-speed: 0.25s;

	/* Video-card custom properties (mirrors .mw-video-carousel) */
	--mw-vc-card-bg: #ffffff;

	--mw-vc-cat-color: #2F31FC;
	--mw-vc-cat-font-size: 18px;

	--mw-vc-heading-color: #1a1a1a;
	--mw-vc-heading-hover-color: #2F31FC;
	--mw-vc-heading-font-size: 24px;
	--mw-vc-heading-line-height: 1.2;

	--mw-vc-excerpt-color: #555555;
	--mw-vc-excerpt-font-size: 0.875rem;
	--mw-vc-excerpt-line-height: 1.55;

	--mw-vc-cta-color: #2F31FC;
	--mw-vc-cta-font-size: 18px;
	--mw-vc-cta-hover-color: #2F31FC;

	--mw-vc-body-padding: 1.25rem;
	--mw-vc-transition-speed: 0.25s;

	--mw-vc-play-icon-size: 60px;
	--mw-vc-play-icon-color: #ffffff;
	--mw-vc-play-icon-bg: rgba(47, 49, 252, 0.9);

	/* Carousel-level custom properties */
	--mw-cc-arrow-size: 48px;
	--mw-cc-arrow-bg: #ffffff;
	--mw-cc-arrow-color: #1a1a1a;
	--mw-cc-arrow-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	--mw-cc-arrow-hover-bg: #f5f5f5;

	--mw-cc-dot-color: #cccccc;
	--mw-cc-dot-active-color: #1a1a1a;

	--mw-cc-transition-speed: 0.25s;
}

/* ── Wrapper ── */
.mw-content-carousel {
	position: relative;
}

/* ── Swiper container ── */
.mw-content-carousel__swiper {
	overflow: hidden;
}

/* ── Swiper slide height equalisation ── */
.mw-content-carousel .swiper-wrapper {
	align-items: stretch;
}

.mw-content-carousel .swiper-slide {
	height: auto;
}

/* ── Navigation Arrows ── */
.mw-content-carousel__arrow {
	position: absolute;
	top: 50%;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--mw-cc-arrow-size);
	height: var(--mw-cc-arrow-size);
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: var(--mw-cc-arrow-bg);
	color: var(--mw-cc-arrow-color);
	box-shadow: var(--mw-cc-arrow-shadow);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background var(--mw-cc-transition-speed) ease,
	            box-shadow var(--mw-cc-transition-speed) ease,
	            opacity 0.3s ease,
	            visibility 0.3s ease;
}

.mw-content-carousel__arrow:hover {
	background: var(--mw-cc-arrow-hover-bg) !important;
	color: var(--mw-cc-arrow-color);
}

.mw-content-carousel__arrow:focus,
.mw-content-carousel__arrow:visited {
	background: var(--mw-cc-arrow-bg) !important;
	color: var(--mw-cc-arrow-color);
}

.mw-content-carousel__arrow:focus-visible {
	outline: 2px solid var(--mw-cc-arrow-color);
	outline-offset: 2px;
	background: var(--mw-cc-arrow-bg) !important;
}

.mw-content-carousel__arrow--prev {
	left: -20px;
}

.mw-content-carousel__arrow--next {
	right: -20px;
}

.mw-content-carousel__arrow.swiper-button-disabled {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* ── Pagination Dots ── */
.mw-content-carousel__pagination.swiper-pagination {
	position: relative;
	margin-top: 1.5rem;
	text-align: center;
}

.mw-content-carousel__pagination .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: var(--mw-cc-dot-color);
	opacity: 1;
	margin: 0 4px;
	transition: background var(--mw-cc-transition-speed) ease,
	            transform var(--mw-cc-transition-speed) ease;
}

.mw-content-carousel__pagination .swiper-pagination-bullet-active {
	background: var(--mw-cc-dot-active-color);
	transform: scale(1.25);
}

/* ── Responsive: pull arrows in on smaller screens ── */
@media (max-width: 1024px) {
	.mw-content-carousel__arrow--prev {
		left: 4px;
	}
	.mw-content-carousel__arrow--next {
		right: 4px;
	}
}

@media (max-width: 767px) {
	.mw-content-carousel__arrow {
		--mw-cc-arrow-size: 40px;
	}

	.mw-content-carousel__arrow--prev {
		left: 4px;
	}

	.mw-content-carousel__arrow--next {
		right: 4px;
	}
}

/* ============================================================
 * Entrance Animation (opt-in via .mw-animate-items)
 * ============================================================ */

.mw-content-carousel.mw-animate-items .swiper-slide {
	opacity: 0;
	transform: translateY(24px);
	transition:
		opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
		transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mw-content-carousel.mw-animate-items .swiper-slide.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Stagger visible slides */
.mw-content-carousel.mw-animate-items .swiper-slide:nth-child(2) { transition-delay: 0.15s; }
.mw-content-carousel.mw-animate-items .swiper-slide:nth-child(3) { transition-delay: 0.30s; }
.mw-content-carousel.mw-animate-items .swiper-slide:nth-child(4) { transition-delay: 0.45s; }

/* Skip animation in Elementor editor */
.elementor-editor-active .mw-content-carousel.mw-animate-items .swiper-slide {
	opacity: 1;
	transform: none;
	transition-delay: 0s;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.mw-content-carousel.mw-animate-items .swiper-slide {
		opacity: 1;
		transform: none;
		transition-delay: 0s;
	}
}
