/* ==============================================
   NaNa 个人网站 - 动画样式文件
   银河系深邃动画 - Animations CSS
   宇宙的激情 - 深邃与神秘！🌌
   ============================================== */

/* ==============================================
   银河系深邃背景效果
   ============================================== */
#hero {
    background: linear-gradient(
        135deg,
        #000000 0%,
        #0a0a1a 20%,
        #0d1117 40%,
        #0a0e1a 60%,
        #050810 80%,
        #000000 100%
    );
    background-size: 400% 400%;
    animation: cosmicGradient 30s ease infinite;
}

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

/* 深邃星云光晕效果 */
#hero::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(
        circle,
        rgba(79, 70, 229, 0.08) 0%,
        rgba(99, 102, 241, 0.05) 30%,
        transparent 70%
    );
    border-radius: 50%;
    animation: nebulaPulse 15s ease-in-out infinite;
    pointer-events: none;
    filter: blur(40px);
}

#hero::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 5%;
    width: 550px;
    height: 550px;
    background: radial-gradient(
        circle,
        rgba(109, 40, 217, 0.06) 0%,
        rgba(124, 58, 237, 0.04) 30%,
        transparent 70%
    );
    border-radius: 50%;
    animation: nebulaPulse 18s ease-in-out infinite reverse;
    pointer-events: none;
    filter: blur(40px);
}

@keyframes nebulaPulse {
    0%, 100% {
        transform: scale(1) translate(0, 0);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.15) translate(20px, -20px);
        opacity: 0.6;
    }
}

/* ==============================================
   流星效果（深邃神秘 - 增强版）
   ============================================== */
.shooting-star {
    position: absolute;
    width: 2.5px;
    height: 2.5px;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(199, 210, 254, 0.9) 50%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 15px 3px rgba(165, 180, 252, 0.8),
                0 0 25px 5px rgba(199, 210, 254, 0.5);
    animation: shootingStar 3s ease-out forwards;
    z-index: 5;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 180px;
    height: 2px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(199, 210, 254, 0.7) 30%,
        rgba(165, 180, 252, 0.4) 60%,
        transparent 100%
    );
    transform: translateX(-180px) translateY(0);
    filter: blur(1px);
}

@keyframes shootingStar {
    0% {
        transform: translateX(0) translateY(0) rotate(-45deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateX(400px) translateY(400px) rotate(-45deg);
        opacity: 0;
    }
}

/* 移动端流星效果优化 */
@media (max-width: 768px) {
    @keyframes shootingStar {
        0% {
            transform: translateX(0) translateY(0) rotate(-45deg);
            opacity: 0;
        }
        10% {
            opacity: 1;
        }
        90% {
            opacity: 0.5;
        }
        100% {
            transform: translateX(200px) translateY(200px) rotate(-45deg);
            opacity: 0;
        }
    }

    #hero::before,
    #hero::after {
        width: 400px;
        height: 400px;
        filter: blur(30px);
    }
}

/* ==============================================
   淡入动画
   ============================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* ==============================================
   淡入上升动画(用于卡片)
   ============================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* ==============================================
   脉冲动画
   ============================================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==============================================
   跳动动画(滚动提示)
   ============================================== */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.animate-bounce {
    animation: bounce 2s infinite;
}

/* ==============================================
   霓虹光晕动画
   ============================================== */
@keyframes neonPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(74, 222, 128, 0.5),
                    0 0 40px rgba(74, 222, 128, 0.3),
                    0 0 60px rgba(74, 222, 128, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(74, 222, 128, 0.7),
                    0 0 60px rgba(74, 222, 128, 0.5),
                    0 0 90px rgba(74, 222, 128, 0.3);
    }
}

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

/* ==============================================
   呼吸光晕动画
   ============================================== */
@keyframes breathe {
    0%, 100% {
        box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(74, 222, 128, 0.6),
                    0 0 40px rgba(74, 222, 128, 0.4);
    }
}

.breathe {
    animation: breathe 3s ease-in-out infinite;
}

/* ==============================================
   滑入动画(从右侧)
   ============================================== */
@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out forwards;
}

/* ==============================================
   滑入动画(从左侧)
   ============================================== */
@keyframes slideInLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

/* ==============================================
   缩放进入动画
   ============================================== */
@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

/* ==============================================
   旋转进入动画
   ============================================== */
@keyframes rotateIn {
    from {
        transform: rotate(-10deg) scale(0.9);
        opacity: 0;
    }
    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

.rotate-in {
    animation: rotateIn 0.6s ease-out forwards;
}

/* ==============================================
   光束扫描动画
   ============================================== */
@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(74, 222, 128, 0.3) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ==============================================
   打字光标闪烁
   ============================================== */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.blink {
    animation: blink 1s step-end infinite;
}

/* ==============================================
   浮动动画
   ============================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* ==============================================
   旋转动画
   ============================================== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ==============================================
   渐变背景动画
   ============================================== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-shift {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* ==============================================
   文字光辉动画
   ============================================== */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(74, 222, 128, 0.5),
                     0 0 20px rgba(74, 222, 128, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(74, 222, 128, 0.8),
                     0 0 40px rgba(74, 222, 128, 0.5),
                     0 0 60px rgba(74, 222, 128, 0.3);
    }
}

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

/* ==============================================
   边框流动动画
   ============================================== */
@keyframes borderFlow {
    0% {
        border-color: #4ade80;
    }
    33% {
        border-color: #60a5fa;
    }
    66% {
        border-color: #c084fc;
    }
    100% {
        border-color: #4ade80;
    }
}

.border-flow {
    animation: borderFlow 3s linear infinite;
}

/* ==============================================
   摇摆动画
   ============================================== */
@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-3deg);
    }
    75% {
        transform: rotate(3deg);
    }
}

.wiggle:hover {
    animation: wiggle 0.5s ease-in-out;
}

/* ==============================================
   心跳动画
   ============================================== */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(1);
    }
}

.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* ==============================================
   数字滚动动画
   ============================================== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp 0.5s ease-out;
}

/* ==============================================
   进度条填充动画
   ============================================== */
@keyframes progressFill {
    from {
        width: 0%;
    }
}

.progress-fill {
    animation: progressFill 1.5s ease-out forwards;
}

/* ==============================================
   卡片翻转动画
   ============================================== */
@keyframes cardFlip {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(180deg);
    }
}

.card-flip {
    animation: cardFlip 0.6s ease-in-out;
    transform-style: preserve-3d;
}

/* ==============================================
   波纹扩散动画
   ============================================== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    animation: ripple 0.6s ease-out;
}

/* ==============================================
   延迟动画工具类
   ============================================== */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* ==============================================
   动画持续时间工具类
   ============================================== */
.duration-fast {
    animation-duration: 0.3s;
}

.duration-normal {
    animation-duration: 0.5s;
}

.duration-slow {
    animation-duration: 1s;
}

/* ==============================================
   GPU 加速优化
   ============================================== */
.gpu-boost {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ==============================================
   移动端动画优化
   ============================================== */
@media (max-width: 768px) {
    /* 简化动画 */
    .fade-in,
    .fade-in-up,
    .slide-in-right,
    .slide-in-left {
        animation-duration: 0.4s !important;
    }

    /* 禁用复杂动画 */
    .neon-pulse,
    .breathe,
    .float,
    .gradient-shift {
        animation: none !important;
    }
}

/* ==============================================
   减少动画偏好设置
   ============================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==============================================
   页面加载动画
   ============================================== */
@keyframes pageLoad {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

body {
    animation: pageLoad 0.5s ease-out;
}
