/**
 * 3D Effects and Enhancements
 * Advanced visual effects for portfolio elements
 */

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

/* Enhanced phone mockups with 3D depth */
.phone-mockup,
.phone-container,
.app-mockup,
.dashboard-mockup {
    transform-style: preserve-3d;
    transform: perspective(1000px);
    position: relative;
}

/* Inner screen depth effect */
.phone-screen {
    transform: translateZ(20px);
    position: relative;
}

/* Floating elements above the screen */
.floating-card,
.float-card {
    transform: translateZ(40px);
}

/* Glare overlay for realistic lighting */
.tilt-glare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    border-radius: inherit;
    z-index: 1;
}

.tilt-glare-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        0deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.03) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    transform: rotate(180deg) translate(-50%, -50%);
    transform-origin: 0 0;
}

/* ============================================
   DEPTH LAYERS
   ============================================ */

/* Create depth with shadows */
.depth-shadow {
    position: relative;
}

.depth-shadow::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 5%;
    right: 5%;
    height: 20px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.3) 0%,
        transparent 70%
    );
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.depth-shadow:hover::after {
    opacity: 1;
}

/* ============================================
   PARALLAX SCROLLING EFFECTS
   ============================================ */

.parallax-container {
    position: relative;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.parallax-layer-back {
    transform: translateZ(-2px) scale(1.2);
}

.parallax-layer-mid {
    transform: translateZ(-1px) scale(1.1);
}

.parallax-layer-front {
    transform: translateZ(0);
}

/* ============================================
   FLOATING ANIMATIONS WITH DEPTH
   ============================================ */

@keyframes float3d {
    0%, 100% {
        transform: translateY(0) translateZ(0) rotateX(0) rotateY(0);
    }
    25% {
        transform: translateY(-20px) translateZ(10px) rotateX(2deg) rotateY(-2deg);
    }
    50% {
        transform: translateY(10px) translateZ(-5px) rotateX(-1deg) rotateY(1deg);
    }
    75% {
        transform: translateY(-10px) translateZ(5px) rotateX(1deg) rotateY(2deg);
    }
}

.float-3d {
    animation: float3d 6s ease-in-out infinite;
    transform-style: preserve-3d;
}

/* ============================================
   CARD HOVER EFFECTS WITH 3D
   ============================================ */

.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-3d-front,
.card-3d-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: inherit;
}

.card-3d-back {
    transform: rotateY(180deg);
}

.card-3d:hover {
    transform: rotateY(180deg);
}

/* ============================================
   REFLECTION EFFECTS
   ============================================ */

.reflection {
    position: relative;
}

.reflection::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 100%;
    background: inherit;
    transform: scaleY(-1);
    opacity: 0.2;
    mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        transparent 50%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        transparent 50%
    );
    pointer-events: none;
}

/* ============================================
   GLASSMORPHISM WITH DEPTH
   ============================================ */

.glass-3d {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px 0 rgba(31, 38, 135, 0.37),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    transform-style: preserve-3d;
}

.glass-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0) 100%
    );
    border-radius: inherit;
    pointer-events: none;
}

/* ============================================
   NEON GLOW EFFECTS
   ============================================ */

.neon-glow {
    position: relative;
    color: #fff;
    text-shadow: 
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px currentColor,
        0 0 80px currentColor;
    animation: neon-pulse 2s ease-in-out infinite alternate;
}

@keyframes neon-pulse {
    from {
        text-shadow: 
            0 0 10px currentColor,
            0 0 20px currentColor,
            0 0 40px currentColor,
            0 0 80px currentColor;
    }
    to {
        text-shadow: 
            0 0 5px currentColor,
            0 0 10px currentColor,
            0 0 20px currentColor,
            0 0 40px currentColor;
    }
}

/* ============================================
   MORPHING SHAPES
   ============================================ */

.morph-shape {
    animation: morph 8s ease-in-out infinite;
    transform-style: preserve-3d;
}

@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        transform: rotate(0deg) translateZ(0);
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
        transform: rotate(90deg) translateZ(20px);
    }
    50% {
        border-radius: 40% 60% 60% 40% / 70% 30% 40% 60%;
        transform: rotate(180deg) translateZ(-10px);
    }
    75% {
        border-radius: 70% 30% 30% 70% / 30% 70% 70% 30%;
        transform: rotate(270deg) translateZ(10px);
    }
}

/* ============================================
   PARTICLE EFFECTS
   ============================================ */

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particle-float 15s linear infinite;
}

@keyframes particle-float {
    from {
        transform: translateY(100vh) translateZ(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    to {
        transform: translateY(-100vh) translateZ(100px) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================
   RESPONSIVE 3D ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Reduce 3D effects on mobile for performance */
    .phone-mockup,
    .phone-container,
    .app-mockup,
    .dashboard-mockup {
        transform: perspective(800px);
    }
    
    .tilt-glare {
        display: none;
    }
    
    @keyframes float3d {
        0%, 100% {
            transform: translateY(0);
        }
        50% {
            transform: translateY(-10px);
        }
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tilt-glare {
        display: none;
    }
}