/*
 * Animations for Fadi MRIRI's Portfolio
 * Author: Fadi MRIRI
 * Version: 1.0
 */

/* ===== Keyframes Animations ===== */

/* Orbit Animations */
@keyframes orbit-rotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes self-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Blink Animation */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Glitch Animation */
@keyframes glitch-animation {
    0% {
        clip: rect(44px, 9999px, 56px, 0);
    }
    5% {
        clip: rect(74px, 9999px, 92px, 0);
    }
    10% {
        clip: rect(98px, 9999px, 94px, 0);
    }
    15% {
        clip: rect(16px, 9999px, 64px, 0);
    }
    20% {
        clip: rect(59px, 9999px, 98px, 0);
    }
    25% {
        clip: rect(24px, 9999px, 44px, 0);
    }
    30% {
        clip: rect(80px, 9999px, 71px, 0);
    }
    35% {
        clip: rect(16px, 9999px, 75px, 0);
    }
    40% {
        clip: rect(1px, 9999px, 91px, 0);
    }
    45% {
        clip: rect(44px, 9999px, 25px, 0);
    }
    50% {
        clip: rect(46px, 9999px, 50px, 0);
    }
    55% {
        clip: rect(44px, 9999px, 30px, 0);
    }
    60% {
        clip: rect(54px, 9999px, 84px, 0);
    }
    65% {
        clip: rect(72px, 9999px, 67px, 0);
    }
    70% {
        clip: rect(95px, 9999px, 24px, 0);
    }
    75% {
        clip: rect(22px, 9999px, 47px, 0);
    }
    80% {
        clip: rect(23px, 9999px, 34px, 0);
    }
    85% {
        clip: rect(74px, 9999px, 67px, 0);
    }
    90% {
        clip: rect(48px, 9999px, 94px, 0);
    }
    95% {
        clip: rect(38px, 9999px, 26px, 0);
    }
    100% {
        clip: rect(20px, 9999px, 59px, 0);
    }
}



/* Cube Animation */
@keyframes cube-spin {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }
    25% {
        transform: rotateX(90deg) rotateY(90deg);
    }
    50% {
        transform: rotateX(180deg) rotateY(180deg);
    }
    75% {
        transform: rotateX(270deg) rotateY(270deg);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ===== Animation Applications ===== */

/* 3D Cube */
.cube-container {
    width: 200px;
    height: 200px;
    perspective: 1000px;
    margin: 0 auto;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: cube-spin 15s infinite linear;
}

.cube:hover {
    animation-play-state: paused;
}

.face {
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--primary-color);
    box-shadow: inset 0 0 30px rgba(76, 175, 80, 0.2);
    backdrop-filter: blur(5px);
}

.front {
    transform: translateZ(100px);
}

.back {
    transform: rotateY(180deg) translateZ(100px);
}

.right {
    transform: rotateY(90deg) translateZ(100px);
}

.left {
    transform: rotateY(-90deg) translateZ(100px);
}

.top {
    transform: rotateX(90deg) translateZ(100px);
}

.bottom {
    transform: rotateX(-90deg) translateZ(100px);
}

/* Section Animations */
section {
    animation: fadeIn 1s ease-out;
}

/* Skill Item Animations */
.skill-item i {
    animation: float 3s ease-in-out infinite;
}

/* Timeline Dot Animation */
.timeline-dot {
    animation: pulse 2s infinite;
}

/* Button Hover Animation */
.primary-btn, .secondary-btn {
    position: relative;
    overflow: hidden;
}

.primary-btn::after, .secondary-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transform: translateX(-100%);
}

.primary-btn:hover::after, .secondary-btn:hover::after {
    animation: shimmer 1.5s infinite;
}

/* Navbar Animation */
.navbar {
    animation: fadeIn 0.5s ease-out;
}

/* Logo Animation */
.logo-text {
    position: relative;
    animation: float 3s ease-in-out infinite;
}

/* Form Field Animation */
.form-field input:focus, .form-field textarea:focus {
    animation: pulse 2s infinite;
}

/* Social Icons Animation */
.footer-social a i {
    transition: transform 0.3s ease;
}

.footer-social a:hover i {
    transform: rotate(360deg);
}

/* Responsive Animations */
@media (max-width: 768px) {
    .cube {
        animation-duration: 20s;
    }

    .skill-item i {
        animation-duration: 4s;
    }
}
