/* 棉韵暖衣 - 全局样式文件 */
/* 基于pico.css的暖色系主题和响应式布局 */

/* 暖色系主题变量 */
:root {
  --primary-color: #f5f5f5; /* 米白 */
  --secondary-color: #d7ccc8; /* 浅咖 */
  --accent-color: #d1c4e9; /* 燕麦色 */
  --text-color: #5d4037; /* 深棕色文字 */
  --light-text: #8d6e63; /* 浅棕色文字 */
  --border-color: #bcaaa4; /* 边框色 */
}

/* 全局基础样式 */
body {
  font-family: "Source Han Sans CN", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-color);
  background-color: var(--primary-color);
  line-height: 1.6;
}

/* 导航栏样式 */
nav {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

nav ul {
  margin: 0;
  padding: 1rem 0;
}

nav li {
  margin: 0 1rem;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

nav a:hover {
  color: var(--light-text);
}

/* 页面容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 响应式布局辅助类 */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 图片样式优化 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-image.loaded {
  opacity: 1;
}

/* 按钮样式增强 */
button, .btn {
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

button:hover, .btn:hover {
  background-color: var(--secondary-color);
  border-color: var(--light-text);
}

/* 页脚样式 */
footer {
  background-color: var(--secondary-color);
  color: var(--text-color);
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
}

/* 动画效果 */
.fade-in {
  animation: fadeIn 0.6s ease-in;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  nav ul {
    flex-direction: column;
    text-align: center;
  }
  
  nav li {
    margin: 0.5rem 0;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  .container {
    padding: 0 0.25rem;
  }
}

/* 文本样式增强 */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-color);
  font-weight: 600;
}

p {
  color: var(--light-text);
  line-height: 1.8;
}

/* 工具类 */
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.p-2 { padding: 2rem; }

/* 加载状态 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: var(--text-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}