/* ─────────────────────────────────────────────────────────────────────────
   Step bar — one row of diagonal-cut steps (Ryan, 2026-11-10).

   The step that needs attention sits open with its name readable; the rest
   stay closed to an icon. Pointing at a closed step slides it open and the
   others shut. One component for every list that walks an agent through a
   fixed set of steps, so no row mixes tags with plain text.

   State is carried by fill, never by a tag:
     is-now   solid cyan      the leader's move
     is-wait  white 13%       waiting on the agent
     is-done  cyan 26%        finished
     is-todo  white 5%        not reached yet

   Two input modes, picked by the device, not the width alone:
     pointer   hover opens a step, click runs it
     touch     tap opens a closed step, a second tap runs it, and a thumb
               dragged across the bar opens each step it passes (step-bar.js)

   Motion: one easing, cubic-bezier(.22,.9,.24,1). The bar slides in once on
   the first paint of a list (.eqsb-pre, cleared by step-bar.js) and never
   again on re-render, filter or sort. prefers-reduced-motion removes all of it.
   ───────────────────────────────────────────────────────────────────────── */
.eqsb {
  --eqsb-cut: 10px;
  --eqsb-ease: cubic-bezier(.22, .9, .24, 1);
  display: flex;
  width: 100%;
  height: 42px;
  min-width: 0;
  touch-action: pan-y;            /* the page still scrolls; sideways is ours */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.eqsb-seg {
  /* a <button>, reset */
  appearance: none; -webkit-appearance: none;
  border: 0; margin: 0; font: inherit; text-align: left;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 0 13px;
  overflow: hidden;
  cursor: default;
  clip-path: polygon(var(--eqsb-cut) 0, 100% 0, calc(100% - var(--eqsb-cut)) 100%, 0 100%);
  transition:
    flex-grow .5s var(--eqsb-ease),
    background-color .25s,
    filter .25s,
    transform .45s var(--eqsb-ease),
    opacity .45s;
}
.eqsb-seg.is-click { cursor: pointer; }
.eqsb-seg + .eqsb-seg { margin-left: calc(5px - var(--eqsb-cut)); }
.eqsb-seg:first-child {
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--eqsb-cut)) 100%, 0 100%);
  border-radius: 8px 0 0 8px;
}
.eqsb-seg:last-child {
  clip-path: polygon(var(--eqsb-cut) 0, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 8px 8px 0;
}
.eqsb-seg:not(:first-child) { padding-left: calc(var(--eqsb-cut) + 9px); }
.eqsb-seg:focus-visible { outline: none; filter: brightness(1.25); }

.eqsb-ic { flex: none; display: flex; width: 16px; height: 16px; }
.eqsb-ic svg { width: 16px; height: 16px; }
.eqsb-tx {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .2s, transform .3s;
}
.eqsb-tx b { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.eqsb-tx em { font-style: normal; font-size: 13px; font-weight: 500; opacity: .8; }
.eqsb-tx em.eqsb-s { display: none; }          /* the short word, touch only */

.eqsb-seg.is-done { background: rgba(42, 171, 226, .26); color: #cdeefb; }
.eqsb-seg.is-now  { background: #2AABE2; color: #fff; }
.eqsb-seg.is-wait { background: rgba(255, 255, 255, .13); color: #f1f5f9; }
.eqsb-seg.is-todo { background: rgba(255, 255, 255, .05); color: #64748b; }

/* A row that is off the roster (hidden agent) keeps its shape, loses its colour. */
.eqsb.is-muted .eqsb-seg { background: rgba(255, 255, 255, .05); color: #64748b; }

.eqsb-seg.is-open { flex-grow: 8; }
.eqsb-seg.is-open .eqsb-tx { opacity: 1; transform: none; transition-delay: .12s; }

/* First paint: every step starts shut and a little to the left. */
.eqsb.eqsb-pre .eqsb-seg { flex-grow: 1 !important; transform: translateX(-18px); opacity: 0; }
.eqsb.eqsb-pre .eqsb-tx { opacity: 0 !important; }

/* ── Pointer: hover opens ───────────────────────────────────────────────── */
@media (hover: hover) and (min-width: 701px) {
  .eqsb:hover .eqsb-seg.is-open { flex-grow: 1; }
  .eqsb:hover .eqsb-seg.is-open .eqsb-tx { opacity: 0; transition-delay: 0s; }
  .eqsb .eqsb-seg:hover,
  .eqsb .eqsb-seg:focus-visible { flex-grow: 8 !important; filter: brightness(1.12); }
  .eqsb .eqsb-seg:hover .eqsb-tx,
  .eqsb .eqsb-seg:focus-visible .eqsb-tx { opacity: 1 !important; transform: none; transition-delay: .12s !important; }
}

/* ── Touch and narrow screens: the open step hugs its label, the rest share
      the row evenly, and every label is icon + name + one short word. ───── */
@media (hover: none), (max-width: 700px) {
  .eqsb { height: 38px; --eqsb-cut: 8px; }
  .eqsb .eqsb-seg,
  .eqsb .eqsb-seg:not(:first-child) { flex: 1 1 0; padding: 0; gap: 0; justify-content: center; min-height: 38px; }
  .eqsb-ic, .eqsb-ic svg { width: 14px; height: 14px; }
  .eqsb-tx {
    max-width: 0; margin-left: 0; overflow: hidden; gap: 6px; transform: none;
    transition: opacity .2s, max-width .45s var(--eqsb-ease), margin .3s;
  }
  .eqsb-tx b, .eqsb-tx em { font-size: 13px; }
  .eqsb-tx em.eqsb-l { display: none; }
  .eqsb-tx em.eqsb-s { display: inline; }
  .eqsb .eqsb-seg.is-open { flex: 0 0 auto; padding: 0 16px 0 calc(var(--eqsb-cut) + 12px); }
  .eqsb .eqsb-seg.is-open:first-child { padding-left: 14px; }
  .eqsb .eqsb-seg.is-open .eqsb-tx { max-width: 220px; margin-left: 7px; }
  .eqsb.eqsb-pre .eqsb-seg { flex: 1 1 0 !important; padding: 0 !important; }
  .eqsb.eqsb-pre .eqsb-tx { max-width: 0 !important; margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .eqsb-seg, .eqsb-tx { transition: none !important; }
  .eqsb.eqsb-pre .eqsb-seg { transform: none; opacity: 1; }
}
