/* M4 Chip wave — see _agents/handoff/chips/README.md for markup contract.
   No-JS / reduced-motion: rows are static, wrapped, centered.
   JS adds .is-live to switch rows to nowrap and drive them with rAF.
   The builder may place data-bee-stop="chips" on .chips; no rule here
   keys off attributes, so there is no conflict. */

.chips {
  --chip-h: 48px;
  --chip-gap: 14px;
  --row-h: 100px;
  --band-pad-y: 22px;
  --row-gap: 8px;
  position: relative;
  overflow: hidden;
  padding: var(--band-pad-y) 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.chips__row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--chip-gap);
}

.chips__row + .chips__row { margin-top: var(--row-gap); }

/* Hide the duplicate rows the script injects from assistive tech; the
   clones also carry aria-hidden, this keeps the static DOM tidy too. */
.chips__row > li[aria-hidden="true"] { display: none; }
.chips.is-live .chips__row > li[aria-hidden="true"] { display: inline-flex; }

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--chip-h);
  padding: 0 18px 0 8px;
  border: 1px solid #E8E8ED;
  border-radius: 999px;
  background: #FFFFFF;
  color: #1D1D1F;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 16px rgba(0,0,0,.05);
  font-family: Inter, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.chip svg {
  width: 20px;
  height: 20px;
  flex: none;
  display: block;
}

.chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Rotate accents: honey, terracotta, teal, sage. */
.chips .chip:nth-child(4n + 1) { --accent: #E5AD35; }
.chips .chip:nth-child(4n + 2) { --accent: #C8643B; }
.chips .chip:nth-child(4n + 3) { --accent: #2F7D6D; }
.chips .chip:nth-child(4n + 4) { --accent: #9DB8A0; }

/* Bee landing: JS adds .is-touched (900ms) to the nearest chip — 4px lift
   with a 2px honey ring. In live mode the script's lift drives the 4px. */
.chip.is-touched {
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px #E5AD35, 0 1px 2px rgba(0,0,0,.04), 0 6px 16px rgba(0,0,0,.05);
}

/* Live mode (JS present): nowrap tracks driven by transform. */
.chips.is-live .chips__row {
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  width: max-content;
  height: var(--row-h);
  will-change: transform;
}

.chips.is-live .chip { will-change: transform; }

@media (hover: hover) and (pointer: fine) {
  .chips.is-live .chip { transition: box-shadow 240ms cubic-bezier(.2, .7, .2, 1); }
  .chips.is-live .chip:hover {
    box-shadow: 0 10px 24px -8px rgba(34, 34, 31, .22), 0 2px 6px rgba(34, 34, 31, .06);
  }
}

@media (max-width: 759px) {
  .chips {
    --chip-h: 40px;
    --chip-gap: 10px;
    --row-h: 76px;
    --band-pad-y: 18px;
  }

  .chip { padding-right: 14px; font-size: 14px; gap: 8px; }
  .chip__icon { width: 28px; height: 28px; }
  .chip svg { width: 18px; height: 18px; }

  /* One row on phone. */
  .chips__row[data-direction="right"] { display: none; }
  .chips.is-live .chips__row[data-direction="right"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chips { overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .chips__row { flex-wrap: wrap; justify-content: center; width: auto; height: auto; }
  .chip { transform: none !important; }
}

/* Icon grammar: 24x24 grid, stroke 1.6, round caps/joins, currentColor. */
svg.chip-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
