/* ============================================================
   space-animations.css — 太空歌剧风动画样式表
   四大核心动画：星轨环绕、全息闪烁、星云流转、数据流窜
   ============================================================ */

/* === 动画一：星轨环绕 (Star Orbit) === */
/* 页面切换或核心模块加载时触发，屏幕边缘划过半透明星轨光带 */
@keyframes space-star-orbit {
  0% {
    transform: translateX(-100%) rotate(-15deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateX(200%) rotate(-15deg);
    opacity: 0;
  }
}

.space-star-orbit-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.space-star-orbit-effect__trail {
  position: absolute;
  width: 200%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.4), rgba(43, 0, 255, 0.6), rgba(0, 255, 255, 0.4), transparent);
  animation: space-star-orbit 0.6s ease-out forwards;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.space-star-orbit-effect__trail:nth-child(1) {
  top: 20%;
  animation-delay: 0s;
}

.space-star-orbit-effect__trail:nth-child(2) {
  top: 50%;
  animation-delay: 0.1s;
}

.space-star-orbit-effect__trail:nth-child(3) {
  top: 80%;
  animation-delay: 0.2s;
}

/* === 动画二：全息闪烁 (Hologram Flicker) === */
/* 关键元素周围的装饰性光影效果 */
@keyframes space-hologram-flicker {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
  }
  10% {
    opacity: 0.95;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
  }
  20% {
    opacity: 1;
    text-shadow: 0 0 8px rgba(43, 0, 255, 0.3);
  }
  35% {
    opacity: 0.92;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 12px rgba(43, 0, 255, 0.4);
  }
  65% {
    opacity: 0.97;
    text-shadow: 0 0 18px rgba(0, 255, 255, 0.35);
  }
  80% {
    opacity: 1;
    text-shadow: 0 0 10px rgba(43, 0, 255, 0.25);
  }
}

/* 全息闪烁应用于按钮的 box-shadow 版本 */
@keyframes space-hologram-flicker-box {
  0%, 100% {
    box-shadow: 0 0 10px rgba(43, 0, 255, 0.25);
  }
  25% {
    box-shadow: 0 0 18px rgba(43, 0, 255, 0.4), 0 0 30px rgba(0, 255, 255, 0.15);
  }
  50% {
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
  }
  75% {
    box-shadow: 0 0 20px rgba(43, 0, 255, 0.35), 0 0 5px rgba(0, 255, 255, 0.2);
  }
}

.space-hologram-flicker {
  animation: space-hologram-flicker 3s infinite;
}

.space-hologram-flicker--box {
  animation: space-hologram-flicker-box 4s infinite;
}

/* === 动画三：星云流转 (Nebula Flow) === */
/* 页面底部或模块底部持续运行的装饰动画 */
@keyframes space-nebula-flow {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 0.06;
  }
  33% {
    transform: rotate(120deg) scale(1.1);
    opacity: 0.08;
  }
  66% {
    transform: rotate(240deg) scale(0.95);
    opacity: 0.05;
  }
  100% {
    transform: rotate(360deg) scale(1);
    opacity: 0.06;
  }
}

@keyframes space-nebula-drift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.space-nebula-flow-layer {
  position: absolute;
  bottom: 0;
  left: -10%;
  width: 120%;
  height: 300px;
  background: radial-gradient(ellipse at center, rgba(43, 0, 255, 0.08) 0%, transparent 70%);
  animation: space-nebula-flow 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.space-nebula-flow-layer--alt {
  background: radial-gradient(ellipse at center, rgba(0, 255, 255, 0.04) 0%, transparent 70%);
  animation-duration: 25s;
  animation-direction: reverse;
}

/* === 动画四：数据流窜 (Data Stream) === */
/* 鼠标悬停在卡片或按钮上时触发 */
@keyframes space-data-flow {
  0% {
    left: -40px;
  }
  100% {
    left: calc(100% + 40px);
  }
}

@keyframes space-data-stream-border {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 200% 0%;
  }
}

.space-data-stream {
  position: relative;
  overflow: hidden;
}

.space-data-stream::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--space-quantum-blue), transparent);
  transition: none;
  opacity: 0;
}

.space-data-stream:hover::after {
  animation: space-data-flow 0.8s ease-out;
  opacity: 1;
}

/* === 能源脉冲动画 === */
@keyframes space-energy-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 15px rgba(43, 0, 255, 0.5);
  }
}

/* === 淡入动画（用于滚动触发） === */
@keyframes space-fade-in-up {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.space-animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.space-animate-on-scroll--visible {
  opacity: 1;
  transform: translateY(0);
}

/* === 脉冲点动画（用于在线状态指示） === */
@keyframes space-pulse-dot {
  0%, 100% {
    box-shadow: 0 0 4px rgba(0, 255, 255, 0.6);
  }
  50% {
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.9);
  }
}

.space-pulse-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--space-quantum-blue);
  border-radius: 50%;
  animation: space-pulse-dot 2s infinite;
  margin-right: 0.5rem;
}

/* === 打字机效果（用于时间戳） === */
@keyframes space-typing-cursor {
  0%, 100% { border-right-color: var(--space-quantum-blue); }
  50% { border-right-color: transparent; }
}

.space-typing-cursor {
  border-right: 2px solid var(--space-quantum-blue);
  padding-right: 4px;
  animation: space-typing-cursor 1s step-end infinite;
}

/* === 滚动数据条动画 === */
@keyframes space-scroll-data {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

.space-auto-scroll {
  animation: space-scroll-data 15s linear infinite;
}

.space-auto-scroll:hover {
  animation-play-state: paused;
}

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