/* 全局样式文件 - 响应式设计和自定义动画效果 */

/* Tailwind 配置保护 */
@layer base {
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
}

/* 自定义CSS变量 - 配色方案 */
:root {
  --color-primary-light: #F5F5F5;
  --color-primary-white: #FAFAFA;
  --color-accent-pink: #F9E5E6;
  --color-accent-brown: #D4C4B7;
  --color-text-dark: #333333;
  --color-text-gray: #666666;
  --color-hover: #2C2C2C;
  --font-size-base: 16px;
  --font-size-mobile: 14px;
}

/* 字体引入 */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap');

/* 全局字体设置 */
body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: var(--font-size-base);
  color: var(--color-text-dark);
  background-color: var(--color-primary-white);
  line-height: 1.8;
  overflow-x: hidden;
}

/* 英文标题字体 */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', 'Noto Sans SC', sans-serif;
  font-weight: 500;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 导航栏样式增强 */
nav a {
  position: relative;
  transition: all 0.3s ease;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1px;
  background-color: var(--color-hover);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

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

/* 轮播图容器 */
.carousel-container {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 500px;
  overflow: hidden;
}

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

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

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

/* 轮播图文字叠加 */
.carousel-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  color: white;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

/* 图片悬停效果 */
.hover-zoom {
  overflow: hidden;
  transition: transform 0.4s ease;
}

.hover-zoom img {
  transition: transform 0.6s ease;
}

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

/* 瀑布流布局 */
.masonry-grid {
  column-count: 3;
  column-gap: 1.5rem;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
}

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

/* 淡入动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 1s ease;
}

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background-color: var(--color-hover);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 0.8;
  visibility: visible;
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-4px);
}

/* 分隔线样式 */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-accent-brown), transparent);
  margin: 3rem 0;
}

/* 响应式设计 - 平板 */
@media (max-width: 1024px) {
  .masonry-grid {
    column-count: 2;
  }
  
  .carousel-container {
    height: 60vh;
    min-height: 400px;
  }
}

/* 响应式设计 - 移动设备 */
@media (max-width: 768px) {
  :root {
    --font-size-base: var(--font-size-mobile);
  }
  
  body {
    font-size: var(--font-size-mobile);
  }
  
  .masonry-grid {
    column-count: 1;
  }
  
  .carousel-container {
    height: 50vh;
    min-height: 300px;
  }
  
  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: 1rem;
    right: 1rem;
  }
  
  nav a::after {
    display: none;
  }
}

/* 加载动画 */
.loading-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* 页面过渡效果 */
.page-transition {
  animation: pageEnter 0.6s ease;
}

@keyframes pageEnter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 图片懒加载优化 */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.5s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--color-hover);
}