/* timeline 模块样式 —— 契约见 MODULES.md：每一条选择器都以 #m-timeline 开头 */

#m-timeline .tl-list {
  position: relative;
  list-style: none;
  max-width: 760px;
  margin: 0 auto;
  padding: 6px 0 28px;
}

/* 居中 1px hairline 竖线，两端柔和收淡 */
#m-timeline .tl-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  margin-left: -0.5px;
  background: linear-gradient(to bottom,
    transparent 0,
    var(--hairline) 22px,
    var(--hairline) calc(100% - 30px),
    transparent 100%);
}

#m-timeline .tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  padding: 22px 0;
}

#m-timeline .tl-date {
  grid-column: 1;
  text-align: right;
  padding-right: 30px;
  font-family: var(--latin);
  font-style: italic;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: .1em;
  color: var(--ink-soft);
}

#m-timeline .tl-body {
  grid-column: 2;
  min-width: 0;
  padding-left: 30px;
}

#m-timeline .tl-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: .04em;
  color: var(--ink);
  overflow-wrap: break-word;
}

#m-timeline .tl-text {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: .02em;
  color: var(--ink-soft);
  overflow-wrap: break-word;
}

/* 定位块只有 1px 宽、与竖线同宽同 left，二者 x 完全重合；可见圆环画在 ::after 上，
   于是「圆点盒子的左边缘与中心」都落在竖线上（同时保证圆环不把 .mod-body 撑出横向溢出）。 */
#m-timeline .tl-dot {
  position: absolute;
  top: 27px;
  left: 50%;
  width: 1px;
  height: 9px;
  margin-left: -0.5px;
}

#m-timeline .tl-dot::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  box-sizing: border-box;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
}

/* 首次滑到这一屏：竖线自上而下长出来，节点按「线走到它的位置」依次浮现
   （.tl-grow 只挂一次；没挂上时内容默认完全可见，动画失败也不影响阅读） */
@keyframes tl-line-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@keyframes tl-item-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes tl-dot-in {
  from { opacity: 0; transform: scale(.35); }
  to   { opacity: 1; transform: scale(1); }
}

#m-timeline .tl-grow::before {
  transform-origin: 50% 0;
  animation: tl-line-grow 1.45s cubic-bezier(.22, 1, .36, 1) both;
}

#m-timeline .tl-grow .tl-item {
  animation: tl-item-in .62s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: var(--tl-delay, .1s);
}

#m-timeline .tl-grow .tl-dot {
  animation: tl-dot-in .5s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: var(--tl-delay, .1s);
}

/* 只有一句话的条目（没有副说明）：不要用加粗标题的字重，读起来才像一行日记 */
#m-timeline .tl-item.no-text .tl-title {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

#m-timeline .tl-empty {
  margin: 0;
  padding: 44px 0;
  text-align: center;
  color: var(--mut);
  font-size: 14px;
  letter-spacing: .16em;
}

@media (max-width: 640px) {
  /* 单侧轴线：竖线在 8px（1px 线占 8~9，中心 8.5）；圆环半径 4.5 → 圆环占 4~13px，不溢出 */
  #m-timeline .tl-list::before {
    left: 8px;
    margin-left: 0;
  }

  /* 内缩不再写在 .tl-list 的 padding 上（那会让 li 整体右移、圆点跑到竖线右边），
     改由 li 内部的 26px 网格沟槽承担 —— 竖线与圆点因此共用同一个坐标原点 */
  #m-timeline .tl-item {
    grid-template-columns: 26px 1fr;
    padding: 18px 0;
  }

  #m-timeline .tl-date {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
    padding-right: 0;
    margin-bottom: 7px;
    font-size: 16px;
  }

  #m-timeline .tl-body {
    grid-column: 2;
    grid-row: 2;
    padding-left: 0;
  }

  /* 圆点改成第 2 行的静态网格项：top 直接以 .tl-body 顶为基准，天然与标题首行齐平 */
  #m-timeline .tl-dot {
    position: static;
    top: auto;
    left: auto;
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    margin-left: 8px;
    margin-top: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #m-timeline .tl-grow::before,
  #m-timeline .tl-grow .tl-item,
  #m-timeline .tl-grow .tl-dot {
    animation: none;
  }
}
