/* Performance optimizations for animations */
.floating-card,
.liquid-glass::before,
.pulse-beam,
.glow-effect::before,
.breathing-glow {
    will-change: transform, opacity;
    contain: layout style;
}

/* GPU acceleration for smooth scrolling */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-overflow-scrolling: touch;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Optimize images and heavy elements */
img,
video,
.hero-svg-instance,
.skill-planet,
.insight-node {
    content-visibility: auto;
}

/* Lazy load off-screen content */
section:not(:first-of-type) {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* Hardware acceleration for animated elements */
.nav-link,
.social-link,
.cta-button,
.skill-category,
.blog-card,
.portfolio-item {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Floating Card Gallery Effect */
.floating-card {
    position: relative;
    animation: float 6s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.floating-card:hover {
    animation-play-state: paused;
    transform: translateY(-20px) scale(1.05);
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(1deg); }
    50% { transform: translateY(-10px) rotate(-1deg); }
    75% { transform: translateY(-15px) rotate(0.5deg); }
}

/* Liquid Glass Effect */
.liquid-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.liquid-glass::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: liquidMove 15s ease-in-out infinite;
}

@keyframes liquidMove {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(10%, 10%); }
    50% { transform: translate(-5%, 15%); }
    75% { transform: translate(15%, -10%); }
}

/* Pulse Beams */
.pulse-beam {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--accent-purple), transparent);
    animation: beamPulse 3s ease-in-out infinite;
}

@keyframes beamPulse {
    0%, 100% { opacity: 0; transform: translateY(-100%); }
    50% { opacity: 1; transform: translateY(100%); }
}

/* Magnetize Button */
.magnetize-btn {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.magnetize-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-blue));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.magnetize-btn:hover::after {
    opacity: 1;
    animation: magneticPulse 1s ease-in-out infinite;
}

@keyframes magneticPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--accent-purple);
    white-space: nowrap;
    animation: typing 3.5s steps(40) 1s forwards, blink 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    50% { border-color: transparent; }
}

/* Tech Cursor */
.tech-cursor {
    cursor: none;
}

.tech-cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-purple);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.15s ease;
    box-shadow: 0 0 20px var(--accent-purple);
}

.tech-cursor-ring {
    width: 40px;
    height: 40px;
    border: 2px solid var(--accent-purple);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    transition: all 0.3s ease;
    opacity: 0.5;
}

/* Glowing Effect */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    inset: -10px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
    filter: blur(20px);
    pointer-events: none;
    border-radius: inherit;
}

.glow-effect:hover::before {
    opacity: 0.6;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Animated Shader Background */
.shader-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(45deg, #0a0a0a, #1a1a1a, #0a0a0a);
    background-size: 400% 400%;
    animation: shaderMove 20s ease infinite;
}

@keyframes shaderMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    grid-auto-rows: 200px;
}

.bento-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bento-item:nth-child(1) { grid-row: span 2; }
.bento-item:nth-child(4) { grid-column: span 2; }
.bento-item:nth-child(6) { grid-row: span 2; }

.bento-item:hover {
    transform: scale(1.02);
    border-color: var(--accent-purple);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3);
}

/* 404 Slow Animation */
.slow-drift {
    animation: drift 30s ease-in-out infinite;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -20px) rotate(2deg); }
    50% { transform: translate(-15px, 15px) rotate(-2deg); }
    75% { transform: translate(15px, 10px) rotate(1deg); }
}

/* Transaction Badge Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.tx-status-badge {
    z-index: 10000;
}
