/* Equal Height Containers for Elementor
   Row  = container with "Equal height row" on
   Card = each container directly inside the row
   Inner rows = the items (containers or widgets) directly inside each card */

/* ---------- Row becomes a grid ---------- */
.elementor .ehc-row.e-con-full,
.elementor .ehc-row.e-con-boxed > .e-con-inner {
	display: grid;
	grid-template-columns: repeat(var(--ehc-cols, 3), minmax(0, 1fr));
	grid-auto-rows: auto;
	column-gap: var(--column-gap, 20px);
	row-gap: var(--row-gap, 20px);
	align-items: stretch;      /* equal card heights */
	justify-items: stretch;
}

/* ---------- Cards fill their grid cell ---------- */
.elementor .ehc-row.e-con-full > .e-con,
.elementor .ehc-row.e-con-boxed > .e-con-inner > .e-con {
	width: auto;
	max-width: 100%;
	min-width: 0;
	height: auto;
	grid-column: auto;
}

/* Boxed cards: let the inner wrapper fill the card */
.elementor .ehc-row.e-con-full > .e-con-boxed > .e-con-inner,
.elementor .ehc-row.e-con-boxed > .e-con-inner > .e-con-boxed > .e-con-inner {
	flex-grow: 1;
}

/* ---------- Push last item to bottom (flex mode) ---------- */
.elementor .ehc-row.ehc-push.e-con-full > .e-con-full > .elementor-element:nth-last-child(1 of .elementor-element),
.elementor .ehc-row.ehc-push.e-con-full > .e-con-boxed > .e-con-inner > .elementor-element:nth-last-child(1 of .elementor-element),
.elementor .ehc-row.ehc-push.e-con-boxed > .e-con-inner > .e-con-full > .elementor-element:nth-last-child(1 of .elementor-element),
.elementor .ehc-row.ehc-push.e-con-boxed > .e-con-inner > .e-con-boxed > .e-con-inner > .elementor-element:nth-last-child(1 of .elementor-element) {
	margin-top: auto;
}

/* ---------- Line up inner containers across the row (subgrid) ---------- */
@supports (grid-template-rows: subgrid) {

	/* Card spans N row tracks and shares them with its neighbours */
	.elementor .ehc-row.ehc-align.e-con-full > .e-con,
	.elementor .ehc-row.ehc-align.e-con-boxed > .e-con-inner > .e-con {
		display: grid;
		grid-row: span var(--ehc-inner-rows, 3);
		grid-template-rows: subgrid;
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--ehc-inner-gap, 0px);
		align-content: stretch;
	}

	/* Boxed card: pass the subgrid through its inner wrapper */
	.elementor .ehc-row.ehc-align.e-con-full > .e-con-boxed > .e-con-inner,
	.elementor .ehc-row.ehc-align.e-con-boxed > .e-con-inner > .e-con-boxed > .e-con-inner {
		display: grid;
		grid-column: 1 / -1;
		grid-row: 1 / -1;
		grid-template-rows: subgrid;
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--ehc-inner-gap, 0px);
		width: 100%;
	}

	/* Inner rows fill their shared track */
	.elementor .ehc-row.ehc-align.e-con-full > .e-con-full > .elementor-element,
	.elementor .ehc-row.ehc-align.e-con-full > .e-con-boxed > .e-con-inner > .elementor-element,
	.elementor .ehc-row.ehc-align.e-con-boxed > .e-con-inner > .e-con-full > .elementor-element,
	.elementor .ehc-row.ehc-align.e-con-boxed > .e-con-inner > .e-con-boxed > .e-con-inner > .elementor-element {
		min-width: 0;
		margin-top: 0;
		margin-bottom: 0;
	}
}

/* Older browsers without subgrid: fall back to push-to-bottom */
@supports not (grid-template-rows: subgrid) {
	.elementor .ehc-row.ehc-align.e-con-full > .e-con-full > .elementor-element:nth-last-child(1 of .elementor-element),
	.elementor .ehc-row.ehc-align.e-con-boxed > .e-con-inner > .e-con-full > .elementor-element:nth-last-child(1 of .elementor-element) {
		margin-top: auto;
	}
}
