:root {
  --ground: #0d0f12;
  --bone: #e8e3d6;
  --bone-dim: #b3a98f;
  --gold: #c9a227;
  --gold-dim: #7d6a24;
  --vermilion: #8b1e1e;
  --rule: rgba(201, 162, 39, .34);
  --serif: "Songti SC", "Songti", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--bone);
  font-family: var(--serif);
  line-height: 1.6;
  caret-color: var(--gold);
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--gold-dim) var(--ground);
}
::selection { background: var(--gold); color: #14100a; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -64px; z-index: 9;
  background: var(--gold); color: #14100a; padding: 10px 16px; font-size: 15px;
}
.skip:focus { top: 16px; }

.screen {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 104px 1fr 340px;
}

/* 站名 */
.masthead {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 34px 64px 0; text-align: right;
}
.brand {
  font-size: 30px; letter-spacing: .18em;
  border-bottom: 1px solid var(--rule); padding-bottom: 8px;
  transition: border-color .18s ease-out, color .18s ease-out;
}
.brand:hover { color: #f3eede; border-bottom-color: var(--gold); }
.brand-note { margin: 10px 0 0; font-size: 14px; letter-spacing: .14em; color: var(--bone-dim); }
.brand-note a { color: var(--gold); border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.brand-note a:hover { color: var(--bone); border-bottom-color: var(--gold); }

/* 纪年刻度线 */
.timeline { position: relative; min-height: 0; }
.hero-hover-bg {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none; background: var(--ground);
}
.hero-hover-bg::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(90deg, rgba(13,15,18,.28), rgba(13,15,18,.65) 58%, rgba(13,15,18,.9));
}
.hero-bg {
  position: absolute; inset: 0; opacity: 0; transform: scale(1.035);
  background-image: var(--hero-image); background-position: center; background-size: cover;
  filter: grayscale(.18) sepia(.08) saturate(.72) brightness(.55) contrast(1.08);
  transition: opacity 1.15s cubic-bezier(.16,1,.3,1), transform 1.6s cubic-bezier(.16,1,.3,1);
}
.chrono { position: relative; }
/* 纪年带：线、刻度、标签、节点同属一条带子，可横向滑动 */
.chrono { position: relative; z-index: 1; height: 100%; overflow-x: auto; overflow-y: hidden; }
/* 纪年带：线、刻度、标签、节点同属一条带子，节点多了就横向滑动 */
.band {
  --node-unit: 200px;
  position: absolute; top: 0; bottom: 0; left: 0; right: auto;
  min-width: 100%; width: max-content; padding: 0 64px;
}
.band::after {
  content: ""; position: absolute; left: 64px; right: 64px; bottom: 0; height: 1px; background: var(--gold);
}
.band::before {
  content: ""; position: absolute; left: 64px; right: 64px; bottom: 0; height: 9px;
  background-image: repeating-linear-gradient(to right, var(--rule) 0 1px, transparent 1px 48px);
}
.scale { display: none; }
.scale-label {
  position: absolute; bottom: 26px; margin: 0;
  font-size: 22px; letter-spacing: .1em; color: var(--gold);
}
.scale-start { left: 64px; }
.scale-now { right: 64px; }

/* 搜索：真正能用的功能放在首屏空白区，不作装饰。 */
.hero-search {
  position: absolute; top: 18px; right: 64px; z-index: 3;
  width: min(430px, calc(100% - 128px)); text-align: right;
}
.search-label {
  display: block; margin-bottom: 8px;
  font-size: 13px; letter-spacing: .16em; color: var(--gold);
}
.search-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search-control input {
  min-width: 0; width: 100%; padding: 12px 14px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: rgba(13, 15, 18, .88); color: var(--bone);
  font: inherit; font-size: 16px; outline: 0;
}
.search-control input::placeholder { color: rgba(179, 169, 143, .86); }
.search-control input:focus { border-color: var(--gold); background: #111418; }
.search-control button {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 1px solid var(--gold); border-radius: 50%;
  background: var(--gold); color: #14100a; font: inherit; font-size: 16px;
  cursor: pointer;
}
.search-control button svg {
  display: block; width: 21px; height: 21px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.search-control button:hover { background: #ddb945; }
.search-status {
  min-height: 20px; margin: 8px 0 0;
  font-size: 13px; line-height: 1.5; color: var(--bone-dim);
}
.ask-entry-button {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 9px 14px;
  border: 1px solid var(--gold); background: rgba(201,162,39,.1);
  color: var(--bone); font-size: 14px; letter-spacing: .06em;
  transition: background .18s ease-out, color .18s ease-out;
}
.ask-entry-button span { color: var(--gold); font-size: 18px; line-height: 1; }
.ask-entry-button:hover { background: var(--gold); color: #14100a; }
.ask-entry-button:hover span { color: #14100a; }

/* 朝代轴：同一列宽，与下方英雄节点严格对齐。 */
.era-axis {
  position: absolute; left: 64px; top: 190px;
  display: grid; grid-template-columns: repeat(10, var(--node-unit));
  margin: 0; padding: 0; list-style: none;
}
.era-axis li {
  grid-column: span var(--span, 1);
  min-width: 0; padding: 0 14px;
  border-left: 1px solid var(--rule);
}
.era-axis li:first-child { border-left: 0; padding-left: 0; }
.era-axis li::before {
  content: ""; display: block; width: 7px; height: 7px; margin-bottom: 12px;
  background: var(--gold); transform: rotate(45deg);
}
.era-name { display: block; font-size: 15px; letter-spacing: .1em; color: var(--gold); }
.era-axis small {
  display: block; margin-top: 5px;
  font-size: 12px; line-height: 1.5; letter-spacing: .02em; color: var(--bone-dim);
}

/* 纪年线上的英雄 */
.roster {
  position: relative; height: 100%; margin: 0; padding: 0;
  list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: var(--node-unit);
}
.roster li {
  position: relative;
  transition: opacity .2s ease-out, filter .2s ease-out;
}
.roster li.is-filtered-out { opacity: .13; filter: grayscale(1); pointer-events: none; }
.roster li.is-search-hit .node-mark {
  background: #b52a2a;
  box-shadow: 0 0 0 5px rgba(201, 162, 39, .14);
}
.node {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 14px;
}
.node-mark {
  width: 26px; height: 26px; margin-bottom: -13px;
  background: var(--vermilion); border: 1px solid var(--gold);
  transform: rotate(45deg);
}
.node-name {
  writing-mode: vertical-rl;
  font-size: 52px; line-height: .96; letter-spacing: .04em; color: #f4f0e4;
}
.node-years {
  writing-mode: vertical-rl;
  font-size: 15px; letter-spacing: .2em; color: var(--gold);
  padding-bottom: 8px;
}
.node-meta {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 14px; white-space: nowrap; font-size: 16px; letter-spacing: .12em; color: var(--bone-dim);
  border-bottom: 1px solid transparent; padding-bottom: 4px;
  transition: color .18s ease-out, border-color .18s ease-out;
}
.node:hover .node-meta, .node:focus-visible .node-meta { color: var(--bone); border-bottom-color: var(--gold); }
.node:hover .node-mark { background: #a82626; }

.timeline:has(.roster li:nth-child(1) .node:hover) .hero-bg-1,
.timeline:has(.roster li:nth-child(1) .node:focus-visible) .hero-bg-1,
.timeline:has(.roster li:nth-child(2) .node:hover) .hero-bg-2,
.timeline:has(.roster li:nth-child(2) .node:focus-visible) .hero-bg-2,
.timeline:has(.roster li:nth-child(3) .node:hover) .hero-bg-3,
.timeline:has(.roster li:nth-child(3) .node:focus-visible) .hero-bg-3,
.timeline:has(.roster li:nth-child(4) .node:hover) .hero-bg-4,
.timeline:has(.roster li:nth-child(4) .node:focus-visible) .hero-bg-4,
.timeline:has(.roster li:nth-child(5) .node:hover) .hero-bg-5,
.timeline:has(.roster li:nth-child(5) .node:focus-visible) .hero-bg-5,
.timeline:has(.roster li:nth-child(6) .node:hover) .hero-bg-6,
.timeline:has(.roster li:nth-child(6) .node:focus-visible) .hero-bg-6,
.timeline:has(.roster li:nth-child(7) .node:hover) .hero-bg-7,
.timeline:has(.roster li:nth-child(7) .node:focus-visible) .hero-bg-7,
.timeline:has(.roster li:nth-child(8) .node:hover) .hero-bg-8,
.timeline:has(.roster li:nth-child(8) .node:focus-visible) .hero-bg-8,
.timeline:has(.roster li:nth-child(9) .node:hover) .hero-bg-9,
.timeline:has(.roster li:nth-child(9) .node:focus-visible) .hero-bg-9,
.timeline:has(.roster li:nth-child(10) .node:hover) .hero-bg-10,
.timeline:has(.roster li:nth-child(10) .node:focus-visible) .hero-bg-10 {
  opacity: .56; transform: scale(1);
}

.roster-note {
  position: absolute; left: 64px; bottom: -86px; margin: 0;
  font-size: 15px; color: var(--bone-dim);
}

/* 三层标识 */
.layers {
  display: grid; grid-template-columns: 288px 1fr; gap: 56px;
  padding: 132px 64px 48px;
}
.layers-intro h2 { margin: 0; font-size: 30px; letter-spacing: .1em; font-weight: 400; }
.layers-lead { margin: 14px 0 0; font-size: 15px; line-height: 1.9; color: var(--bone-dim); }
.ledger-link {
  display: inline-block; margin-top: 18px;
  color: var(--gold); font-size: 14px;
  border-bottom: 1px solid var(--rule); padding-bottom: 3px;
}
.ledger-link:hover { color: var(--bone); border-bottom-color: var(--gold); }
.layer-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
  margin: 0; padding: 22px 0 0; list-style: none;
  border-top: 1px solid var(--rule);
}
.layer h3 { margin: 0; font-size: 20px; font-weight: 400; letter-spacing: .08em; }
.layer p { margin: 10px 0 0; font-size: 15px; line-height: 1.85; color: var(--bone-dim); }
.mark { display: block; width: 26px; height: 26px; margin-bottom: 16px; }
.layer-evidence .mark { background: var(--bone); }
.layer-restore .mark {
  border: 1px solid var(--bone);
  background: linear-gradient(to bottom, transparent 12px, var(--bone) 12px 13px, transparent 13px);
}
.layer-art .mark {
  border: 1px solid rgba(139, 30, 30, .72);
  background: repeating-linear-gradient(45deg, var(--vermilion) 0 3px, transparent 3px 7px);
}

/* 签名动作：纪年线刻出，节点落下；一次 */
@media (prefers-reduced-motion: no-preference) {
  .band::after { transform-origin: left center; animation: draw 900ms cubic-bezier(.16, 1, .3, 1) both; }
  .node { animation: strike 640ms cubic-bezier(.16, 1, .3, 1) 480ms both; }
  .hero-search { animation: search-enter 680ms cubic-bezier(.16, 1, .3, 1) 140ms both; }
  .era-axis li { animation: era-enter 540ms cubic-bezier(.16, 1, .3, 1) both; }
  .era-axis li:nth-child(1) { animation-delay: 180ms; }
  .era-axis li:nth-child(2) { animation-delay: 220ms; }
  .era-axis li:nth-child(3) { animation-delay: 260ms; }
  .era-axis li:nth-child(4) { animation-delay: 300ms; }
  .era-axis li:nth-child(5) { animation-delay: 340ms; }
  .era-axis li:nth-child(6) { animation-delay: 380ms; }
  .era-axis li:nth-child(7) { animation-delay: 420ms; }
  .era-axis li:nth-child(8) { animation-delay: 460ms; }
  @keyframes draw { from { transform: scaleX(0); } }
  /* 内容默认必须可见：入场只做位移，不做透明度 */
  @keyframes strike { from { transform: translate(-50%, 12px); } }
  @keyframes search-enter { from { transform: translateY(-10px); } }
  @keyframes era-enter { from { transform: translateY(10px); } }
}

/* 移动端 */
@media (max-width: 900px) {
  .hero-hover-bg { display: none; }
  .screen { grid-template-rows: auto auto auto; }
  .masthead { align-items: flex-start; text-align: left; padding: 26px 24px 0; }
  .brand { font-size: 25px; }
  .brand-note { font-size: 13px; }
  .chrono { min-height: 58vh; }
  .hero-search { top: 22px; right: 24px; left: 24px; width: auto; text-align: left; }
  .search-label { margin-bottom: 6px; }
  .search-control input { padding: 11px 14px; font-size: 16px; }
  .search-control button { width: 46px; height: 46px; }
  .search-status { margin-top: 6px; }
  .band { --node-unit: 150px; padding: 0 24px; }
  .node { gap: 8px; }
  .node-name { font-size: 26px; }
  .node-years { display: none; }
  .node-mark { width: 18px; height: 18px; margin-bottom: -9px; }
  .node-meta { margin-top: 10px; font-size: 13px; letter-spacing: .06em; }
  .node-meta .cta { display: none; }
  .era-axis { left: 24px; top: 224px; }
  .era-axis li { padding-right: 8px; padding-left: 8px; }
  .era-axis small { display: none; }
  .era-name { font-size: 13px; }
  .roster-note { left: 24px; bottom: -78px; font-size: 13px; }
  .scale-label { display: none; }
  .scale-start { left: 24px; }
  .scale-now { right: 24px; }
  .layers { grid-template-columns: 1fr; gap: 20px; padding: 132px 24px 44px; }
  .layers-intro h2 { font-size: 24px; }
  .layer-list { grid-template-columns: 1fr; gap: 28px; padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg { transition: none; }
}
