/* The chat surface. Four exchanges ship in the markup and ChatDemo shows one at
   a time, so with no JavaScript the whole transcript is readable and every
   question and answer is still in the document for a crawler. */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: clamp(18px, 2.4vw, 26px);
}

/* Reserves the tallest exchange so switching prompts never shortens the card
   and pulls the page up under the reader's cursor. Two-line questions plus a
   three-line answer is the worst case; below the split the bubbles go full
   width and the reservation grows with them. */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 250px;
  justify-content: flex-end;
}

.chat-exchange {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Only ever set by ChatDemo, so the attribute is absent with no JavaScript and
   every exchange stays visible. */
.chat-exchange[hidden] { display: none; }

.chat-msg {
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  max-width: 85%;
}

.chat-role {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* The question is the reader's own, so it sits on the tint and reads as quiet.
   The answer is the product speaking, so it takes the petrol panel. */
.chat-msg-user {
  align-self: flex-end;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}
.chat-msg-user .chat-role { color: var(--ink-faint); }

.chat-msg-agent {
  align-self: flex-start;
  background: var(--petrol-900);
  color: var(--on-dark);
}
.chat-msg-agent .chat-role { color: var(--accent-bright); }

/* Sits on the last typed character. Added by ChatDemo and removed once the
   answer is complete, so a settled answer carries no stray block. */
.chat-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--accent-bright);
  animation: chat-blink 1s steps(1, end) infinite;
}

@keyframes chat-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-caret { display: none; }
}

@media (max-width: 700px) {
  .chat-msg { max-width: 100%; }
  .chat-thread { min-height: 320px; }
}
