/* ===== CSS 变量与主题配置 ===== */
:root {
  --primary-color: #2c3e50;
  --accent-color: #e74c3c;
  --light-bg: #f8f9fa;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --border-color: #ecf0f1;
  --transition-speed: 0.3s;
  
  /* 新增：第四步变量 */
  --color-primary: #1a3a52;
  --color-secondary: #c41e3a;
  --color-accent: #8b7355;
  --color-light: #f5f3f0;
  --color-text: #2c3e50;
  --color-border: #e0dbd4;
  --color-hover: rgba(196, 30, 58, 0.1);
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --duration-fast: 0.2s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== 全局样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'SimSun', sans-serif;
  background-color: var(--light-bg);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ===== Header & Navigation ===== */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 28px;
  font-weight: 600;
  padding: 20px 40px;
  margin: 0;
  letter-spacing: 0.5px;
}

/* ===== 导航栏设计 ===== */
nav {
  background-color: white;
  padding: 0;
  border-top: 1px solid var(--border-color);
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
}

nav ul li {
  margin: 0;
  flex: 1;
  text-align: center;
  min-width: 120px;
}

nav ul li a {
  display: block;
  color: var(--text-primary);
  text-decoration: none;
  padding: 15px 20px;
  font-weight: 500;
  font-size: 15px;
  border-bottom: 3px solid transparent;
  transition: all var(--transition-speed) ease;
  position: relative;
}

/* ===== 导航悬停效果 ===== */
nav ul li a:hover {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background-color: #f5f5f5;
}

/* 当前页面指示 */
nav ul li a.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  font-weight: 600;
}

/* ===== Main 内容区域 ===== */
main {
  background-color: white;
  min-height: calc(100vh - 300px);
}

main h2 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--primary-color);
  border-bottom: 3px solid var(--accent-color);
  padding-bottom: 10px;
  display: inline-block;
}

main p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ===== Hero 区域 ===== */
.hero {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  padding: 80px 40px;
  text-align: center;
  animation: fadeInDown 0.8s ease;
}

.hero h2 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  color: white;
  border: none;
  padding: 0;
  letter-spacing: 1px;
}

.hero p {
  font-size: 18px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-block;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.hero-btn-primary {
  background-color: var(--accent-color);
  color: white;
}

.hero-btn-primary:hover {
  background-color: #c0392b;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.hero-btn-secondary {
  background-color: white;
  color: var(--primary-color);
  border: 2px solid white;
}

.hero-btn-secondary:hover {
  background-color: transparent;
  color: white;
  transform: translateY(-3px);
}

/* ===== 首页作品预览 ===== */
.featured-works {
  padding: 60px 40px;
  background-color: var(--light-bg);
}

.featured-works h3 {
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.featured-works > p {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 16px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  max-width: 1200px;
  margin: 0 auto;
}

.featured-item {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: fadeInUp 0.6s ease backwards;
}

.featured-item:nth-child(1) { animation-delay: 0.1s; }
.featured-item:nth-child(2) { animation-delay: 0.2s; }
.featured-item:nth-child(3) { animation-delay: 0.3s; }
.featured-item:nth-child(4) { animation-delay: 0.4s; }

.featured-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.featured-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.featured-item:hover img {
  transform: scale(1.05);
}

.featured-item p {
  padding: 15px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  margin: 0;
}

/* ===== CTA 区域 ===== */
.cta-section {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  padding: 60px 40px;
  text-align: center;
}

.cta-section h3 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 20px;
  color: white;
}

.cta-section p {
  font-size: 18px;
  margin-bottom: 30px;
  color: rgba(255, 255, 255, 0.9);
}

.cta-section a {
  display: inline-block;
  padding: 14px 50px;
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.cta-section a:hover {
  background-color: #c0392b;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* ===== About 页面 ===== */
.about {
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.about h3 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.about ul {
  list-style: none;
  padding-left: 20px;
}

.about ul li {
  padding: 8px 0;
  color: var(--text-secondary);
  padding-left: 25px;
  position: relative;
  font-size: 15px;
}

.about ul li:before {
  content: "●";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

/* ===== Contact 表单 ===== */
.contact {
  padding: 40px;
  max-width: 600px;
  margin: 0 auto;
}

.contact form {
  margin-top: 30px;
}

.contact label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 14px;
}

.contact input,
.contact textarea {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-speed) ease;
  background-color: #fafafa;
}

.contact input:focus,
.contact textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.contact button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.contact button:hover {
  background-color: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.contact button:active {
  transform: translateY(0);
}

/* ===== Gallery 作品集 - 第四步优化 ===== */
.gallery {
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.6s var(--ease);
}

.gallery-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.gallery-header h2 {
  font-size: 32px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
  letter-spacing: 0.05em;
  border-bottom: 3px solid var(--accent-color);
  padding-bottom: 10px;
  display: inline-block;
}

.gallery-header p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ===== 分类筛选按钮 - 第四步 ===== */
.filter-buttons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
  animation: slideDown 0.6s var(--ease) 0.1s both;
}

.filter-btn {
  padding: 0.6rem 1.2rem;
  border: 2px solid var(--border-color);
  background-color: white;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 24px;
  transition: all var(--duration-normal) var(--ease);
  position: relative;
  overflow: hidden;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: var(--accent-color);
  transition: left var(--duration-normal) var(--ease);
  z-index: -1;
}

.filter-btn:hover {
  color: white;
  border-color: var(--accent-color);
}

.filter-btn:hover::before {
  left: 0;
}

.filter-btn.active {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ===== 作品网格 - 第四步 ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.gallery-item {
  animation: fadeIn 0.6s var(--ease);
  transition: all var(--duration-normal) var(--ease);
}

.gallery-item.hide {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  position: absolute;
  z-index: -1;
}

.gallery-item.show {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  position: relative;
  z-index: 1;
}

.gallery-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all var(--duration-slow) var(--ease);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gallery-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(-8px);
}

/* ===== 图片容器 - 第四步 ===== */
.image-wrapper {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f0e6d2 0%, #e8dcc8 100%);
  height: 280px;
  flex-shrink: 0;
}

.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease),
              transform var(--duration-slow) var(--ease);
}

.gallery-image.loaded {
  opacity: 1;
}

.gallery-card:hover .gallery-image {
  transform: scale(1.08);
}

/* ===== 加载骨架屏 - 第四步 ===== */
.loading-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #f0e6d2 0%,
    #e8dcc8 50%,
    #f0e6d2 100%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  z-index: 1;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== 图片覆盖层 - 第四步 ===== */
.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(26, 58, 82, 0.4) 100%
  );
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease);
  z-index: 2;
}

.gallery-card:hover .image-overlay {
  opacity: 1;
}

/* ===== 作品信息 - 第四步 ===== */
.gallery-info {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  flex-grow: 1;
}

.gallery-info h3 {
  font-size: 1.3rem;
  color: var(--primary-color);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0;
}

.category-tag {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background-color: rgba(231, 76, 60, 0.1);
  color: var(--accent-color);
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  width: fit-content;
  margin: 0;
}

.gallery-info .description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  flex-grow: 1;
}

/* ===== 无结果提示 - 第四步 ===== */
.no-results {
  text-align: center;
  padding: var(--spacing-xl);
  display: none;
}

.no-results p {
  font-size: 1.2rem;
  color: #999;
}

/* ===== 兼容旧版本的 Gallery 样式 ===== */
.gallery h2 {
  width: 100%;
}

.gallery ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  padding: 0;
  margin: 30px 0;
  list-style: none;
}

.gallery ul li {
  background-color: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gallery ul li:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.gallery img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-speed) ease;
}

.gallery ul li:hover img {
  transform: scale(1.05);
}

.gallery ul li p {
  padding: 15px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  margin: 0;
}

/* ===== Footer ===== */
footer {
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  padding: 30px;
  margin-top: 50px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
  font-size: 14px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

/* ===== 动画效果 ===== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 响应式设计：平板 (1024px 及以下) ===== */
@media (max-width: 1024px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery ul {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
  }

  .image-wrapper {
    height: 240px;
  }

  header {
    padding: var(--spacing-md) var(--spacing-md);
  }

  nav ul {
    gap: var(--spacing-md);
  }

  nav a {
    font-size: 0.95rem;
  }
}

/* ===== 响应式设计：平板竖屏 (768px 及以下) ===== */
@media (max-width: 768px) {
  header h1 {
    font-size: 24px;
    padding: 15px 20px;
  }

  nav ul li {
    flex: 1 1 50%;
    min-width: auto;
  }

  nav ul li a {
    padding: 12px 15px;
    font-size: 14px;
  }

  .hero {
    padding: 60px 20px;
  }

  .hero h2 {
    font-size: 36px;
  }

  .hero p {
    font-size: 16px;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .hero-btn {
    width: 100%;
    padding: 12px 30px;
    font-size: 15px;
  }

  .featured-works {
    padding: 40px 20px;
  }

  .featured-works h3 {
    font-size: 26px;
  }

  .featured-works > p {
    font-size: 15px;
    margin-bottom: 30px;
  }

  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .featured-item img {
    height: 220px;
  }

  .cta-section {
    padding: 40px 20px;
  }

  .cta-section h3 {
    font-size: 26px;
  }

  .cta-section p {
    font-size: 16px;
  }

  .about {
    padding: 20px;
  }

  .contact {
    padding: 20px;
  }

  .gallery {
    padding: 20px;
  }

  main h2 {
    font-size: 26px;
  }

  .gallery ul {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .gallery img {
    height: 200px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }

  .gallery-header h2 {
    font-size: 1.8rem;
  }

  .image-wrapper {
    height: 200px;
  }

  .filter-buttons {
    gap: var(--spacing-xs);
  }

  .filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}

/* ===== 响应式设计：手机横屏 (600px 及以下) ===== */
@media (max-width: 600px) {
  header h1 {
    font-size: 20px;
    padding: 12px 15px;
  }

  nav ul li {
    flex: 1 1 50%;
  }

  nav ul li a {
    padding: 10px 12px;
    font-size: 13px;
  }

  .hero {
    padding: 50px 15px;
  }

  .hero h2 {
    font-size: 28px;
  }

  .hero p {
    font-size: 15px;
  }

  .featured-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .featured-item img {
    height: 220px;
  }

  .featured-works {
    padding: 30px 15px;
  }

  .featured-works h3 {
    font-size: 22px;
  }

  .cta-section {
    padding: 30px 15px;
  }

  .cta-section h3 {
    font-size: 22px;
  }

  .gallery ul {
    grid-template-columns: 1fr;
  }

  .gallery img {
    height: 200px;
  }

  .gallery {
    padding: 20px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .gallery-header h2 {
    font-size: 1.5rem;
  }

  .gallery-header p {
    font-size: 1rem;
  }

  .image-wrapper {
    height: 180px;
  }

  .gallery-info {
    padding: var(--spacing-sm);
  }

  .gallery-info h3 {
    font-size: 1.1rem;
  }

  .filter-buttons {
    gap: 0.4rem;
  }

  .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  nav ul {
    gap: var(--spacing-sm);
  }

  nav a {
    font-size: 0.9rem;
  }
}

/* ===== 响应式设计：手机竖屏 (480px 及以下) ===== */
@media (max-width: 480px) {
  header h1 {
    font-size: 18px;
    padding: 10px 12px;
  }

  nav ul li {
    flex: 1 1 100%;
    min-width: auto;
  }

  nav ul li a {
    padding: 10px 12px;
    font-size: 12px;
  }

  .hero {
    padding: 40px 12px;
  }

  .hero h2 {
    font-size: 24px;
  }

  .hero p {
    font-size: 14px;
    margin-bottom: 30px;
  }

  .hero-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .featured-works {
    padding: 25px 12px;
  }

  .featured-works h3 {
    font-size: 20px;
  }

  .featured-works > p {
    font-size: 14px;
    margin-bottom: 25px;
  }

  .featured-item img {
    height: 180px;
  }

  .featured-item p {
    padding: 12px;
    font-size: 14px;
  }

  .cta-section {
    padding: 25px 12px;
  }

  .cta-section h3 {
    font-size: 20px;
  }

  .cta-section p {
    font-size: 14px;
  }

  .cta-section a {
    padding: 10px 25px;
    font-size: 14px;
  }

  .about {
    padding: 12px;
  }

  .about h3 {
    font-size: 18px;
  }

  .contact {
    padding: 12px;
  }

  .contact label {
    font-size: 13px;
  }

  .contact input,
  .contact textarea {
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 15px;
  }

  .contact button {
    padding: 10px 25px;
    font-size: 14px;
  }

  .gallery {
    padding: 12px;
  }

  main h2 {
    font-size: 20px;
  }

  main p {
    font-size: 14px;
  }

  .gallery ul {
    gap: 10px;
  }

  .gallery img {
    height: 180px;
  }

  .gallery ul li p {
    padding: 12px;
    font-size: 14px;
  }

  footer {
    padding: 20px 12px;
  }

  footer p {
    font-size: 12px;
  }

  .gallery-grid {
    gap: var(--spacing-sm);
  }

  .gallery-header h2 {
    font-size: 1.3rem;
  }

  .gallery-header p {
    font-size: 0.95rem;
  }

  .image-wrapper {
    height: 160px;
  }

  .gallery-info {
    padding: var(--spacing-sm);
    gap: 0.4rem;
  }

  .gallery-info h3 {
    font-size: 1rem;
  }

  .gallery-info .description {
    font-size: 0.9rem;
  }

  .category-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
  }

  .filter-buttons {
    gap: 0.3rem;
  }

  .filter-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
  }

  nav {
    width: 100%;
  }

  nav ul {
    gap: var(--spacing-xs);
    font-size: 0.85rem;
  }

  header {
    padding: var(--spacing-sm);
  }

  header h1 {
    font-size: 1.2rem;
  }

  footer {
    font-size: 0.85rem;
    padding: var(--spacing-md);
  }
}
