/**
 * WP GSAP Motion — Frontend v4.0
 *
 * Rule #1: never force `opacity` or `visibility` with !important on an animated
 * node. GSAP writes inline styles without !important, so such a rule silently
 * breaks every fade-based effect — that was the core bug in v2.
 *
 * FOUC is handled by the `.wpghr-pending` class instead: PHP stamps it on the
 * wrapper at render time, the rule below hides it, and the runtime removes it
 * the moment every hiding effect has its start state in place. An inline
 * failsafe timer removes it unconditionally, so content can never stay
 * invisible.
 *
 * Everything else here is structure the effects need and cannot express as an
 * inline style: masks, stand-in slats, glitch layers, the shimmer sheen and the
 * horizontal-scroll layout.
 */

[data-wpghr].wpghr-pending {
	visibility: hidden;
}

/* Interactive triggers get an affordance. */
[data-wpghr].wpghr-interactive {
	cursor: pointer;
}

/* ------------------------------------------------------------------ text */

/* Gradient sweep: paint the background through the glyphs. */
.wpghr-gradient {
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	-webkit-text-fill-color: transparent;
	background-repeat: no-repeat;
}

/* Highlight marker sits behind the text. */
.wpghr-has-marker {
	position: relative;
	display: inline-block;
	isolation: isolate;
}

.wpghr-marker {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0.08em;
	z-index: -1;
	display: block;
	pointer-events: none;
	border-radius: 0.05em;
}

/* Typewriter caret. */
.wpghr-cursor {
	display: inline-block;
	width: 0.08em;
	min-width: 2px;
	height: 1em;
	margin-left: 0.05em;
	background: currentColor;
	vertical-align: -0.1em;
	animation: wpghr-blink 1s steps(1) infinite;
}

@keyframes wpghr-blink {
	0%, 49% { opacity: 1; }
	50%, 100% { opacity: 0; }
}

/* Glitch: two tinted clones stacked exactly over the real text. */
.wpghr-glitch {
	position: relative;
	display: inline-block;
}

.wpghr-glitch-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	pointer-events: none;
	user-select: none;
	white-space: pre-wrap;
}

/* Split pieces: hint the compositor while animating, release afterwards. */
[data-wpghr].wpghr-armed .wpghr-line,
[data-wpghr].wpghr-armed .wpghr-word,
[data-wpghr].wpghr-armed .wpghr-char {
	will-change: transform, opacity;
}

[data-wpghr].wpghr-done .wpghr-line,
[data-wpghr].wpghr-done .wpghr-word,
[data-wpghr].wpghr-done .wpghr-char {
	will-change: auto;
}

/* Kerning shifts when characters get their own boxes. */
[data-wpghr] .wpghr-char {
	font-kerning: none;
	text-rendering: optimizeSpeed;
}

/* ----------------------------------------------------------------- image */

/*
 * Mask wrapper, inserted by JS around the animated node.
 *
 * `display: inline-block` by default so it can wrap an inline image without
 * changing the flow; `--block` for cases where the image is a block and the
 * wrapper has to fill the width it had.
 */
.wpghr-mask {
	position: relative;
	display: inline-block;
	overflow: hidden;
	max-width: 100%;
	vertical-align: top;
	/* A transform on the mask creates a containing block, which is what keeps
	   the counter-moving image from escaping it. */
	will-change: transform;
}

.wpghr-mask--block {
	display: block;
	width: 100%;
}

/* Blinds stand-ins: absolutely placed strips carrying slices of the picture. */
.wpghr-blinds {
	position: relative;
}

.wpghr-slat {
	position: absolute;
	display: block;
	background-repeat: no-repeat;
	pointer-events: none;
}

/* --------------------------------------------------------------- scroll */

/*
 * Horizontal scroll.
 *
 * Applied as classes rather than inline styles so teardown is a class removal
 * and Elementor's own responsive CSS is never overwritten.
 *
 * Two things had to be right here, and both are Elementor's doing:
 *
 * 1. The direction must be written as Elementor's custom property. Elementor
 *    styles containers through `.e-con { flex-direction: var(--flex-direction) }`,
 *    so a plain `flex-direction: row` on our class is overridden by the
 *    variable's value and the children stay in a column.
 *
 * 2. The selector must out-specify `.e-con.e-flex`, which sets
 *    `--flex-direction: column` at 0,2,0 and — like all of Elementor's CSS —
 *    loads after this file. A single class cannot win that on cascade order.
 *
 * What is deliberately NOT set is a width. The row is meant to overflow its
 * container, and `overflow: hidden` on the same element clips it; that overflow
 * is exactly what the runtime measures as travel distance. Forcing
 * `width: max-content` looks like the obvious way to fit the children, but for
 * `e-con-full` — where the track IS the container — it widens the element past
 * the viewport instead, which gives the whole document a horizontal scrollbar
 * and leaves nothing to overflow, so the measured travel drops to zero.
 */
.wpghr-hscroll {
	overflow: hidden;
}

/* Elementor sets `overflow: var(--overflow)` and defaults that variable to
 * visible. Its stylesheet loads after ours, so set the variable as well. */
.e-con.e-flex.wpghr-hscroll,
.wpghr-hscroll {
	--overflow: hidden;
}

.e-con.e-flex.wpghr-hscroll-track,
.e-con-inner.wpghr-hscroll-track,
.wpghr-hscroll-track {
	--flex-direction: row;
	--flex-wrap: nowrap;
	--align-items: stretch;
	display: flex;
}

.e-con.e-flex.wpghr-hscroll--center,
.e-con-inner.wpghr-hscroll--center,
.wpghr-hscroll--center {
	--align-items: center;
}

.wpghr-hscroll--flush {
	padding-left: 0;
	padding-right: 0;
}

/* `.e-con.e-flex` sets `flex: 0 1 auto` at 0,2,0. A single track class loses
 * that cascade and squeezes fixed-width children until there is no travel.
 * Override Elementor's variables rather than writing a fragile inline style. */
.wpghr-hscroll-track > .e-con.e-flex,
.wpghr-hscroll-track > .elementor-element,
.wpghr-hscroll-track > * {
	--flex-grow: 0;
	--flex-shrink: 0;
	flex: 0 0 auto;
}

/* ---------------------------------------------------------- interaction */

.wpghr-has-shimmer {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.wpghr-shimmer {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	display: block;
	pointer-events: none;
	/* Above the element's own background, below its text. */
	z-index: 1;
}

/* ------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
	.wpghr-cursor {
		animation: none;
	}

	/*
	 * The runtime already skips or reduces animations, but a looping effect that
	 * slipped through must not keep moving.
	 */
	.wpghr-shimmer,
	.wpghr-glitch-layer {
		display: none;
	}
}
