* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden; /* 禁止横向滚动 */
  width: 100%; /* 确保宽度不会超出视口 */
}

html {
  overscroll-behavior: contain;

  @media (prefers-reduced-motion: no-preference) {
    scroll-behavior: smooth;
  }
}

body {
  --activeColor: rgb(240 240 240);
  --navBgColor: rgb(37 38 41);
  --navTextColor: rgb(144 144 150);
  --mainBg: rgb(20 20 23);
  font-family: "Syncopate", sans-serif;
  min-height: 100vh;
  margin: 0;
  color: rgb(20 20 23);
  background: var(--mainBg);
}

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

/* 调整 section 的布局，使内容整体上移 */
section {
  --h: calc(var(--i) * 30);

  min-height: 100vh;
  padding: 4rem 0 max(5vh, 2rem); /* 减少顶部 padding，整体上移 */
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: hsl(var(--h, 0) 75% 60%);
}

.container {
  width: 100%;
  max-width: 80rem;
  padding: 0 max(5vw, 1rem);
  transform-style: preserve-3d;
  perspective: 900px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* 内容靠上对齐 */
  align-items: center;

  @media (min-width: 60em) {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1rem;
  }
}

nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--navBgColor);
  color: var(--navTextColor);
  z-index: 1000;
  height: 6rem;

  &::after {
    content: "";
    position: absolute;
    top: 1.7rem;
    left: 0;
    width: 100%;
    height: 0.25rem;
    background: currentColor;
    pointer-events: none;
  }
}

.marker {
  position: fixed;
  top: 1.75rem;
  left: 4rem;
  width: 1rem;
  height: 1rem;
  transform: translate3d(-50%, -50%, 0);
  background: var(--activeColor);
  border-radius: 100%;
  z-index: 2000;

  &::before {
    content: "";
    position: absolute;
    top: calc(50% - 0.2rem);
    right: 100%;
    width: 4rem;
    height: 0.4rem;
    background-color: var(--activeColor);
  }
}

.nav__track {
  position: relative;
  /* min-width: calc(100% + (10 * 8rem)); */
  padding: 1.5rem max(100rem, 100%) 0 0;
  height: 6rem;
}

.nav__list {
  list-style: none;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
}

/* 时间轴导航字体 */
.nav__link span {
  font-family: "Syncopate", sans-serif;
  font-weight: 700; /* 加粗 */
}

.nav__link {
  position: relative;
  display: block;
  min-width: 8rem;
  padding: 2.25rem 1rem 0.5rem;
  text-align: center;
  color: inherit;
  text-decoration: none;
  z-index: 1;
  transition: color 150ms;

  &:hover,
  &:focus {
    color: var(--activeColor);
    text-decoration: underline;
  }

  &::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0.65rem;
    height: 0.65rem;
    background-color: currentColor;
    border-radius: 50%;
    transform: translate3d(-50%, 0, 0);
    transform-origin: center center;
  }

  span {
    display: block;
    transition: transform 200ms;
  }

  &.is-active {
    span {
      transform: scale(1.4);
      color: var(--activeColor);
    }

    &::after {
      display: none;
    }
  }
}

/* 调整 section__heading 和 section__description 的位置 */
.section__heading {
  font-family: "zihunbiantaoti";
  font-weight: 400; /* 加粗 */
  font-size: 4rem;
  /* font-size: clamp(2rem, 12vmin, 7rem); */
  line-height: 1;
  letter-spacing: -0.06em;
  margin: 0 0 1rem;
  grid-row: 1;
  grid-column: 1 / span 7;
  align-self: start; /* 标题靠上对齐 */
  position: relative;
  z-index: 1;
  margin-top: 2rem; /* 增加上边距，整体上移 */
}



.section__description {
  font-family:'Smiley Sans Oblique';
  font-weight:'100';
  grid-row: 2;
  grid-column: 1 / span 4;
  align-self: start; /* 描述靠上对齐 */
  max-height: 40vh;
  overflow-y: auto;
  padding-right: 1rem;
  font-size: 1.2rem;
  line-height: 1.6;
  /* color: var(--navTextColor); */
  margin-top: 1rem; /* 增加上边距，整体上移 */
}

@media (max-width: 59.99em) {
  .section__description {
    grid-column: 1 / span 7;
  }
}

.section__image {
  position: relative;
  width: 100%;
  padding: 0 10%;
  margin: 0 auto;
  overflow: visible;

  @media (min-width: 60em) {
    grid-row: 1;
    grid-column: 5 / span 3;
    align-self: center;
    max-width: 100%;
  }
  @media (max-width: 59.99em) {
    grid-row: 2;
    grid-column: 1 / span 7;
    margin-top: 2rem;
    max-width: 100%;
  }
}

.carousel {
  position: relative;
  width: 120%;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  transform: translateX(-8.33%);
  pointer-events: auto; /* 确保触摸事件可用 */
}

@media (max-width: 59.99em) {
  .carousel {
    height: 400px;
    width: 150%;
    transform: translateX(-16.66%);
  }
}

.card {
  position: absolute;
  width: auto;
  height: auto;
  max-width: 80%;
  max-height: 80%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out, z-index 0s 0.6s;
  opacity: 0;
  z-index: 0;
}

.card img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px; /* 圆角 */
  background-color: #fff; /* 防止图片透明部分下方元素穿透 */
  overflow: hidden; /* 确保圆角部分不会出现黑色尖角 */
}

.card.active {
  opacity: 1;
  z-index: 1;
  transition-delay: 0s;
  transform: translateX(0) scale(1);
  box-shadow: 0 10px 30px 10px rgba(0, 0, 0, 0.1); /* 增加阴影扩散范围 */
}

.card.prev,
.card.next {
  opacity: 0.7;
  z-index: 0;
}

.card.prev {
  transform: translateX(-40%) scale(0.8) rotate(-15deg);
}

.card.next {
  transform: translateX(40%) scale(0.8) rotate(15deg);
}

.card.prev-far {
  transform: translateX(-80%) scale(0.6) rotate(-30deg);
}

.card.next-far {
  transform: translateX(80%) scale(0.6) rotate(30deg);
}

main {
  padding-top: 6rem;
}
