/* ========== 加载屏 ========== */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.6s ease;
}

.loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-inner {
  text-align: center;
  width: 280px;
}

.loader-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--color-accent);
  border-radius: 3px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FFB6C1, #FF69B4);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loader-text {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: 12px;
}

/* ========== CSS Custom Properties ========== */
:root {
  --color-bg: #FFF8F0;
  --color-accent: #FFE4CC;
  --color-text: #8B6914;
  --color-text-light: #C4A882;
  --color-white: #FFFFFF;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(139, 105, 20, 0.08);
  --transition: 0.6s ease;
}

/* ========== Reset & Base ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 7.4H22l-6.2 4.5 2.4 7.4L12 16.8l-6.2 4.5 2.4-7.4L2 9.4h7.6z' fill='%23FFD700' stroke='%23DAA520' stroke-width='0.8'/%3E%3C/svg%3E") 12 12, auto;
}

/* ========== 星星特效 ========== */
.stars-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ========== 背景音乐 ========== */
.music-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  color: var(--color-text);
  transition: box-shadow 0.3s;
}

.music-btn:hover {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}

.music-btn.playing svg {
  animation: spin 2s linear infinite;
}

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

/* 鼠标残影 */
.cursor-trail {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background-size: contain;
  background-repeat: no-repeat;
  transition: opacity 0.15s ease;
}

/* ========== 封面区 ========== */
.cover {
  position: relative;
  height: 100vh;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-overlay {
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 48px 64px;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(139, 105, 20, 0.15), 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 228, 204, 0.6);
}

.cover-title {
  font-size: 2.8rem;
  font-weight: 400;
  margin-bottom: 10px;
  color: var(--color-text);
  letter-spacing: 2px;
}

.cover-subtitle {
  font-size: 1rem;
  color: var(--color-text-light);
  margin-bottom: 16px;
}

.cover-names {
  font-size: 1.4rem;
  color: var(--color-text);
  letter-spacing: 6px;
  font-weight: 500;
}

.scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
  color: var(--color-text-light);
  font-size: 1.5rem;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

/* ========== 时间线区 ========== */
.timeline {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 60px 20px;
}

/* 居中时间轴线 */
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, transparent, var(--color-accent) 5%, var(--color-accent) 95%, transparent);
  transform: translateX(-50%);
}

.entry {
  position: relative;
  width: 45%;
  margin-bottom: 60px;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
}

/* 左侧条目 */
.entry.left {
  margin-left: 0;
  transform: translateX(-30px);
}

/* 右侧条目 */
.entry.right {
  margin-left: 55%;
  transform: translateX(30px);
}

.entry.visible {
  opacity: 1;
  transform: translateX(0);
}

/* 时间轴节点 */
.entry-node {
  position: absolute;
  top: 20px;
  width: 50px;
  height: 50px;
  background: var(--color-accent);
  border: 3px solid var(--color-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--color-accent);
  z-index: 1;
  overflow: hidden;
}

.node-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 图片放大灯箱 */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img,
.lightbox-video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
  object-fit: contain;
  cursor: grab;
  user-select: none;
}

.lightbox-img.dragging {
  transition: none;
}

.lightbox-video {
  display: none;
}

.lightbox-spinner {
  display: none;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin 0.8s linear infinite;
}

.lightbox-spinner.show {
  display: block;
}

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

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 36px;
  cursor: pointer;
  z-index: 10001;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 32px;
  cursor: pointer;
  padding: 16px;
  z-index: 10001;
  opacity: 0.8;
  transition: opacity 0.2s;
  user-select: none;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

.clickable-img {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.clickable-img:hover {
  transform: scale(1.02);
}

.entry.left .entry-node {
  right: -10%;
  transform: translateX(50%);
}

.entry.right .entry-node {
  left: -10%;
  transform: translateX(-50%);
}

/* 连接线 */
.entry-connector {
  position: absolute;
  top: 43px;
  height: 2px;
  background: var(--color-accent);
  width: 8%;
}

.entry.left .entry-connector {
  right: -8%;
}

.entry.right .entry-connector {
  left: -8%;
}

.entry-card {
  background: var(--color-white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.entry-date {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-text);
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.entry-title {
  font-size: 1.5rem;
  margin-bottom: 16px;
  font-weight: 500;
}

/* 媒体网格 - 小相册效果 */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.media-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.media-item img:hover {
  transform: scale(1.1);
}

.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.entry-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text);
}

/* ========== 统计区 ========== */
.stats {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px 80px;
  text-align: center;
}

.stats-title {
  font-size: 1.8rem;
  margin-bottom: 40px;
  font-weight: 300;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--color-white);
  padding: 24px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition), transform var(--transition);
}

.stat-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .cover-title {
    font-size: 1.8rem;
  }

  .cover-overlay {
    padding: 24px 32px;
    margin: 0 16px;
  }

  .timeline {
    padding: 40px 16px;
  }

  /* 移动端：时间轴移到左侧 */
  .timeline::before {
    left: 30px;
  }

  .entry {
    width: calc(100% - 70px);
    margin-left: 70px !important;
    transform: translateY(30px) !important;
  }

  .entry.visible {
    transform: translateY(0) !important;
  }

  .entry.left .entry-node,
  .entry.right .entry-node {
    left: -55px;
    right: auto;
    transform: translateX(0);
  }

  .entry.left .entry-connector,
  .entry.right .entry-connector {
    left: -8px;
    right: auto;
    width: 8px;
  }

  .entry-title {
    font-size: 1.25rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
