/**
 * MXMEDIA Addons — Expandable Cards
 *
 * ANIMATION LAYERS:
 *   1. Card width transition (flex-grow animated)
 *   2. Card background zoom (subtle scale on active/hover)
 *   3. Overlay gradient darkening
 *   4. Tags: fade + slide down (with stagger)
 *   5. Title: subtle lift
 *   6. Description: max-height expand + fade
 *   7. Button: background darken + arrow icon slide
 *   8. Top-right arrows: crossfade idle <-> yellow
 *   9. Nav arrows: scale + shadow grow
 *
 * All colors / sizes use CSS variables so Elementor can override them.
 */

/* ==========================================================================
   1. Base wrapper
   ========================================================================== */
.mxm-ec-wrapper {
	width: 100%;
	position: relative;
	box-sizing: border-box;
}

.mxm-ec-wrapper *,
.mxm-ec-wrapper *::before,
.mxm-ec-wrapper *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   2. Layout container
   ========================================================================== */
.mxm-ec {
	--mxm-ec-active-flex: 2.2;
	--mxm-ec-columns: 4;
	--mxm-ec-overlay-top: rgba(0, 0, 0, 0.15);
	--mxm-ec-overlay-bottom: rgba(0, 0, 0, 0.55);
	--mxm-ec-overlay-bottom-active: rgba(0, 0, 0, 0.65);
	width: 100%;
}

.mxm-ec--grid {
	display: flex;
	gap: 16px;
}

/* ==========================================================================
   3. Card (the main animated container)
   ========================================================================== */
.mxm-ec__card {
	position: relative;
	display: block;
	height: 500px;
	min-width: 0;
	overflow: hidden;
	cursor: pointer;
	text-decoration: none;
	border-radius: 20px;
	/* We do NOT paint the background on the card itself.
	   A pseudo-element handles it so we can scale it independently. */
	color: #fff;
	isolation: isolate;
	transition: flex-grow 600ms cubic-bezier(0.4, 0, 0.2, 1),
	            flex-basis 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mxm-ec--grid .mxm-ec__card {
	flex: 1 1 0%;
}

/* Background zoom layer — absolute pseudo that inherits the card's background
   image (set inline via style="") and can scale independently of the overlay.
   This gives a clean zoom without distorting the picture like background-size does. */
.mxm-ec__card::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image: inherit;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transform: scale(1);
	transform-origin: center;
	transition: transform 700ms cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 0;
	pointer-events: none;
	will-change: transform;
}

/* Overlay gradient */
.mxm-ec__card::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, var(--mxm-ec-overlay-top) 0%, var(--mxm-ec-overlay-bottom) 100%);
	z-index: 1;
	transition: background 0.5s ease;
	pointer-events: none;
}

/* ==========================================================================
   4. Tags (top-left)
   ========================================================================== */
.mxm-ec__tags {
	position: absolute;
	top: 20px;
	left: 20px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	pointer-events: none;
	max-width: calc(100% - 80px);
}

.mxm-ec__tag {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: rgba(255, 255, 255, 0.18);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	padding: 6px 14px;
	border-radius: 50px;
	white-space: nowrap;
	letter-spacing: 0.2px;
	line-height: 1.3;
	/* Animation: start state */
	opacity: 0;
	transform: translateY(-10px);
	transition: opacity 450ms ease, transform 450ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered entrance for tags */
.mxm-ec__tag:nth-child(1) { transition-delay: 50ms; }
.mxm-ec__tag:nth-child(2) { transition-delay: 130ms; }
.mxm-ec__tag:nth-child(3) { transition-delay: 210ms; }
.mxm-ec__tag:nth-child(4) { transition-delay: 290ms; }

.mxm-ec__tag::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background-color: #DFFF5A;
	flex-shrink: 0;
}

/* ==========================================================================
   5. Arrows (top-right) — crossfade between idle & active
   ========================================================================== */
.mxm-ec__arrow {
	position: absolute;
	top: 20px;
	right: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	z-index: 3;
	pointer-events: none;
	transition: opacity 400ms ease,
	            transform 400ms cubic-bezier(0.4, 0, 0.2, 1),
	            background-color 400ms ease;
}

.mxm-ec__arrow svg {
	width: 40%;
	height: 40%;
	fill: none;
	transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mxm-ec__arrow-idle {
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.22);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.35);
	opacity: 1;
	transform: scale(1);
}

.mxm-ec__arrow-idle svg { stroke: #fff; }

.mxm-ec__arrow-active {
	width: 44px;
	height: 44px;
	background: #DFFF5A;
	z-index: 4;
	/* Hidden by default */
	opacity: 0;
	transform: scale(0.7) rotate(-30deg);
}

.mxm-ec__arrow-active svg { stroke: #1a1a1a; }

/* ==========================================================================
   6. Content block (title / desc / btn)
   ========================================================================== */
.mxm-ec__content {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 24px 22px 22px;
	z-index: 2;
	color: #fff;
}

.mxm-ec__title {
	font-size: 30px;
	font-weight: 600;
	line-height: 1.1;
	margin: 0;
	letter-spacing: -0.5px;
	color: #fff;
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	word-wrap: break-word;
	transform: translateY(0);
	transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mxm-ec__desc {
	font-size: 13px;
	line-height: 1.5;
	margin: 0;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transform: translateY(10px);
	transition: max-height 500ms cubic-bezier(0.4, 0, 0.2, 1),
	            opacity 400ms ease 80ms,
	            margin 400ms ease,
	            transform 450ms cubic-bezier(0.4, 0, 0.2, 1) 80ms;
	color: rgba(255, 255, 255, 0.9);
}

.mxm-ec__btn {
	margin-top: 18px;
	background: rgba(255, 255, 255, 0.95);
	color: #1a1a1a;
	border-radius: 50px;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	position: relative;
	transition: background-color 350ms ease,
	            color 350ms ease,
	            transform 350ms cubic-bezier(0.4, 0, 0.2, 1),
	            box-shadow 350ms ease;
}

.mxm-ec__btn > span:first-child {
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
	transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button HOVER — lift + shadow + slide label */
.mxm-ec__btn:hover {
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	transform: translateY(-1px);
}
.mxm-ec__btn:hover > span:first-child {
	transform: translateX(-2px);
}
.mxm-ec__btn:hover .mxm-ec__btn-arrow {
	transform: translateX(3px) rotate(-4deg);
}
.mxm-ec__btn:hover .mxm-ec__btn-arrow svg {
	transform: translateX(1px);
}

.mxm-ec__btn:active {
	transform: translateY(0);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mxm-ec__btn-arrow {
	width: 26px;
	height: 26px;
	background: #1a1a1a;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1),
	            background-color 350ms ease;
}

.mxm-ec__btn-arrow svg {
	width: 11px;
	height: 11px;
	stroke: #fff;
	fill: none;
	transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   7. TOP-RIGHT ARROW — hover effect when card is "active/open"
   (this makes the yellow button feel clickable)
   ========================================================================== */
.mxm-ec__card:hover .mxm-ec__arrow-active {
	background: #CBF53A;
}

/* ==========================================================================
   8. STATES — "open" (applied to: .is-active in grid, all cards in carousel,
                        all cards on mobile, hovered card in grid-desktop)
   ========================================================================== */

/* ---- Mixin selector for "open" state ---- */
.mxm-ec__card.is-active::after,
.mxm-ec--carousel .mxm-ec__card::after {
	transform: scale(1.08);
}

.mxm-ec__card.is-active::before,
.mxm-ec--carousel .mxm-ec__card::before {
	background: linear-gradient(to bottom, var(--mxm-ec-overlay-top) 0%, var(--mxm-ec-overlay-bottom-active) 100%);
}

.mxm-ec__card.is-active .mxm-ec__tag,
.mxm-ec--carousel .mxm-ec__tag {
	opacity: 1;
	transform: translateY(0);
}

.mxm-ec__card.is-active .mxm-ec__arrow-idle,
.mxm-ec--carousel .mxm-ec__arrow-idle {
	opacity: 0;
	transform: scale(0.7) rotate(30deg);
}

.mxm-ec__card.is-active .mxm-ec__arrow-active,
.mxm-ec--carousel .mxm-ec__arrow-active {
	opacity: 1;
	transform: scale(1) rotate(0);
}

.mxm-ec__card.is-active .mxm-ec__desc,
.mxm-ec--carousel .mxm-ec__desc {
	max-height: 300px;
	opacity: 1;
	margin-top: 12px;
	transform: translateY(0);
}

.mxm-ec__card.is-active .mxm-ec__title,
.mxm-ec--carousel .mxm-ec__title {
	transform: translateY(-2px);
}

/* Grid: active card flex-grow */
.mxm-ec--grid .mxm-ec__card.is-active {
	flex-grow: var(--mxm-ec-active-flex);
}

/* ==========================================================================
   9. DESKTOP HOVER — hovered card becomes "open"
   ========================================================================== */
@media (hover: hover) and (min-width: 1025px) {
	/* When the row is hovered, reset ALL cards to neutral */
	.mxm-ec--grid:hover .mxm-ec__card {
		flex-grow: 1;
	}
	.mxm-ec--grid:hover .mxm-ec__card::after {
		transform: scale(1);
	}

	.mxm-ec--grid:hover .mxm-ec__card::before {
		background: linear-gradient(to bottom, var(--mxm-ec-overlay-top) 0%, var(--mxm-ec-overlay-bottom) 100%);
	}
	.mxm-ec--grid:hover .mxm-ec__card .mxm-ec__tag {
		opacity: 0;
		transform: translateY(-10px);
	}
	.mxm-ec--grid:hover .mxm-ec__card .mxm-ec__arrow-idle {
		opacity: 1;
		transform: scale(1) rotate(0);
	}
	.mxm-ec--grid:hover .mxm-ec__card .mxm-ec__arrow-active {
		opacity: 0;
		transform: scale(0.7) rotate(-30deg);
	}
	.mxm-ec--grid:hover .mxm-ec__card .mxm-ec__desc {
		max-height: 0;
		opacity: 0;
		margin-top: 0;
		transform: translateY(10px);
	}
	.mxm-ec--grid:hover .mxm-ec__card .mxm-ec__title {
		transform: translateY(0);
	}

	/* The HOVERED card opens up */
	.mxm-ec--grid:hover .mxm-ec__card:hover {
		flex-grow: var(--mxm-ec-active-flex);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover::after {
		transform: scale(1.08);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover::before {
		background: linear-gradient(to bottom, var(--mxm-ec-overlay-top) 0%, var(--mxm-ec-overlay-bottom-active) 100%);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover .mxm-ec__tag {
		opacity: 1;
		transform: translateY(0);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover .mxm-ec__arrow-idle {
		opacity: 0;
		transform: scale(0.7) rotate(30deg);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover .mxm-ec__arrow-active {
		opacity: 1;
		transform: scale(1) rotate(0);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover .mxm-ec__desc {
		max-height: 300px;
		opacity: 1;
		margin-top: 12px;
		transform: translateY(0);
	}
	.mxm-ec--grid:hover .mxm-ec__card:hover .mxm-ec__title {
		transform: translateY(-2px);
	}
}

/* ==========================================================================
   10. TABLET
   ========================================================================== */
@media (max-width: 1024px) {
	.mxm-ec--grid {
		flex-wrap: wrap;
	}
	.mxm-ec--grid .mxm-ec__card {
		flex: 1 1 calc((100% - (var(--mxm-ec-columns, 2) - 1) * 12px) / var(--mxm-ec-columns, 2));
		max-width: 100%;
	}
	.mxm-ec__title { font-size: 24px; }
}

/* ==========================================================================
   11. MOBILE (everything open by default, no hover)
   ========================================================================== */
@media (max-width: 767px) {
	.mxm-ec--grid {
		flex-direction: column;
		flex-wrap: nowrap;
	}
	.mxm-ec--grid .mxm-ec__card {
		flex: 1 1 auto;
		width: 100%;
		max-width: 100%;
	}
	.mxm-ec--grid .mxm-ec__card::after {
		transform: scale(1.08);
	}
	.mxm-ec--grid .mxm-ec__card::before {
		background: linear-gradient(to bottom, var(--mxm-ec-overlay-top) 0%, var(--mxm-ec-overlay-bottom-active) 100%);
	}
	.mxm-ec--grid .mxm-ec__card .mxm-ec__tag {
		opacity: 1;
		transform: translateY(0);
	}
	.mxm-ec--grid .mxm-ec__card .mxm-ec__arrow-idle {
		opacity: 0;
	}
	.mxm-ec--grid .mxm-ec__card .mxm-ec__arrow-active {
		opacity: 1;
		transform: scale(1) rotate(0);
	}
	.mxm-ec--grid .mxm-ec__card .mxm-ec__desc {
		max-height: 300px;
		opacity: 1;
		margin-top: 12px;
		transform: translateY(0);
	}
	.mxm-ec__title { font-size: 28px; }

	/* When mobile-carousel is enabled on a grid widget,
	   we swap the grid flex-column into a carousel via JS. */
	.mxm-ec--grid.mxm-ec--mobile-carousel {
		flex-direction: row;
		flex-wrap: nowrap;
		padding-bottom: 44px; /* space for pagination */
		display: block; /* let swiper manage layout */
	}
	/* When wrapped in swiper, card sits inside .swiper-slide, so reset flex */
	.mxm-ec--grid.mxm-ec--mobile-carousel .mxm-ec__card {
		flex: 1 1 auto;
		width: 100%;
		min-width: 0;
	}
	.mxm-ec--grid.mxm-ec--mobile-carousel .swiper {
		width: 100%;
		overflow: hidden;
	}
	.mxm-ec--grid.mxm-ec--mobile-carousel .swiper-slide {
		height: auto;
		display: flex;
		align-items: stretch;
		min-height: 500px;
	}
	.mxm-ec--grid.mxm-ec--mobile-carousel .swiper-pagination {
		position: absolute;
		bottom: 0 !important;
		left: 0;
		right: 0;
		width: 100%;
		text-align: center;
		line-height: 1;
		z-index: 5;
	}
}

/* ==========================================================================
   12. CAROUSEL
   ========================================================================== */
.mxm-ec--carousel {
	position: relative;
	display: block;
	width: 100%;
	padding: 0 56px;
	min-height: 500px;
}

.mxm-ec--carousel .swiper {
	width: 100%;
	overflow: hidden;
	padding-bottom: 44px;
}

.mxm-ec--carousel .swiper-wrapper {
	align-items: stretch;
}

.mxm-ec--carousel .swiper-slide {
	height: auto;
	display: flex;
	align-items: stretch;
	min-height: 500px;
}

.mxm-ec--carousel .mxm-ec__card {
	width: 100%;
	flex: 1 1 auto;
}

/* Pagination */
.mxm-ec--carousel .swiper-pagination {
	position: absolute;
	bottom: 0 !important;
	left: 0;
	right: 0;
	width: 100%;
	text-align: center;
	line-height: 1;
	z-index: 5;
}

.mxm-ec--carousel .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background-color: rgba(0, 0, 0, 0.25);
	opacity: 1;
	transition: all 0.3s ease;
	margin: 0 4px !important;
	display: inline-block;
	vertical-align: middle;
	border-radius: 50%;
}

.mxm-ec--carousel .swiper-pagination-bullet:hover {
	background-color: rgba(0, 0, 0, 0.5);
	transform: scale(1.2);
}

.mxm-ec--carousel .swiper-pagination-bullet-active {
	background-color: #1a1a1a;
	width: 24px;
	border-radius: 4px;
}

/* Navigation arrows */
.mxm-ec-nav {
	position: absolute;
	top: calc(50% - 22px);
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	border: none;
	padding: 0;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
	            box-shadow 300ms ease,
	            background-color 300ms ease;
}

.mxm-ec-nav:hover {
	transform: translateY(-50%) scale(1.12);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.mxm-ec-nav:hover svg {
	transform: scale(1.1);
}

.mxm-ec-nav:active {
	transform: translateY(-50%) scale(1.05);
}

.mxm-ec-nav svg {
	width: 16px;
	height: 16px;
	stroke: #1a1a1a;
	fill: none;
	pointer-events: none;
	transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mxm-ec-nav--prev { left: 0; }
.mxm-ec-nav--next { right: 0; }

.mxm-ec-nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: not-allowed;
}
.mxm-ec-nav.swiper-button-disabled:hover {
	transform: translateY(-50%) scale(1);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

@media (max-width: 767px) {
	.mxm-ec--carousel { padding: 0; }
	.mxm-ec-nav { display: none; }
}

/* ==========================================================================
   13. Respect user's "reduce motion" preference
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.mxm-ec *,
	.mxm-ec *::before,
	.mxm-ec *::after,
	.mxm-ec-nav,
	.mxm-ec-nav svg {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* ==========================================================================
   14. Elementor editor — disable transitions so edits apply instantly
   ========================================================================== */
body.elementor-editor-active .mxm-ec__card,
body.elementor-editor-active .mxm-ec__card * {
	transition: none !important;
}
