/**
 * AvalynxAnimate
 *
 * Modern scroll animations based on vanilla JavaScript with configurable
 * scroll-position and visibility-observer triggers. The animated state is
 * triggered by the avalynx-animate-in class only; the delay applies only
 * while animating in.
 *
 * Initial states are class based (avalynx-animate-<name>): without JavaScript
 * nothing is hidden — progressive enhancement.
 *
 * @version 1.0.0
 * @license MIT
 * @author https://github.com/avalynx/avalynx-animate/graphs/contributors
 * @website https://github.com/avalynx/
 * @repository https://github.com/avalynx/avalynx-animate.git
 * @bugs https://github.com/avalynx/avalynx-animate/issues
 *
 */

[class*='avalynx-animate-'] {
	transition-property: opacity, transform, filter, clip-path;
	transition-duration: var(--avalynx-animate-duration, 400ms);
	transition-delay: 0ms;
	transition-timing-function: var(--avalynx-animate-easing, ease);
}

.avalynx-animate-prepare {
	transition: none !important;
}

/* ============================================================
   Classic animations (fade / flip / slide / zoom)
   ============================================================ */

/* fade */
.avalynx-animate-fade { opacity: 0; }
.avalynx-animate-fade-up { opacity: 0; transform: translate3d(0, 100px, 0); }
.avalynx-animate-fade-down { opacity: 0; transform: translate3d(0, -100px, 0); }
.avalynx-animate-fade-left { opacity: 0; transform: translate3d(100px, 0, 0); }
.avalynx-animate-fade-right { opacity: 0; transform: translate3d(-100px, 0, 0); }
.avalynx-animate-fade-up-right { opacity: 0; transform: translate3d(-100px, 100px, 0); }
.avalynx-animate-fade-up-left { opacity: 0; transform: translate3d(100px, 100px, 0); }
.avalynx-animate-fade-down-right { opacity: 0; transform: translate3d(-100px, -100px, 0); }
.avalynx-animate-fade-down-left { opacity: 0; transform: translate3d(100px, -100px, 0); }

/* flip (3D) */
.avalynx-animate-flip-left { backface-visibility: hidden; transform: perspective(2500px) rotateY(-100deg); }
.avalynx-animate-flip-right { backface-visibility: hidden; transform: perspective(2500px) rotateY(100deg); }
.avalynx-animate-flip-up { backface-visibility: hidden; transform: perspective(2500px) rotateX(-100deg); }
.avalynx-animate-flip-down { backface-visibility: hidden; transform: perspective(2500px) rotateX(100deg); }

/* slide */
.avalynx-animate-slide-up { transform: translate3d(0, 100%, 0); }
.avalynx-animate-slide-down { transform: translate3d(0, -100%, 0); }
.avalynx-animate-slide-left { transform: translate3d(100%, 0, 0); }
.avalynx-animate-slide-right { transform: translate3d(-100%, 0, 0); }

/* zoom */
.avalynx-animate-zoom-in { opacity: 0; transform: scale(0.6); }
.avalynx-animate-zoom-in-up { opacity: 0; transform: translate3d(0, 100px, 0) scale(0.6); }
.avalynx-animate-zoom-in-down { opacity: 0; transform: translate3d(0, -100px, 0) scale(0.6); }
.avalynx-animate-zoom-in-left { opacity: 0; transform: translate3d(100px, 0, 0) scale(0.6); }
.avalynx-animate-zoom-in-right { opacity: 0; transform: translate3d(-100px, 0, 0) scale(0.6); }
.avalynx-animate-zoom-out { opacity: 0; transform: scale(1.2); }
.avalynx-animate-zoom-out-up { opacity: 0; transform: translate3d(0, 100px, 0) scale(1.2); }
.avalynx-animate-zoom-out-down { opacity: 0; transform: translate3d(0, -100px, 0) scale(1.2); }
.avalynx-animate-zoom-out-left { opacity: 0; transform: translate3d(100px, 0, 0) scale(1.2); }
.avalynx-animate-zoom-out-right { opacity: 0; transform: translate3d(-100px, 0, 0) scale(1.2); }

/* ============================================================
   New animations (modern set)
   ============================================================ */

/* blur-in */
.avalynx-animate-blur-in { opacity: 0; filter: blur(12px); }
.avalynx-animate-blur-in-up { opacity: 0; filter: blur(12px); transform: translate3d(0, 40px, 0); }
.avalynx-animate-blur-in-down { opacity: 0; filter: blur(12px); transform: translate3d(0, -40px, 0); }
.avalynx-animate-blur-in-left { opacity: 0; filter: blur(12px); transform: translate3d(-40px, 0, 0); }
.avalynx-animate-blur-in-right { opacity: 0; filter: blur(12px); transform: translate3d(40px, 0, 0); }

/* pop (overshoot) */
.avalynx-animate-pop { opacity: 0; transform: scale(0.35); }
.avalynx-animate-pop-up { opacity: 0; transform: translate3d(0, 40px, 0) scale(0.35); }
.avalynx-animate-pop-down { opacity: 0; transform: translate3d(0, -40px, 0) scale(0.35); }

/* tilt-in (3D) */
.avalynx-animate-tilt-in-left { opacity: 0; transform: perspective(800px) rotateY(24deg) translate3d(-60px, 0, 0); }
.avalynx-animate-tilt-in-right { opacity: 0; transform: perspective(800px) rotateY(-24deg) translate3d(60px, 0, 0); }

/* roll-in */
.avalynx-animate-roll-in-left { opacity: 0; transform: translate3d(-120px, 0, 0) rotate(-360deg); }
.avalynx-animate-roll-in-right { opacity: 0; transform: translate3d(120px, 0, 0) rotate(360deg); }

/* mask-wipe (clip-path) — fully hidden start states: trigger points come
   from the layout position, the clipped area does not matter. */
.avalynx-animate-mask-wipe-left { clip-path: inset(0 100% 0 0); }
.avalynx-animate-mask-wipe-right { clip-path: inset(0 0 0 100%); }
.avalynx-animate-mask-wipe-up { clip-path: inset(100% 0 0 0); }
.avalynx-animate-mask-wipe-down { clip-path: inset(0 0 100% 0); }
.avalynx-animate-mask-circle { clip-path: circle(0% at 50% 50%); }

/* ============================================================
   Animated state (avalynx-animate-in = trigger class)
   ============================================================ */

.avalynx-animate-in[class*='avalynx-animate-'] {
	opacity: 1;
	transform: none;
	filter: none;
	transition-delay: var(--avalynx-animate-delay, 0ms);
}

/* clip-path final states per shape (none is not interpolatable) */
.avalynx-animate-in.avalynx-animate-mask-wipe-left,
.avalynx-animate-in.avalynx-animate-mask-wipe-right,
.avalynx-animate-in.avalynx-animate-mask-wipe-up,
.avalynx-animate-in.avalynx-animate-mask-wipe-down {
	clip-path: inset(0 0 0 0);
}
.avalynx-animate-in.avalynx-animate-mask-circle {
	clip-path: circle(100% at 50% 50%);
}

/* ============================================================
   Hover animations (data-avalynx-animate-hover)
   Triggered by mouseenter/mouseleave on the element carrying the
   attribute (or its data-avalynx-animate-hover-target descendant).
   One-shot effects run as keyframe animations and re-arm on every
   new hover; held states (grow/shrink) use the shared transition.
   ============================================================ */

.avalynx-animate-hover-shake { animation: avalynx-hover-shake .5s ease both; }
.avalynx-animate-hover-jiggle { animation: avalynx-hover-jiggle .45s ease both; }
.avalynx-animate-hover-pop { animation: avalynx-hover-pop .5s ease both; }
.avalynx-animate-hover-bounce { animation: avalynx-hover-bounce .55s ease both; }
.avalynx-animate-hover-tada { animation: avalynx-hover-tada .8s ease both; }
.avalynx-animate-hover-heartbeat { animation: avalynx-hover-heartbeat 1s ease-in-out both; }

/* Held states — doubled class to win against the avalynx-animate-in reset above. */
.avalynx-animate-hover-grow.avalynx-animate-hover-grow { transform: scale(1.08); }
.avalynx-animate-hover-shrink.avalynx-animate-hover-shrink { transform: scale(0.94); }

@keyframes avalynx-hover-shake {
	0%, 100% { transform: translateX(0); }
	15% { transform: translateX(-6px); }
	30% { transform: translateX(6px); }
	45% { transform: translateX(-4px); }
	60% { transform: translateX(4px); }
	75% { transform: translateX(-2px); }
	90% { transform: translateX(2px); }
}

@keyframes avalynx-hover-jiggle {
	0%, 100% { transform: rotate(0deg); }
	25% { transform: rotate(-2deg); }
	50% { transform: rotate(2deg); }
	75% { transform: rotate(-1deg); }
}

@keyframes avalynx-hover-pop {
	0% { transform: scale(1); }
	50% { transform: scale(1.07); }
	75% { transform: scale(0.98); }
	100% { transform: scale(1); }
}

@keyframes avalynx-hover-bounce {
	0%, 100% { transform: translateY(0); }
	30% { transform: translateY(-8px); }
	55% { transform: translateY(2px); }
	75% { transform: translateY(-3px); }
}

@keyframes avalynx-hover-tada {
	0%, 100% { transform: scale(1) rotate(0deg); }
	10%, 20% { transform: scale(0.96) rotate(-2deg); }
	30%, 50%, 70%, 90% { transform: scale(1.05) rotate(2deg); }
	40%, 60%, 80% { transform: scale(1.05) rotate(-2deg); }
}

@keyframes avalynx-hover-heartbeat {
	0%, 40%, 80%, 100% { transform: scale(1); }
	20% { transform: scale(1.06); }
	60% { transform: scale(1.03); }
}

/* ============================================================
   Reduced motion / disabled
   ============================================================ */

.avalynx-animate-disabled [class*='avalynx-animate-'],
html.avalynx-animate-disabled [class*='avalynx-animate-'] {
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	[class*='avalynx-animate-'] {
		transition: none;
	}

	[class*='avalynx-animate-hover-'] {
		animation: none;
		transform: none;
	}
}
