.eis-section {
	--eis-overlay: rgba(0, 0, 0, 0.4);
	--eis-height: 430px;
	--eis-gap: 12px;
	--eis-expand: 1.35;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 30px 16px 40px;
	box-sizing: border-box;
	/* Avada/Fusion columns are flex containers — without these the section
	   collapses to zero width as a flex child. */
	flex: 1 1 100%;
	min-width: 0;
	--eis-title-color: #fff;
	--eis-title-size: 22px;
	--eis-title-weight: 600;
}

/* Full-width mode: break out of any padded parent container, edge-to-edge. */
.eis-section.eis-full {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding-left: 0;
	padding-right: 0;
}

.eis-section *,
.eis-section *::before,
.eis-section *::after {
	box-sizing: border-box;
}

.eis-section-title {
	text-align: center;
	font-size: 28px;
	font-weight: 700;
	margin: 0 0 28px;
}

.eis-row {
	display: flex;
	gap: var(--eis-gap);
	height: var(--eis-height);
}

.eis-item {
	position: relative;
	flex: 1 1 0%;
	min-width: 0;
	overflow: hidden;
	cursor: pointer;
	transition: flex-grow 0.7s cubic-bezier(0.4, 0, 0.2, 1);
	outline: none;
}

.eis-item.eis-active {
	flex-grow: var(--eis-expand);
	cursor: default;
}

.eis-media {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	transform: scale(1.001);
	transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.eis-item:not(.eis-active):hover .eis-media {
	transform: scale(1.05);
}

/* Overlays — collapsed cards use --eis-overlay-collapsed, the expanded card
   uses --eis-overlay; either can be transparent. */
.eis-overlay {
	position: absolute;
	inset: 0;
	background: var(--eis-overlay-collapsed, transparent);
	transition: background 0.7s ease;
	pointer-events: none;
}

.eis-item.eis-active .eis-overlay {
	background: var(--eis-overlay, transparent);
}

/* Number label */
.eis-number {
	position: absolute;
	top: 18px;
	left: 22px;
	color: var(--eis-title-color, #fff);
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
	z-index: 2;
}

/* Caption (title + arrow) */
.eis-caption {
	position: absolute;
	left: 24px;
	right: 20px;
	bottom: 22px;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px;
	z-index: 2;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.45s ease 0.15s, transform 0.45s ease 0.15s;
	pointer-events: none;
}

.eis-title {
	color: var(--eis-title-color, #fff);
	font-size: var(--eis-title-size, 22px);
	font-weight: var(--eis-title-weight, 600);
	line-height: 1.35;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
	overflow-wrap: anywhere;
}

/* HTML inside titles (headings, paragraphs) inherits the title styling
   instead of picking up theme heading margins/sizes. */
.eis-title h1,
.eis-title h2,
.eis-title h3,
.eis-title h4,
.eis-title h5,
.eis-title h6,
.eis-title p {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	text-shadow: inherit;
}

.eis-arrow {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 40px;
	border: 1px solid rgba(255, 255, 255, 0.85);
	color: #fff;
	font-size: 18px;
	text-decoration: none;
	background: rgba(0, 0, 0, 0.15);
	transition: background 0.25s ease, color 0.25s ease;
}

.eis-arrow:hover {
	background: #fff;
	color: #111;
}

/* Title visibility rules */
.eis-row.eis-titles-expanded .eis-item.eis-active .eis-caption {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.eis-row.eis-titles-collapsed .eis-item:not(.eis-active) .eis-caption {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.eis-row.eis-titles-collapsed .eis-item:not(.eis-active) .eis-title {
	font-size: calc(var(--eis-title-size, 22px) * 0.7);
}

.eis-row.eis-titles-collapsed .eis-item:not(.eis-active) .eis-arrow {
	display: none;
}

/* Bottom button */
.eis-button-wrap {
	text-align: center;
	margin-top: 30px;
}

.eis-button {
	display: inline-block;
	background: #c62233;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	padding: 12px 26px;
	transition: background 0.25s ease;
}

.eis-button:hover {
	background: #a51b29;
	color: #fff;
}

/* Keyboard focus */
.eis-item:focus-visible {
	outline: 3px solid #4a90d9;
	outline-offset: -3px;
}

/* Responsive: 2×2 grid on small screens — no expanding, all cards equal. */
@media (max-width: 767px) {
	.eis-row {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: var(--eis-gap);
		height: auto;
	}

	.eis-item,
	.eis-item.eis-active {
		flex: none;
		height: auto;
		cursor: default;
	}

	.eis-item {
		display: flex;
		flex-direction: column;
		overflow: visible;
	}

	.eis-media {
		position: relative;
		inset: auto;
		width: 100%;
		height: auto;
		aspect-ratio: 1 / 1;
		overflow: hidden;
	}

	.eis-item:not(.eis-active):hover .eis-media {
		transform: none;
	}

	.eis-number {
		top: 10px;
		left: 14px;
		font-size: 14px;
	}

	/* Titles show on every card (as long as titles are enabled in settings). */
	.eis-row.eis-titles-expanded .eis-caption,
	.eis-row.eis-titles-collapsed .eis-caption {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}

	.eis-row.eis-titles-collapsed .eis-item:not(.eis-active) .eis-arrow {
		display: inline-flex;
	}

	.eis-title,
	.eis-row.eis-titles-collapsed .eis-item:not(.eis-active) .eis-title {
		font-size: min(var(--eis-title-size, 22px), 16px);
	}

	.eis-arrow {
		width: 34px;
		height: 30px;
		font-size: 14px;
	}

	/* --- Mobile title position: OVER the image, with overlay --- */
	.eis-m-over .eis-overlay,
	.eis-m-over .eis-item.eis-active .eis-overlay {
		position: absolute;
		inset: 0;
		background: var(--eis-overlay, transparent);
	}

	.eis-m-over .eis-caption {
		position: absolute;
		left: 14px;
		right: 12px;
		bottom: 12px;
	}

	/* --- Mobile title position: BELOW the image, no overlay --- */
	.eis-m-below .eis-overlay {
		display: none;
	}

	.eis-m-below .eis-caption {
		position: static;
		margin-top: 8px;
		align-items: center;
	}

	.eis-m-below .eis-title {
		color: inherit;
		text-shadow: none;
	}

	.eis-m-below .eis-arrow {
		color: inherit;
		border-color: currentColor;
		background: transparent;
	}
}
