/* ===================================
   TYPING EFFECT ANIMATIONS
   Typewriter and text reveal effects
   =================================== */

/* Typewriter Effect for Hero Title */
.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    animation:
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
    display: inline-block;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--primary-color);
    }
}

/* Fade in subtitle after title */
.fade-in-delayed {
    opacity: 0;
    animation: fadeInUp 1s ease forwards;
    animation-delay: 3.5s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide in buttons */
.slide-in-buttons {
    opacity: 0;
    animation: slideInFromLeft 1s ease forwards;
    animation-delay: 4.5s;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Character by character reveal */
.char-reveal {
    display: inline-block;
    opacity: 0;
    animation: charFadeIn 0.1s ease forwards;
}

@keyframes charFadeIn {
    to {
        opacity: 1;
    }
}

/* Glitch effect for special text */
.glitch-text {
    position: relative;
    animation: glitch 1s linear infinite;
}

@keyframes glitch {

    2%,
    64% {
        transform: translate(2px, 0) skew(0deg);
    }

    4%,
    60% {
        transform: translate(-2px, 0) skew(0deg);
    }

    62% {
        transform: translate(0, 0) skew(5deg);
    }
}

/* Gradient text animation */
.gradient-text-typing {
    background: linear-gradient(90deg,
            var(--primary-color),
            var(--secondary-color),
            var(--primary-light),
            var(--secondary-color),
            var(--primary-color));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s linear infinite;
}

@keyframes gradientFlow {
    to {
        background-position: 200% center;
    }
}

/* Word by word reveal */
.word-reveal {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: wordSlideIn 0.5s ease forwards;
}

@keyframes wordSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cursor blink only */
.cursor-blink {
    border-right: 3px solid var(--primary-color);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Scramble text effect */
@keyframes scramble {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .typing-effect {
        border-right-width: 2px;
        animation:
            typing 2.5s steps(30, end),
            blink-caret 0.75s step-end infinite;
    }

    .fade-in-delayed {
        animation-delay: 2.5s;
    }

    .slide-in-buttons {
        animation-delay: 3.5s;
    }
}

/* Disable animations for reduced motion */
@media (prefers-reduced-motion: reduce) {

    .typing-effect,
    .fade-in-delayed,
    .slide-in-buttons,
    .char-reveal,
    .word-reveal {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .typing-effect {
        border-right: none;
    }
}