/* Medical case routing diagram */
.case-flow {
  --trace: #38818a;
  --wire: 19px;
  --row: 36px;
  display: grid;
  place-items: center;
  margin: 4px 0;
  padding: 22px clamp(10px, 2vw, 24px);
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at center, #14323966, transparent 72%),
    radial-gradient(circle, #32323c 1px, transparent 1px) 0 0 / 14px 14px, var(--bg);
  font: 500 .85rem/1.3 var(--font-mono);
}
.case-circuit { width: min(100%, 282px); display: grid; justify-items: center; }
.case-circuit svg { width: 17px; height: 17px; flex: none; }
.case-circuit .endpoint, .case-circuit .task { display: flex; align-items: center; gap: 10px; }
.case-circuit .endpoint {
  padding: 6px 13px; border: 1px solid #56565f;
  color: var(--ink); background: var(--surface);
}
.case-circuit .review { border-color: #938c2c; background: #242311; color: var(--yellow); }
.case-circuit .connector {
  width: 50%; height: 12px; border: 0 solid var(--trace);
}
.case-circuit .feed { justify-self: start; border-width: 1px 0 0 1px; margin-top: 7px; }
.case-circuit .collect { justify-self: end; border-width: 0 1px 1px 0; margin-bottom: 7px; }
.case-circuit .endpoint { position: relative; }
.case-circuit .endpoint::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: 1px; height: 8px; background: var(--trace);
}
.case-circuit .review::after { top: auto; bottom: 100%; }
.case-circuit .tasks {
  width: 100%; padding: 0 var(--wire); display: grid; gap: 7px;
  background: linear-gradient(var(--trace),var(--trace)) left top / 1px calc(100% - var(--row) / 2) no-repeat,
    linear-gradient(var(--trace),var(--trace)) right bottom / 1px calc(100% - var(--row) / 2) no-repeat;
}
.case-circuit .task {
  position: relative; min-height: var(--row); padding: 4px 12px;
  border: 1px solid #32565b; background: #101d21; color: var(--ink);
}
.case-circuit .task svg { color: var(--cyan); }
.case-circuit .task::before, .case-circuit .task::after {
  content: ""; position: absolute; top: 50%; width: var(--wire); height: 1px; background: var(--trace);
}
.case-circuit .task::before { right: 100%; }
.case-circuit .task::after { left: 100%; }
.war-map { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.more .arrow { display: inline-block; }
@media (min-width: 900px) {
  .build.main {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    column-gap: 32px;
  }
  .build.main > * { grid-column: 1; }
  .build.main > .meta, .build.main > .build-head, .build.main > .tags { grid-column: 1 / -1; }
  .build.main > .case-flow { grid-column: 2; grid-row: 3 / 6; }
}
.case-circuit { position: relative; }
.case-circuit .case-signals {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  pointer-events: none; fill: none; stroke: var(--cyan); stroke-width: 2;
  stroke-linecap: round; opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .case-circuit { --cycle: 5.4s; --play: paused; }
  .case-circuit.running { --play: running; }
  .case-circuit .case-signals { opacity: 1; }
  .case-signals path {
    stroke-dasharray: 13 120;
    animation: case-trace var(--cycle) infinite;
    animation-timing-function: linear(0, 0 var(--start), 1 var(--end), 1);
    animation-play-state: var(--play);
  }
  .case-signals .inlet { --start: 6%; --end: 23%; }
  .case-signals .entry { --start: 22%; --end: 38%; }
  .case-signals .exit { --start: 45%; --end: 61%; }
  .case-signals .outlet { --start: 60%; --end: 74%; stroke: var(--yellow); }
  @keyframes case-trace {
    from { stroke-dashoffset: 15; }
    to { stroke-dashoffset: -102; }
  }
  .case-circuit .endpoint, .case-circuit .task {
    animation: case-intake var(--cycle) ease-in-out infinite;
    animation-play-state: var(--play);
  }
  .case-circuit .task { animation-name: task-light; }
  .case-circuit .review { animation-name: review-light; }
  @keyframes case-intake {
    0%, 18%, 100% { border-color: #56565f; box-shadow: none; }
    7% { border-color: var(--cyan); box-shadow: 0 0 10px #00f0ff38; }
  }
  @keyframes task-light {
    0%, 28%, 54%, 100% { border-color: #32565b; background: #101d21; box-shadow: none; }
    38%, 44% { border-color: var(--cyan); background: #19363a; box-shadow: inset 3px 0 var(--cyan); }
  }
  @keyframes review-light {
    0%, 65%, 90%, 100% { border-color: #938c2c; box-shadow: none; }
    75%, 80% { border-color: var(--yellow); box-shadow: 0 0 15px #fcee0a48; }
  }
  .more .arrow { transition: transform 160ms ease-out; }
  .more:is(:hover, :focus-visible) .arrow { transform: translateX(3px); }
}
