*, *::before, *::after { box-sizing: border-box; }

/* ===== 可自行修改的变量 ===== */
:root {
  --edge-gap: clamp(16px, 3vw, 28px);           /* 刻度/连接线离边缘的距离（响应式） */
  --bubble-max-width: clamp(360px, 36vw, 520px); /* 气泡最大宽度（响应式） */
}

body {
  margin: 0;
  background: #080808;
  color: #ddd;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===== 页面头部 ===== */
.timeline-page {
  min-height: 100vh;
  padding-bottom: 80px;
}

.page-header {
  padding: 48px 60px 24px;
}
.back-nav {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 14px;
  border: 1px solid #ff4d4d;
  border-radius: 20px;
  background: rgba(255, 77, 77, 0.12);
  color: #ff4d4d;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 1px;
  transition: all 0.2s ease;
}
.back-nav:hover {
  background: #ff4d4d;
  color: #fff;
}
.page-header h1 {
  margin: 0 0 6px;
  font-family: "Cinzel", serif;
  font-size: 26px;
  font-weight: 800;
  color: #ff4d4d;
  letter-spacing: 3px;
}
.page-header p {
  margin: 0;
  color: #666;
  font-size: 13px;
  letter-spacing: 1px;
}

/* ===== 标签筛选器 ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 60px 16px;
  flex-wrap: wrap;
}
.filter-tags {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.filter-chip {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  position: relative;
  padding-bottom: 6px;
  user-select: none;
  transition: color 0.25s ease;
}
.filter-chip::before {
  content: "";
  width: 4px;
  height: 4px;
  background: #444;
  transform: rotate(45deg);
  margin-right: 8px;
  flex-shrink: 0;
  transition: background 0.25s ease, transform 0.25s ease;
}
.filter-chip::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: #ff4d4d;
  transition: width 0.3s ease;
  transform: translateX(-50%);
}
.filter-chip:hover {
  color: #999;
}
.filter-chip:hover::before {
  background: #666;
}
.filter-chip.active {
  color: #fff;
  font-weight: 700;
}
.filter-chip.active::before {
  background: #ff4d4d;
  transform: rotate(45deg) scale(1.5);
}
.filter-chip.active::after {
  width: 100%;
}
.filter-clear {
  padding: 6px 14px;
  border: 1px solid #ff4d4d;
  border-radius: 20px;
  background: rgba(255, 77, 77, 0.12);
  color: #ff4d4d;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.filter-clear:hover {
  background: #ff4d4d;
  color: #fff;
}

/* ===== 双轨容器 ===== */
.timeline-wrapper {
  display: flex;
  position: relative;
  min-height: 600px;
  padding: 20px 0 60px;
  transition: min-height 0.4s ease;
}

/* ===== 单侧轨道 ===== */
.track {
  position: relative;
  width: 50%;
  flex-shrink: 0;
  min-height: 600px;
}

.track-left  { padding-left: var(--edge-gap); }
.track-right { padding-right: var(--edge-gap); }

/* ===== 最左/最右侧月度刻度 ===== */
.ticks-left,
.ticks-right {
  position: absolute;
  top: 0;
  width: 80px;
  z-index: 1;
  transition: height 0.4s ease;
  pointer-events: none;
}

.ticks-left  { left: var(--edge-gap); }
.ticks-right { right: var(--edge-gap); }

.tick {
  position: absolute;
  display: flex;
  align-items: center;
  height: 0;
}

.tick-line {
  width: 12px;
  height: 2px;
  background: #ff4d4d;
  flex-shrink: 0;
  opacity: 0.8;
}

.tick-label {
  font-family: "Space Grotesk", monospace, sans-serif;
  font-size: 10px;
  color: #ff4d4d;
  white-space: nowrap;
  opacity: 0.7;
  letter-spacing: 0.5px;
  padding: 0 6px;
  font-weight: 600;
}

/* 年份标签：在刻度上方独立显示，更大更显眼 */
.year-label {
  position: absolute;
  top: 0;
  font-family: "Space Grotesk", monospace, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #ff4d4d;
  opacity: 0.9;
  white-space: nowrap;
  letter-spacing: 1px;
  pointer-events: none;
}

.ticks-left .year-label  { left: 0; }   /* 年份与刻度线左端对齐 */
.ticks-right .year-label { right: 0; }  /* 年份与刻度线右端对齐 */

/* 左侧刻度：从左边缘向右延伸 */
.ticks-left .tick {
  left: 0;
  flex-direction: row;
}

/* 右侧刻度：从右边缘向左延伸 */
.ticks-right .tick {
  right: 0;
  flex-direction: row-reverse;
}

/* 刻度顶部装饰点 */
.ticks-left::before,
.ticks-right::before {
  content: "";
  position: absolute;
  top: -4px;
  width: 8px;
  height: 8px;
  background: #ff4d4d;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
  z-index: 2;
}
.ticks-left::before  { left: 2px; }
.ticks-right::before { right: 2px; }

/* ===== 事件组 ===== */
.event-group {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  z-index: 3;
}

.event-group.org { align-items: flex-start; }
.event-group.per { align-items: flex-end; }

/* 筛选隐藏状态 */
.event-group.hidden {
  display: none;
}

/* ===== 事件行（连接线 + 气泡） ===== */
.event-wrap {
  display: flex;
  align-items: center;
  width: 100%;
}

/* 左侧：connector 从边缘延伸到气泡 */
.event-group.org .event-wrap { flex-direction: row; }
/* 右侧：connector 从气泡延伸到边缘 */
.event-group.per .event-wrap { flex-direction: row-reverse; }

/* 连接线：虚线连接到边缘刻度
   修改 flex 值可调整虚线长度：connector_flex / (connector_flex + spacer_flex) = 虚线占比 */
.connector {
  flex: 1;
  height: 0;
  border-top: 2px dashed #ff4d4d;
  opacity: 0.55;
  min-width: 12px;
  position: relative;
}

/* 连接线离刻度留出间距 */
.event-group.org .connector { margin-left: 10px; }
.event-group.per .connector { margin-right: 10px; }

/* 内侧撑开器：调大 flex 值可缩短虚线 */
.spacer {
  flex: 3;
  min-width: 12px;
}

/* 连接线端点小圆点，对齐刻度线 */
.connector::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 6px;
  height: 6px;
  background: #ff4d4d;
  border-radius: 50%;
  opacity: 0.8;
}

.event-group.org .connector::after { left: 0; }
.event-group.per .connector::after { right: 0; }

/* ===== 气泡 ===== */
.bubble {
  max-width: var(--bubble-max-width);
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.bubble:hover {
  transform: scale(1.04);
}

/* 组织：红色 */
.event-group.org .bubble {
  background: linear-gradient(135deg, #b71c1c 0%, #e53935 100%);
  color: #fff;
  box-shadow: 0 3px 14px rgba(229, 57, 53, 0.35);
}
.event-group.org .bubble:hover {
  box-shadow: 0 5px 22px rgba(229, 57, 53, 0.55);
}

/* 个人：蓝黄渐变 */
.event-group.per .bubble {
  background: linear-gradient(135deg, #1565c0 0%, #f9a825 100%);
  color: #fff;
  box-shadow: 0 3px 14px rgba(21, 101, 192, 0.35);
}
.event-group.per .bubble:hover {
  box-shadow: 0 5px 22px rgba(21, 101, 192, 0.55);
}

.b-date {
  font-family: "Space Grotesk", monospace, sans-serif;
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 3px;
  letter-spacing: 0.5px;
}

.b-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
}

/* 标签图标：气泡右上角 */
.tag-icon {
  position: absolute;
  top: 4px;
  right: 6px;
  bottom: auto;
  width: 26px;
  height: 26px;
  opacity: 0.85;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* ===== 模态框遮罩 ===== */
.tl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  will-change: opacity;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1),
              visibility 0.3s cubic-bezier(0.2, 0, 0, 1);
  padding: 24px;
}
.tl-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ===== 模态框容器 ===== */
.tl-modal-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}
.tl-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid #2a2a2a;
  border-radius: 50%;
  background: #141414;
  color: #999;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  line-height: 1;
}
.tl-modal-close:hover {
  border-color: #ff4d4d;
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.12);
}

/* ===== 模态框内容区 ===== */
.tl-modal-body {
  padding: 36px 36px 32px;
  overflow-y: auto;
  max-height: 90vh;
}
.tl-modal-body::-webkit-scrollbar {
  width: 4px;
}
.tl-modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.tl-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 77, 77, 0.12);
  border-radius: 2px;
}
.tl-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 77, 77, 0.25);
}
.tl-modal-title {
  font-family: "Cinzel", serif;
  font-size: 22px;
  font-weight: 800;
  color: #ff4d4d;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  line-height: 1.3;
}
.tl-modal-date {
  font-family: "Space Grotesk", monospace, sans-serif;
  font-size: 12px;
  color: #666;
  letter-spacing: 1px;
  margin-bottom: 20px;
}
.tl-modal-desc {
  font-size: 14px;
  color: #bbb;
  line-height: 1.8;
  margin-bottom: 24px;
}

/* 模态框内图片轮播 */
.tl-modal-img-carousel {
  position: relative;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0a;
}
.tl-img-track {
  display: grid;
  place-items: center;
}
.tl-img-track img {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tl-img-track img.active {
  opacity: 1;
  visibility: visible;
}
.tl-img-track img.active:hover {
  opacity: 0.8;
}
.tl-img-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 4px;
}
.tl-img-arrow {
  background: none;
  border: 1px solid rgba(255, 77, 77, 0.3);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: #ff4d4d;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.tl-img-arrow:hover {
  background: rgba(255, 77, 77, 0.2);
  border-color: #ff4d4d;
}
.tl-img-counter {
  font-size: 11px;
  color: #777;
  font-family: "Space Grotesk", monospace, sans-serif;
  min-width: 40px;
  text-align: center;
}
.tl-modal-img-cap {
  font-size: 11px;
  color: #666;
  text-align: center;
  padding: 6px 0 4px;
}

/* 模态框内视频 */
.tl-modal-video {
  margin-bottom: 20px;
}
.tl-modal-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
}

/* 模态框内视频轮播 */
.tl-modal-video-carousel {
  position: relative;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0a;
}
.tl-video-track {
  position: relative;
}
.tl-carousel-video {
  display: none;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
}
.tl-carousel-video.active {
  display: block;
}
.tl-video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 6px;
}
.tl-video-arrow {
  background: none;
  border: 1px solid rgba(255, 77, 77, 0.3);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: #ff4d4d;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.tl-video-arrow:hover {
  background: rgba(255, 77, 77, 0.2);
  border-color: #ff4d4d;
}
.tl-video-counter {
  font-size: 11px;
  color: #777;
  font-family: "Space Grotesk", monospace, sans-serif;
  min-width: 40px;
  text-align: center;
}

/* 模态框内链接 */
.tl-modal-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tl-modal-link {
  display: block;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #ff8080;
  text-decoration: none;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.tl-modal-link:hover {
  background: #222;
  border-color: #ff4d4d;
}

/* ===== 图片灯箱 ===== */
.tl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tl-lightbox.active {
  display: flex;
}
.tl-lightbox-images {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
}
.tl-lightbox-images img {
  grid-area: 1 / 1;
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}
.tl-lightbox-images img.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.tl-lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
.tl-lightbox-close:hover {
  color: #ff4d4d;
  background: rgba(255, 255, 255, 0.08);
}
.tl-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid rgba(255, 77, 77, 0.3);
  color: #ff4d4d;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.tl-lightbox-arrow:hover {
  background: rgba(255, 77, 77, 0.2);
  border-color: #ff4d4d;
}
.tl-lightbox-prev {
  left: 32px;
}
.tl-lightbox-next {
  right: 32px;
}
.tl-lightbox-counter {
  display: none;
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: #777;
  font-size: 11px;
  font-family: "Space Grotesk", monospace, sans-serif;
  z-index: 10;
  min-width: 40px;
  text-align: center;
}

/* ===== 响应式：小屏适配 ===== */
@media (max-width: 768px) {
  .page-header {
    padding: 32px 24px 16px;
  }
  .page-header h1 {
    font-size: 20px;
    letter-spacing: 1px;
  }

  .filter-bar {
    padding: 0 24px 12px;
  }
  .filter-chip {
    padding: 4px 10px;
    font-size: 11px;
  }

  .ticks-left, .ticks-right {
    width: 50px;
  }
  .tick-label {
    font-size: 8px;
    padding: 0 3px;
  }
  .tick-line {
    width: 10px;
  }

  .bubble {
    padding: 8px 12px;
    border-radius: 16px;
  }
  .b-date {
    font-size: 10px;
  }
  .b-title {
    font-size: 12px;
  }

  .tl-modal-container {
    max-width: 100%;
    border-radius: 12px;
  }
  .tl-modal-body {
    padding: 28px 20px 24px;
  }
  .tl-modal-title {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  :root {
    --edge-gap: 12px;
    --bubble-max-width: 140px;
  }

  .page-header h1 {
    font-size: 17px;
  }

  .ticks-left, .ticks-right {
    width: 36px;
  }
  .tick-label {
    font-size: 7px;
  }
  .tick-line {
    width: 8px;
  }

  .connector {
    border-top-width: 1px;
  }

  .b-title {
    font-size: 11px;
  }
}