/* Chat messages and input (public/chat.js), used by the /marius chat panel (layout in profile.css).
   Uses the page's style tokens, so it follows the page style. */

.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.chat__msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat__msg--assistant {
  align-self: flex-start;
  background: color-mix(in srgb, var(--muted) 16%, var(--paper));
  border-bottom-left-radius: 4px;
}
.chat__msg--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 4px;
}
.chat__msg--assistant { white-space: normal; }
.chat__msg--error { color: #b3261e; white-space: pre-wrap; }
[data-style="night"] .chat__msg--error { color: #ff8a80; }

/* Formatted answers */
.chat__msg p { margin: 0 0 0.65em; }
.chat__msg ul, .chat__msg ol { margin: 0.2em 0 0.65em; padding-left: 1.25em; }
.chat__msg li + li { margin-top: 0.3em; }
.chat__msg > :last-child { margin-bottom: 0; }
.chat__msg code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88em; }

/* Typing indicator */
.chat__dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.chat__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chat-dot 1s ease-in-out infinite;
}
.chat__dots i:nth-child(2) { animation-delay: 0.15s; }
.chat__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.chat__form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid color-mix(in srgb, var(--muted) 30%, transparent);
}
.chat__input {
  flex: 1;
  resize: none;
  border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}
.chat__input:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.chat__send {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--ink);
  color: var(--paper);
  font: 600 0.85rem var(--font-body);
  cursor: pointer;
}
.chat__send:disabled { opacity: 0.5; cursor: default; }
