/* 科技动画背景效果 */

/* 数字雨效果 */
.digital-rain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 2; /* ensure above light overlays */
}

.digit-column {
  position: absolute;
  top: 0px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.2;
  color: #38bdf8;
  opacity: 0.6;
  /* 纵向排列字符（逐个字符作为块元素） */
  display: flex;
  flex-direction: column;
  white-space: normal;
  animation: digitalFall linear infinite;
  z-index: 3;
}

/* 单个数字样式（可调行距/发光等效果） */
.digit-column .digit-char {
  line-height: 1.1;
}

@keyframes digitalFall {
  0% {
    transform: translateY(-50px);
    opacity: 0;
  }
  5% {
    opacity: 0.8;
  }
  95% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(calc(100vh + 100px));
    opacity: 0;
  }
}

/* 电路板流动线条 */
.circuit-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.circuit-line {
  position: absolute;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--color-primary-500) 20%, 
    var(--color-secondary-400) 50%, 
    var(--color-accent-500) 80%, 
    transparent 100%);
  opacity: 0.4;
}

.circuit-line.horizontal {
  height: 1px;
  width: 100%;
  animation: circuitFlowH 8s ease-in-out infinite;
}

.circuit-line.vertical {
  width: 1px;
  height: 100%;
  animation: circuitFlowV 6s ease-in-out infinite;
}

@keyframes circuitFlowH {
  0%, 100% {
    transform: translateX(-100%);
    opacity: 0;
  }
  20%, 80% {
    opacity: 0.6;
  }
  50% {
    transform: translateX(0);
    opacity: 0.8;
  }
}

@keyframes circuitFlowV {
  0%, 100% {
    transform: translateY(-100%);
    opacity: 0;
  }
  20%, 80% {
    opacity: 0.6;
  }
  50% {
    transform: translateY(0);
    opacity: 0.8;
  }
}

/* 数据流动效果 */
.data-stream {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.data-packet {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--color-primary-400);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--color-primary-400);
  animation: dataFlow linear infinite;
}

.data-packet:nth-child(2n) {
  background: var(--color-secondary-400);
  box-shadow: 0 0 10px var(--color-secondary-400);
  animation-delay: -2s;
}

.data-packet:nth-child(3n) {
  background: var(--color-accent-400);
  box-shadow: 0 0 10px var(--color-accent-400);
  animation-delay: -4s;
}

@keyframes dataFlow {
  0% {
    transform: translateX(-10px) translateY(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateX(calc(100vw + 10px)) translateY(-50px);
    opacity: 0;
  }
}

/* 几何图形流动 */
.geometric-flow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
}

.geo-shape {
  position: absolute;
  opacity: 0.2;
  animation: geoFloat 12s ease-in-out infinite;
}

.geo-triangle {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid var(--color-primary-400);
}

.geo-square {
  width: 12px;
  height: 12px;
  background: var(--color-secondary-400);
  border-radius: 2px;
}

.geo-circle {
  width: 10px;
  height: 10px;
  background: var(--color-accent-400);
  border-radius: 50%;
}

@keyframes geoFloat {
  0%, 100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10%, 90% {
    opacity: 0.3;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 0.6;
  }
}

/* 网络连接线 */
.network-web {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
}

.network-node {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--color-primary-400);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.6);
  animation: networkPulse 3s ease-in-out infinite;
}

.network-connection {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, 
    var(--color-primary-400), 
    var(--color-secondary-400), 
    var(--color-primary-400));
  opacity: 0.4;
  animation: connectionFlow 4s ease-in-out infinite;
}

@keyframes networkPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.6);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 0 0 25px rgba(79, 70, 229, 0.8);
  }
}

@keyframes connectionFlow {
  0%, 100% {
    opacity: 0.2;
    background-position: 0% 50%;
  }
  50% {
    opacity: 0.8;
    background-position: 100% 50%;
  }
}

/* 代码流动效果 */
.code-stream {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
}

.code-line {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--color-primary-400);
  opacity: 0.3;
  white-space: nowrap;
  animation: codeScroll 15s linear infinite;
}

.code-line:nth-child(2n) {
  color: var(--color-secondary-400);
  animation-delay: -5s;
}

.code-line:nth-child(3n) {
  color: var(--color-accent-400);
  animation-delay: -10s;
}

@keyframes codeScroll {
  0% {
    transform: translateX(100vw);
    opacity: 0;
  }
  10% {
    opacity: 0.4;
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* 扫描线效果 */
.scan-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.scan-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--color-primary-500) 40%, 
    rgba(255, 255, 255, 0.8) 50%, 
    var(--color-primary-500) 60%, 
    transparent 100%);
  opacity: 0.6;
  animation: scanMove 6s ease-in-out infinite;
}

@keyframes scanMove {
  0%, 100% {
    top: -2px;
    opacity: 0;
  }
  10%, 90% {
    opacity: 0.8;
  }
  50% {
    top: 50%;
    opacity: 1;
  }
}

/* 粒子连接效果 */
.particle-network {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
}

.network-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--color-primary-400);
  border-radius: 50%;
  animation: particleFloat 8s ease-in-out infinite;
}

.network-particle:nth-child(2n) {
  background: var(--color-secondary-400);
  animation-delay: -2s;
}

.network-particle:nth-child(3n) {
  background: var(--color-accent-400);
  animation-delay: -4s;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translate(0, 0) scale(0.5);
    opacity: 0.3;
  }
  25% {
    transform: translate(20px, -30px) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translate(-15px, -60px) scale(1.2);
    opacity: 1;
  }
  75% {
    transform: translate(-40px, -30px) scale(0.8);
    opacity: 0.6;
  }
}

/* 响应式优化 */
@media (max-width: 768px) {
  .digit-column {
    font-size: 12px;
  }
  
  .code-line {
    font-size: 10px;
  }
  
  .data-packet {
    width: 3px;
    height: 3px;
  }
  
  .network-node {
    width: 4px;
    height: 4px;
  }
}

/* 深色主题特定优化 - 只显示数字雨 */
.dark-theme .digit-column {
  color: #38bdf8 !important;
  opacity: 0.6 !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4) !important;
}

/* 深色主题隐藏其他所有动画效果 */
.dark-theme .circuit-lines,
.dark-theme .data-stream,
.dark-theme .geometric-flow,
.dark-theme .network-web,
.dark-theme .code-stream,
.dark-theme .scan-lines,
.dark-theme .particle-network {
  display: none;
}

/* 明亮主题特定优化 - 只显示数字雨和数据包 */
.light-theme .digit-column {
  color: #1f2937 !important; /* slate-800 for visibility */
  opacity: 0.45 !important;  /* increase visibility on light bg */
  font-weight: 400 !important;
  text-shadow: 0 1px 2px rgba(99, 102, 241, 0.18) !important;
}

/* 明亮主题隐藏其他动画效果 */
.light-theme .circuit-lines,
.light-theme .geometric-flow,
.light-theme .network-web,
.light-theme .code-stream,
.light-theme .scan-lines,
.light-theme .particle-network {
  display: none;
}

.light-theme .data-packet {
  opacity: 0.8;
  background: var(--color-primary-500);
  box-shadow: 
    0 0 8px rgba(79, 70, 229, 0.4),
    0 0 16px rgba(6, 182, 212, 0.2);
}

.light-theme .data-packet:nth-child(2n) {
  background: var(--color-secondary-500);
  box-shadow: 
    0 0 8px rgba(168, 85, 247, 0.4),
    0 0 16px rgba(245, 158, 11, 0.2);
}

.light-theme .data-packet:nth-child(3n) {
  background: var(--color-accent-500);
  box-shadow: 
    0 0 8px rgba(234, 179, 8, 0.4),
    0 0 16px rgba(16, 185, 129, 0.2);
}

/* 明亮主题数字雨背景遮罩效果 */
.light-theme .digital-rain::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, 
    rgba(248, 250, 252, 0.25) 0%,
    rgba(248, 250, 252, 0.12) 30%,
    transparent 60%,
    rgba(248, 250, 252, 0.12) 90%,
    rgba(248, 250, 252, 0.25) 100%);
  pointer-events: none;
  z-index: 1;
}