/* ==========================================================================
   Elementor Services Grid Widget — structural styles.
   All colors, spacing, typography, and animation values are controlled
   live from Elementor (see class-services-grid-widget.php). This file only
   contains the structural CSS needed to make the layout / hover mechanics
   work; it intentionally avoids hardcoding any editable design values.
   ========================================================================== */

.esg-services-grid {
	width: 100%;
	box-sizing: border-box;
}

.esg-services-grid *,
.esg-services-grid *::before,
.esg-services-grid *::after {
	box-sizing: border-box;
}

/* ---------------------------- Header ---------------------------- */

.esg-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
}

.esg-header-left {
	max-width: 100%;
}

.esg-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	margin: 0 0 14px;
}

.esg-eyebrow:before {
	content: '';
	display: inline-block;
	height: 1px;
	flex-shrink: 0;
}

.esg-title {
	margin: 0;
	text-transform: uppercase;
	line-height: 1.05;
}

.esg-header-right {
	flex: 0 0 auto;
}

.esg-header-desc {
	margin: 0;
	text-align: left;
}

@media (max-width: 767px) {
	.esg-header {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ---------------------------- Grid ---------------------------- */

.esg-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: 190px;
	column-gap: 2px;
	row-gap: 2px;
	width: 100%;
}

/* ---------------------------- Card ---------------------------- */

.esg-card {
	position: relative;
	display: block;
	overflow: hidden;
	width: 100%;
	height: 100%;
	text-decoration: none;
	grid-row: span 1;
	isolation: isolate;
}

.esg-card--featured {
	grid-row: span 2;
}

.esg-card:before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	transition-property: opacity;
	transition-duration: 400ms;
	transition-timing-function: ease-out;
}

.esg-card-inner {
	position: relative;
	width: 100%;
	height: 100%;
	transition-property: transform;
	transition-duration: 400ms;
	transition-timing-function: ease-out;
}

.esg-card-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition-property: transform;
	transition-duration: 400ms;
	transition-timing-function: ease-out;
	backface-visibility: hidden;
	will-change: transform;
}

.esg-card-content {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 24px;
}

.esg-card-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 8px;
}

.esg-card-title {
	line-height: 1.25;
}

.esg-card-desc {
	overflow: hidden;
	max-height: 0;
	opacity: 0;
	margin-top: 0;
	transform: translateY(12px);
	transition-property: max-height, opacity, transform, margin-top;
	transition-duration: 400ms;
	transition-timing-function: ease-out;
}

/* Reveal the description on hover / focus (mouse + keyboard access). */
.esg-card:hover .esg-card-desc,
.esg-card:focus-within .esg-card-desc,
.esg-card--active .esg-card-desc {
	max-height: 200px;
	opacity: 1;
	transform: translateY(0);
}

/* Touch-device tap state mirrors the hover overlay/zoom for consistency. */
.esg-card--active:before {
	opacity: 0.95;
}

.esg-card--active .esg-card-img {
	transform: scale(1.04);
}

/* When hover animation is disabled from Elementor, always show the description. */
.esg-hover-disabled .esg-card-desc {
	max-height: none;
	opacity: 1;
	transform: none;
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.esg-card:before,
	.esg-card-inner,
	.esg-card-img,
	.esg-card-desc {
		transition-duration: 1ms !important;
	}
}

/* ---------------------------- Responsive fallback ----------------------------
   Elementor's responsive controls generate their own breakpoint CSS for the
   values registered above (columns, gaps, row-height, spacing, etc.). These
   rules are just a safety net for editors who don't touch the responsive
   controls, so the layout still degrades gracefully out of the box.
   ------------------------------------------------------------------------- */

@media (max-width: 1024px) {
	.esg-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.esg-grid {
		grid-template-columns: repeat(1, 1fr);
	}

	.esg-card--featured {
		grid-row: span 1;
	}
}
