/* ------------------------------------------------------------------
   Ask Rideau anything (#prompts on the home page).
   Example questions as the user's own chat messages, in rows that drift
   sideways at a constant speed. prompts.js deals the list into rows (three
   wide, two on a phone) and lays each row's group out three times, each
   ending in one gap, so moving the track by a third of its width lands
   exactly where it started. Hovering or focusing a row stops it; rows also
   stop while the section is off screen.

   Without script, or with reduced motion, the list stays one static,
   centred cluster with every question shown once.

   Pairs (WCAG): ink-100 #ECECEC on the bubble ink-750 #212121 13.6, on
   hover ink-700 #2A2A2A 12.2; teal-300 #7FC4CF 8.2 and 7.3; the tag
   ink-400 #9E9E9E on the canvas #0D0D0D 7.25. The mark in the mention is
   signal-500 (3.9 on the bubble), a graphic beside the word, not text.
   ------------------------------------------------------------------ */

.prompts { overflow: hidden; overflow: clip; }
.pw-head .lede { max-width: 30em; }

/* --- one question ------------------------------------------------------ */
.pw-item {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.pw-bubble {
  display: block;
  max-width: min(420px, 80vw);
  min-height: 44px;
  margin: 0;
  padding: 14px 20px 15px;
  border: 0;
  /* A sent message: round, with the tail corner at the foot on the right. */
  border-radius: 18px 18px 6px 18px;
  background-color: var(--ink-750);
  font: inherit;
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  text-align: left;
  text-wrap: pretty;
  color: var(--ink-100);
  cursor: pointer;
  transition: background-color 150ms ease;
}
.pw-bubble:hover { background-color: var(--ink-700); }
.pw-bubble:focus-visible { outline: 2px solid var(--signal-500); outline-offset: 3px; }

/* The mention, as it reads in a chat app with Rideau connected. */
.pw-at {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  margin-right: 0.15em;
  font-weight: 500;
  color: var(--teal-300);
  white-space: nowrap;
}
.pw-at svg { width: 0.9em; height: 0.9em; align-self: center; fill: var(--signal-500); }

.pw-tag {
  padding-right: 6px;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink-400);
}

/* --- static: no script, reduced motion --------------------------------- */
.pw-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 24px 16px;
  max-width: var(--frame-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- moving rows -------------------------------------------------------- */
.pw-rows {
  --pw-fade: clamp(32px, 9vw, 160px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--pw-fade), #000 calc(100% - var(--pw-fade)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--pw-fade), #000 calc(100% - var(--pw-fade)), transparent);
}
/* clip, not hidden: focus cannot scroll a clipped row out of step with its
   animation. The padding leaves room for the focus ring. */
.pw-row { overflow: hidden; overflow: clip; padding-block: 6px; }
.pw-track {
  position: relative;
  display: flex;
  width: max-content;
  animation: pw-left var(--pw-dur, 60s) linear infinite;
  will-change: transform;
}
.pw-row--right .pw-track { animation-name: pw-right; }
.pw-group {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 16px;
  padding-right: 16px;
}
.pw-row:hover .pw-track,
.pw-row:focus-within .pw-track,
.pw.is-off .pw-track { animation-play-state: paused; }

/* One group is a third of the track; moving by exactly that is the loop. */
@keyframes pw-left { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(calc(-100% / 3), 0, 0); } }
@keyframes pw-right { from { transform: translate3d(calc(-100% / 3), 0, 0); } to { transform: translate3d(0, 0, 0); } }

@media (max-width: 767px) {
  .pw-bubble { padding: 12px 16px 13px; font-size: 16px; }
  .pw-list { gap: 20px 12px; }
  .pw-rows { gap: 16px; }
  .pw-group { gap: 12px; padding-right: 12px; }
}
