/* 年表：时间长河（总览）+ 按分期分段的纵向时间轴。
 * 先写手机（轴在左，单列），900px 以上是桌面（轴在中间，左右交错）。 */
.tl { --tl-num: Georgia, "Times New Roman", "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;   /* 数字用西文字体，夹着的汉字仍是宋体 */
  --tl-tint: rgba(58, 42, 30, .06); --tl-g: 80px; }
#page-timeline { scroll-padding-top: 72px; }   /* 键盘聚焦或跳转时，别让吸顶的段落头盖住目标 */
.tl .page-head { align-items: center; margin-bottom: 12px; }
.tl .page-head p { flex-basis: 100%; }
.tl-new { position: relative; margin-left: auto; }
.tl-new::after { content: ""; position: absolute; inset: -6px -2px; }   /* 触控范围撑到 40px 以上 */

/* ------------------------------------------------------------ 筛选 */
.tl-chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-16px - var(--sar)) 0 calc(-16px - var(--sal)); padding: 2px calc(16px + var(--sar)) 6px calc(16px + var(--sal)); }
.tl-chips::-webkit-scrollbar { display: none; }
.tl-chips .chip { position: relative; }
.tl-chips .chip::after { content: ""; position: absolute; inset: -5px -1px; }   /* 把触控范围撑到 40px 以上 */
.tl-hint { min-height: 1.7em; margin-top: 3px; font-size: 12.5px; line-height: 1.7; color: var(--sub); }
.tl-wide { display: none; }

/* ------------------------------------------------------------ 时间长河 */
.tl-river { position: relative; margin-top: 12px; padding: 12px 10px 11px; animation: rise .55s var(--ease-out) both; }
.tl-river .sec-title { margin: 0 2px 10px; }
.tl-fig { position: relative; user-select: none; -webkit-user-select: none; }
/* 真实比例：每一千年一样宽 */
.tl-ruler { position: relative; height: 18px; font: 10.5px/1.3 var(--tl-num); color: var(--sub); }
.tl-ruler span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.tl-ruler span::after { content: ""; position: absolute; left: 50%; top: 14px; height: 4px; border-left: 1px solid var(--line-strong); }
.tl-ruler .first { transform: none; } .tl-ruler .first::after { left: 0; }
.tl-ruler .last { transform: translateX(-100%); } .tl-ruler .last::after { left: auto; right: 0; }
.tl-scale { position: relative; height: 14px; overflow: hidden; background: var(--card-hi); border: 1px solid var(--ink-line); border-radius: 3px 4px 3px 4px / 4px 3px 4px 3px; }
.tl-scale b { position: absolute; top: 0; bottom: 0; }
.tl-scale b.alt { background: var(--tl-tint); }
.tl-scale i { position: absolute; top: 1.5px; bottom: 1.5px; width: 1.5px; margin-left: -.75px; background: var(--c); opacity: .92; transition: opacity .25s; }
.tl-scale i.dim { opacity: .1; }
.tl-fan { display: block; width: 100%; height: 22px; }
.tl-fan polygon { fill: none; } .tl-fan polygon.alt { fill: var(--tl-tint); }
.tl-fan line { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* 拉开后的六个分期 */
.tl-bands { position: relative; display: flex; background: var(--card-hi); border: 1px solid var(--ink-line); border-bottom-width: 1.5px; border-radius: 4px 5px 0 0 / 5px 4px 0 0; }
.tl-band { position: relative; flex: none; min-width: 0; }
.tl-band.alt { background: var(--tl-tint); }
.tl-band + .tl-band::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px dashed var(--line-strong); pointer-events: none; }
.tl-band-head { display: grid; justify-items: center; width: 100%; min-height: 40px; padding: 5px 0 1px; border: 0; background: none; cursor: pointer; line-height: 1.25; color: var(--ink); }
.tl-band-head strong { font-size: 14.5px; font-weight: 600; letter-spacing: .14em; text-indent: .14em; transition: color .15s; }
.tl-band-head small { font: 11px/1.2 var(--latin); color: var(--sub); }
.tl-band-head em { display: none; }
.tl-band-head:active strong { color: var(--seal); }
.tl-plot { position: relative; height: var(--plot-h, 70px); touch-action: pan-y; transition: height .3s var(--ease-out); }
.tl-bands.can-pick .tl-plot { cursor: pointer; }
.tl-dot { position: absolute; width: var(--dot, 9px); height: var(--dot, 9px); background: var(--c); border-radius: 1.5px; box-shadow: 0 1px 0 rgba(58, 42, 30, .5);
  transition: bottom .35s var(--ease-out), opacity .25s, transform .12s; }
.tl-dot.dim { opacity: .14; box-shadow: none; }
.tl-dot.on { z-index: 2; transform: scale(1.65); box-shadow: 0 0 0 1px var(--card-hi), 0 0 0 2px var(--ink); }
.tl-ticks { position: relative; height: 18px; margin-top: 6px; font: 11px/1.3 var(--tl-num); color: var(--ink-soft); }
.tl-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.tl-ticks span::before { content: ""; position: absolute; left: 50%; bottom: calc(100% + 1px); height: 5px; border-left: 1px solid var(--ink-line); }
.tl-ticks .first { transform: none; } .tl-ticks .first::before { left: 0; }
.tl-ticks .last { transform: translateX(-100%); } .tl-ticks .last::before { left: auto; right: 0; }
.tl-river.is-small .tl-ticks { font-size: 10px; }
.tl-river-note { margin-top: 7px; font-size: 12.5px; line-height: 1.7; color: var(--sub); text-align: justify; }
/* 点到某一格时的提示卡 */
.tl-tip { position: absolute; z-index: 5; left: 0; top: 0; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 8px); padding: 4px 12px 4px 5px; text-align: left; pointer-events: none;
  background: var(--card-hi); border: 1.5px solid var(--ink-line); border-radius: var(--wob-b); box-shadow: 0 2.5px 0 var(--edge), 0 10px 22px rgba(80, 55, 30, .2); }
.tl-tip.pinned { pointer-events: auto; cursor: pointer; }
.tl-tip img { flex: none; width: 58px; height: 44px; object-fit: contain; }
.tl-tip > span { display: grid; min-width: 0; }
.tl-tip strong { font-size: 14.5px; font-weight: 600; letter-spacing: .08em; line-height: 1.45; white-space: nowrap; }
.tl-tip small { max-width: 15em; font-size: 12px; line-height: 1.45; color: var(--sub); }
.tl-tip em { display: none; flex: none; align-items: center; gap: 1px; margin-left: 2px; font-style: normal; font-size: 12.5px; letter-spacing: .1em; color: var(--seal); }
.tl-tip.pinned em { display: inline-flex; }

/* ------------------------------------------------------------ 分期段落 */
.tl-era { margin-top: 22px; }
/* 段落头吸顶：纸色实底，下面一道墨线，再往下一小段渐隐 */
.tl-era-head { position: sticky; top: var(--sat); z-index: 6; display: flex; align-items: center; gap: 9px; min-height: 50px;
  margin: 0 calc(-16px - var(--sar)) 0 calc(-16px - var(--sal)); padding: 5px calc(6px + var(--sar)) 5px calc(16px + var(--sal));
  background: var(--paper); border-bottom: 1.5px solid var(--ink-line); }
.tl-era-head::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: calc(var(--sat) + 1px); background: var(--paper); }
.tl-era-head::after { content: ""; position: absolute; left: 0; right: 0; top: calc(100% + 1.5px); height: 10px; pointer-events: none; background: linear-gradient(rgba(243, 234, 216, .92), rgba(243, 234, 216, 0)); }
.tl-era-name { flex: none; padding: 3px 9px 3px 12px; font-size: 16px; font-weight: 600; letter-spacing: .28em; line-height: 1.5; }
.tl-era-range { min-width: 0; font: 13px/1.4 var(--tl-num); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-era-note { display: none; }
.tl-era-count { flex: none; margin-left: auto; font-size: 12.5px; color: var(--sub); white-space: nowrap; }
.tl-era-count b { font: 600 15.5px var(--latin); color: var(--ink); }
.tl-up { flex: none; width: 40px; min-height: 40px; color: var(--sub); }
.tl-era-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 12px; margin: 14px 0 0; font-size: 13px; line-height: 1.75; color: var(--sub); }
.tl-era-note2 { font-size: 14.5px; letter-spacing: .08em; color: var(--ink-soft); }
.tl-era-span { font-family: var(--tl-num); }
.tl-tallies { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0 13px; }
.tl-tally { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: opacity .25s; }
.tl-tally b { font: 600 13px var(--latin); color: var(--ink-soft); }
.tl-tally.dim { opacity: .38; }
.tl-tally i, .tl-place i, .tl-sides i, .tl-end i { flex: none; width: 7px; height: 7px; background: var(--c, var(--gold)); transform: rotate(45deg); border-radius: 1px; box-shadow: 0 0 0 1px rgba(58, 42, 30, .55); }

/* ------------------------------------------------------------ 时间轴上的条目 */
.tl-list { position: relative; list-style: none; margin: 8px 0 0; padding: 4px 0 6px; }
.tl-list::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; border-left: 1.5px solid var(--ink-line); }
.tl-item { position: relative; padding-left: 24px; }
.tl-node { position: absolute; z-index: 1; left: 3.5px; top: 30px; width: 12px; height: 12px; background: var(--c); border: 1.5px solid var(--ink); border-radius: 1.5px; transform: rotate(45deg); box-shadow: 0 0 0 2.5px var(--paper); }
.tl-year, .tl-sides { display: none; }
.tl-card { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 6px 7px 2px; text-align: left; cursor: pointer;
  background: none; border: 1.5px solid transparent; border-radius: var(--wob-a); transition: background .15s, border-color .2s, box-shadow .2s; }
.tl-card:active { background: rgba(58, 42, 30, .06); }
.tl-thumb { position: relative; flex: none; width: 106px; aspect-ratio: 42 / 31; }
.tl-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .3s var(--ease-out); }
.tl-text { flex: 1; display: grid; min-width: 0; }
.tl-period { font-size: 12.5px; line-height: 1.5; letter-spacing: .03em; color: var(--seal-deep); }
.tl-name { font-size: 17px; font-weight: 600; line-height: 1.45; letter-spacing: .1em; }
.tl-place { font-size: 12.5px; line-height: 1.5; color: var(--sub); }
.tl-place i { display: inline-block; margin: 0 8px 1.5px 2px; vertical-align: middle; }
.tl-intro { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 3px; font-size: 13px; line-height: 1.65; color: var(--ink-soft); }
/* 已看过：缩略图一角盖个小圆章 */
.tl-stamp { display: none; position: absolute; left: -3px; bottom: -3px; place-items: center; width: 40px; height: 40px; pointer-events: none; color: var(--seal);
  background: rgba(243, 234, 216, .8); border: 1.5px solid var(--seal); border-radius: 50%; opacity: .9; transform: rotate(-10deg);
  box-shadow: inset 0 0 0 2px rgba(243, 234, 216, .95), inset 0 0 0 3px var(--seal); }
.tl-stamp b { font-size: 9.5px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.tl-item.is-visited .tl-stamp { display: grid; }
/* 从总览跳过来的那一条：变成一张小卡片 */
.tl-item.is-target .tl-card { background: var(--card-hi); border-color: var(--ink-line); box-shadow: 0 3px 0 var(--edge); animation: tl-land .6s var(--ease-back) both; }
@keyframes tl-land { from { transform: translateY(10px); } to { transform: none; } }
/* 相隔很久：这一段轴画成虚线 */
.tl-gap, .tl-empty { position: relative; padding: 9px 0 9px 26px; font-size: 12px; letter-spacing: .12em; color: var(--sub); }
.tl-gap::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 8px;
  background: repeating-linear-gradient(to bottom, var(--ink-line) 0 3px, transparent 3px 8px) 50% 0 / 1.5px 100% no-repeat var(--paper); }
.tl-gap b { font: 600 12.5px var(--latin); letter-spacing: 0; color: var(--ink-soft); }
.tl-empty { padding: 6px 0 0; font-size: 13.5px; letter-spacing: .04em; }
.tl-era.is-empty .tl-list { display: block; padding: 0; }
.tl-era.is-empty .tl-list::before { display: none; }
.tl-end { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 34px; font-size: 13px; letter-spacing: .1em; color: var(--sub); }

/* ------------------------------------------------------------ 桌面（≥900px）：页边距变宽，筛选不再横向滚动 */
@media (min-width: 900px) {
  .tl .page-head p { flex: 1 1 220px; order: 1; } .tl-new { order: 2; }
  .tl-new::after, .tl-chips .chip::after { content: none; }
  .tl-chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0 4px; }
  .tl-hint { font-size: 13px; }
  .tl-river { margin-top: 14px; padding: 14px 16px 13px; }
  .tl-ruler { font-size: 11px; }
  .tl-scale { height: 16px; } .tl-scale i { width: 2px; margin-left: -1px; }
  .tl-fan { height: 32px; }
  /* 分期名、座数，放得下时右边再写这一期有多少年（放不下就折到下一行，被固定的高度裁掉） */
  .tl-band-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px; height: 34px; min-height: 0; padding: 6px 10px 0; overflow: hidden; line-height: 28px; }
  .tl-band-head strong { font-size: 15.5px; text-indent: 0; }
  .tl-band-head small { font-size: 12px; line-height: inherit; }
  .tl-band-head small::after { content: attr(data-unit); font-family: var(--serif); font-size: 11.5px; }
  .tl-band-head em { display: block; margin-left: auto; font: 11.5px/28px var(--tl-num); color: var(--sub); white-space: nowrap; }
  .tl-band-head:hover strong { color: var(--seal); }
  .tl-ticks { font-size: 11.5px; }
  .tl-river-note { font-size: 13px; }

  .tl-era { margin-top: 34px; }
  .tl-era-head { top: 0; gap: 14px; min-height: 56px; margin: 0; padding: 7px 0; }
  .tl-era-name { padding: 4px 11px 4px 15px; font-size: 18px; }
  .tl-era-range { font-size: 14px; }
  .tl-era-note { display: block; min-width: 0; font-size: 14.5px; letter-spacing: .1em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tl-era-count { font-size: 13px; }
  .tl-era-sub { margin-top: 16px; }
  .tl-era-note2 { display: none; }
  .tl-tallies { flex-basis: auto; }
  .tl-item { padding-left: 30px; }
  .tl-card { gap: 16px; padding: 7px 10px; }
  .tl-thumb { width: 140px; }
  .tl-name { font-size: 18px; }
  .tl-intro { font-size: 13.5px; }
  .tl-gap, .tl-empty { padding-left: 42px; }
  .tl-era.is-empty .tl-empty { padding-left: 0; }
  .tl-stamp { width: 44px; height: 44px; } .tl-stamp b { font-size: 10.5px; }
}

/* ------------------------------------------------------------ 够宽时（≥1100px）：轴在中间，条目左右交错 */
@media (min-width: 1100px) {
  .tl-wide { display: inline; }
  /* 段落头：分期名压在轴线上，年份在左，说明在右 */
  .tl-era-head { display: grid; grid-template-columns: 84px 1fr auto 1fr 84px; gap: 0 16px; }
  .tl-era-count { grid-area: 1 / 1; justify-self: start; margin: 0 0 0 4px; }
  .tl-era-range { grid-area: 1 / 2; justify-self: end; }
  .tl-era-name { grid-area: 1 / 3; }
  .tl-era-note { grid-area: 1 / 4; justify-self: start; }
  .tl-up { grid-area: 1 / 5; justify-self: end; }
  .tl-era-sub { justify-content: center; }

  /* 每条占两行，左右两列错开一行，像拉链一样咬合；行号由脚本写在条目上 */
  .tl-list { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(64px, auto); margin-top: 10px; padding: 14px 0 22px; }
  .tl-list::before { left: 50%; margin-left: -.75px; }
  .tl-item { align-self: start; padding: 0; }
  .tl-item.l { grid-column: 1; padding-right: var(--tl-g); }
  .tl-item.r { grid-column: 2; padding-left: var(--tl-g); }
  /* 节点到条目的引线；年份标在轴的另一侧 */
  .tl-item::before { content: ""; position: absolute; top: 35.5px; width: calc(var(--tl-g) - 16px); border-top: 1px dashed var(--line-strong); }
  .tl-item.l::before { right: 9px; } .tl-item.r::before { left: 9px; }
  .tl-item.l .tl-node { left: auto; right: -6.5px; } .tl-item.r .tl-node { left: -6.5px; }
  .tl-year { position: absolute; top: 25px; display: block; font: 12.5px/1.7 var(--tl-num); letter-spacing: .02em; color: var(--ink-soft); white-space: nowrap; }
  .tl-item.l .tl-year { left: calc(100% + 16px); } .tl-item.r .tl-year { right: calc(100% + 16px); }
  .tl-card { gap: 14px; }
  .tl-item.l .tl-card { flex-direction: row-reverse; text-align: right; }
  .tl-item.l .tl-stamp { left: auto; right: -3px; }
  .tl-intro { font-size: 13px; }
  .tl-gap { grid-column: 1 / -1; display: grid; place-items: center; padding: 0; }
  .tl-gap::before { left: 50%; margin-left: -4px; }
  .tl-gap span { position: relative; padding: 1px 15px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 999px; }
  .tl-empty { padding: 4px 0 0; text-align: center; }
  /* 对照两个洲时，轴两侧各标一个洲名 */
  .tl-sides { grid-area: 1 / 1 / 2 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: center; font-size: 13.5px; letter-spacing: .2em; color: var(--ink-soft); }
  .tl-sides span { display: flex; align-items: center; gap: 8px; padding: 0 26px; }
  .tl-sides span:first-child { flex-direction: row-reverse; }
}
@media (min-width: 1280px) { .tl-thumb { width: 152px; } }
@media (hover: hover) {
  .tl-card:hover { background: rgba(58, 42, 30, .05); }
  .tl-card:hover .tl-thumb img { transform: translateY(-3px); }
}
:lang(en) .tl-band-head strong { font-size: 14px; letter-spacing: 0; text-indent: 0; }
:lang(en) .tl-band-head small::after { content: none; }
:lang(en) .tl-band-head em { display: none; }
:lang(en) .tl-year { white-space: normal; text-align: center; }
@media (max-width: 899px) {
  :lang(en) .tl-band-head { height: 58px; grid-template-rows: 1fr auto; align-items: center; gap: 2px; }
  :lang(en) .tl-band-head strong { font-size: clamp(10px, 2.9vw, 14px); }
  :lang(en) .tl-ticks { font-size: 9px; }
}
:lang(en) .tl-river-note { text-align: left; }
:lang(en) .tl-name { letter-spacing: .015em; }
@media (max-width: 500px) {
  :lang(en) .tl-ruler span:nth-child(2), :lang(en) .tl-ticks span:nth-child(2) { visibility: hidden; }
  :lang(en) .tl-band-head strong { font-size: 11px; }
}
