/* /nexa "Why Nexa" — the wire.
   Replaces the old 01/02/03 lines plus the "One thread. Four providers." route (~190 words)
   with one drawing: accounts on the left, one thread in the middle, the surfaces you work in
   on the right. The handover is shown, not written — the left column takes turns while the
   trunk into Nexa never stops. Hairlines + moving light only, no cards. */

.wire {
  --hub: clamp(62px, 6.6vw, 80px);
  margin-top: clamp(34px, 5vh, 58px);
  /* the drawing reaches a little past the text column so both runs of wire stay long */
  margin-inline: clamp(-30px, -2.2vw, 0px);
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(80px, 1fr) auto minmax(80px, 1fr) minmax(0, auto);
  grid-template-rows: auto minmax(320px, 38vh);
  column-gap: clamp(10px, 1.1vw, 15px);
  align-items: stretch;
}

.wire-cap {
  grid-row: 1; align-self: end; padding-bottom: 16px;
  font-size: 10px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-40);
}
.wire-cap.is-in { grid-column: 1; text-align: left; }
.wire-cap.is-out { grid-column: 5; }

/* ---------- the two label columns ----------
   Both sides use the same two-cell node — a fixed mark cell, then the name — so every
   logo sits on one left edge and every name starts on the next one. */
.wire-col { grid-row: 2; display: grid; }
.wire-col.is-in { grid-column: 1; grid-template-rows: repeat(5, 1fr); }
.wire-col.is-out { grid-column: 5; grid-template-rows: repeat(5, 1fr); }

.wire-node {
  display: grid; grid-template-columns: 20px minmax(0, auto);
  align-items: center; column-gap: 11px; white-space: nowrap;
}
.wire-node > img, .wire-node > svg { justify-self: center; }
.wire-node b { font-size: var(--fs-copy); font-weight: 500; letter-spacing: -.01em; color: var(--ink); }
.wire-node img { height: 15px; width: auto; opacity: var(--logo-op); filter: var(--logo-filter); }
.wire-node img[src*="opencode"] { height: 18px; }
.wire-node img[src*="kimi"], .wire-node img[src*="grok"] { height: 18px; }
.wire-node svg { width: 17px; height: 17px; color: var(--ink-40); }

/* One provider drives at a time. The thread underneath does not change. */
.wire-col.is-in .wire-node {
  opacity: .4;
  animation: wireTurn 16.5s ease infinite;
  animation-delay: calc(var(--k) * 3.3s);
}
@keyframes wireTurn { 0%, 16% { opacity: 1 } 20%, 100% { opacity: .4 } }

/* the mark hops when its turn comes round — two decaying bounces, then still */
.wire-col.is-in .wire-node img {
  transform-origin: 50% 70%;
  animation: wireBounce 16.5s linear infinite;
  animation-delay: calc(var(--k) * 3.3s);
}
/* rise decelerates, fall accelerates — a ball, not a pulse */
@keyframes wireBounce {
  0% { transform: translateY(0) scale(1); animation-timing-function: ease-out }
  2.4% { transform: translateY(-5px) scale(1.13); animation-timing-function: ease-in }
  5.6% { transform: translateY(0) scale(1); animation-timing-function: ease-out }
  8% { transform: translateY(-2.4px) scale(1.06); animation-timing-function: ease-in }
  10.8% { transform: translateY(0) scale(1); animation-timing-function: ease-out }
  12.4% { transform: translateY(-.9px) scale(1.02); animation-timing-function: ease-in }
  14.4%, 100% { transform: translateY(0) scale(1) }
}

/* ---------- the wires ---------- */
.wire-bus { --n: 4; grid-row: 2; position: relative; }
.wire-bus.is-in { grid-column: 2; }
.wire-bus.is-out { grid-column: 4; }
/* the trunk — every branch on this side, one line into Nexa. --n is how many. */
.wire-bus::before {
  content: ""; position: absolute; left: 50%;
  top: calc(50% / var(--n)); bottom: calc(50% / var(--n));
  width: 1px; background: var(--hairline);
}
.wire-bus i, .wire-bus u { position: absolute; height: 1px; background: var(--hairline); }
.wire-bus i { top: calc((100% * var(--k) + 50%) / var(--n)); }
.wire-bus u { top: 50%; }
.wire-bus.is-in i { left: 0; width: 50%; }
.wire-bus.is-in u { left: 50%; right: 0; }
.wire-bus.is-out i { left: 50%; right: 0; }
.wire-bus.is-out u { left: 0; width: 50%; }

/* the port where a wire meets its label */
.wire-bus i::before {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--bg); border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
}
.wire-bus.is-in i::before { left: -2px; }
.wire-bus.is-out i::before { right: -2px; }

/* moving light, always travelling away from where it came from */
.wire-bus i::after, .wire-bus u::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat;
  background-size: 36% 100%;
}
.wire-bus u::after { animation: wireFlow 3.3s linear infinite; opacity: .9; }
.wire-bus.is-out u::after { animation-delay: -1.6s; }
.wire-bus.is-out i::after {
  opacity: .72; animation: wireFlow 4.4s linear infinite;
  animation-delay: calc(var(--k) * -1.1s);
}
.wire-bus.is-in i::after {
  opacity: 0; animation: wireTurnFlow 16.5s linear infinite;
  animation-delay: calc(var(--k) * 3.3s);
}
@keyframes wireFlow { from { background-position: -46% 0 } to { background-position: 146% 0 } }
@keyframes wireTurnFlow {
  0% { background-position: -46% 0; opacity: 0 }
  1.5% { opacity: .95 }
  14% { background-position: 146% 0; opacity: .95 }
  16%, 100% { background-position: 146% 0; opacity: 0 }
}

/* ---------- the hub ---------- */
.wire-core { grid-row: 2; grid-column: 3; position: relative; display: grid; place-items: center; }
.wire-hub {
  position: relative; display: grid; place-items: center;
  width: var(--hub); aspect-ratio: 1; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ink) 24%, transparent);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}
.wire-hub::before {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px solid var(--hairline);
  animation: wireHalo 4.6s ease-in-out infinite;
}
.wire-hub img { width: 26px; height: 26px; opacity: .92; filter: var(--logo-filter); }
@keyframes wireHalo { 0%, 100% { transform: scale(1); opacity: .95 } 50% { transform: scale(1.1); opacity: .3 } }

.wire-name {
  position: absolute; top: 50%; margin-top: calc(var(--hub) / 2 + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 3px; white-space: nowrap;
}
.wire-name b { font-size: var(--fs-sub); font-weight: 500; letter-spacing: -.01em; color: var(--ink); }
.wire-name em {
  font-style: normal; font-size: 10px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-40);
}

/* ---------- what little copy is left ---------- */
.wire-facts {
  margin-top: clamp(30px, 4.6vh, 48px);
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--hairline);
}
.wire-facts > div { display: flex; flex-direction: column; gap: 5px; padding: 20px 30px 0 0; }
.wire-facts b { font-size: var(--fs-copy); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.wire-facts span { max-width: 28ch; font-size: var(--fs-lead); line-height: 1.55; color: var(--ink-60); }
.wire-note { margin-top: clamp(22px, 3vh, 30px); max-width: 64ch; font-size: var(--fs-sub); line-height: 1.6; color: var(--ink-60); }
.wire-note b { color: var(--ink); font-weight: 600; }

@media (max-width: 900px) {
  /* stacked, the drawing becomes three rows joined by a short seam */
  .wire { grid-template-columns: 1fr; grid-template-rows: auto; row-gap: 30px; margin-inline: 0; }
  .wire-cap, .wire-bus { display: none; }
  .wire-col, .wire-core { grid-column: 1; grid-row: auto; }
  .wire-col { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 22px; }
  .wire-node { grid-template-columns: auto minmax(0, auto); column-gap: 8px; }
  .wire-col.is-in .wire-node { opacity: 1; animation: none; }
  .wire-col.is-in .wire-node img { animation: none; }
  .wire-core { display: flex; flex-direction: column; align-items: center; }
  .wire-name { position: static; margin-top: 12px; }
  .wire-core::before, .wire-core::after { content: ""; position: absolute; left: 50%; width: 1px; height: 16px; background: var(--hairline); }
  .wire-core::before { top: -22px } .wire-core::after { bottom: -22px }
  .wire-facts { grid-template-columns: 1fr; border-top: 0; }
  .wire-facts > div { padding: 16px 0 0; border-top: 1px solid var(--hairline); }
}
@media (prefers-reduced-motion: reduce) {
  .wire-col.is-in .wire-node { opacity: 1; animation: none; }
  .wire-col.is-in .wire-node img { animation: none; }
  .wire-hub::before, .wire-bus i::after, .wire-bus u::after { animation: none; }
  .wire-bus i::after, .wire-bus u::after { display: none; }
}
