/* 
 * CSS optimizations for SVG animations
 * Performance enhancements and cross-browser compatibility
 */

/* Base performance optimizations */
svg {
    will-change: transform, opacity;
    transform: translateZ(0); /* Hardware acceleration hint */
    backface-visibility: hidden;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    svg *,
    svg *::before,
    svg *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Hardware acceleration for better performance */
.killchain-stage svg {
    transform: translateZ(0);
    will-change: transform;
}

/* Fallback for older browsers */
@supports not (will-change: transform) {
    .killchain-stage svg {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Performance monitoring */
.killchain-stage {
    contain: layout style paint;
}

/* Accessibility improvements */
svg:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
.killchain-stage svg * {
    transition: none; /* Let GSAP handle all transitions */
}

/* High DPI optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .killchain-stage svg {
        shape-rendering: crispEdges;
    }
}

/* --- GSAP Animation Enhancements (v5.0 - High Fidelity) --- */

/* 3D Container & Perspective */
.killchain-stage {
    perspective: 1200px;
    transform-style: preserve-3d;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at center, #1a1f2c 0%, #0a0a0a 100%);
    border: 1px solid rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5) inset;
}

.killchain-svg-wrapper {
    transform-style: preserve-3d;
    will-change: transform;
    filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.2));
}

/* Info Panel - Glassmorphism HUD */
.killchain-info-panel {
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(10, 20, 30, 0.85);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-left: 3px solid #00ff88;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    z-index: 100;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* CRT Scanline Overlay */
.killchain-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 50;
    opacity: 0.3;
    animation: scanline-scroll 10s linear infinite;
}

@keyframes scanline-scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

/* Glitch Effect Class (Applied via JS) */
.glitch-active {
    animation: glitch-anim 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    filter: drop-shadow(2px 0 0 rgba(255,0,0,0.5)) drop-shadow(-2px 0 0 rgba(0,255,255,0.5));
}

@keyframes glitch-anim {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

/* Particle Canvas */
.killchain-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
}

/* Terminal Log */
.killchain-terminal {
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px currentColor;
    font-weight: bold;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background-color: currentColor;
    margin-left: 2px;
    animation: cursor-blink 1s step-end infinite;
    vertical-align: middle;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
