/* home.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Noto Serif SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #f9f7f0 0%, #e8f4f8 100%);
  color: #333;
  line-height: 1.6;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.header {
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    max-width: 1400px; /* 增加最大宽度以容纳更多内容 */
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0; /* 防止logo在空间不足时被压缩 */
}

.logo img {
    width: 50px;
    /* height: 50px; */
    /* border-radius: 50%; */
    border: 3.4px solid #201e1e;
    
}

.logo h1 {
    font-size: 2rem;
    color: #d32f2f;
    text-decoration: none;
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif; /* 独立字体样式，不继承body */
    white-space: nowrap; /* 防止标题文字换行 */
}

.nav ul {
  display: flex;
  list-style: none;
  gap: 20px; /* 统一间距为20px，与其他页面保持一致 */
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.nav a {
  text-decoration: none;
  color: #333;
  font-weight: 1000;
  font-size: 1.2rem; /* 统一字体大小，与其他页面保持一致 */
  font-family: 'Microsoft YaHei', 'SimHei', sans-serif; /* 独立字体样式，不继承body */
  transition: color 0.3s;
  white-space: nowrap;
}

.nav a:hover,
.nav a.active {
  color: #d32f2f;
}

/* 汉堡按钮样式 */
.menu-toggle {
    display: none; /* 默认隐藏，小屏幕才显示 */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 101;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* 汉堡动画：激活状态 */
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg);
    transform-origin: top left;
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
    transform-origin: bottom left;
}

/* Hero Section */
.hero {
  height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), 
              url('https://images.unsplash.com/photo-1506784365847-bbad94f05e1c?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
  color: white;
  text-align: center;
  margin-top: 72px; /* 避开 fixed header */
}

.hero-content {
  max-width: 800px;
  padding: 2rem;
}

.hero h1 {
  font-size: 3.8rem;
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s ease 0.3s forwards;
}

.hero-title {
  font-size: 3.8rem;
  margin-bottom: 1.2rem;
  margin-left: 40px;
}

.subtitle {
  font-size: 1.4rem;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeInUp 1s ease 0.6s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dialect-buttons {
  margin: 1.5rem 0;
}

.dialect-btn {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.5);
  color: white;
  padding: 0.7rem 1.8rem;
  margin: 0 0.6rem;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dialect-btn:hover {
  background: white;
  color: #e74c3c;
  transform: translateY(-2px);
}

.dialect-btn:active {
  transform: translateY(0) scale(0.98);
}

.audio-visualizer {
  margin-top: 2rem;
}

#audio-visualizer canvas {
  width: 100%;
  max-width: 600px;
  height: 80px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  margin: 0 auto;
}

#audio-visualizer p {
  margin-top: 1rem;
  font-size: 1.1rem;
  opacity: 0.9;
}

/* 动画通用规则 */
[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: 
    opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/* Problems Section */
.problems {
  padding: 6rem 0 4rem;
  background: white;
}

.problems h2 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 3rem;
  color: #2c3e50;
}

.problem-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.card {
  background: #fafafa;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.card h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: #e74c3c;
}

/* Features Section */
.features {
  padding: 5rem 0;
  background: #f8fbff;
}

.features h2 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 3rem;
  color: #2c3e50;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.feature-item {
  text-decoration: none;
  color: inherit;
  background: white;
  padding: 2.2rem 1.5rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feature-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.icon {
  font-size: 2.8rem;
  margin-bottom: 1.2rem;
  display: block;
}

.feature-item h3 {
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
}

/* Word Cloud */
.wordcloud {
  padding: 5rem 0 4rem;
  background: white;
  text-align: center;
}

.wordcloud h2 {
  font-size: 2.2rem;
  margin-bottom: 2.5rem;
  color: #2c3e50;
}

.word-cloud-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1rem;
}

.word-cloud-container span {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 30px;
  background: #eef7ff;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s;
  cursor: default;
}

.word-cloud-container span:hover {
  background: #d0e8ff;
  transform: scale(1.05);
}

/* Footer */
.footer {
  background: #2c3e50;
  color: white;
  text-align: center;
  padding: 2rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    height: auto;
    padding: 120px 0 60px;
  }
  
  .hero h1 {
    font-size: 2.5rem;
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .subtitle {
    font-size: 1.2rem;
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .dialect-btn {
    display: block;
    margin: 0.6rem auto;
    width: 80%;
  }
  
  .menu-toggle {
    display: flex; /* 手机端显示汉堡按钮 */
  }

  .nav {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s ease, opacity 0.4s ease;
    z-index: 99;
  }

  .nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav ul {
    flex-direction: column;
    gap: 0;
    overflow: hidden;
  }

  .nav ul li {
    border-bottom: 1px solid #eee;
  }

  .nav a {
    display: block;
    padding: 15px 20px;
    font-size: 1.2rem;
  }

  .nav a:hover,
  .nav a.active {
    background-color: #f5f5f5;
    color: #d32f2f;
  }

  /* 容器自适应 */
  .header .container {
    padding: 0 15px;
  }

  .logo h1 {
    font-size: 1.6rem;
  }
  
  .header {
    min-width: 100%;
  }
}

/* 超小屏幕适配（最大宽度 480px） */
@media (max-width: 480px) {
  .header .container {
    padding: 0 10px;
  }
  
  .logo img {
    width: 40px;
  }
  
  .logo h1 {
    font-size: 1.4rem;
  }
  
  .nav a {
    font-size: 1.1rem;
    padding: 12px 15px;
  }
}