/* Portfolio Animations */
.portfolio-section {
    /* Loading Screen */
    .loading-screen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--bg-color);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        transition: opacity 0.5s ease-out;
    }

    .loader {
        width: 50px;
        height: 50px;
        border: 3px solid var(--accent-color);
        border-radius: 50%;
        border-top-color: transparent;
        animation: spin 1s linear infinite;
    }

    /* Text Glitch Effect */
    .glitch-text {
        animation: glitch 1s linear infinite;
        position: relative;
    }

    .glitch-text::before,
    .glitch-text::after {
        content: attr(data-text);
        position: absolute;
        left: 0;
        text-shadow: 1px 0 var(--accent-color);
        width: 100%;
        clip: rect(44px, 450px, 56px, 0);
        animation: glitch-anim 5s infinite linear alternate-reverse;
    }

    .glitch-text::before {
        left: 2px;
        text-shadow: -1px 0 var(--accent-color);
        animation: glitch-anim-2 1s infinite linear alternate-reverse;
    }

    /* Scroll Reveal */
    .reveal {
        opacity: 0;
        transform: translateY(30px);
        transition: all 0.8s ease;
    }

    .reveal.active {
        opacity: 1;
        transform: translateY(0);
    }

    /* Project Card Animations */
    .project-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;

        &:hover {
            transform: translateY(-10px);
            box-shadow: 0 10px 30px rgba(138, 43, 226, 0.2);
        }
    }

    /* Hidden Project Reveal */
    .hidden-project {
        position: relative;
        cursor: pointer;

        &::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, var(--accent-color), transparent);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        &:hover::before {
            opacity: 0.2;
        }
    }

    /* Project Link Hover Effect */
    .project-link {
        position: relative;
        overflow: hidden;

        &::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(
                90deg,
                transparent,
                rgba(255, 255, 255, 0.2),
                transparent
            );
            transition: left 0.5s ease;
        }

        &:hover::before {
            left: 100%;
        }
    }

    /* Social Link Hover Animation */
    .social-link {
        position: relative;
        
        &::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--accent-color);
            border-radius: 25px;
            transform: scale(0);
            transition: transform 0.3s ease;
            z-index: -1;
        }

        &:hover::before {
            transform: scale(1);
        }
    }

    /* Submit Button Loading State */
    .submit-btn {
        &.loading {
            pointer-events: none;
            opacity: 0.8;

            .btn-text {
                visibility: hidden;
            }

            &::after {
                content: '';
                position: absolute;
                width: 20px;
                height: 20px;
                border: 2px solid var(--text-color);
                border-top-color: transparent;
                border-radius: 50%;
                animation: spin 1s linear infinite;
                left: calc(50% - 10px);
                top: calc(50% - 10px);
            }
        }
    }

    /* Matrix Mode Animation */
    &.matrix-mode {
        position: relative;
        overflow: hidden;

        &::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(
                rgba(0, 0, 0, 0.8),
                var(--accent-color)
            );
            z-index: 9998;
            animation: matrixFade 5s ease;
        }
    }

    /* Active Navigation Link */
    .nav-link, .mobile-link {
        &.active {
            color: var(--accent-color);

            &::after {
                width: 100%;
            }
        }
    }

    /* Floating Elements Animation */
    .floating-element {
        position: fixed;
        bottom: -20px;
        font-size: 1.5rem;
        pointer-events: none;
        animation: float 3s ease-out forwards;
        z-index: 9999;
    }
}

/* Keyframes */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@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);
    }
}

@keyframes glitch-anim {
    0% {
        clip: rect(31px, 9999px, 94px, 0);
        transform: skew(0.85deg);
    }
    5% {
        clip: rect(70px, 9999px, 92px, 0);
        transform: skew(0.85deg);
    }
    100% {
        clip: rect(67px, 9999px, 86px, 0);
        transform: skew(0.85deg);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(31px, 9999px, 94px, 0);
        transform: skew(0.85deg);
    }
    5% {
        clip: rect(70px, 9999px, 92px, 0);
        transform: skew(0.85deg);
    }
    100% {
        clip: rect(67px, 9999px, 86px, 0);
        transform: skew(0.85deg);
    }
}

@keyframes matrixFade {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Crown Animation */
.crown-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

.crown {
    font-size: 5rem;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.crown.visible {
    opacity: 1;
    transform: scale(1);
}

/* Glitch active state for name */
.glitch-text.glitch-active {
    animation: royalGlitch 0.5s ease-in-out;
}

@keyframes royalGlitch {
    0% {
        transform: translate(0);
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    }
    20% {
        transform: translate(-2px, 2px);
        text-shadow: 2px 2px 10px rgba(255, 215, 0, 0.7), -2px -2px 10px rgba(255, 165, 0, 0.7);
    }
    40% {
        transform: translate(2px, -2px);
        text-shadow: -2px -2px 10px rgba(255, 215, 0, 0.7), 2px 2px 10px rgba(255, 165, 0, 0.7);
    }
    60% {
        transform: translate(-2px, -2px);
        text-shadow: 2px -2px 10px rgba(255, 215, 0, 0.7), -2px 2px 10px rgba(255, 165, 0, 0.7);
    }
    80% {
        transform: translate(2px, 2px);
        text-shadow: -2px 2px 10px rgba(255, 215, 0, 0.7), 2px -2px 10px rgba(255, 165, 0, 0.7);
    }
    100% {
        transform: translate(0);
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    }
}

/* Sparkle Animation */
.sparkle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.sparkle {
    position: absolute;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s ease, transform 1s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

/* Particle Animation */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 1;
    transition: opacity 2s ease, transform 2s ease;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* Scroll Indicator */
.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    color: var(--accent-color);
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-arrow {
    font-size: 1.5rem;
    margin-top: 0.5rem;
    animation: bounce 2s infinite;
}

.hero-scroll {
    position: absolute;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    animation: pulse 2s infinite;
    z-index: 10;
}

.section-scroll {
    margin: 2rem auto;
}

.scroll-indicator-section {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 2rem 0;
}

.scroll-indicator-wrapper {
    text-align: center;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
} 