/* 保留桌面版左右交錯的樣式 */
.timeline-class {
  position: relative;
  margin: 2rem 0;
  padding: 2rem 0;
}

.timeline-class::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 5px;
  background: #ddd;
  transform: translateX(-50%);
}

.timeline-class::after {
  content: '';
  position: absolute;
  top: -10px; /* 調整箭頭的垂直位置 */
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 30px solid #ddd; /* 與中線顏色一致 */
}  

.timeline-item {
  position: relative;
  width: 50%;
  padding: 1rem 2rem;
  box-sizing: border-box;
  margin-bottom: 1rem;
}

.timeline-item.left {
  left: 0;
  text-align: left;
}

.timeline-item.right {
  left: 50%;
  text-align: left;
}

.timeline-item .timeline-content {
  background: var(--content-bg, #f9f9f9);
  padding: 0.05rem 1rem 1rem 1rem;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  position: relative;
}

[theme=dark] .timeline-item .timeline-content {
  background: var(--content-bg,rgb(34, 34, 34));
}

.timeline-item.left .timeline-content::after {
  content: "";
  position: absolute;
  top: 1rem;
  right: -10px;
  border: 5px solid transparent;
  border-left-color: #f9f9f9;
}

.timeline-item.right .timeline-content::after {
  content: "";
  position: absolute;
  top: 1rem;
  left: -10px;
  border: 5px solid transparent;
  border-right-color: #f9f9f9;
}

[theme=dark] .timeline-item.left .timeline-content::after {
  border-left-color: rgb(34, 34, 34);
}

[theme=dark] .timeline-item.right .timeline-content::after {
  border-right-color: rgb(34, 34, 34);
}

.timeline-date {
  font-size: 0.9rem;
  color: #999;
  display: block;
  margin-bottom: 0.5rem;
}

/* 手機版: 單行顯示，去除左右交錯效果 */
@media (max-width: 768px) {
  .timeline-class::before {
    left: 10px; /* 時間軸改成居左 */
    transform: none; /* 不再垂直對齊 */
  }

  .timeline-class::after {
    left: 4.5px; /* 時間軸改成居左 */
    transform: none; /* 不再垂直對齊 */
  }  

  .timeline-item {
    width: 100%; /* 每個項目占滿整行 */
    text-align: left; /* 文字左對齊 */
    margin-left: 0; /* 去除左右邊距 */
    margin-right: 0;
  }

  .timeline-item.right {
    left: 0;
    text-align: left;
  }

  .timeline-item.left {
    left: 0;
    text-align: left;
  }

  .timeline-item .timeline-content {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

    /* 移除右箭頭樣式 */
  .timeline-item.left .timeline-content::after {
    content: none;
    display: none;
  }

  .timeline-item.left .timeline-content::before {
    content: "";
    position: absolute;
    top: 1rem;
    left: -10px;
    border: 5px solid transparent;
    border-right-color: #f9f9f9;
  }

  [theme=dark] .timeline-item.left .timeline-content::before {
    border-right-color: rgb(34, 34, 34);
  }
}

/* 外框設定：置中與保險 overflow */
.timeline-item .timeline-content .timeline-flipclock {
  width: 100%;
  display: flex;
  justify-content: center;
  /*overflow-x: auto;*/
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* flip-clock 本體縮放由 JS 控制 */
.timeline-item .timeline-content .flip-class {
  transform-origin: top center;
  transition: transform 0.3s ease;
}

.timeline-content .flip-clock-title {
  font-size: 1em;
  height: auto;              /* 改為自適應 */
  max-width: 100%;           /* 不超出容器寬度 */
  white-space: normal;       /* 允許換行 */
  word-break: break-word;    /* 自動斷行 */
  width: 100%;               /* 滿版但不超出 */
  padding-left: 2.9rem;
}