/* 发展历程：中间时间轴 + 左右图文奇偶交替（大尺寸增强版） */

/* ====== 容器与布局（加大尺寸） ====== */
.history-zigzag__shell {
  position: relative;
  overflow-x: clip;
}

.history-zigzag__body {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 80rem; /* 从 73.125rem 加宽 */
  margin-inline: auto;
}

@media (width >= 768px) {
  .history-zigzag__body {
    grid-template-columns: minmax(0, 1.1fr) auto minmax(0, 1.1fr);
    gap: 2rem 2.5rem;
    align-items: stretch;
  }
}

@media (width >= 1024px) {
  .history-zigzag__body {
    gap: 2.5rem 3rem;
  }
}

@media (width >= 1280px) {
  .history-zigzag__body {
    gap: 3rem 3.5rem;
  }
}

/* ====== 左右翼（固定最小高度，确保 absolute slot 有展示空间） ====== */
.history-zigzag__wing {
  position: relative;
  min-height: 18rem;
  overflow: hidden;
}

@media (width >= 768px) {
  .history-zigzag__wing {
    min-height: 22rem;
    width: 100%;
    max-width: 34rem;
  }

  .history-zigzag__wing--left {
    justify-self: end;
  }

  .history-zigzag__wing--right {
    justify-self: start;
  }
}

@media (width >= 1024px) {
  .history-zigzag__wing {
    min-height: 26rem;
    max-width: 38rem;
  }
}

@media (width >= 1280px) {
  .history-zigzag__wing {
    min-height: 30rem;
    max-width: 42rem;
  }
}

/* ====== Slot 切换动画 ====== */
.history-zigzag__slot {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.45s ease,
    transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-zigzag__wing--left .history-zigzag__slot {
  justify-content: flex-end;
  transform: translateX(-1.25rem);
}

.history-zigzag__wing--right .history-zigzag__slot {
  justify-content: flex-start;
  transform: translateX(1.25rem);
}

.history-zigzag__slot.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

/* ====== 图片区：填满整个左翼/右翼，与文字区+时间轴等高 ====== */
.history-zigzag__media {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 1rem;
  border: 1px solid rgb(17 25 40 / 8%);
  background: #ffffff;
  box-shadow: 0 8px 28px rgb(15 23 42 / 8%);
  overflow: hidden;
  transition:
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 激活态：品牌色边框 + 光晕 */
.history-zigzag__slot.is-active .history-zigzag__media {
  border-color: rgb(195 3 25 / 28%);
  box-shadow:
    0 8px 32px rgb(195 3 25 / 12%),
    0 0 0 1px rgb(195 3 25 / 8%);
}

.dark .history-zigzag__media {
  background: #1f2937;
  border-color: rgb(255 255 255 / 8%);
  box-shadow: 0 8px 28px rgb(0 0 0 / 30%);
}

.dark .history-zigzag__slot.is-active .history-zigzag__media {
  border-color: rgb(195 3 25 / 22%);
  box-shadow:
    0 8px 32px rgb(195 3 25 / 10%),
    0 0 0 1px rgb(195 3 25 / 8%);
}

/* 图片展台：填满 media，作为 cover 裁切的容器 */
.history-zigzag__photo-stage {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden;
}

.dark .history-zigzag__photo-stage {
  /* 无需额外背景，图片直接覆盖 */
}

/* 图片本身：直接铺满容器，圆角跟随父级 */
.history-zigzag__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* dark 模式下图片无需额外阴影，card 层已有 */

/* 悬停微放大 */
.history-zigzag__slot.is-active .history-zigzag__media:hover .history-zigzag__photo {
  transform: scale(1.03);
}

/* ====== 文字区：大尺寸丰满版 ====== */
.history-zigzag__copy {
  width: 100%;
  max-width: 34rem; /* 从 28rem 加宽 */
  padding: 1rem 0.75rem;
}

@media (width >= 768px) {
  .history-zigzag__copy {
    max-width: 32rem;
    padding: 1.25rem 1rem;
  }
}

@media (width >= 1024px) {
  .history-zigzag__copy {
    max-width: 36rem;
    padding: 1.5rem 1.25rem;
  }
}

@media (width >= 1280px) {
  .history-zigzag__copy {
    max-width: 40rem;
    padding: 1.75rem 1.5rem;
  }
}

/* ---- 右翼文字：标准左对齐 ---- */
.history-zigzag__wing--right .history-zigzag__copy {
  text-align: left;
}

/* ---- 左翼文字：关键修复 ----
   使用 flex column 布局，让 badge 和标题自然靠右，
   描述和要点列表左对齐保证可读性
*/
.history-zigzag__wing--left .history-zigzag__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* 整体内容靠右 */
  text-align: left;       /* 但文字本身左对齐，不影响阅读 */
}

/* 左翼 badge：跟随靠右，内部文字不变 */
.history-zigzag__wing--left .history-zigzag__copy .equipment-zigzag__badge {
  margin-bottom: 0.875rem;
}

/* 左翼标题：靠右对齐，视觉上贴近时间轴 */
.history-zigzag__wing--left .history-zigzag__copy .equipment-zigzag__title {
  text-align: right;
  margin-bottom: 0.75rem;
  width: 100%; /* 确保占满宽度才能 right 生效 */
}

/* 左翼描述和要点：恢复左对齐，确保可读性 */
.history-zigzag__wing--left .history-zigzag__copy .equipment-zigzag__desc,
.history-zigzag__wing--left .history-zigzag__copy .equipment-zigzag__points {
  text-align: left;
  width: 100%;
}

/* Badge 年份标签 */
.history-zigzag__copy .equipment-zigzag__badge {
  display: inline-block;
  margin-bottom: 0.875rem;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--brand-red, #c30319);
  background: rgba(195, 3, 25, 0.08);
  font-variant-numeric: tabular-nums;
}

.dark .history-zigzag__copy .equipment-zigzag__badge {
  background: rgba(195, 3, 25, 0.18);
}

/* 标题：加大字号 */
.history-zigzag__copy .equipment-zigzag__title {
  margin-bottom: 0.75rem;
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--brand-black, #111928);
  transition: color 0.3s ease;
}

@media (width >= 768px) {
  .history-zigzag__copy .equipment-zigzag__title {
    font-size: 1.5625rem;
  }
}

@media (width >= 1024px) {
  .history-zigzag__copy .equipment-zigzag__title {
    font-size: 1.875rem; /* 30px */
  }
}

.dark .history-zigzag__copy .equipment-zigzag__title {
  color: #fff;
}

/* 描述文字：加大行高和间距 */
.history-zigzag__copy .equipment-zigzag__desc {
  margin-bottom: 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--color-body, #637381);
}

@media (width >= 1024px) {
  .history-zigzag__copy .equipment-zigzag__desc {
    font-size: 1rem;
  }
}

.dark .history-zigzag__copy .equipment-zigzag__desc {
  color: #9ca3af;
}

/* 要点列表：加大间距 */
.history-zigzag__copy .equipment-zigzag__points {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-zigzag__copy .equipment-zigzag__points li {
  position: relative;
  margin-bottom: 0.625rem;
  padding-left: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-dark, #111928);
}

.history-zigzag__copy .equipment-zigzag__points li:last-child {
  margin-bottom: 0;
}

.history-zigzag__copy .equipment-zigzag__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--brand-red, #c30319);
  flex-shrink: 0;
}

.dark .history-zigzag__copy .equipment-zigzag__points li {
  color: #e5e7eb;
}

.history-zigzag__copy time {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

/* ====== 中间时间轴（跟随左右翼高度） ====== */
.history-zigzag__axis {
  display: flex;
  gap: 0.5rem;
  order: -1;
  overflow-x: auto;
  padding: 0.125rem 0 0.25rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

@media (width >= 768px) {
  .history-zigzag__axis {
    order: 0;
    position: relative;
    flex-direction: column;
    justify-content: space-between;
    align-self: stretch;
    min-height: 22rem;
    padding: 1rem 0;
    overflow: visible;
  }

  /* 主连接线 */
  .history-zigzag__axis::before {
    content: "";
    position: absolute;
    top: 1rem;
    bottom: 1rem;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 9999px;
    background: linear-gradient(
      180deg,
      rgb(195 3 25 / 0%) 0%,
      rgb(195 3 25 / 45%) 10%,
      rgb(195 3 25 / 50%) 50%,
      rgb(195 3 25 / 45%) 90%,
      rgb(195 3 25 / 0%) 100%
    );
    pointer-events: none;
    box-shadow: 0 0 8px rgb(195 3 25 / 18%);
  }

  /* 流动光线 */
  .history-zigzag__axis::after {
    content: "";
    position: absolute;
    top: 1rem;
    bottom: 1rem;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 9999px;
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgb(195 3 25 / 60%) 30%,
      rgb(255 255 255 / 70%) 50%,
      rgb(195 3 25 / 60%) 70%,
      transparent 100%
    );
    background-size: 100% 200%;
    animation: historyAxisFlow 4s ease-in-out infinite;
    pointer-events: none;
    opacity: 0.6;
  }
}

@keyframes historyAxisFlow {
  0% { background-position: 0% 0%; }
  50% { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

@media (width >= 1024px) {
  .history-zigzag__axis {
    min-height: 26rem;
    padding: 1.25rem 0;
  }

  .history-zigzag__axis::before,
  .history-zigzag__axis::after {
    top: 1.25rem;
    bottom: 1.25rem;
  }
}

@media (width >= 1280px) {
  .history-zigzag__axis {
    min-height: 30rem;
  }

  .history-zigzag__axis::before,
  .history-zigzag__axis::after {
    top: 1.5rem;
    bottom: 1.5rem;
  }
}

/* ====== 时间轴节点（加大） ====== */
.history-zigzag__node {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-width: 3.75rem;
  padding: 0.55rem 1rem;
  border: 1.5px solid rgb(195 3 25 / 18%);
  border-radius: 9999px;
  background: #fff;
  color: var(--brand-black, #111928);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition:
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-zigzag__node:hover {
  border-color: var(--brand-red, #c30319);
  color: var(--brand-red, #c30319);
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 4px 12px rgb(195 3 25 / 18%),
    0 0 0 3px rgb(195 3 25 / 8%);
}

.history-zigzag__node.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-red, #c30319), #e0041c);
  color: #fff;
  box-shadow:
    0 4px 16px rgb(195 3 25 / 38%),
    0 0 0 3px rgb(195 3 25 / 18%);
  transform: scale(1.08);
  font-weight: 700;
}

/* 脉冲动画 */
.history-zigzag__node.is-active::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  border: 2px solid var(--brand-red, #c30319);
  animation: historyNodePulse 2s ease-out infinite;
  pointer-events: none;
}

@keyframes historyNodePulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}

.dark .history-zigzag__node {
  background: #1f2937;
  border-color: rgb(255 255 255 / 12%);
  color: rgb(255 255 255 / 88%);
}

.dark .history-zigzag__node:hover {
  border-color: var(--brand-red, #c30319);
  color: var(--brand-red, #c30319);
  box-shadow:
    0 4px 12px rgb(195 3 25 / 20%),
    0 0 0 3px rgb(195 3 25 / 10%);
}

.dark .history-zigzag__node.is-active {
  color: #fff;
  box-shadow:
    0 4px 16px rgb(195 3 25 / 42%),
    0 0 0 3px rgb(195 3 25 / 22%);
}

/* ====== 移动端适配 ====== */
@media (width < 768px) {
  .history-zigzag__body {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(16rem, auto);
  }

  .history-zigzag__axis {
    grid-column: 1 / -1;
    grid-row: 1;
    box-shadow: 0 4px 12px rgb(0 0 0 / 6%);
    border-radius: 9999px;
    padding: 0.375rem 0.5rem;
    background: rgb(255 255 255 / 70%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .history-zigzag__wing--left {
    grid-column: 1;
    grid-row: 2;
    min-height: 16rem;
  }

  .history-zigzag__wing--right {
    grid-column: 2;
    grid-row: 2;
    min-height: 16rem;
  }

  .history-zigzag__media {
    height: 100%;
    padding: 0;
  }

  .history-zigzag__photo {
    max-height: none;
  }

  /* 移动端文字居中，取消左翼特殊布局 */
  .history-zigzag__copy {
    display: block;
    text-align: center !important;
    padding: 1rem 0.75rem;
  }

  .history-zigzag__wing--left .history-zigzag__copy .equipment-zigzag__badge,
  .history-zigzag__wing--left .history-zigzag__copy .equipment-zigzag__title {
    text-align: center !important;
  }

  .history-zigzag__node {
    min-width: 3rem;
    padding: 0.4rem 0.875rem;
    font-size: 0.8125rem;
  }

  .history-zigzag__copy .equipment-zigzag__title {
    font-size: 1.125rem;
  }
}

/* ====== 无 JS 降级 ====== */
.history-zigzag:not([data-history-zigzag-init]) .history-zigzag__body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.history-zigzag:not([data-history-zigzag-init]) .history-zigzag__axis {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  order: 0;
  box-shadow: none;
  background: transparent;
  padding: 0.125rem 0 0.25rem;
}

.history-zigzag:not([data-history-zigzag-init]) .history-zigzag__axis::before,
.history-zigzag:not([data-history-zigzag-init]) .history-zigzag__axis::after {
  display: none;
}

.history-zigzag:not([data-history-zigzag-init]) .history-zigzag__wing {
  min-height: 0;
}

.history-zigzag:not([data-history-zigzag-init]) .history-zigzag__slot {
  position: relative;
  inset: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  margin-bottom: 1rem;
}

/* ====== Reduced Motion ====== */
@media (prefers-reduced-motion: reduce) {
  .history-zigzag__slot,
  .history-zigzag__photo,
  .history-zigzag__node,
  .history-zigzag__media {
    transition: none !important;
  }

  .history-zigzag__node.is-active::before,
  .history-zigzag__axis::after {
    animation: none !important;
  }
}
