/* 全局样式配置 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500&display=swap');

:root {
  --color-primary: #f5f5f0;
  --color-secondary: #e8e8e0;
  --color-text: #4a4a4a;
  --color-text-light: #8a8a8a;
  --color-accent: #d4c5b9;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  color: var(--color-text);
  background-color: var(--color-primary);
  line-height: 1.8;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: -webkit-optimize-contrast;
}

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

/* 导航栏样式 */
.nav-link {
  position: relative;
  padding-bottom: 2px;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--color-text);
  transition: var(--transition-smooth);
  transform: translateX(-50%);
}

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

/* 图片悬停效果 */
.hover-lift {
  transition: var(--transition-smooth);
  overflow: hidden;
}

.hover-lift img {
  transition: var(--transition-smooth);
}

.hover-lift:hover img {
  transform: scale(1.03);
}

.hover-lift:hover {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

/* 轮播图淡入淡出 */
.carousel-item {
  opacity: 0;
  transition: opacity 1s ease-in-out;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.carousel-item.active {
  opacity: 1;
  position: relative;
}

/* 文字淡入动画 */
.fade-in {
  animation: fadeIn 1.2s ease-in;
}

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

/* 滚动视差效果 */
.parallax {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* 网格布局 */
.grid-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

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

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 36px;
  cursor: pointer;
  font-weight: 300;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  opacity: 0.7;
}

/* 懒加载占位符 */
.lazy-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 响应式布局 */
@media (max-width: 1024px) {
  .grid-masonry {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .grid-masonry {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .parallax {
    background-attachment: scroll;
  }
}

/* 平滑滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #c4b5a9;
}

/* 按钮重置 */
button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* 选中文本样式 */
::selection {
  background: var(--color-accent);
  color: white;
}

/* 焦点可访问性 */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}