.project-diagram {
  --project-play: paused;
  --project-motion-ink: #e6f7ff;
}

.project-row__visual > .project-diagram {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--project-poster-ink, #87d9ff);
}

.project-row--navigation { --project-poster-ink: #87d9ff; }
.project-row--wearable { --project-poster-ink: #86d8cd; }
.project-row--flow { --project-poster-ink: #b0c7f6; }
.project-row--neurodata { --project-poster-ink: #9acbff; }

.projects-index .project-row .project-row__visual {
  opacity: 1;
  padding: .45rem .55rem;
  border: 1px solid #a4d8ef24;
  border-radius: .8rem;
  background: radial-gradient(ellipse at 80% 0, #2d80aa1c, transparent 65%), linear-gradient(145deg, #102e45, #071e32 85%);
  transform: none;
}

.project-diagram[data-motion="running"] { --project-play: running; }

.project-motion { pointer-events: none; }
.project-motion__trace {
  fill: none;
  stroke: var(--project-motion-ink);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14 100;
  animation: project-route-travel 6s linear infinite;
}
.project-motion > * {
  animation-play-state: var(--project-play);
  animation-fill-mode: both;
}

/* The route follows an open lobby, the main corridor and the doctor's doorway. */
.hospital-map { --map-destination: #8bdac8; }
.hospital-map__boundary { stroke: currentColor; stroke-width: 1; stroke-opacity: .24; }
.hospital-map__room { fill: currentColor; fill-opacity: .045; stroke: currentColor; stroke-width: 1.25; stroke-opacity: .46; stroke-linejoin: round; }
.hospital-map__doctor-room { fill: var(--map-destination); fill-opacity: .09; stroke: var(--map-destination); stroke-width: 1.4; stroke-opacity: .8; }
.hospital-map__corridor { fill: none; stroke: currentColor; stroke-width: 15; stroke-opacity: .055; stroke-linejoin: round; stroke-linecap: round; }
.hospital-map__furniture { stroke: currentColor; stroke-width: 1; stroke-opacity: .22; stroke-linecap: round; }
.hospital-map__route { stroke: currentColor; stroke-width: 1.5; stroke-opacity: .5; stroke-dasharray: 1.4 1.8; stroke-linejoin: round; stroke-linecap: round; }
.hospital-map__origin { fill: currentColor; stroke: #092c44; stroke-width: 1.5; }
.hospital-map__label { fill: currentColor; font: 650 10px var(--font-sans, sans-serif); letter-spacing: .01em; }
.hospital-map__label--doctor { fill: var(--map-destination); }
.hospital-map__destination { fill: #0b2c40; stroke: var(--map-destination); stroke-width: 1.4; }
.hospital-map__cross { stroke: var(--map-destination); stroke-width: 1.3; stroke-linecap: round; }
.project-motion__navigation-trace {
  stroke-width: 2;
  stroke-dasharray: 100 100;
  animation: hospital-route-reveal 9s linear infinite;
  animation-play-state: var(--project-play);
}
.project-motion__arrival {
  fill: #8bdac8;
  fill-opacity: .1;
  stroke: #8bdac8;
  stroke-width: .9;
  animation: hospital-arrival 9s linear infinite;
  animation-play-state: var(--project-play);
}
.project-diagram:not([data-navigation-playing="true"]) :is(.project-motion__navigation-trace, .project-motion__arrival) { animation-name: none; opacity: 0; }
.project-motion__cursor-halo { fill: currentColor; fill-opacity: .18; }
.project-motion__cursor-disc { fill: #f4fbff; stroke: currentColor; stroke-width: 1.6; }
.project-motion__cursor-person { fill: #092d46; }
@keyframes hospital-route-reveal {
  0%, 10% { stroke-dashoffset: 100; opacity: .85; }
  85%, 96% { stroke-dashoffset: 0; opacity: .85; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes hospital-arrival {
  0%, 80% { opacity: 0; }
  86%, 96% { opacity: .9; }
  100% { opacity: 0; }
}

@keyframes project-route-travel {
  0%, 8% { stroke-dashoffset: 16; opacity: 0; }
  18%, 75% { opacity: .55; }
  90%, 100% { stroke-dashoffset: -100; opacity: 0; }
}
@media (37.5rem < width <= 58rem) {
  .project-row {
    grid-template-columns: 2.2rem minmax(0, 1fr) 8rem 2.5rem;
    grid-template-areas: "number main visual arrow" "number institution visual arrow";
  }
  .projects-index .project-row .project-row__visual {
    grid-area: visual;
    align-self: center;
    position: relative;
    inset: auto;
    z-index: 1;
    width: 100%;
    min-width: 0;
    height: 5.25rem;
  }
}

@media (width <= 37.5rem) {
  .project-row .project-diagram[data-motion="running"] { --project-play: paused; }
  .project-row:is(:focus-within, .is-mobile-active) .project-diagram[data-motion="running"] { --project-play: running; }
}

@media (prefers-reduced-motion: reduce) {
  .project-motion { display: none; }
  .project-motion > * { animation: none !important; }
}
