loci-connection {
  display: block;
  container-type: inline-size;
}

.lc-figure {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.lc-stages {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: clamp(1.3rem, 4vw, 3rem) clamp(.5rem, 2vw, 1.75rem);
}

.lc-node {
  display: grid;
  justify-items: center;
  gap: .55rem;
  position: relative;
  min-width: 0;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--ink-secondary);
  font: inherit;
  font-size: .88rem;
  font-weight: 560;
  cursor: pointer;
}

.lc-node svg {
  width: clamp(4rem, 8cqw, 6rem);
  height: auto;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.lc-node .lc-plate { fill: var(--bg); }
.lc-node .lc-fine { opacity: .65; }
.lc-node .lc-junction { fill: currentColor; }
.lc-node .lc-bright { stroke-width: 2.6; }
.lc-node .lc-sweep, .lc-node .lc-review-ring, .lc-node .lc-result-row { display: none; }
.lc-node[aria-current], .lc-node:hover, .lc-node:focus-visible { color: var(--accent); }
.lc-node[aria-current] .lc-plate { fill: var(--accent-soft); }
.lc-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lc-node:not(:first-child)::before {
  content: '';
  position: absolute;
  left: -16%;
  top: 33%;
  width: 32%;
  height: 2px;
  background: var(--line-strong);
}

loci-connection[data-running] .lc-node[aria-current]:not(:first-child)::before {
  background: linear-gradient(90deg, var(--line-strong) 0 36%, var(--accent) 50%, var(--line-strong) 64% 100%);
  background-size: 250% 100%;
  animation: lc-transfer .85s ease-out both;
}

@keyframes lc-transfer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.lc-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(12rem, 1fr);
  gap: 1.3rem 3.5rem;
  align-items: center;
  padding: 1.25rem clamp(1rem, 3.5vw, 2.5rem);
  min-height: 8rem;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
}

.lc-detail p { font-size: 1rem; line-height: 1.55; max-width: 62ch; }
.lc-detail dl { border-left: 1px solid var(--line-strong); padding-inline-start: 1.4rem; }
.lc-detail dt { margin-bottom: .2rem; font-size: .78rem; color: var(--ink-muted); }
.lc-detail dd { font: .82rem/1.55 var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.agent-host-note { max-width: 80ch; margin-block: 1.1rem; color: var(--ink-secondary); font-size: .91rem; }

@container (max-width: 610px) {
  .lc-stages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "grant connect predict" "measure approve inspect";
    gap: 1.5rem 0;
  }
  .lc-node:nth-child(4) { grid-area: inspect; }
  .lc-node:nth-child(5) { grid-area: approve; }
  .lc-node:nth-child(6) { grid-area: measure; }
  .lc-node:nth-child(4)::before { left: 50%; top: -1.1rem; width: 2px; height: .8rem; }
  .lc-node:nth-child(n+5)::before { left: auto; right: -16%; transform: rotate(180deg); }
  .lc-detail { grid-template-columns: 1fr; align-content: start; gap: .7rem; min-height: 12rem; }
  .lc-detail dl { border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lc-node::before { animation: none !important; }
}
