/**
 * optimizations.css — 智达恒通网站优化样式
 * 基于 OpenAI 和 Anthropic 官网设计
 * 功能：流畅动画 + 视觉层次优化 + 交互反馈增强
 */

/* ==================== 流畅动画 ==================== */

/* 全局平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 淡入动画（优化现有 .fade-up） */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* 左侧滑入动画 */
.fade-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* 右侧滑入动画 */
.fade-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* 缩放淡入动画 */
.fade-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/*  stagger 动画延迟 */
.fade-up:nth-child(1), .fade-left:nth-child(1), .fade-right:nth-child(1) { transition-delay: 0s; }
.fade-up:nth-child(2), .fade-left:nth-child(2), .fade-right:nth-child(2) { transition-delay: 0.1s; }
.fade-up:nth-child(3), .fade-left:nth-child(3), .fade-right:nth-child(3) { transition-delay: 0.2s; }
.fade-up:nth-child(4), .fade-left:nth-child(4), .fade-right:nth-child(4) { transition-delay: 0.3s; }

/* ==================== 卡片悬停效果 ==================== */

.feature-card,
.case-card,
.pricing-card,
.integration-card {
  transition: all 0.3s ease;
}

.feature-card:hover,
.case-card:hover,
.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

/* ==================== 按钮动画 ==================== */

.btn {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 10px rgba(59, 130, 246, 0.2);
}

/* 按钮涟漪效果 */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}

.btn-ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* ==================== 导航栏优化 ==================== */

.nav-links a {
  transition: all 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--blue);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* ==================== 输入框聚焦效果 ==================== */

input, textarea, select {
  transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 加载动画 ==================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.loading-animation {
  animation: fadeInUp 0.6s ease forwards;
}

/* ==================== 视觉层次优化 ==================== */

/* 增加留白 */
.section {
  padding: 80px 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 统一圆角规范 */
.btn, .feature-card, .case-card {
  border-radius: 12px;
}

.pricing-card, .integration-card {
  border-radius: 16px;
}

.hero-card {
  border-radius: 20px;
}

/* 优化字体层级 */
h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

p {
  line-height: 1.8;
}

/* ==================== 深色模式优化 ==================== */

/* 注意：主题变量已在 index.html 内联 CSS 中定义，此处不再重复定义 */

/* ==================== 响应式优化 ==================== */

@media (max-width: 768px) {
  .section {
    padding: 60px 0;
  }
  
  .container {
    padding: 0 16px;
  }
  
  h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }
  
  h2 {
    font-size: clamp(1.3rem, 5vw, 2rem);
  }
  
  .feature-card:hover,
  .case-card:hover,
  .pricing-card:hover {
    transform: translateY(-4px);
  }
}

@media (max-width: 480px) {
  .section {
    padding: 40px 0;
  }
  
  h1 {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==================== 打印样式 ==================== */

@media print {
  .nav, .btn, .fade-up {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .section {
    page-break-inside: avoid;
  }
}
