/* ============================================
   ADVANCED ANIMATIONS & INTERACTIONS CSS
   Premium styling for next-level portfolio
   ============================================ */

/* ============================================
   1. SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

.scroll-trigger {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-trigger.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Animation Types */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes heroEntrance {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    70% {
        opacity: 0.9;
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.slideInUp.animate-in {
    animation: slideInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.slideInLeft.animate-in {
    animation: slideInLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.popIn.animate-in {
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.fadeInScale.animate-in {
    animation: fadeInScale 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.fadeInUp.animate-in {
    animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.heroEntrance.animate-in {
    animation: heroEntrance 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ============================================
   2. MAGNETIC CURSOR EFFECTS
   ============================================ */

.custom-cursor {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: difference;
    transition: all 0.1s ease;
}

.cursor-follower {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.custom-cursor.cursor-hover {
    transform: scale(1.5);
    background: var(--secondary-color);
}

.cursor-follower.cursor-hover {
    transform: scale(1.8);
    border-color: var(--secondary-color);
    opacity: 0.8;
}

/* Magnetic elements */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================
   3. 3D TILT EFFECTS
   ============================================ */

.tilt-element {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
}

.tilt-element::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    pointer-events: none;
}

.tilt-element:hover::before {
    opacity: 1;
}

/* Enhanced 3D card effects */
.project-card.tilt-element,
.service-card.tilt-element {
    transform-origin: center;
}

.project-card.tilt-element:hover,
.service-card.tilt-element:hover {
    box-shadow: 
        var(--shadow-2xl),
        0 25px 50px rgba(99, 102, 241, 0.2);
}

/* ============================================
   4. PAGE TRANSITIONS
   ============================================ */

.page-transitioning {
    overflow: hidden;
}

.page-transitioning::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(45deg, 
        var(--primary-color), 
        var(--secondary-color));
    z-index: 9998;
    opacity: 0;
    animation: pageTransition 0.8s ease-in-out;
}

@keyframes pageTransition {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    50% {
        opacity: 0.1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
    }
}

.page-section {
    scroll-margin-top: 80px;
}

/* ============================================
   5. SCROLL PROGRESS INDICATOR
   ============================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        var(--primary-color), 
        var(--secondary-color), 
        var(--accent-color));
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ============================================
   6. FLOATING SHAPES
   ============================================ */

.floating-shape {
    position: fixed;
    pointer-events: none;
    z-index: 1;
    opacity: 0.1;
    filter: blur(1px);
}

.floating-shape-0 {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
}

.floating-shape-1 {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    transform: rotate(45deg);
}

.floating-shape-2 {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}

.floating-shape-3 {
    width: 35px;
    height: 35px;
    background: var(--primary-color);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

@keyframes floating {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
    }
    50% {
        transform: translateY(-40px) translateX(-10px) rotate(180deg);
    }
    75% {
        transform: translateY(-20px) translateX(-20px) rotate(270deg);
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.05;
    }
    50% {
        opacity: 0.15;
    }
}

/* ============================================
   7. ENHANCED HOVER EFFECTS
   ============================================ */

/* Enhanced button hover effects */
.btn {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.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.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        var(--shadow-xl),
        0 15px 35px rgba(99, 102, 241, 0.3);
}

/* Enhanced card hover effects */
.project-card,
.service-card {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.project-card::after,
.service-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.05) 0%, 
        transparent 50%, 
        rgba(6, 182, 212, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-card:hover::after,
.service-card:hover::after {
    opacity: 1;
}

/* Enhanced navigation links */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::before {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateX(-50%);
}

.nav-link:hover::before {
    width: 100%;
}

/* ============================================
   8. PARALLAX ENHANCEMENTS
   ============================================ */

.gradient-orb {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* Section background parallax layers */
.section-bg {
    position: absolute;
    inset: 0;
    will-change: transform;
    pointer-events: none;
}

/* ============================================
   9. MICRO-INTERACTIONS
   ============================================ */

/* Enhanced skill tags */
.skill-tag {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    transform-origin: center;
}

.skill-tag:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        var(--shadow-lg),
        0 10px 25px rgba(99, 102, 241, 0.2);
}

.skill-tag::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.skill-tag:hover::before {
    opacity: 0.1;
}

/* Enhanced social links */
.social-link {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.social-link:hover {
    transform: translateY(-8px) scale(1.1);
    box-shadow: 
        var(--shadow-xl),
        0 15px 30px rgba(99, 102, 241, 0.3);
}

.social-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.social-link:hover::before {
    opacity: 1;
}

/* ============================================
   10. LOADING ANIMATIONS
   ============================================ */

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.shimmer {
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   11. RESPONSIVE ANIMATIONS
   ============================================ */

/* Reduce animations on mobile for performance */
@media (max-width: 768px) {
    .floating-shape {
        display: none;
    }
    
    .custom-cursor,
    .cursor-follower {
        display: none;
    }
    
    .tilt-element {
        transform: none !important;
    }
    
    .magnetic {
        transform: none !important;
    }
}

/* ============================================
   12. ACCESSIBILITY & REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-shape,
    .custom-cursor,
    .cursor-follower {
        display: none !important;
    }
    
    .scroll-trigger {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================
   13. DARK THEME ENHANCEMENTS
   ============================================ */

.dark-theme .custom-cursor {
    background: var(--secondary-color);
    mix-blend-mode: difference;
}

.dark-theme .cursor-follower {
    border-color: var(--secondary-color);
}

.dark-theme .scroll-progress {
    background: rgba(0, 0, 0, 0.3);
}

.dark-theme .floating-shape {
    opacity: 0.05;
}

/* ============================================
   14. PRINT STYLES
   ============================================ */

@media print {
    .custom-cursor,
    .cursor-follower,
    .floating-shape,
    .scroll-progress {
        display: none !important;
    }
    
    .scroll-trigger {
        opacity: 1 !important;
        transform: none !important;
    }
}
