/* ==================== 全局样式配置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-primary: #F8F9FA;
  --color-white: #FFFFFF;
  --color-dark: #343A40;
  --color-beige: #F5F1E8;
  --color-terracotta: #9C6B5E;
  --color-blue-gray: #6C757D;
  --color-text-dark: #212529;
  --color-text-medium: #495057;
  --spacing-base: 24px;
  --border-radius: 8px;
  --max-width: 1200px;
  --transition-speed: 300ms;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text-dark);
  background-color: var(--color-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-speed) ease;
}

/* ==================== 导航栏样式 ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-link {
  position: relative;
  padding: 0.5rem 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-terracotta);
  transition: all var(--transition-speed) ease;
  transform: translateX(-50%);
}

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

/* ==================== 轮播图样式 ==================== */
.carousel-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.carousel-slide.active {
  opacity: 1;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-caption {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  text-align: center;
}

.carousel-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 2rem;
  pointer-events: none;
}

.carousel-btn {
  pointer-events: all;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.carousel-btn:hover {
  background: var(--color-white);
  transform: scale(1.1);
}

.carousel-indicators {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.indicator.active {
  background: var(--color-white);
  transform: scale(1.2);
}

/* ==================== 卡片样式 ==================== */
.card {
  background: var(--color-white);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all var(--transition-speed) ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.card-image {
  position: relative;
  overflow: hidden;
  padding-top: 133.33%;
}

.card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-speed) ease;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

.card-content {
  padding: 1.5rem;
}

/* ==================== 图片懒加载 ==================== */
img[data-src] {
  filter: blur(10px);
  transition: filter 0.5s ease;
}

img.loaded {
  filter: blur(0);
}

/* ==================== 瀑布流布局 ==================== */
.masonry-grid {
  column-count: 3;
  column-gap: var(--spacing-base);
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: var(--spacing-base);
}

/* ==================== 模态框样式 ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: var(--color-white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  transition: transform var(--transition-speed) ease;
}

.modal-close:hover {
  transform: scale(1.1);
}

/* ==================== 页面过渡动画 ==================== */
.fade-in {
  animation: fadeIn var(--transition-speed) ease-in;
}

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

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (max-width: 768px) {
  :root {
    --spacing-base: 16px;
  }
  
  .carousel-caption {
    bottom: 60px;
    padding: 0.75rem 1.5rem;
    font-size: 14px;
  }
  
  .carousel-btn {
    width: 40px;
    height: 40px;
  }
  
  .masonry-grid {
    column-count: 1;
  }
  
  .card-content {
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .carousel-controls {
    padding: 0 1rem;
  }
  
  .modal-content {
    max-width: 95vw;
  }
}

/* ==================== 无障碍优化 ==================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

*:focus-visible {
  outline: 2px solid var(--color-terracotta);
  outline-offset: 2px;
}

/* ==================== 页脚样式 ==================== */
footer {
  background: var(--color-white);
  text-align: center;
  padding: 2rem;
  color: var(--color-text-medium);
  font-size: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}