/* ============================================
   ANIMATIONS - Keyframes & Animation Utilities
   ============================================ */

/* ========== TEXT REVEAL ANIMATIONS ========== */

/* Clip Path Wipe from Left */
.reveal-text {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
}

.reveal-text.active {
    animation: revealText 0.8s var(--ease-smooth) forwards;
}

@keyframes revealText {
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* Fade Up */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
}

.fade-up.active {
    animation: fadeUp 0.8s var(--ease-smooth) forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In */
.fade-in {
    opacity: 0;
}

.fade-in.active {
    animation: fadeIn 0.8s var(--ease-smooth) forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Scale In */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
}

.scale-in.active {
    animation: scaleIn 0.6s var(--ease-smooth) forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In Left */
.slide-left {
    opacity: 0;
    transform: translateX(-50px);
}

.slide-left.active {
    animation: slideLeft 0.8s var(--ease-smooth) forwards;
}

@keyframes slideLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right */
.slide-right {
    opacity: 0;
    transform: translateX(50px);
}

.slide-right.active {
    animation: slideRight 0.8s var(--ease-smooth) forwards;
}

@keyframes slideRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== STAGGER ANIMATIONS ========== */
.stagger>* {
    opacity: 0;
    transform: translateY(20px);
}

.stagger.active>* {
    animation: fadeUp 0.6s var(--ease-smooth) forwards;
}

.stagger.active>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger.active>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger.active>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger.active>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger.active>*:nth-child(5) {
    animation-delay: 0.5s;
}

.stagger.active>*:nth-child(6) {
    animation-delay: 0.6s;
}

.stagger.active>*:nth-child(7) {
    animation-delay: 0.7s;
}

.stagger.active>*:nth-child(8) {
    animation-delay: 0.8s;
}

/* ========== TYPING ANIMATION ========== */
.typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--color-secondary);
    width: 0;
}

.typing.active {
    animation: typing 2s steps(30) forwards, blink 0.7s step-end infinite;
}

@keyframes typing {
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* ========== TYPEWRITER EFFECT ========== */
.typewriter {
    position: relative;
}

.typewriter::after {
    content: '|';
    position: absolute;
    right: -10px;
    color: var(--color-secondary);
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ========== INFINITE SCROLL ========== */
.infinite-scroll {
    display: flex;
    animation: infiniteScroll 30s linear infinite;
}

@keyframes infiniteScroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* Pause on hover */
.infinite-scroll-container:hover .infinite-scroll {
    animation-play-state: paused;
}

/* ========== PULSE ANIMATION ========== */
.pulse {
    animation: pulse 2s var(--ease-smooth) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* ========== FLOAT ANIMATION ========== */
.float {
    animation: float 6s var(--ease-smooth) infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ========== SPIN ANIMATION ========== */
.spin {
    animation: spin 10s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ========== GLOW ANIMATION ========== */
.glow {
    animation: glow 2s var(--ease-smooth) infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }

    to {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
    }
}

/* ========== VIDEO BACKGROUND ZOOM ========== */
.video-zoom {
    animation: videoZoom 20s var(--ease-smooth) infinite alternate;
}

@keyframes videoZoom {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

/* ========== COUNTER NUMBER SCRAMBLE ========== */
.number-scramble {
    font-variant-numeric: tabular-nums;
}

/* ========== SVG PATH DRAW ========== */
.path-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.path-draw.active {
    animation: pathDraw 2s var(--ease-smooth) forwards;
}

@keyframes pathDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ========== MASK REVEAL ========== */
.mask-reveal {
    clip-path: inset(50% 50% 50% 50%);
}

.mask-reveal.active {
    animation: maskReveal 1s var(--ease-smooth) forwards;
}

@keyframes maskReveal {
    to {
        clip-path: inset(0% 0% 0% 0%);
    }
}

/* ========== GLITCH EFFECT ========== */
.glitch {
    position: relative;
}

.glitch:hover::before,
.glitch:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch:hover::before {
    animation: glitch-1 0.3s infinite linear alternate-reverse;
    color: #ff0000;
    z-index: -1;
}

.glitch:hover::after {
    animation: glitch-2 0.3s infinite linear alternate-reverse;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch-1 {
    0% {
        clip-path: inset(40% 0 61% 0);
        transform: translate(-2px, 2px);
    }

    20% {
        clip-path: inset(92% 0 1% 0);
        transform: translate(1px, -1px);
    }

    40% {
        clip-path: inset(43% 0 1% 0);
        transform: translate(-1px, 1px);
    }

    60% {
        clip-path: inset(25% 0 58% 0);
        transform: translate(2px, -2px);
    }

    80% {
        clip-path: inset(54% 0 7% 0);
        transform: translate(-2px, 2px);
    }

    100% {
        clip-path: inset(58% 0 43% 0);
        transform: translate(1px, -1px);
    }
}

@keyframes glitch-2 {
    0% {
        clip-path: inset(65% 0 14% 0);
        transform: translate(2px, -2px);
    }

    20% {
        clip-path: inset(10% 0 85% 0);
        transform: translate(-1px, 1px);
    }

    40% {
        clip-path: inset(66% 0 16% 0);
        transform: translate(1px, -1px);
    }

    60% {
        clip-path: inset(98% 0 1% 0);
        transform: translate(-2px, 2px);
    }

    80% {
        clip-path: inset(42% 0 40% 0);
        transform: translate(2px, -2px);
    }

    100% {
        clip-path: inset(9% 0 53% 0);
        transform: translate(-1px, 1px);
    }
}

/* ========== IMAGE GLITCH HOVER ========== */
.img-glitch {
    position: relative;
    overflow: hidden;
}

.img-glitch img {
    transition: all 0.3s var(--ease-smooth);
}

.img-glitch:hover img {
    filter: saturate(1.2);
}

.img-glitch::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg,
            transparent 45%,
            var(--color-secondary) 45%,
            var(--color-secondary) 55%,
            transparent 55%);
    background-size: 4px 4px;
    opacity: 0;
    mix-blend-mode: overlay;
    z-index: 2;
    transition: opacity 0.3s var(--ease-smooth);
}

.img-glitch:hover::before {
    opacity: 0.3;
    animation: scanlines 0.5s steps(8) infinite;
}

@keyframes scanlines {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 4px;
    }
}

/* ========== RIPPLE EFFECT ========== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.ripple:active::after {
    animation: rippleEffect 0.6s var(--ease-smooth);
}

@keyframes rippleEffect {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }

    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* ========== CONFETTI ========== */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--color-secondary);
    animation: confettiFall 3s var(--ease-smooth) forwards;
}

.confetti:nth-child(odd) {
    background: var(--color-accent);
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-100vh) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ========== MAGNETIC BUTTON ========== */
.magnetic {
    transition: transform 0.3s var(--ease-smooth);
}

/* ========== 3D TILT ========== */
.tilt {
    transform-style: preserve-3d;
    transition: transform 0.3s var(--ease-smooth);
}

.tilt-content {
    transform: translateZ(30px);
}

/* ========== GRAIN TEXTURE ANIMATION ========== */
.grain-animated::before {
    animation: grainAnimation 8s steps(10) infinite;
}

@keyframes grainAnimation {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-5%, -10%);
    }

    20% {
        transform: translate(-15%, 5%);
    }

    30% {
        transform: translate(7%, -25%);
    }

    40% {
        transform: translate(-5%, 25%);
    }

    50% {
        transform: translate(-15%, 10%);
    }

    60% {
        transform: translate(15%, 0%);
    }

    70% {
        transform: translate(0%, 15%);
    }

    80% {
        transform: translate(3%, 35%);
    }

    90% {
        transform: translate(-10%, 10%);
    }
}

/* ========== LOADING DOTS ========== */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-secondary);
    border-radius: 50%;
    animation: loadingDots 1.4s var(--ease-smooth) infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDots {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}