/* One overlay carries the same five pointers across all component boundaries. */
.page-crew {
  position: fixed;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  opacity: 0;
}
.page-crew.crew-visible { opacity: 1; }
.crew-worker {
  --body: #181818;
  --edge: white;
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 20px;
  opacity: .9;
}
.crew-visible .crew-worker {
  transition: transform 690ms cubic-bezier(.23,.68,.21,1), opacity 220ms;
}
.crew-worker:nth-child(2) { --body: #fafafa; --edge: #252525; transition-duration: 735ms, 220ms; }
.crew-worker:nth-child(3) { --body: #666; transition-duration: 765ms, 220ms; }
.crew-worker:nth-child(4) { --body: #ddd; --edge: #333; transition-duration: 800ms, 220ms; }
.crew-worker:nth-child(5) { --body: #3b3b3b; transition-duration: 840ms, 220ms; }
.page-crew.crew-docking .crew-worker { transition: none; }
.crew-worker::before, .crew-worker::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--edge);
  clip-path: polygon(4% 2%, 99% 55%, 65% 62%, 81% 90%, 59% 100%, 43% 71%, 17% 95%);
}
.crew-worker::after { inset: 2px; background: var(--body); }
.crew-role {
  position: absolute;
  top: 95%;
  left: 85%;
  padding: 2px 4px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--edge);
  background: var(--body);
  font: 600 10px/1.1 ui-monospace, monospace;
  transition: opacity 180ms;
}
.page-crew[data-phase='build'] .crew-worker {
  --stroke-x: 20px;
  --stroke-y: 7px;
  animation: crew-fit 650ms cubic-bezier(.28,.65,.32,1) both;
}
.page-crew[data-phase='build'] .crew-worker:nth-child(even) { --stroke-x: -20px; --stroke-y: 13px; }
.page-crew[data-phase='build'] .crew-worker:nth-child(3n) { --stroke-x: 4px; --stroke-y: -17px; }
@keyframes crew-fit {
  0%, 100% { translate: 0 0; }
  34% { translate: var(--stroke-x) 0; }
  67% { translate: var(--stroke-x) var(--stroke-y); }
}
.page-crew[data-phase='rest'] .crew-role,
.page-crew[data-phase='home'] .crew-role { opacity: 0; }
.page-crew[data-phase='rest'] .crew-worker { opacity: .53; }
.crew-away .swarm-cursor:nth-child(8n + 2):nth-child(-n + 34) { visibility: hidden; }

.crew-fitting { position: relative; }
.crew-fitting::after {
  content: '';
  pointer-events: none;
  position: absolute;
  inset: 1px;
  z-index: 1;
  border: 1px dashed currentColor;
  border-radius: inherit;
  animation: crew-draw 700ms ease-out both;
}
@keyframes crew-draw {
  0% { opacity: 0; clip-path: inset(0 99% 99% 0); }
  24% { opacity: .7; }
  65% { clip-path: inset(0); opacity: .65; }
  100% { clip-path: inset(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .page-crew, .crew-fitting::after { display: none; }
}

/* Match each pointer sweep to the part's reveal timeline. */
.page-crew[data-assembly='approach'] .crew-worker {
  transition: transform var(--part-travel) cubic-bezier(.26,.74,.31,1), opacity 150ms;
}
.page-crew[data-assembly='sweep'] .crew-worker {
  animation: none;
  transition: transform var(--placement-time) linear, opacity 150ms;
}
