/* A finite illustration: extract, gather, then surface source-linked passages. */
.source-flow {
  --flow-blue: #2563eb;
  --flow-line: #99b7e5;
  display: grid;
  grid-template-columns:
    minmax(0, 1.4fr) minmax(40px, 0.7fr) minmax(100px, 0.8fr)
    minmax(40px, 0.7fr) minmax(0, 1.4fr);
  align-items: center;
  width: min(100%, 960px);
  margin: 0 auto;
  text-align: left;
}
.flow-description {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.flow-sources,
.flow-results {
  display: grid;
  grid-template-rows: 24px repeat(3, 80px);
  gap: 14px;
  min-width: 0;
}
.flow-heading {
  margin: 0;
  color: #405372;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 24px;
}
.flow-source,
.flow-excerpt {
  position: relative;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid #c3d3e9;
  border-radius: 6px;
  background: #fff;
}
.flow-source-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #354b6d;
  font-size: 0.82rem;
  line-height: 22px;
}
.flow-source-name img {
  flex: none;
}
.flow-document {
  display: grid;
  gap: 4px;
  margin: 8px 0 0 30px;
}
.flow-document i,
.flow-passage i {
  display: block;
  height: 3px;
  background: #c3d3e9;
}
.flow-document i:first-child {
  width: 86%;
}
.flow-document i:last-child {
  width: 64%;
}
.flow-document .flow-extraction {
  background: var(--flow-blue);
  width: 76%;
  transform-origin: left;
  animation: flow-extract 4.8s ease both;
}
.flow-item-2 .flow-extraction {
  animation-delay: 0.12s;
}
.flow-item-3 .flow-extraction {
  animation-delay: 0.24s;
}
.flow-rail {
  height: 268px;
  margin-top: 38px;
}
.flow-rail svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke-width: 1.5;
}
.flow-rail path {
  vector-effect: non-scaling-stroke;
}
.flow-tracks {
  stroke: var(--flow-line);
}
.flow-fragments {
  stroke: var(--flow-blue);
  stroke-dasharray: 100 200;
  opacity: 0;
}
.flow-fragments path {
  animation: flow-draw 0.8s ease-out 1.15s both;
}
.flow-fragments {
  animation: flow-ink 2s ease 1.15s both;
}
.flow-rail-in .flow-fragments .flow-trunk {
  animation-delay: 1.85s;
}
.flow-rail-out .flow-fragments {
  animation-delay: 2.55s;
}
.flow-rail-out .flow-fragments path {
  animation-delay: 3.05s;
}
.flow-rail-out .flow-fragments .flow-trunk {
  animation-delay: 2.55s;
  animation-duration: 0.5s;
}
.flow-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 38px;
  min-height: 88px;
}
.flow-center img {
  width: 88px;
  height: 88px;
}
.flow-excerpt {
  border-left: 3px solid var(--flow-blue);
  height: 80px;
  align-self: center;
}
.flow-passage {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  animation: flow-reveal 4.8s ease both;
}
.flow-passage i {
  height: 4px;
  background: #7298ce;
}
.flow-passage i:last-child {
  width: 72%;
}
.flow-item-2 .flow-passage i:last-child {
  width: 88%;
}
.flow-results {
  grid-template-rows: 24px repeat(2, 127px);
}
@keyframes flow-extract {
  0%,
  8% {
    transform: scaleX(0);
  }
  26%,
  100% {
    transform: scaleX(1);
  }
}
@keyframes flow-draw {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes flow-ink {
  0% {
    opacity: 0;
  }
  8%,
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes flow-reveal {
  0%,
  68% {
    opacity: 0.2;
  }
  90%,
  100% {
    opacity: 1;
  }
}
@media (max-width: 640px) {
  .source-flow {
    grid-template-columns: 1fr;
    width: min(100%, 400px);
    margin-top: 0;
  }
  .flow-sources {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 24px 96px;
    gap: 10px;
  }
  .flow-heading {
    grid-column: 1 / -1;
    text-align: center;
  }
  .flow-source {
    padding: 10px 6px;
  }
  .flow-source-name {
    flex-direction: column;
    gap: 3px;
    font-size: 0.7rem;
  }
  .flow-document {
    margin: 8px 6px 0;
  }
  .flow-rail {
    position: relative;
    width: 100%;
    height: 54px;
    margin: 0;
  }
  .flow-rail svg {
    display: none;
  }
  .flow-rail::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background:
      linear-gradient(var(--flow-blue), var(--flow-blue)) 0 -12px / 1px 12px
        no-repeat,
      var(--flow-line);
    animation: flow-down 4.8s ease-in-out both;
  }
  .flow-rail-out::before {
    animation-delay: 1.5s;
    animation-duration: 3.3s;
  }
  .flow-rail-in::after {
    content: "";
    position: absolute;
    inset: 0 16.66% 50%;
    border: solid var(--flow-line);
    border-width: 0 1px 1px;
    border-radius: 0 0 6px 6px;
  }
  .flow-center {
    margin: 0;
    min-height: 0;
  }
  .flow-center img {
    width: 68px;
    height: 68px;
  }
  .flow-rail-out {
    height: 36px;
    margin-top: 12px;
  }
  .flow-results {
    grid-template-rows: 24px repeat(2, 66px);
    gap: 10px;
  }
  .flow-excerpt {
    padding: 10px 14px;
    height: 66px;
  }
  .flow-passage {
    gap: 8px;
    margin-top: 5px;
  }
  .flow-passage i:last-child {
    width: 100%;
  }
}
@keyframes flow-down {
  0%,
  24% {
    background-position: 0 -12px;
  }
  55%,
  100% {
    background-position: 0 80px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .source-flow .flow-extraction,
  .source-flow .flow-fragments,
  .source-flow .flow-fragments path,
  .source-flow .flow-passage,
  .source-flow .flow-rail::before {
    animation: none;
  }
}
