/**
 * ESA Image Carousel
 */

.esa-icw {
	--esa-icw-columns: 3;
	--esa-icw-columns-tablet: 2;
	--esa-icw-columns-mobile: 1;
	width: 100%;
	box-sizing: border-box;
}

.esa-icw *,
.esa-icw *::before,
.esa-icw *::after {
	box-sizing: border-box;
}

.esa-icw-viewport {
	width: 100%;
	overflow: hidden;
}

.esa-icw-track {
	display: flex;
	flex-wrap: nowrap;
	gap: 16px;
	transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

.esa-icw-item {
	position: relative;
	flex: 0 0 calc(
		(100% - (var(--esa-icw-columns) - 1) * var(--esa-icw-gap, 16px))
		/ var(--esa-icw-columns)
	);
	min-width: 0;
	background-position: center center;
	background-size: cover;
	background-repeat: no-repeat;
	overflow: hidden;
	border-radius: 16px;
	height: 360px;
	display: flex;
}

.esa-icw-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 1;
	transition: opacity 0.45s ease;
}

.esa-icw-content {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	padding: 28px;
	gap: 8px;
}

.esa-icw-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.esa-icw-icon i,
.esa-icw-icon svg {
	display: inline-block;
}

.esa-icw-label {
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
	margin: 0;
	font-size: 12px;
}

.esa-icw-heading {
	margin: 4px 0;
	font-size: 28px;
	font-weight: 600;
	line-height: 1.15;
}

.esa-icw-description {
	margin: 8px 0 0;
	font-size: 14px;
	line-height: 1.55;
}

/* ============= Active-state layers ============= */
.esa-icw-bg-active {
	position: absolute;
	inset: 0;
	background-position: center center;
	background-size: cover;
	background-repeat: no-repeat;
	opacity: 0;
	transition: opacity 0.45s ease;
	z-index: 0;
	pointer-events: none;
}

.esa-icw-item.esa-icw-active .esa-icw-bg-active {
	opacity: 1;
}

/* The visible-state opacity reads from CSS variables that the per-item
   opacity controls write to. The hide rules below use literal `opacity: 0`
   so they always win on the wrong-state overlay regardless of the variable. */
.esa-icw-overlay-normal {
	opacity: var(--esa-icw-overlay-strength, 1);
}

.esa-icw-overlay-active {
	opacity: 0;
}

.esa-icw-item.esa-icw-active .esa-icw-overlay-active {
	opacity: 1;
}

.esa-icw-item.esa-icw-active .esa-icw-overlay-normal {
	opacity: 0;
}

/* The two layouts share the same absolute slot so swapping is instant.
   The hide rule is keyed on the parent to guarantee precedence over the
   base .esa-icw-content { display: flex } regardless of stylesheet order.
   `justify-content` is driven by the per-item stack-position class
   (`.esa-icw-stack-*`) so the user can collapse the icon/label/heading
   group together with description/tags/button at top, middle, or bottom. */
.esa-icw-content-active {
	position: absolute;
	inset: 0;
	z-index: 2;
	flex-direction: column;
	padding: 28px;
	gap: 12px;
}

.esa-icw-content-active.esa-icw-stack-split  { justify-content: space-between; }
.esa-icw-content-active.esa-icw-stack-top    { justify-content: flex-start; }
.esa-icw-content-active.esa-icw-stack-middle { justify-content: center; }
.esa-icw-content-active.esa-icw-stack-bottom { justify-content: flex-end; }

.esa-icw-item .esa-icw-content-active {
	display: none;
}

.esa-icw-item.esa-icw-active .esa-icw-content-normal {
	display: none;
}

.esa-icw-item.esa-icw-active .esa-icw-content-active {
	display: flex;
}

.esa-icw-active-top,
.esa-icw-active-bottom {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
}

/* Description + tag list must span the full width of their column so the
   text wraps naturally and the tag pills can align via justify-content,
   independent of the icon/label/heading alignment. */
.esa-icw-content-active .esa-icw-description,
.esa-icw-content-active .esa-icw-tags {
	align-self: stretch;
	width: 100%;
}

/* ============= Tags ============= */
.esa-icw-tags {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.esa-icw-tag {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	background-color: rgba(255, 255, 255, 0.18);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
}

/* ============= Footer (counter + nav) ============= */
.esa-icw-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin-top: 32px;
	flex-wrap: wrap;
}

.esa-icw-counter {
	display: inline-flex;
	align-items: baseline;
	gap: 4px;
	font-feature-settings: "tnum";
	line-height: 1;
}

.esa-icw-counter-current {
	font-size: 64px;
	font-weight: 700;
	line-height: 1;
}

.esa-icw-counter-sep,
.esa-icw-counter-total {
	font-size: 22px;
	font-weight: 500;
	line-height: 1;
}

.esa-icw-counter-sep {
	margin: 0 2px;
}

/* ============= Nav arrows ============= */
.esa-icw-nav {
	display: inline-flex;
	align-items: center;
	gap: 12px;
}

.esa-icw-arrow {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid #cbd5e1;
	background: transparent;
	color: #1f2937;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.esa-icw-arrow svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	display: block;
}

.esa-icw-arrow:hover {
	background: #1d83b3;
	color: #fff;
	border-color: #1d83b3;
}

.esa-icw-arrow:active {
	transform: scale(0.96);
}

.esa-icw-arrow:focus-visible {
	outline: 2px solid #1d83b3;
	outline-offset: 2px;
}

.esa-icw-arrow[disabled],
.esa-icw-arrow.is-disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

/* ============= Responsive ============= */
@media (max-width: 1024px) {
	.esa-icw-item {
		flex: 0 0 calc(
			(100% - (var(--esa-icw-columns-tablet) - 1) * var(--esa-icw-gap, 16px))
			/ var(--esa-icw-columns-tablet)
		);
	}

	.esa-icw-counter-current { font-size: 52px; }
	.esa-icw-counter-sep,
	.esa-icw-counter-total   { font-size: 18px; }
}

@media (max-width: 640px) {
	.esa-icw-item {
		flex: 0 0 calc(
			(100% - (var(--esa-icw-columns-mobile) - 1) * var(--esa-icw-gap, 16px))
			/ var(--esa-icw-columns-mobile)
		);
		height: 320px;
	}

	.esa-icw-footer {
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.esa-icw-counter-current { font-size: 44px; }
	.esa-icw-counter-sep,
	.esa-icw-counter-total   { font-size: 16px; }
}

/* Editor: prevent dragging the track interfering with controls */
.elementor-editor-active .esa-icw-track {
	cursor: default;
}

/* ============= Button =============
   Each item can opt-in to a per-state button. The button sits inside
   the content column (after the description for normal items, after
   the tags for active items) and is laid out as a flex row so the
   optional icon stays vertically centred with the label. The
   `--icon-before` / `--icon-after` modifier flips the order of the
   text + icon spans without needing a duplicate DOM. */
.esa-icw-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 22px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
	margin-top: 8px;
	align-self: flex-start;
}

/* Honour the column's text-align: center / right by aligning the
   button itself rather than letting flex stretch it. */
.esa-icw-content[style*="text-align: center"] .esa-icw-btn,
.esa-icw-content[style*="align-items: center"] .esa-icw-btn {
	align-self: center;
}
.esa-icw-content[style*="text-align: right"] .esa-icw-btn,
.esa-icw-content[style*="align-items: flex-end"] .esa-icw-btn {
	align-self: flex-end;
}

.esa-icw-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
	text-decoration: none;
}

.esa-icw-btn-text {
	display: inline-block;
	line-height: 1.2;
}

.esa-icw-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.esa-icw-btn-icon i {
	font-size: 14px;
	line-height: 1;
}

.esa-icw-btn-icon svg {
	width: 14px;
	height: 14px;
	display: block;
}

.esa-icw-btn--icon-before { flex-direction: row; }
.esa-icw-btn--icon-after  { flex-direction: row; }
.esa-icw-btn--icon-before .esa-icw-btn-text { order: 2; }
.esa-icw-btn--icon-before .esa-icw-btn-icon { order: 1; }
.esa-icw-btn--icon-after  .esa-icw-btn-text { order: 1; }
.esa-icw-btn--icon-after  .esa-icw-btn-icon { order: 2; }
