/* 远端 / 远端跟踪分支 / 本地分支 三层拓扑图
   用法：.topology > .place.remote + .link + .place.tracking + .link + .place.local
   每个 .place 里放 .where（位置标签）、h3（分支名）、p（说明）。
   .link 里放 .op 表示在这两层之间移动数据的命令。
   tracking 层刻意用警示色——它是快照，会过期，这是本课要害。 */

.topology {
  margin: 20px 0 0;
}

.topology .place {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
}

.topology .place h3 {
  margin: 6px 0 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.15rem;
}

.topology .place p {
  margin: 0;
  color: #3e4955;
  font-size: 0.92rem;
}

.topology .where {
  display: inline-block;
  padding: 0.16em 0.7em;
  border-radius: 999px;
  color: white;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.topology .remote {
  border-color: #9aa4b2;
  background: #eef1f5;
}

.topology .remote .where {
  background: #475467;
}

.topology .tracking {
  border-width: 2px;
  border-color: var(--amber);
  background: var(--amber-soft);
}

.topology .tracking .where {
  background: var(--amber);
}

.topology .local {
  border-color: #bed3eb;
  background: var(--blue-soft);
}

.topology .local .where {
  background: var(--blue);
}

/* 两层之间的命令带 */
.topology .link {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
}

.topology .op {
  padding: 0.3em 0.85em;
  border: 1px solid #b7afa0;
  border-radius: 8px;
  background: white;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.topology .op.down::before {
  content: "↓ ";
  color: var(--green);
  font-weight: 800;
}

.topology .op.up::before {
  content: "↑ ";
  color: var(--blue);
  font-weight: 800;
}

.topology .op.blocked {
  border-color: var(--red);
  color: var(--red);
  background: #fbeae9;
}

.topology .op.blocked::before {
  content: "✕ ";
  font-weight: 800;
}

/* 时间线：展示快照过期的过程 */
.timeline {
  display: grid;
  grid-template-columns: 88px 1fr;
  overflow: hidden;
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.timeline > div {
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.timeline > div:nth-child(2n + 1) {
  border-right: 1px solid var(--line);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  color: var(--muted);
}

.timeline > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.timeline .hot {
  background: var(--amber-soft);
  font-weight: 650;
}

@media (max-width: 700px) {
  .timeline {
    grid-template-columns: 1fr;
  }

  .timeline > div:nth-child(2n + 1) {
    border-right: 0;
    padding-bottom: 0;
  }
}

@media print {
  .topology .place, .timeline {
    break-inside: avoid;
  }
}
