/* ===================================
   动画样式文件
   深色科技感网站动画效果
   =================================== */

/* CSS 变量定义 */
:root {
  --accent-primary: #00d4ff;
  --accent-secondary: #7b2cbf;
  --accent-tertiary: #00ff88;
  --transition-normal: 0.3s ease;
}

/* ===================================
   1. 淡入动画
   =================================== */

/* 基础淡入 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* 从下往上淡入 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* 从左淡入 */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* 从右淡入 */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* 缩放淡入 */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* ===================================
   2. 滚动触发状态
   =================================== */

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

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

/* ===================================
   3. 悬停效果
   =================================== */

/* 悬停上浮 */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

/* 悬停发光 */
.hover-glow {
  transition: box-shadow var(--transition-normal), filter var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5),
              0 0 40px rgba(0, 212, 255, 0.3);
  filter: brightness(1.1);
}

/* 悬停放大 */
.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* ===================================
   4. 持续动画
   =================================== */

/* 脉冲效果 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* 漂浮效果 */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* 发光脉冲 */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3),
                0 0 20px rgba(0, 212, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6),
                0 0 40px rgba(0, 212, 255, 0.4),
                0 0 60px rgba(0, 212, 255, 0.2);
  }
}

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

/* ===================================
   5. 特殊效果
   =================================== */

/* 渐变边框动画 */
@keyframes gradientBorder {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-border {
  position: relative;
  background: linear-gradient(
    90deg,
    var(--accent-primary),
    var(--accent-secondary),
    var(--accent-tertiary),
    var(--accent-primary)
  );
  background-size: 300% 300%;
  animation: gradientBorder 3s ease-in-out infinite;
  padding: 2px;
  border-radius: 8px;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 2px;
  background: #0a0a0f;
  border-radius: 6px;
  z-index: -1;
}

/* 流光效果 */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 212, 255, 0.3),
    transparent
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

/* 打字机效果 */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 100% {
    border-color: transparent;
  }
  50% {
    border-color: var(--accent-primary);
  }
}

.typing {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent-primary);
  animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

/* ===================================
   6. 数字计数动画准备
   =================================== */

.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: all 0.3s ease;
  opacity: 1;
}

/* ===================================
   7. 延迟类
   =================================== */

.delay-100 {
  animation-delay: 0.1s;
  transition-delay: 0.1s;
}

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

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

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

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

/* ===================================
   性能优化
   =================================== */

/* 为动画元素启用硬件加速 */
.fade-in,
.fade-in-up,
.fade-in-left,
.fade-in-right,
.fade-in-scale,
.animate-on-scroll,
.hover-lift,
.hover-scale,
.float {
  will-change: transform, opacity;
}

/* 动画完成后移除 will-change */
.animate-on-scroll.animated {
  will-change: auto;
}

/* 减少不必要的重绘 */
.hover-glow,
.glow-pulse {
  will-change: box-shadow;
}

/* ===================================
   响应式调整
   =================================== */

/* 移动设备上减少动画强度 */
@media (max-width: 768px) {
  .hover-lift:hover {
    transform: translateY(-3px);
  }

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

  .fade-in-up,
  .fade-in-left,
  .fade-in-right {
    animation-duration: 0.6s;
  }
}

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

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
}

/* ===================================
   8. 滚动指示器和交互元素
   =================================== */

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  opacity: 0.7;
  animation: fadeInUp 1s ease 1s both;
}

.mouse {
  width: 26px;
  height: 40px;
  border: 2px solid var(--accent-primary);
  border-radius: 15px;
  position: relative;
  display: flex;
  justify-content: center;
}

.wheel {
  width: 4px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 2px;
  margin-top: 8px;
  animation: scrollWheel 1.5s ease-in-out infinite;
}

@keyframes scrollWheel {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(12px); opacity: 0; }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
}

.back-to-top i {
  color: white;
  font-size: 1.2rem;
}

/* ===================================
   9. 联系表单样式
   =================================== */

/* Contact Section Styles */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .contact-wrapper {
    grid-template-columns: 1fr;
  }
}

.contact-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.contact-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact-item i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
  color: var(--accent-primary);
  font-size: 1.1rem;
}

.contact-item h4 {
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.contact-item p,
.contact-item a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.contact-item a:hover {
  color: var(--accent-primary);
}

/* Contact Form */
.contact-form-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
}

.contact-form .form-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.contact-form label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.3s ease;
  background: var(--bg-tertiary);
  padding: 0 0.5rem;
}

.contact-form textarea + label {
  top: 1rem;
  transform: none;
}

.contact-form input:focus + label,
.contact-form input:not(:placeholder-shown) + label,
.contact-form select:focus + label,
.contact-form select:not([value=""]) + label,
.contact-form textarea:focus + label,
.contact-form textarea:not(:placeholder-shown) + label {
  top: 0;
  font-size: 0.8rem;
  color: var(--accent-primary);
}

.contact-form select + label {
  top: 0;
  font-size: 0.8rem;
}

.contact-form button[type="submit"] {
  width: 100%;
  margin-top: 1rem;
}
