/* 首頁 Timeline(spec docs/superpowers/specs/2026-10-30-homepage-timeline-design.md 6.3/6.4/6.5)。
   只在 Timeline 分頁載入(demo-list.ejs)。配色只用 style.css 變數,直角。
   手機(≤640px,與 style.css 的斷點一致):卡寬 72%、16:9 縮圖、scroll-snap。
   桌機(≥641px):卡寬 220px、縮圖高 120px(同 .example-thumb-img)。 */

/* 外層 clip(不是 hidden):擋整頁橫捲,又不會變成捲動容器而弄壞日期標題的 sticky。 */
.lv-section.tl-home { padding-top: 20px; overflow-x: clip; }

section.tl-day {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 28px;
  min-width: 0;
}

/* 日期標題黏在頂端。header 不是 sticky,捲走後頂端唯一固定的東西是
   style.css 的 body::before 6px 胭脂紅橫條(position: fixed; height: 6px; z-index: 100),
   所以 top 對齊 6px,z-index 低於那條橫條。 */
.tl-day-title {
  position: sticky;
  top: 6px;
  z-index: 5;
  margin: 0 0 10px;
  padding: 8px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
/* dashboard 的「我的 Timeline」放在 var(--surface) 的分頁區塊裡;沿用大廳的 var(--bg)
   會在黏住時露出一條色帶。只限 #my-timeline,大廳不受影響。 */
#my-timeline .tl-day-title { background: var(--surface); }

.tl-rowwrap { position: relative; }

.tl-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}
.tl-row::-webkit-scrollbar { display: none; }

/* 列尾哨兵:不佔版面、不吸附 */
.tl-row-end { flex: 0 0 1px; align-self: stretch; }

/* 卡片(<a> 與教室卡 <button> 共用);先蓋掉 style.css 的全域 button 樣式。 */
.tl-card {
  flex: 0 0 72%;
  min-width: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.tl-card:hover,
button.tl-card:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
  transform: none; /* 列有 overflow,上浮會被裁掉 */
}
button.tl-card:active { transform: none; }
.tl-card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tl-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--leaf-soft);
  border-bottom: 1px solid var(--border);
}
.tl-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tl-thumb .example-thumb { height: 100%; border-bottom: 0; }

.tl-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.tl-badge--room { background: var(--gold); color: var(--bg); }
[data-theme="light"] .tl-badge--room { color: var(--text); }
.tl-thumb .members-badge,
.tl-thumb .tl-vis {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  border-radius: 0;
  pointer-events: none;
}

.tl-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin: 8px 10px 0;
  min-height: 2.7em;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.tl-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: auto 10px 0;
  padding: 6px 0 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.tl-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-views { flex: none; white-space: nowrap; }

/* 教室卡與它展開出來的卡片 */
.tl-card--room { border-top: 3px solid var(--gold); }
.tl-card--room[aria-expanded="true"] { border-color: var(--gold); border-top-width: 3px; }
.tl-card--room[aria-busy="true"] { cursor: progress; opacity: 0.7; }
.tl-card[data-tl-parent] { border-bottom: 3px solid var(--gold); }

/* 桌機「‹ ›」:JS 只在 (hover: hover) 才建立;垂直置中在縮圖上。
   用 margin 置中不用 transform,避免被全域 button:hover 的 translateY 蓋掉。 */
.tl-arrow {
  position: absolute;
  top: 50%;
  margin-top: -24px;
  z-index: 3;
  width: 36px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
}
.tl-arrow:hover,
.tl-arrow:active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); transform: none; }
.tl-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-arrow[hidden] { display: none; }
.tl-arrow--prev { left: 0; }
.tl-arrow--next { right: 0; }
@media (hover: none) { .tl-arrow { display: none; } }

/* 載入狀態、重試、無 JS 連結 */
.tl-status {
  min-height: 1.5em;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.tl-status:empty { padding: 0; }
.tl-retry {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
}
.tl-retry:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.tl-row-retry { flex: 0 0 auto; align-self: center; scroll-snap-align: end; white-space: nowrap; }
.tl-older { display: inline-block; margin: 8px 0; }
.tl-older[hidden] { display: none; }
.tl-sentinel { height: 1px; }

.tl-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 641px) {
  .tl-card { flex: 0 0 220px; width: 220px; }
  .tl-thumb { aspect-ratio: auto; height: 120px; }
  .tl-arrow { top: 36px; margin-top: 0; } /* 縮圖 120px 的中線 */
}

@media (prefers-reduced-motion: reduce) {
  .tl-row { scroll-behavior: auto; }
  .tl-card { transition: none; }
}
