/* Animations CSS */

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

/* Slide In Animation */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Glow Effect */
@keyframes glow {
    0% {
        box-shadow: 0 0 5px var(--accent-blue);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-blue);
    }
    100% {
        box-shadow: 0 0 5px var(--accent-blue);
    }
}

/* Optimized 3D Cube Animation - Reduced complexity for better performance */
.rotating-cube {
    position: relative;
    width: 300px;
    height: 300px;
    transform-style: preserve-3d;
    perspective: 1000px;
    margin: 50px auto;
    will-change: transform;
    /* Prevent layout shifts from cube animations */
    contain: layout style paint;
    /* Reserve space to prevent layout shifts */
    flex-shrink: 0;
}

.cube-face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 176, 255, 0.1);
    border: 2px solid var(--accent-blue);
    backface-visibility: hidden; /* Optimized for performance */
}

.cube-face.front {
    transform: translateZ(150px);
}

.cube-face.back {
    transform: translateZ(-150px) rotateY(180deg);
}

.cube-face.right {
    transform: rotateY(90deg) translateZ(150px);
}

.cube-face.left {
    transform: rotateY(-90deg) translateZ(150px);
}

.cube-face.top {
    transform: rotateX(90deg) translateZ(150px);
}

.cube-face.bottom {
    transform: rotateX(-90deg) translateZ(150px);
}

@keyframes rotateCube {
    0% {
        transform: rotateX(0) rotateY(0);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

.rotating-cube {
    animation: rotateCube 30s linear infinite; /* Slower animation for better performance */
}

/* Pause animation on reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .rotating-cube {
        animation: none;
    }
}

/* Animated Elements */
.animate-on-scroll {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: no-preference) {
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.6s ease;
    }

    .animate-on-scroll.visible {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Service Card Hover Animation */
.service-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 176, 255, 0.2);
}

/* Stats Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter.animate {
    animation: countUp 1s ease forwards;
}

/* Project Card Hover Effects */
.project-card .overlay {
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .overlay {
    opacity: 1;
}

.project-card img {
    transition: transform 0.3s ease;
}

.project-card:hover img {
    transform: scale(1.1);
}

/* Button Hover Animation */
.cta-button {
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 176, 255, 0.3);
}

/* Navigation Menu Animation */
.nav-toggle span {
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Remove Page Transition Effects */
.page-transition {
    display: none;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--accent-blue);
    z-index: 1001;
    transition: width 0.1s ease;
}

/* Loading Animation */
@keyframes loading {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--steel-grey);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: loading 1s infinite linear;
}

/* Text Gradient Animation */
.text-gradient {
    background: linear-gradient(45deg, var(--accent-blue), var(--white));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientMove 3s ease infinite;
}