:root {
  --primary: #9f8c76;
  --secondary: #6b9080;
  --accent: #a5a5af;
  --light: #f4f1e8;
  --dark: #2d2d2d;
  --easing: cubic-bezier(0.4, 0, 0.2, 1);
  --radius: clamp(12px, 2vw, 16px);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --surface: rgba(255, 255, 255, 0.92);
  --text-primary: #444;
  --timeline-width: min(1200px, 92%);
}

/* 性能优化基础设置 */
/* 移动端优化 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow-x: hidden;
}

body {
  font-family: system-ui, "LXGW WenKai", sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(45deg, #f9f9f9 0%, #f4f1e8 100%);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

/* 可访问性增强 */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* 导航栏优化 */
.page-nav {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.8rem;
  z-index: 100;
  max-width: calc(100vw - 2rem);
}

.page-nav a {
  color: var(--secondary);
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  transition: all 0.2s var(--easing);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  font-size: clamp(0.85rem, 3vw, 1rem);
  white-space: nowrap;
}

.page-nav a:hover {
  background: var(--secondary);
  color: white;
  transform: translateY(-2px);
}

/* 时间轴系统优化 */
.timeline {
  position: relative;
  padding: 6rem 0 3rem;
  margin: 0 auto;
  width: var(--timeline-width);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  height: 100%;
  width: 4px;
  background: linear-gradient(
    to bottom,
    var(--secondary) 0%,
    rgba(107, 144, 128, 0.2) 80%,
    transparent 100%
  );
  transform: translateX(-50%);
}

.timeline-card {
  position: relative;
  width: calc(50% - 4rem);
  padding: 1.5rem;
  margin: 2rem 0;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.6s var(--easing);
  opacity: 0;
  will-change: transform, opacity;
}

.timeline-card:nth-child(odd) {
  left: 5%;
  transform: translateX(-30px);
}

.timeline-card:nth-child(even) {
  left: 55%;
  transform: translateX(30px);
}

.timeline-card.active {
  opacity: 1;
  transform: translateX(0);
}

.timeline-card:hover {
  transform: translateY(-6px) scale(1.02) !important;
  box-shadow: 0 12px 24px rgba(107, 144, 128, 0.15),
    inset 0 0 0 1px rgba(107, 144, 128, 0.1);
}

/* .timeline-card h3 {
      font-size: 1.1rem;
    } */

/* .timeline-card li {
      font-size: 0.9rem;
      word-break: break-word;
    } */

.timeline-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--light);
  border: 3px solid var(--secondary);
  border-radius: 50%;
  top: 1.5rem;
  right: calc(100% + 8px);
}

/* 知识星系优化 */
.knowledge-galaxy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  padding: 2rem;
  margin: 4rem auto;
  max-width: var(--timeline-width);
}

.planet {
  position: relative;
  padding: 2rem;
  border-radius: 50%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    145deg,
    rgba(244, 241, 232, 0.96) 0%,
    rgba(255, 255, 255, 0.8) 100%
  );
  box-shadow: 0 8px 24px rgba(107, 144, 128, 0.1);
  transition: all 0.8s var(--easing);
  cursor: pointer;
  transform: translateZ(0);
}

.planet::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid var(--secondary);
  border-radius: 50%;
  animation: pulse 3s infinite;
}

.planet:hover {
  transform: scale(1.1) rotate(5deg);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* 轮播优化 */
.philosophy-carousel {
  position: relative;
  min-height: 260px;
  margin: 8rem auto 4rem;
  width: var(--timeline-width);
}

.quote-slide {
  position: absolute;
  width: 100%;
  padding: 3rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 1s var(--easing);
}

.quote-slide.active {
  opacity: 1;
  transform: none;
}

.carousel-indicators {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.8rem;
}

.carousel-indicators button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  opacity: 0.3;
  transition: all 0.3s var(--easing);
}

.carousel-indicators button.active {
  opacity: 1;
  transform: scale(1.2);
  background: var(--secondary);
}

/* 暗黑模式优化 */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #b8a28a;
    --secondary: #7ba392;
    --surface: rgba(40, 40, 40, 0.92);
    --text-primary: #d9d9d9;
    --light: #2d2d2d;
  }

  body {
    background: linear-gradient(45deg, #1a1a1a 0%, #2d2d2d 100%);
  }

  .planet {
    background: linear-gradient(
      145deg,
      rgba(45, 45, 45, 0.96) 0%,
      rgba(30, 30, 30, 0.8) 100%
    );
  }
}

/* 响应式优化 */
@media (max-width: 768px) {
  .page-nav {
    flex-direction: column;
    align-items: flex-end;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-card {
    width: calc(100% - 3rem);
    margin: 2rem 0;
    left: 1.5rem !important;
    padding: 1.5rem;
  }

  .timeline-marker {
    right: calc(100% + 6px);
    width: 18px;
    height: 18px;
  }

  .knowledge-galaxy {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .philosophy-carousel {
    padding: 0 1rem;
  }
}

/* 返回顶部按钮优化 */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--secondary);
  color: white;
  cursor: pointer;
  opacity: 0;
  transition: all 0.3s var(--easing);
  box-shadow: var(--shadow);
}

.scroll-top.visible {
  opacity: 1;
}

.scroll-top {
  --arrow-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(45deg, var(--secondary), var(--primary));
  transition: transform 0.3s var(--easing), opacity 0.3s var(--easing);
}

.scroll-top::before {
  content: "↑";
  font-size: 1.8em;
  font-weight: 300;
  transition: transform 0.3s var(--easing);
}

.scroll-top:hover::before {
  transform: translateY(-2px);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 480px) {
  .page-nav {
    top: 0.5rem;
    right: 0.5rem;
    gap: 0.5rem;
  }

  .page-nav a {
    padding: 0.3rem 0.8rem;
  }

  .timeline {
    padding-top: 4rem;
  }

  .timeline-card {
    width: calc(100% - 3rem);
    left: 1.5rem !important;
    padding: 1.2rem;
  }

  .planet {
    width: 90%;
  }
}

/* 知识星系增强特效 */
.knowledge-galaxy {
  position: relative;
  overflow: visible;
}

.planet {
  position: relative;
  transition: transform 0.6s var(--easing), filter 0.4s var(--easing);
  transform-style: preserve-3d;
}

.planet::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(var(--secondary-rgb), 0.2) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.4s var(--easing);
}

.planet:hover {
  filter: brightness(1.1);
}

.planet:hover::after {
  opacity: 1;
}

/* 3D旋转特效 */
.planet {
  transform: rotateX(var(--rotate-x)) rotateY(var(--rotate-y))
    scale(var(--scale, 1));
}

/* 连接线动画 */
.knowledge-galaxy::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  border: 2px solid var(--secondary);
  border-radius: 50%;
  opacity: 0.1;
  transform: translate(-50%, -50%);
  animation: galaxy-rotate 120s linear infinite;
}

@keyframes galaxy-rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* 星光特效 */
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(0.95);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.planet::before {
  animation: pulse 3s infinite, twinkle 2s infinite alternate;
}

/* 粒子特效 */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--secondary);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: rotate(var(--angle)) translate(80px) scale(0);
  animation: particle-float 3s infinite, particle-scale 2s infinite;
}

@keyframes particle-float {
  0%,
  100% {
    transform: rotate(var(--angle)) translate(80px) scale(0);
  }

  50% {
    transform: rotate(var(--angle)) translate(100px) scale(1);
  }
}

@keyframes particle-scale {
  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: 0.6;
  }
}

/* 新增防止内容溢出 */
.philosophy-carousel,
.knowledge-galaxy,
.timeline {
  overflow: hidden;
}
