/**
 * Shared Animations
 * 共享动画样式 - 可被多个页面复用
 */

/* === CSS Variables for Animation === */
:root {
    --transition-fast: 0.3s;
    --transition-normal: 0.4s;
    --transition-slow: 0.6s;
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Floating Animations === */
.float,
.floating {
    animation: float 6s ease-in-out infinite;
}

.float-delay-1,
.floating-delay-1 {
    animation: float 6s ease-in-out 1s infinite;
}

.float-delay-2,
.floating-delay-2 {
    animation: float 6s ease-in-out 2s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Float with rotation */
@keyframes float-rotate {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(3deg); }
}

.float-rotate {
    animation: float-rotate 6s ease-in-out infinite;
}

/* Floating Icon (smaller movement) */
@keyframes float-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.floating-icon {
    animation: float-icon 4s ease-in-out infinite;
}

/* === Fade Animations === */
.fade-up,
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s var(--ease-smooth);
}

.fade-up.visible,
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* === Scale Animations === */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all var(--transition-slow) var(--ease-smooth);
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* === Slide Animations === */
@keyframes slide-in-up {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.slide-in-up {
    animation: slide-in-up 0.6s ease forwards;
}

/* === Pulse Animations === */
.pulse-ring {
    position: absolute;
    border-radius: 50%;
    animation: pulse-ring 3s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 40px rgba(16, 185, 129, 0.8); }
}

.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* === Bounce Animation === */
.scroll-indicator {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) translateX(-50%); }
    40% { transform: translateY(-20px) translateX(-50%); }
    60% { transform: translateY(-10px) translateX(-50%); }
}

/* === Marquee Animation === */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.marquee-content {
    display: inline-block;
    animation: marquee 40s linear infinite;
}

.marquee-item {
    display: inline-block;
    padding: 0 3rem;
    opacity: 0.5;
    transition: opacity 0.3s;
    filter: grayscale(100%);
}

.marquee-item:hover {
    opacity: 1;
    filter: grayscale(0%);
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* === Data Flow Animation === */
@keyframes data-flow {
    0% { transform: translateX(-100%) translateY(0px); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(100%) translateY(-10px); opacity: 0; }
}

.data-flow-line {
    position: absolute;
    height: 2px;
    background: #10B981;
    opacity: 0.6;
    animation: data-flow 3s linear infinite;
}

/* === Blueprint Scan Animation === */
@keyframes blueprint-scan {
    0%, 100% { transform: translateX(-100%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

.blueprint-scan {
    animation: blueprint-scan 3s linear infinite;
}

/* === Card Illuminate Animation === */
@keyframes card-illuminate {
    0% { border-color: transparent; box-shadow: none; }
    100% { border-color: #00C4CC; box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
}

/* === Connection Lines Animation === */
.connection-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0, 137, 255, 0.5), transparent);
    animation: flowLine 3s linear infinite;
}

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

/* === Text Flow Animation === */
.text-gradient-anim {
    background: linear-gradient(to right, #0089FF, #00C1DE, #7B61FF, #0089FF);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textFlow 5s linear infinite;
}

@keyframes textFlow {
    to { background-position: 200% center; }
}

/* === Glitch Effect === */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch-text::before {
    color: #00C1DE;
    z-index: -1;
    animation: glitch-anim-1 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    color: #7B61FF;
    z-index: -2;
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 1px); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
    40% { clip-path: inset(40% 0 50% 0); transform: translate(-2px, 2px); }
    60% { clip-path: inset(80% 0 5% 0); transform: translate(1px, -2px); }
    80% { clip-path: inset(10% 0 70% 0); transform: translate(-1px, 1px); }
    100% { clip-path: inset(50% 0 30% 0); transform: translate(2px, -1px); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(65% 0 5% 0); transform: translate(2px, -1px); }
    20% { clip-path: inset(15% 0 75% 0); transform: translate(-2px, 1px); }
    40% { clip-path: inset(85% 0 5% 0); transform: translate(1px, 2px); }
    60% { clip-path: inset(25% 0 55% 0); transform: translate(-1px, -2px); }
    80% { clip-path: inset(45% 0 35% 0); transform: translate(2px, 1px); }
    100% { clip-path: inset(5% 0 85% 0); transform: translate(-2px, -1px); }
}

/* === Path Draw Animation (SVG) === */
.path-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: pathDraw 3s ease forwards;
}

@keyframes pathDraw {
    to { stroke-dashoffset: 0; }
}

/* === Ping Animation === */
.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}
