/* How it works: four steps, each a small CRT screen looping four ASCII frames, joined
   by a dashed wire a data packet runs along. Matches the hero monitor. */
.site-shell .hiw-steps {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}
.hiw-step {
  position: relative;
  min-width: 0;
  padding: 28px var(--grid-inset) 32px;
  border-right: 1px solid var(--border);
}
.hiw-step:last-child {
  border-right: 0;
}
.hiw-art {
  --hiw-bg: #0c1812;
  --hiw-fg: #a3f3c2;
  position: relative;
  height: 106px;
  margin-bottom: 24px;
  background: var(--hiw-bg);
  box-shadow:
    inset 0 0 18px rgb(0 0 0 / 70%),
    4px 4px 0 var(--border);
}
.hiw-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / 28%) 0 2px, transparent 2px 4px);
}
.hiw-frame {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 14px;
  overflow: hidden;
  color: var(--hiw-fg);
  background: none;
  font: 500 11px/14px var(--mono);
  letter-spacing: 0;
  white-space: pre;
  text-shadow: 0 0 4px rgb(163 243 194 / 40%);
  visibility: hidden;
  /* Frame f of step s shows for 0.8s of a 3.2s loop; steps run a beat apart. */
  animation: hiw-frame 3.2s step-end infinite;
  animation-delay: calc(var(--f) * 0.8s - var(--s) * 0.8s - 6.4s);
}
.hiw-wire {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 100%;
  width: calc(var(--grid-inset) * 2 + 1px);
  height: 0;
  border-top: 2px dashed var(--primary);
  overflow: visible;
}
.hiw-wire > span {
  position: absolute;
  top: -9px;
  left: 0;
  color: var(--primary);
  font: 700 11px/16px var(--mono);
  animation: hiw-packet 1.6s steps(8) infinite;
}
.hiw-number {
  display: block;
  margin-bottom: 10px;
  color: var(--primary);
  font: 500 12px var(--mono);
}
.hiw-step h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.hiw-step p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.6;
}

@keyframes hiw-frame {
  0% {
    visibility: visible;
  }
  25%,
  100% {
    visibility: hidden;
  }
}
@keyframes hiw-packet {
  to {
    left: calc(100% - 3ch);
  }
}

@media (max-width: 1100px) {
  .site-shell .hiw-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hiw-step:nth-child(2) {
    border-right: 0;
  }
  .hiw-step:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
  .hiw-step:nth-child(2) .hiw-wire {
    display: none;
  }
}
@media (max-width: 600px) {
  .site-shell .hiw-steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .hiw-step {
    border-right: 0;
  }
  .hiw-step + .hiw-step {
    border-top: 1px solid var(--border);
  }
  .hiw-wire {
    display: none;
  }
}

/* Reduced motion: each screen holds its final frame. */
@media (prefers-reduced-motion: reduce) {
  .hiw-frame,
  .hiw-wire > span {
    animation: none;
  }
  .hiw-frame:last-of-type {
    visibility: visible;
  }
}
