/* ==========================================================================
   3D mount ([iws_3d_hero], [iws_3d variant="…"]) — Techkit Child
   The canvas is decorative (aria-hidden), never receives pointer events and sits
   behind content. Space is reserved (aspect-ratio) so there is no layout shift.
   ========================================================================== */

.iws-3d {
	--iws-3d-bg: radial-gradient(120% 90% at 50% 38%, #24245f 0%, var(--iws-ink, #14133b) 48%, var(--iws-graphite, #1c1f26) 100%);
	--iws-3d-poster: url("../images/3d-fallback-desktop-dark.webp");
	--iws-3d-poster-mobile: url("../images/3d-fallback-mobile-dark.webp");
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	min-height: 320px;
	overflow: hidden;
	isolation: isolate;
	contain: layout paint;
	border-radius: var(--iws-radius-lg, 20px);
	background: var(--iws-3d-bg);
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
}

.iws-3d--light {
	--iws-3d-bg: radial-gradient(120% 90% at 50% 38%, #ffffff 0%, #f6f9ff 55%, #e7ebf4 100%);
	--iws-3d-poster: url("../images/3d-fallback-desktop-light.webp");
	--iws-3d-poster-mobile: url("../images/3d-fallback-mobile-light.webp");
}

.iws-3d__fallback {
	position: absolute;
	inset: 0;
	background-image: var(--iws-3d-poster);
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	opacity: 1;
	transition: opacity var(--iws-dur-3, 400ms) var(--iws-ease, ease);
	will-change: opacity;
}

.iws-3d__canvas {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	pointer-events: none;
	opacity: 0;
	transition: opacity var(--iws-dur-3, 400ms) var(--iws-ease, ease);
	outline: none;
}

.iws-3d.is-3d-active .iws-3d__canvas {
	opacity: 1;
}

.iws-3d.is-3d-active .iws-3d__fallback {
	opacity: 0;
}

/*
 * Wide background mounts with align="right|left" (text on the other side): the 3D camera
 * shifts the scene sideways, so the static poster does the same instead of sitting under
 * the headline. The inner edge fades into the mount gradient.
 */
@media (min-width: 768px) {
	.iws-3d--background[data-iws-align="right"] .iws-3d__fallback,
	.iws-3d--background[data-iws-align="left"] .iws-3d__fallback {
		--iws-3d-fade-x: linear-gradient(to right, transparent 0%, #000 22%, #000 100%);
		--iws-3d-fade-y: linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
		inset: auto;
		top: 50%;
		width: 58%;
		height: auto;
		max-height: 100%;
		aspect-ratio: 16 / 10;
		translate: 0 -50%;
		background-size: cover;
		-webkit-mask-image: var(--iws-3d-fade-x), var(--iws-3d-fade-y);
		-webkit-mask-composite: source-in;
		mask-image: var(--iws-3d-fade-x), var(--iws-3d-fade-y);
		mask-composite: intersect;
	}

	.iws-3d--background[data-iws-align="right"] .iws-3d__fallback {
		right: 0;
	}

	.iws-3d--background[data-iws-align="left"] .iws-3d__fallback {
		--iws-3d-fade-x: linear-gradient(to left, transparent 0%, #000 22%, #000 100%);
		left: 0;
	}
}

/* Tier 4: static image with a slow CSS drift (not for reduced motion / tier 5). */
.iws-3d--fallback-animate .iws-3d__fallback {
	animation: iws-3d-drift 14s var(--iws-ease, ease-in-out) infinite alternate;
	transform-origin: 50% 45%;
}

@keyframes iws-3d-drift {
	from { transform: scale(1) translate3d(0, 0, 0); }
	to { transform: scale(1.035) translate3d(0, -1.2%, 0); }
}

@media (max-width: 767px) {
	.iws-3d {
		aspect-ratio: 1 / 1;
		min-height: 280px;
	}

	.iws-3d__fallback {
		background-image: var(--iws-3d-poster-mobile);
	}

	/* Portrait background mounts: poster sits at the top (matches the 3D framing), never under the text. */
	.iws-3d--background .iws-3d__fallback {
		background-size: 100% auto;
		background-position: center top;
	}
}

@media (prefers-reduced-motion: reduce) {
	.iws-3d__fallback,
	.iws-3d--fallback-animate .iws-3d__fallback {
		animation: none !important;
		transform: none !important;
	}
}

/* --------------------------------------------------------------------------
   layout="background": fills the parent Elementor container behind its content.
   Use on a container with Content Width = Full Width for edge-to-edge results.
   -------------------------------------------------------------------------- */
.iws-3d--background {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	min-height: 0;
	aspect-ratio: auto;
	border-radius: 0;
	z-index: 0;
}

.elementor-widget-shortcode:has(.iws-3d--background) {
	position: absolute !important;
	inset: 0;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	z-index: 0;
	pointer-events: none;
}

.elementor-widget-shortcode:has(.iws-3d--background) > .elementor-widget-container,
.elementor-widget-shortcode:has(.iws-3d--background) .elementor-shortcode {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
}

.e-con:has(> .elementor-widget-shortcode .iws-3d--background),
.e-con-inner:has(> .elementor-widget-shortcode .iws-3d--background),
.elementor-widget-wrap:has(> .elementor-widget-shortcode .iws-3d--background) {
	position: relative;
	isolation: isolate;
}

.e-con:has(> .elementor-widget-shortcode .iws-3d--background) > :not(.elementor-widget-shortcode):not(.elementor-absolute):not(.elementor-fixed),
.e-con-inner:has(> .elementor-widget-shortcode .iws-3d--background) > :not(.elementor-widget-shortcode):not(.elementor-absolute):not(.elementor-fixed),
.elementor-widget-wrap:has(> .elementor-widget-shortcode .iws-3d--background) > :not(.elementor-widget-shortcode):not(.elementor-absolute):not(.elementor-fixed) {
	position: relative;
	z-index: 1;
}
