/* botchat.css — the live agent on the landing page.
 *
 * Deliberately not styled as a floating widget. A launcher bubble in the corner
 * reads as support you have to go looking for; this sits in the page where the
 * demo used to, at the size of a section, because talking to it *is* the demo.
 *
 * Tokens only — see theme.css. Nothing here introduces a colour.
 */

.botchat {
  border: 1px solid var(--rule-bright);
  background: var(--bg-panel);
  display: grid;
  gap: 0;
}

/* Tall enough to hold a real exchange, capped so the page still scrolls past
   it. `overscroll-behavior` keeps a scroll inside the log from grabbing the
   page once it bottoms out. */
.botchat__log {
  min-height: 18rem;
  max-height: 26rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-deep) transparent;
}

.botchat__row { display: flex; }
.botchat__row--me { justify-content: flex-end; }
.botchat__row--bot { justify-content: flex-start; }

.botchat__bubble {
  max-width: min(46ch, 88%);
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.55;
  border: var(--border);
  white-space: pre-wrap;   /* the agent sends paragraphs, not markup */
  word-break: break-word;
}

.botchat__row--bot .botchat__bubble {
  background: var(--bg-raise);
  color: var(--fg);
  border-left: 2px solid var(--accent);
}

.botchat__row--me .botchat__bubble {
  background: var(--bg-inset);
  color: var(--fg-dim, var(--fg));
  border-right: 2px solid var(--accent-soft);
}

/* Three dots, because a spinner suggests a page load and this is a person-like
   pause. Motion is removed wholesale under reduced-motion below. */
.botchat__bubble--thinking {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
}
.botchat__bubble--thinking i {
  width: 0.32rem;
  height: 0.32rem;
  background: var(--accent);
  opacity: 0.35;
  animation: botpulse 1.1s ease-in-out infinite;
}
.botchat__bubble--thinking i:nth-child(2) { animation-delay: 0.18s; }
.botchat__bubble--thinking i:nth-child(3) { animation-delay: 0.36s; }

@keyframes botpulse {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-0.18rem); }
}

.botchat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: end;
  padding: 1rem 1.25rem;
  border-top: var(--border);
  background: var(--bg-raise);
}

.botchat__prompt {
  min-width: 0;
  display: grid;
  gap: 0.3rem;
}

.botchat__prompt-label {
  color: var(--accent);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.botchat__prompt-hint {
  color: var(--fg-faint);
  font-size: var(--step--1);
  line-height: 1.45;
}

.botchat__input {
  min-width: 0;
  margin-top: 0.35rem;
  border: 1px solid var(--rule-bright);
  border-left: 2px solid var(--accent);
  background: var(--bg-inset);
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg);
}
.botchat__input::placeholder { color: var(--fg-mute); }
.botchat__input:focus,
.botchat__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.botchat__input:disabled { opacity: 0.5; }

.botchat__send {
  min-height: 3.1rem;
  justify-content: center;
  align-self: end;
}
.botchat__send:disabled { opacity: 0.45; cursor: default; }

.botchat__suggest {
  border-top: var(--border);
  padding: 1rem 1.25rem;
}
.botchat__suggest-label {
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 0.6rem;
}
.botchat__chips { display: block; }

.botchat__chip {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-inset));
  color: var(--fg);
  font: inherit;
  font-size: var(--step--1);
  line-height: 1.5;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}

.botchat__chip-text { max-width: 58ch; }

.botchat__chip-action {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.botchat__chip-action::after {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin: 0 0.05rem 0.1rem 0.45rem;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

.botchat__chip:hover,
.botchat__chip:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-inset));
  color: var(--accent-lit);
  outline: none;
}

.botchat__note {
  border-top: var(--border);
  margin: 0;
  padding: 0.8rem 1.25rem;
  font-size: 0.8rem;
  color: var(--fg-mute);
}
.botchat__note a { margin-left: 0.35rem; }

@media (max-width: 40rem) {
  .botchat__log { min-height: 14rem; max-height: 20rem; padding: 1rem; }
  .botchat__bubble { max-width: 92%; }
  .botchat__form { grid-template-columns: 1fr; padding: 1rem; }
  .botchat__send { width: 100%; }
  .botchat__suggest { padding: 1rem; }
  .botchat__chip { align-items: flex-start; flex-direction: column; gap: 0.5rem; }
  .botchat__chip-action { font-size: var(--step--1); }
  .botchat__note { padding: 0.8rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .botchat__bubble--thinking i { animation: none; opacity: 0.6; }
}
