/* How it works: the agent's panel on the workbench's right, as its design draws it. Its head (the
   default agent, on this computer), the conversation (the newest lines in view, older ones leaving
   by the top; your lines on the right), and its foot: what the chat is about (the page you're on),
   the box to ask in, and Send. how-frame.css draws the rest of the workbench. Only tokens. */

.cw-chat {
  grid-area: chat;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-inline-start: var(--border) solid var(--line);
}
.ch-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border) solid var(--line);
}
.ch-ic {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-text);
}
.cw .ch-ic svg {
  width: 16px;
  height: 16px;
}
.ch-head b,
.ch-head small {
  display: block;
  white-space: nowrap;
}
.ch-head b {
  font-weight: var(--weight-semibold);
  color: var(--text-strong);
}
.ch-head small {
  font-size: 12px;
  color: var(--text-muted);
}
.ch-msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  overflow: hidden;
  padding: var(--space-3);
}
.ch-step {
  display: none;
  flex-direction: column;
  gap: var(--space-2);
}
.hw[data-step="1"] .ch-step[data-s="1"],
.hw[data-step="2"] .ch-step[data-s="2"],
.hw[data-step="3"] .ch-step[data-s="3"] {
  display: flex;
}
.bub {
  flex: none;
  max-width: 94%;
  margin: 0;
  padding: var(--space-3);
  border-radius: var(--radius-card);
}
.bub.them {
  align-self: flex-start;
  border: var(--border) solid var(--line);
  background: var(--surface);
  color: var(--text-strong);
}
.bub.me {
  align-self: flex-end;
  background: var(--surface-3);
  color: var(--text-strong);
}
.bub.q {
  display: grid;
  gap: var(--space-2);
}
.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ch-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-control);
  border: var(--border) solid var(--line-strong);
  font-size: 13px;
  color: var(--text-strong);
}
.cw .ch-opt svg {
  width: 14px;
  height: 14px;
}
.ch-opt.st.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-on-accent);
  animation: hw-press 600ms var(--ease-out);
}
.typed.typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-inline-start: 1px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: hw-caret 900ms steps(1) infinite;
}
@keyframes hw-caret {
  50% {
    opacity: 0;
  }
}

/* The foot: about this page, the box, Send */
.ch-foot {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: var(--border) solid var(--line);
}
.ch-about {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.cw .ch-about svg {
  width: 14px;
  height: 14px;
}
.ch-about [data-s] {
  display: none;
}
.hw[data-step="1"] .ch-about [data-s="1"],
.hw[data-step="2"] .ch-about [data-s="2"],
.hw[data-step="3"] .ch-about [data-s="3"] {
  display: inline;
}
.ch-in {
  min-height: 52px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  border: var(--border) solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  color: var(--text-subtle);
}
.ch-send {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.ch-send small {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}
.ch-send .btnx {
  flex: none;
  height: 34px;
  padding-inline: var(--space-3);
}
.cw .ch-send svg {
  width: 15px;
  height: 15px;
}

/* On a phone the chat sits under the page: the foot keeps only the box */
@container (max-width: 680px) {
  .cw-chat {
    border-inline-start: 0;
    border-top: var(--border) solid var(--line);
  }
  .ch-head {
    padding-block: var(--space-2);
  }
  .ch-about,
  .ch-send {
    display: none;
  }
  .ch-foot {
    padding: var(--space-2) var(--space-3) var(--space-3);
  }
  .ch-in {
    min-height: 0;
  }
}
