/**
 * Environment / parallax cards — demo-skin #environments parity (no Tailwind).
 *
 * Last modified: 2026-04-17
 *
 * @package CW_Elementor_Widgets
 */

.cw-environment-section {
	position: relative;
	width: 100%;
	box-sizing: border-box;
	padding-top: var(--cw-env-section-pt, 8rem);
	padding-bottom: var(--cw-env-section-pb, 8rem);
	z-index: 10;
	overflow: hidden;
	border-top: 1px solid var(--cw-env-section-border, rgba(255, 255, 255, 0.05));
	background: var(
		--cw-env-section-bg,
		linear-gradient(180deg, var(--cw-surface-2, #1c1c1c) 0%, var(--cw-surface-1, #141414) 55%, var(--cw-bg, #0c0c0c) 100%)
	);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.cw-environment-inner {
	width: 100%;
	max-width: min(1400px, var(--cw-content-max-width, 1280px));
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

@media (max-width: 1366px) {
	.cw-environment-inner {
		padding-inline-start: max(
			var(--cw-gutter-inline),
			env(safe-area-inset-left, 0px),
			var(--cw-env-inner-px, 0px)
		);
		padding-inline-end: max(
			var(--cw-gutter-inline),
			env(safe-area-inset-right, 0px),
			var(--cw-env-inner-px, 0px)
		);
	}
}

@media (min-width: 1367px) {
	.cw-environment-inner {
		padding-left: var(--cw-env-inner-px, 1.5rem);
		padding-right: var(--cw-env-inner-px, 1.5rem);
	}
}

.cw-environment-intro {
	width: 100%;
	text-align: center;
	margin-bottom: var(--cw-env-intro-mb, clamp(3.5rem, 8vw, 5rem));
}

/* demo-skin #environments h2: text-4xl md:text-5xl lg:text-6xl */
.cw-environment-heading {
	margin: 0 0 var(--cw-env-heading-mb, 1.5rem);
	font-family: var(--cw-font-heading, "Barlow", system-ui, sans-serif);
	font-weight: 700;
	line-height: var(--cw-line-height-heading, 1.08);
	letter-spacing: 0;
	color: var(--cw-env-heading-color, #fff);
	font-size: 2.25rem;
}

@media (min-width: 768px) {
	.cw-environment-heading {
		font-size: 3rem;
	}
}

@media (min-width: 1024px) {
	.cw-environment-heading {
		font-size: 3.75rem;
	}
}

.cw-environment-heading .split-word {
	display: inline-block;
	margin-right: 0.2em;
	will-change: transform, opacity;
}

.cw-environment-heading .split-word:last-child {
	margin-right: 0;
}

/* Scroll reveal: start state in CSS; cw-widgets-scroll-reveal uses gsap.to only (no from() flicker). */
.cw-environment-intro .cw-environment-heading.split-reveal-heading .split-word {
	opacity: 0;
	transform: translate3d(0, 115%, 0);
}

.cw-environment-intro .cw-environment-lede {
	opacity: 0;
	transform: translate3d(0, 30px, 0);
}

@media (max-width: 767px) {
	.cw-environment-intro .cw-environment-heading.split-reveal-heading .split-word,
	.cw-environment-intro .cw-environment-lede {
		opacity: 1;
		transform: none;
	}
}

.cw-environment-section .gsap-env-card {
	opacity: 0;
	transform: translate3d(0, 30px, 0);
}

@media (prefers-reduced-motion: reduce) {
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-environment-intro .cw-environment-heading.split-reveal-heading .split-word,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-environment-intro .cw-environment-lede,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .gsap-env-card {
		opacity: 1;
		transform: none;
	}
}

.elementor-editor-active .cw-environment-intro .cw-environment-heading.split-reveal-heading .split-word,
.elementor-editor-active .cw-environment-intro .cw-environment-lede,
.elementor-editor-active .cw-environment-section .gsap-env-card {
	opacity: 1;
	transform: none;
}

.cw-environment-intro .text-pill {
	display: inline-block;
	overflow: hidden;
	padding: 0.25rem 1.25rem;
	background: color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 15%, transparent);
	border-radius: 999px;
	position: relative;
	z-index: 1;
	vertical-align: baseline;
	font-size: 0.92em;
}

.cw-environment-intro .text-pill::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 999px;
	padding: 1px;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--cw-accent-primary, #dc2626) 80%, transparent),
		color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 80%, transparent)
	);
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	z-index: -1;
}

.cw-environment-lede {
	margin: 0 auto;
	max-width: 42rem;
	font-family: var(--cw-font-body, "Inter", sans-serif);
	font-size: 1.125rem;
	line-height: 1.6;
	color: var(--cw-env-lede-color, var(--cw-text-muted, #8090a8));
	font-weight: 400;
}

.cw-environment-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--cw-env-grid-gap, 1.5rem);
	align-items: stretch;
}

@media (min-width: 768px) {
	.cw-environment-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.cw-environment-grid {
		grid-template-columns: repeat(4, 1fr);
	}

	/*
	 * Repeater can have fewer than four cards; without this, `repeat(4, 1fr)` leaves an empty column
	 * (e.g. three cards → three narrow columns + dead fourth). Match column count to rendered cards on lg+.
	 */
	.cw-environment-grid[data-cw-env-card-count="1"] {
		grid-template-columns: 1fr;
	}

	.cw-environment-grid[data-cw-env-card-count="2"] {
		grid-template-columns: repeat(2, 1fr);
	}

	.cw-environment-grid[data-cw-env-card-count="3"] {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* Parallax shell (theme cw-motion.js adds 3D tilt on .parallax-container) */
.cw-env-parallax.parallax-container {
	display: block;
	position: relative;
	perspective: 1000px;
	transform-style: preserve-3d;
	min-height: var(--cw-env-card-min-h, 450px);
	height: var(--cw-env-card-h, 450px);
	cursor: pointer;
	color: inherit;
	text-decoration: none;
	outline-offset: 4px;
}

a.cw-env-parallax:focus-visible {
	outline: 2px solid color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 70%, #fff);
	border-radius: 26px;
}

/*
 * demo-skin .parallax-card: rgb(--bg2 / 0.4) + backdrop-blur(24px); image layer sits inside .cw-env-card__media.
 */
.cw-env-parallax .parallax-card {
	border-radius: 24px;
	position: relative;
	transition: box-shadow 0.4s ease;
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
	width: 100%;
	height: 100%;
	padding: 0;
	display: block;
	overflow: hidden;
}

/* Photo cards: frosted shell (parity with demo-skin #environments). */
.cw-env-parallax .parallax-card.cw-env-card--has-image {
	background: color-mix(in srgb, var(--cw-surface-2, #1c1c1c) 40%, transparent);
	-webkit-backdrop-filter: blur(24px);
	backdrop-filter: blur(24px);
}

/* UE .ue-3d-content-card-wrap parity: GSAP rotates this inner layer; outer .parallax-card stays the clip + chrome shell. No CSS transform transition here. */
.cw-env-parallax .cw-env-card__tilt {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	transform-style: preserve-3d;
	pointer-events: none;
	will-change: transform;
}

.cw-env-parallax .parallax-card.cw-env-card--no-image {
	background: linear-gradient(
		145deg,
		color-mix(in srgb, var(--cw-surface-3, #242424) 85%, transparent),
		color-mix(in srgb, var(--cw-surface-2, #1c1c1c) 100%, transparent)
	);
	-webkit-backdrop-filter: blur(24px);
	backdrop-filter: blur(24px);
}

/* Demo distributor tile: novaCard lift — subtle rim + depth */
.cw-env-parallax .parallax-card.cw-env-card--surface-elevated {
	border-color: rgba(255, 255, 255, 0.11);
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.28),
		inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.cw-env-parallax .parallax-card.cw-env-card--surface-elevated.cw-env-card--has-image {
	background: color-mix(in srgb, var(--cw-surface-2, #1c1c1c) 40%, transparent);
	-webkit-backdrop-filter: blur(24px);
	backdrop-filter: blur(24px);
}

.cw-env-parallax:hover .parallax-card.cw-env-card--surface-elevated,
.cw-env-parallax:focus-within .parallax-card.cw-env-card--surface-elevated {
	box-shadow: 0 10px 44px rgba(0, 0, 0, 0.34),
		inset 0 0 60px color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 6%, transparent),
		inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.cw-env-parallax:hover .parallax-card,
.cw-env-parallax:focus-within .parallax-card {
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3),
		inset 0 0 60px color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 6%, transparent);
}

/* Photo fills card; hover glow sits above scrim; copy above everything. */
.cw-env-card__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	border-radius: 24px;
	pointer-events: none;
	isolation: isolate;
	will-change: transform;
	transform: translateZ(0);
}

.cw-env-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		var(--cw-surface-2, #1c1c1c) 0%,
		color-mix(in srgb, var(--cw-surface-2, #1c1c1c) 50%, transparent) 50%,
		transparent 100%
	);
	z-index: 3;
	pointer-events: none;
	border-radius: inherit;
}

.cw-env-card__media-tint {
	position: absolute;
	inset: 0;
	z-index: 2;
	mix-blend-mode: overlay;
	opacity: 0;
	transition: opacity 0.7s ease;
	pointer-events: none;
	border-radius: inherit;
}

.cw-env-parallax .parallax-bg {
	position: absolute;
	inset: 0;
	border-radius: 24px;
	z-index: 4;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--cw-accent-primary, #dc2626) 12%, transparent),
		color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 12%, transparent)
	);
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.cw-env-parallax:hover .parallax-bg,
.cw-env-parallax:focus-within .parallax-bg {
	opacity: 1;
}

.cw-env-card__media-tint.is-red {
	background: color-mix(in srgb, var(--cw-accent-primary, #dc2626) 20%, transparent);
}

.cw-env-card__media-tint.is-purple {
	background: color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 20%, transparent);
}

.cw-env-parallax:hover .cw-env-card__media-tint,
.cw-env-parallax:focus-within .cw-env-card__media-tint {
	opacity: 1;
}

.cw-env-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	filter: grayscale(1);
	opacity: 0.6;
	transition: opacity 1.5s cubic-bezier(0.25, 1, 0.5, 1), transform 1.5s cubic-bezier(0.25, 1, 0.5, 1),
		filter 0.5s ease;
	transform: scale(1);
	z-index: 1;
}

.cw-env-parallax:hover .cw-env-card__img,
.cw-env-parallax:focus-within .cw-env-card__img {
	opacity: 0.9;
	filter: grayscale(0);
	transform: scale(1.1);
}

.cw-env-card__content.parallax-content {
	position: relative;
	z-index: 5;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-height: 100%;
	padding: 2rem;
	box-sizing: border-box;
	transform: translateZ(0);
	will-change: transform;
	pointer-events: auto;
}

/* Hover lift — inner stack so theme JS can own parallax translate on .cw-env-card__content (UE-style). */
.cw-env-card__lift {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	width: 100%;
	transform: translateZ(0);
	transition: transform 0.5s ease-out;
}

/* demo-skin #environments: .parallax-content group-hover:-translate-y-4 duration-500 */
.cw-env-parallax:hover .cw-env-card__lift,
.cw-env-parallax:focus-within .cw-env-card__lift {
	transform: translateY(-1rem) translateZ(0);
}

.cw-env-card__icon {
	width: 3.5rem;
	height: 3.5rem;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 1rem;
	border: 1px solid rgba(255, 255, 255, 0.05);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 1.5rem;
	opacity: 1;
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	transition: background 0.5s ease, border-color 0.5s ease;
}

.cw-env-card__icon .elementor-icon,
.cw-env-card__icon svg {
	width: 1.75rem;
	height: 1.75rem;
	fill: currentColor;
	color: #fff;
}

.cw-env-parallax:hover .cw-env-card__icon,
.cw-env-parallax:focus-within .cw-env-card__icon {
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--cw-accent-primary, #dc2626) 35%, transparent),
		color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 35%, transparent)
	);
	border-color: transparent;
}

/* demo-skin #environments: h3 always visible (text-3xl font-bold); p + CTA opacity-0 until group-hover duration-500. */
.cw-env-card__title {
	margin: 0 0 0.5rem;
	font-family: var(--cw-font-heading, "Barlow", sans-serif);
	font-weight: 700;
	font-size: clamp(1.375rem, 2.6vw, 1.875rem);
	line-height: 1.1;
	letter-spacing: 0;
	color: #fff;
	opacity: 1;
	visibility: visible;
	transition: color 0.5s ease;
	text-wrap: balance;
}

.cw-env-parallax:hover .cw-env-card__title.is-accent-red,
.cw-env-parallax:focus-within .cw-env-card__title.is-accent-red {
	color: var(--cw-accent-primary, #dc2626);
}

.cw-env-parallax:hover .cw-env-card__title.is-accent-purple,
.cw-env-parallax:focus-within .cw-env-card__title.is-accent-purple {
	color: var(--cw-accent-secondary, #00b7fa);
}

.cw-env-card__excerpt {
	margin: 0.5rem 0 0;
	font-family: var(--cw-font-body, "Inter", sans-serif);
	font-size: 0.875rem;
	line-height: 1.625;
	color: var(--cw-text-muted, #8090a8);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s ease;
}

.cw-env-parallax:hover .cw-env-card__excerpt,
.cw-env-parallax:focus-within .cw-env-card__excerpt {
	opacity: 1;
	pointer-events: auto;
}

.cw-env-card__cta {
	display: flex;
	align-items: center;
	margin-top: 1rem;
	font-family: var(--cw-font-body, "Inter", sans-serif);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.5;
	color: #fff;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s ease;
}

.cw-env-parallax:hover .cw-env-card__cta,
.cw-env-parallax:focus-within .cw-env-card__cta {
	opacity: 1;
	pointer-events: auto;
}

.cw-env-card__cta .elementor-icon,
.cw-env-card__cta svg {
	width: 1.125rem;
	height: 1.125rem;
	margin-left: 0.5rem;
	transition: transform 0.5s ease;
}

.cw-env-parallax:hover .cw-env-card__cta .cw-env-card__cta-icon,
.cw-env-parallax:focus-within .cw-env-card__cta .cw-env-card__cta-icon {
	transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-parallax .parallax-card,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__img,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__media-tint,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-parallax .parallax-bg,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__content.parallax-content,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__icon,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__excerpt,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__cta,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-card__title {
		transition-duration: 0.01ms !important;
	}

	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-parallax:hover .cw-env-card__img,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-parallax:focus-within .cw-env-card__img,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .gsap-env-card.is-content-revealed .cw-env-card__img {
		transform: none !important;
	}

	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-parallax:hover .cw-env-card__lift,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .cw-env-parallax:focus-within .cw-env-card__lift,
	.cw-environment-section:not([data-cw-ignore-reduced-motion="1"]) .gsap-env-card.is-content-revealed .cw-env-card__lift {
		transform: translateZ(0) !important;
	}
}

/* Mobile: IntersectionObserver reveals (cw-motion.js) */
@media (max-width: 767px) {
	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__lift {
		transform: translateY(-1rem) translateZ(0);
	}

	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__excerpt,
	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__cta {
		opacity: 1 !important;
		pointer-events: auto;
	}

	/* demo mobile: title stays white until “reveal”; optional accent when strip is active (parity with hover title tint). */
	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__title.is-accent-red {
		color: var(--cw-accent-primary, #dc2626);
	}

	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__title.is-accent-purple {
		color: var(--cw-accent-secondary, #00b7fa);
	}

	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__media-tint {
		opacity: 1;
	}

	.cw-environment-section .gsap-env-card.is-content-revealed .parallax-bg {
		opacity: 1;
	}

	.cw-environment-section .gsap-env-card.is-content-revealed .parallax-card {
		box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3),
			inset 0 0 60px color-mix(in srgb, var(--cw-accent-secondary, #00b7fa) 6%, transparent);
	}

	.cw-environment-section .gsap-env-card.is-content-revealed .cw-env-card__img {
		opacity: 0.9;
		filter: grayscale(0);
		transform: scale(1.08);
	}
}
