/**
 * Hero Section Animation Styles
 * Matrix-themed effects for OSINT Tools homepage
 */

/* Hero Container */
.hero-section {
    position: relative;
    overflow: hidden;
}

/* Matrix Rain Canvas */
#matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.3;
}

/* Hero Content - Above Canvas */
.hero-content {
    position: relative;
    z-index: 1;
}

/* Animated Title */
.hero-title {
    position: relative;
    display: inline-block;
}

/* Glitch Effect */
@keyframes glitch-1 {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
}

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

.hero-title.glitch {
    animation: glitch-1 0.3s ease-in-out;
}

/* Text Glow Effect */
@keyframes text-glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 255, 65, 0.5),
                     0 0 20px rgba(0, 255, 65, 0.3),
                     0 0 30px rgba(0, 255, 65, 0.2);
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 255, 65, 0.8),
                     0 0 30px rgba(0, 255, 65, 0.5),
                     0 0 40px rgba(0, 255, 65, 0.3);
    }
}

.hero-title-animated {
    animation: text-glow 3s ease-in-out infinite;
}

/* Typing Cursor Effect */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background-color: var(--matrix-green);
    margin-left: 5px;
    animation: cursor-blink 1s step-end infinite;
    vertical-align: middle;
}

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

/* Scanline Effect */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(0, 255, 65, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 100% 50px;
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 2;
    opacity: 0.5;
}

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

/* Grid Background Effect */
.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
}

/* Particle Effect Container */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: var(--matrix-green);
    border-radius: 50%;
    opacity: 0;
    animation: particle-float 15s linear infinite;
}

@keyframes particle-float {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) translateX(50px);
    }
}

/* Data Stream Effect */
.data-stream {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: var(--matrix-green);
    opacity: 0;
    white-space: nowrap;
    z-index: 0;
    animation: stream-flow 20s linear infinite;
    pointer-events: none;
}

@keyframes stream-flow {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translateX(100vw);
    }
}

/* Pulsing Dots */
.pulse-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: var(--matrix-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(2);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #matrix-canvas {
        opacity: 0.2;
    }
    
    .scanline {
        opacity: 0.3;
    }
}
/* 故障特效 (Glitch Effect) */
.glitch-text {
    position: relative;
    display: inline-block;
}

/* 创建两个重影层 */
.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000; /* 假设背景是黑色，遮挡原字 */
}

/* 红色重影偏移 */
.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

/* 蓝色/绿色重影偏移 */
.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 5s infinite linear alternate-reverse;
}

/* 动画关键帧：随机裁剪文字，制造闪烁感 */
@keyframes glitch-anim {
    0% { clip: rect(12px, 9999px, 86px, 0); }
    5% { clip: rect(54px, 9999px, 12px, 0); }
    10% { clip: rect(32px, 9999px, 94px, 0); }
    15% { clip: rect(78px, 9999px, 2px, 0); }
    20% { clip: rect(10px, 9999px, 43px, 0); }
    25% { clip: rect(6px, 9999px, 20px, 0); }
    30% { clip: rect(2px, 9999px, 60px, 0); }
    35% { clip: rect(48px, 9999px, 32px, 0); }
    40% { clip: rect(21px, 9999px, 88px, 0); }
    100% { clip: rect(21px, 9999px, 88px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(62px, 9999px, 16px, 0); }
    5% { clip: rect(14px, 9999px, 92px, 0); }
    10% { clip: rect(82px, 9999px, 44px, 0); }
    15% { clip: rect(38px, 9999px, 2px, 0); }
    20% { clip: rect(90px, 9999px, 63px, 0); }
    25% { clip: rect(26px, 9999px, 80px, 0); }
    30% { clip: rect(12px, 9999px, 30px, 0); }
    35% { clip: rect(58px, 9999px, 12px, 0); }
    40% { clip: rect(41px, 9999px, 58px, 0); }
    100% { clip: rect(41px, 9999px, 58px, 0); }
}
