/*
 * IF27 Pattern
 * The wrapper gets the "ifp-on" class from Elementor (prefix_class).
 * Colors and width come from CSS variables set by the Elementor controls:
 *   --ifp-bg  background color
 *   --ifp-fg  shapes color
 *   --ifp-w   pattern width
 */

/* Zero specificity: never overrides an Elementor position setting. */
:where(.ifp-on) {
	position: relative;
}

/*
 * The layer is the first child at z-index 0. Widgets, nested containers and the
 * legacy .elementor-container are already positioned, so they paint above it in
 * tree order. Only the boxed inner wrapper is static: lift it with z-index (it is
 * a flex/grid item) without changing the containing block of absolute widgets.
 */
.ifp-on > .e-con-inner {
	z-index: 1;
}

.ifp-layer {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
	border-radius: inherit;
	background-color: var(--ifp-bg, #8533ff);
}

/*
 * Full height box anchored right. The width sets the scale of the triangles; the
 * script repeats the tile upward and downward so the pattern never shows an edge.
 */
.ifp-art {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--ifp-w, 54%);
}

.ifp-art svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Full cycle (9 s): entrance, pause, exit. Staggered by column then row. */
.ifp-art .cell {
	animation: ifp-cycle 9s ease-in-out var(--d) infinite both;
}

@keyframes ifp-cycle {
	0% {
		opacity: 0;
		transform: translateX(-30px);
	}
	12%,
	84% {
		opacity: 1;
		transform: none;
	}
	96%,
	100% {
		opacity: 0;
		transform: translateX(30px);
	}
}

/* Hatching: slow endless drift, seamless loop. */
.ifp-art .hatch {
	animation: ifp-drift 2.6s linear infinite;
}

.ifp-art .hatch.rev {
	animation-direction: reverse;
}

.ifp-art .hatch path {
	fill: none;
	stroke: var(--ifp-fg, #fff);
	stroke-width: 1;
	stroke-opacity: 0.9;
}

@keyframes ifp-drift {
	to {
		transform: translateY(6px);
	}
}

/* Dots: opacity wave sweeping the triangle from left to right. */
.ifp-art .dot {
	fill: none;
	stroke: var(--ifp-fg, #fff);
	stroke-width: 3.4;
	stroke-linecap: round;
	animation: ifp-wave 4.6s ease-in-out calc(var(--d) + 1.2s + var(--i) * 0.05s) infinite both;
}

@keyframes ifp-wave {
	0%,
	60%,
	100% {
		opacity: 0.3;
	}
	25% {
		opacity: 1;
	}
}

/* Rays: drawn from the tip, held, then erased toward the tip. */
.ifp-art .ray {
	stroke: var(--ifp-fg, #fff);
	stroke-width: 1.3;
	stroke-dasharray: 1;
	animation: ifp-draw 9s ease-in-out calc(var(--d) + var(--k) * 0.05s) infinite both;
}

@keyframes ifp-draw {
	0% {
		stroke-dashoffset: 1;
	}
	16%,
	82% {
		stroke-dashoffset: 0;
	}
	94%,
	100% {
		stroke-dashoffset: -1;
	}
}

.ifp-art .fan {
	transform-box: fill-box;
	transform-origin: 100% 50%;
	animation: ifp-breathe 7s ease-in-out calc(var(--d) + 1.5s) infinite alternate both;
}

@keyframes ifp-breathe {
	to {
		transform: scaleY(0.88);
	}
}

/* Paused while off screen (toggled by the script). */
.ifp-layer.is-off * {
	animation-play-state: paused;
}

/* Respect the system setting: no motion. */
@media (prefers-reduced-motion: reduce) {
	.ifp-art * {
		animation: none !important;
	}
}

/* Small screens: the pattern becomes a faint watermark. */
@media (max-width: 767px) {
	.ifp-art {
		opacity: 0.3;
	}
}
