
.byom { display: flex; flex-direction: column; gap: clamp(24px, 3.2vh, 34px); }

/* ── The card: three stages, two connectors, one payoff line ──
   The stages share one row grid (subgrid): heads on row 1, bodies on row 2,
   art on row 3, so every row starts on the same line across the three. The
   model stage is sized to ten tiles, so it has no dead space to its right,
   and the three art blocks are built to roughly the same height. */
.byom-card { border-radius: 24px; padding: clamp(22px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 22px; }
.byom-flow {
  display: grid;
  grid-template-columns: 394px 56px minmax(0, 1fr) 56px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  row-gap: 12px;
}
.byom-stage { grid-row: 1 / span 3; display: grid; grid-template-rows: subgrid; row-gap: 12px; min-width: 0; }
.byom-stage-head { display: flex; align-items: center; gap: 9px; }
.byom-step { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; padding: 3px 7px; border-radius: 7px; flex: 0 0 auto; }
.byom-stage-title { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; color: var(--mel-text-primary); }
.byom-stage-body { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--mel-text-secondary); max-width: 40ch; }
.byom-stage-art { align-self: start; padding-top: 4px; }

.byom-groups { display: flex; flex-direction: column; gap: 10px; }
.byom-group { display: flex; flex-direction: column; gap: 6px; }
.byom-group-label { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mel-text-muted); }
.byom-tiles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.byom-tile { position: relative; display: block; line-height: 0; transition: transform 160ms ease; }
.byom-tile:hover { transform: translateY(-2px); }

.byom-plate {
  display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 9px;
  background: var(--byom-plate); box-shadow: var(--byom-plate-shadow), inset 0 0 0 1px var(--byom-plate-ring);
}
.byom-plate img { object-fit: contain; display: block; }
.byom-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; font-weight: 700; line-height: 1; color: #0F172A; letter-spacing: -0.02em; }
.byom-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.byom-clients { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.byom-client { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px 10px 5px 5px; border-radius: 11px; }
.byom-client-name { font-size: 13px; font-weight: 600; color: var(--mel-text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.byom-melaya { display: flex; flex-direction: column; gap: 10px; }
.byom-endpoint { display: block; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; padding: 9px 12px; border-radius: 11px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.byom-surfaces { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; justify-items: center; }
.byom-surfaces img { width: 100%; max-width: 64px; height: auto; display: block; }

.byom-payoff {
  margin: 0; padding-top: 18px; border-top: 1px solid var(--byom-rule);
  font-size: 15px; line-height: 1.5; font-weight: 550; letter-spacing: -0.005em;
  color: var(--mel-text-primary); text-align: center; text-wrap: balance;
}

/* ── Connectors: on the heads' line, a hairline with one dot travelling ── */
.byom-conn { grid-row: 1; position: relative; align-self: center; justify-self: center; width: 32px; height: 2px; }
.byom-conn-line { position: absolute; inset: 0; border-radius: 2px; background: linear-gradient(90deg, var(--byom-a1), var(--byom-a2)); opacity: 0.55; }
.byom-conn-dot {
  position: absolute; top: 50%; left: 0; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--byom-a1); box-shadow: 0 0 8px var(--byom-a1);
  animation: byom-travel-x 1.8s cubic-bezier(.45,.05,.55,.95) infinite;
}
@keyframes byom-travel-x { from { left: 0; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } to { left: calc(100% - 6px); opacity: 0; } }
@keyframes byom-travel-y { from { top: 0; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } to { top: calc(100% - 6px); opacity: 0; } }

/* ── Notes: three short lines side by side ── */
.byom-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 32px; }
.byom-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 13px; line-height: 1.55; color: var(--mel-text-muted); }
.byom-note-ic { flex: 0 0 auto; padding-top: 2px; }
.byom-note-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.byom-note-links a { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; text-decoration: none; }
.byom-note-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Below desktop: stages stack, connectors turn vertical ── */
@media (max-width: 1080px) {
  .byom-flow { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 0; }
  .byom-stage { grid-row: auto; display: flex; flex-direction: column; gap: 10px; }
  .byom-stage-body { max-width: 60ch; }
  .byom-conn { grid-row: auto; width: 2px; height: 28px; margin: 10px 0 10px 16px; justify-self: start; }
  .byom-conn-line { background: linear-gradient(180deg, var(--byom-a1), var(--byom-a2)); }
  .byom-conn-dot { left: 50%; top: 0; margin-top: 0; margin-left: -3px; animation-name: byom-travel-y; }
  .byom-clients { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .byom-melaya { flex-direction: row; align-items: center; gap: 14px; }
  .byom-endpoint { flex: 1 1 auto; min-width: 0; }
  .byom-surfaces { flex: 0 0 auto; display: flex; gap: 4px; }
  .byom-surfaces img { width: 48px; }
  .byom-notes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .byom-card { border-radius: 18px; padding: 16px 14px; gap: 16px; }
  .byom-tile .byom-plate { width: 30px !important; height: 30px !important; border-radius: 8px; }
  .byom-tile .byom-plate img { width: 19px; height: 19px; }
  .byom-clients { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .byom-melaya { flex-direction: column; align-items: stretch; gap: 10px; }
  .byom-surfaces { justify-content: space-between; }
  .byom-surfaces img { width: 56px; }
  .byom-payoff { text-align: left; font-size: 14px; padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .byom-conn-dot { animation: none; opacity: 0; }
}
