/**
 * Animations CSS for Brian Guvava's Portfolio
 * Contains animation effects, transitions, and custom cursor
 */

/* ===== Custom Cursor ===== */
.custom-cursor {
    display: none; /* Hide the custom cursor */
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    will-change: transform;
}

.cursor-dot {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    transition: transform 0.1s ease;
}

.cursor-ring {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 40px;
    height: 40px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    opacity: 0.5;
    transition: width 0.3s ease, height 0.3s ease, top 0.3s ease, left 0.3s ease, opacity 0.3s ease;
}

.cursor-hover .cursor-ring {
    top: -30px;
    left: -30px;
    width: 60px;
    height: 60px;
    opacity: 0.8;
}

.cursor-active .cursor-dot {
    transform: scale(1.5);
}

.cursor-hidden {
    opacity: 0;
}

/* Hide default cursor when custom cursor is active - DISABLED */
body:not(.touch-device) {
    cursor: auto; /* Restore default cursor */
}

body:not(.touch-device) a,
body:not(.touch-device) button,
body:not(.touch-device) .btn,
body:not(.touch-device) input,
body:not(.touch-device) [data-interactive] {
    cursor: auto; /* Restore default cursor for interactive elements */
}

/* Update cursor for specific elements to improve usability */
body:not(.touch-device) a {
    cursor: pointer;
}
body:not(.touch-device) button,
body:not(.touch-device) .btn {
    cursor: pointer;
}
body:not(.touch-device) input[type="text"],
body:not(.touch-device) textarea {
    cursor: text;
}

/* ===== Scroll Animations ===== */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.animated {
    opacity: 1;
    transform: translate(0, 0) !important;
}

/* Animation variations */
.fade-up {
    transform: translateY(30px);
}

.fade-down {
    transform: translateY(-30px);
}

.fade-left {
    transform: translateX(-30px);
}

.fade-right {
    transform: translateX(30px);
}

.fade-in {
    opacity: 0;
}

.zoom-in {
    transform: scale(0.9);
}

.zoom-out {
    transform: scale(1.1);
}

/* Staggered animations */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-item.animated {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Section Transitions ===== */
.section-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--primary-rgb), 0.1);
    backdrop-filter: blur(5px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.section-transition.active {
    opacity: 1;
}

.section-transition.fade-out {
    opacity: 0;
}

/* ===== Hover Effects ===== */
.hover-effect {
    transform: translateY(-10px) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Ripple effect for buttons */
.btn {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    animation: ripple 0.6s linear;
    transform: scale(0);
    opacity: 1;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Button hover shine effect */
.btn::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.7s ease;
}

.btn:hover::before {
    left: 100%;
}

/* ===== Card hover effects ===== */
.project-card, .skill-card, .testimonial-card {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* ===== Keyframe Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Preloader Animation ===== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-light);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* ===== Performance Optimizations ===== */
/* Use GPU acceleration for animations */
.animated, .hover-effect, .custom-cursor, .animate-on-scroll, .section-transition {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Responsive adjustments */
@media (max-width: 992px) {
    /* Simplify animations on mobile */
    .animate-on-scroll {
        transition: opacity 0.5s ease, transform 0.5s ease;
    }
    
    /* Hide custom cursor on mobile */
    .custom-cursor {
        display: none;
    }
}

/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-on-scroll, .animated, .stagger-item {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    
    .custom-cursor {
        display: none !important;
    }
}
