/* ===== 基础重置与全局动效 ===== */
:root {
  --primary: #2a6df4;         /* 主蓝色 */
  --primary-dark: #1a56d8;    /* 深蓝 */
  --accent: #ff6b6b;          /* 强调色 */
  --text-dark: #2c3e50;       /* 深色文本 */
  --text-light: #7f8c8d;      /* 浅色文本 */
  --light-bg: #f8fafc;        /* 浅背景 */
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --card-shadow-hover: 0 12px 30px rgba(42, 109, 244, 0.15);
  --transition-slow: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-dark);
  background: #ffffff;
  line-height: 1.75;
  overflow-x: hidden;
}

/* ===== UI中国风格动效系统 ===== */
/* 1. 卡片悬停立体效果 */
.article-card {
  transform: translateY(0) rotateX(0);
  transition: var(--transition-slow);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  overflow: hidden;
  opacity: 0; /* 初始隐藏用于动画 */
  animation: cardAppear 0.8s forwards;
}

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

.article-card:hover {
  transform: translateY(-8px) rotateX(5deg);
  box-shadow: var(--card-shadow-hover);
}

/* 2. 文字渐入动画 (UI中国标题效果) */
.section-title {
  position: relative;
  padding-bottom: 15px;
  opacity: 0;
  animation: textReveal 1s 0.3s forwards;
}

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

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  animation: lineExpand 0.8s 0.5s forwards;
  transform-origin: left;
  transform: scaleX(0);
}

@keyframes lineExpand {
  100% { transform: scaleX(1); }
}

/* 3. 浮动元素动画 (UI中国徽标效果) */
@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
  100% { transform: translateY(0); }
}

.floating-element {
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 10px 8px rgba(42, 109, 244, 0.15));
}

/* 4. 文字逐字显现效果 */
.text-reveal {
  display: inline-block;
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  opacity: 0;
  transform: translateY(1em);
  animation: textRevealChar 0.6s forwards;
}

@keyframes textRevealChar {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 5. 动态下划线导航 (UI中国导航交互) */
.nav-link {
  position: relative;
  padding: 12px 0;
  margin: 0 15px;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
  transition: var(--transition-fast);
}

.nav-link:hover::after {
  width: 100%;
}

/* 6. 3D卡片翻转效果 */
.flip-card {
  perspective: 1500px;
}

.flip-card-inner {
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* 7. 滚动进度指示器 */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 1000;
}

.progress-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.2s ease;
}

/* ===== UI中国风格组件优化 ===== */
/* 头部导航栏动效 */
.header {
  transition: var(--transition-slow);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.86);
}

.header-scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
  padding: 8px 0;
}

/* 按钮悬停动效 */
.btn {
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
  z-index: 1;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--primary-dark);
  transition: var(--transition-fast);
  z-index: -1;
}

.btn:hover::after {
  width: 100%;
}

/* 图片缩放动效 */
.scale-hover {
  overflow: hidden;
  border-radius: 8px;
}

.scale-hover img {
  transition: transform 0.7s ease, filter 0.5s ease;
}

.scale-hover:hover img {
  transform: scale(1.08);
  filter: brightness(1.05);
}

/* ===== 响应式动效调整 ===== */
@media (max-width: 768px) {
  .section-title {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .section-title::after {
    animation: none;
    transform: scaleX(1);
  }
  
  .text-reveal span {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ===== 动效性能优化 ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}