/* Animated migration map */
.anim-bar {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  margin: 24px 0 14px; padding: 14px 18px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.btn.play { min-width: 96px; font-weight: 600; }
.year-block { flex: 1 1 320px; display: flex; align-items: center; gap: 14px; }
.year-now {
  font-size: 30px; font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; min-width: 84px; color: var(--series-1);
}
#scrub { flex: 1; accent-color: var(--series-1); }

.anim-stats {
  position: absolute; top: 12px; right: 14px; text-align: right;
  padding: 10px 14px; border-radius: 8px; font-size: 12.5px;
  background: color-mix(in srgb, var(--surface-1) 90%, transparent);
  border: 1px solid var(--border); color: var(--text-secondary);
}
.anim-stats b { color: var(--text-primary); font-size: 17px; font-variant-numeric: tabular-nums; }

.trail { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trail-dot { vector-effect: non-scaling-stroke; }
.mover { vector-effect: non-scaling-stroke; }
.pulse { fill: none; vector-effect: non-scaling-stroke; }

.event-feed {
  margin-top: 14px; min-height: 76px;
  display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start;
}
.event {
  font-size: 12.5px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  color: var(--text-secondary); animation: fadein .4s ease;
}
.event b { color: var(--text-primary); }
.event.grad { border-color: var(--series-1); }
.event.move { border-color: var(--series-2); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }


.sector-bar { position: absolute; left: 14px; top: 12px; width: 210px; }
.segbar {
  display: flex; height: 9px; border-radius: 5px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.segbar .seg { height: 100%; }
.segcap { margin-top: 5px; font-size: 11.5px; color: var(--text-secondary); }
.segcap b { color: var(--text-primary); }

.follow-panel {
  position: absolute; right: 14px; bottom: 14px; width: 268px; max-height: 62%;
  overflow: auto; padding: 14px 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface-1) 95%, transparent);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.follow-panel .close-follow {
  float: right; border: 0; background: none; color: var(--text-muted);
  font-size: 15px; cursor: pointer; line-height: 1;
}
.fp-name { font-weight: 650; font-size: 14.5px; }
.fp-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.fp-steps { list-style: none; margin: 0; padding: 0; }
.fp-steps li {
  position: relative; padding: 0 0 10px 16px; font-size: 12.5px;
  border-left: 2px solid var(--border); color: var(--text-muted);
}
.fp-steps li.done { color: var(--text-secondary); border-left-color: var(--series-1); }
.fp-steps li::before {
  content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--border-strong);
}
.fp-steps li.done::before { background: var(--series-1); }
.fp-steps .yr { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: 6px; color: var(--text-primary); }
.fp-steps .ct { display: block; font-size: 11px; opacity: .8; }
.route { vector-effect: non-scaling-stroke; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  margin: 0 0 12px; padding: 12px 16px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.filter-bar .count { margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.btn.small { font-size: 12px; padding: 5px 11px; }
.ghosted { opacity: .13; }

/* ---------------- per-person career timelines ---------------- */
.career-rows { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto;
               border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; background: var(--surface-1); }
.crow {
  display: grid; grid-template-columns: 190px 52px 1fr; gap: 12px; align-items: center;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.crow:hover { background: var(--surface-2); }
.crow.on { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--series-1); }
.crow .nm { font-size: 13px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .yr { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.crow svg { width: 100%; height: 26px; overflow: visible; }
.tl-axis { stroke: var(--border); stroke-width: 1; }
.tl-seg { stroke-width: 2.5; stroke-linecap: round; }
.tl-dot { stroke: var(--surface-1); stroke-width: 1.2; }
.tl-home { fill: var(--text-primary); }
.career-head { display: grid; grid-template-columns: 190px 52px 1fr; gap: 12px;
               padding: 4px 10px 8px; font-size: 11px; letter-spacing: .06em;
               text-transform: uppercase; color: var(--text-muted); }

/* ---------------- institution index ---------------- */
.inst-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.inst {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 13px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 9px;
}
.inst .nm { font-size: 13px; }
.inst .nm small { display: block; color: var(--text-muted); font-size: 11px; }
.inst .n { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 650; min-width: 26px; text-align: right; }
.inst .n.now { color: var(--series-1); }
.inst .n.ever { color: var(--text-muted); font-weight: 500; }

/* ---------------- person dialog ---------------- */
dialog#person-dialog {
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 26px;
  background: var(--surface-1); color: var(--text-primary);
  max-width: 760px; width: calc(100% - 40px); box-shadow: var(--shadow);
}
dialog#person-dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .close { position: absolute; top: 14px; right: 16px; border: 0; background: none;
                color: var(--text-muted); font-size: 17px; cursor: pointer; }
.pd-name { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.pd-sub { font-size: 13px; color: var(--text-secondary); margin: 3px 0 18px; }
.pd-chart { width: 100%; overflow-x: auto; margin-bottom: 18px; }
.pd-cols { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
.pd-cols h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase;
              letter-spacing: .07em; color: var(--text-muted); }
.pd-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.pd-list li { padding: 5px 0 5px 14px; position: relative; border-left: 2px solid var(--border); }
.pd-list li::before { content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px;
                      border-radius: 50%; background: var(--border-strong); }
.pd-list li.acad::before { background: var(--series-1); }
.pd-list .y { font-variant-numeric: tabular-nums; color: var(--text-muted); margin-right: 7px; }
.pd-list .w { color: var(--text-muted); font-size: 11.5px; display: block; }
@media (max-width: 640px) { .pd-cols { grid-template-columns: 1fr; } }

.crow .nm a { color: inherit; text-decoration: none; }
.crow .nm a:hover { color: var(--series-1); text-decoration: underline; }

.feed-head {
  margin: 14px 0 6px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
}

.map-reset {
  position: absolute; right: 12px; bottom: 12px; z-index: 4;
  font: inherit; font-size: 13px; font-weight: 600; padding: 11px 16px;
  border-radius: 999px; cursor: pointer;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
@media (max-width: 720px) { .map-reset { right: 10px; bottom: 10px; padding: 13px 18px; } }
