/* ---- the assistant drawer's conversation: the body, the bubbles and the
   thinking bubble (2026-09-29) ----

   Split from assistant.css past its size cap. One block per module of
   ui/assistant/: transcript.py (the body and the empty state), bubbles.py
   (the reader's and the assistant's bubbles, the avatar, the failure line)
   and thinking.py (what is out with the model). Every colour is a brand.css
   token; the ground of the drawer stays white. */

/* ui/assistant/transcript.py */

.aucra-chat .aucra-chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text);
  font-size: 0.92rem;
}
.aucra-chat-empty {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.81rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ui/assistant/bubbles.py */

.aucra-chat-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.aucra-chat-row-you {
  justify-content: flex-end;
  /* The reader's bubble keeps a step in from the assistant's side, so the two
     columns read apart at a glance. */
  padding-left: 36px;
}
.aucra-chat-row-assistant {
  align-items: flex-start;
}
.aucra-chat-row-assistant > :not(.aucra-chat-avatar) {
  flex: 1;
  min-width: 0;
}
.aucra-chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}
/* The reader's words: compact and strong, ink soft with white words (12.8:1),
   the corner on the reader's side tightened into the tail. */
.aucra-chat-bubble-you {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--ink-soft);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(28, 33, 38, 0.12);
}
.aucra-chat .aucra-chat-bubble-you .aucra-chat-text {
  color: #ffffff;
}
/* The assistant's: a white soft panel, the tail at the avatar's corner. */
.aucra-chat-bubble-assistant,
.aucra-chat-bubble-thinking,
.aucra-chat-failure {
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 4px 14px 14px 14px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}
/* The failure line in the warn palette. The words keep the text ink (13:1 on
   the wash); the warn orange on the wash is 4.51:1, too close to the floor. */
.aucra-chat .aucra-chat-failure {
  background: var(--warn-wash);
  border-color: rgba(180, 83, 9, 0.32);
  box-shadow: none;
}
.aucra-chat-row-assistant:has(> .aucra-chat-failure) > .aucra-chat-avatar {
  background: var(--warn-wash);
  color: var(--warn);
  box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.32);
}
.aucra-chat-avatar {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-wash);
  color: var(--gold-deep);
  box-shadow: inset 0 0 0 1px var(--output-line);
}
.aucra-chat-avatar svg {
  width: 14px;
  height: 14px;
}
.aucra-chat-text {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}
.aucra-chat-foot {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}
/* "You" and "Assistant", for a screen reader alone. */
.aucra-chat-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* What just arrived, and nothing else, pops in. */
.aucra-chat-pop {
  animation: aucra-chat-pop 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.aucra-chat-row-you.aucra-chat-pop {
  transform-origin: 100% 100%;
}
.aucra-chat-row-assistant.aucra-chat-pop {
  transform-origin: 0 0;
}
@keyframes aucra-chat-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
}

/* ui/assistant/thinking.py */

/* Only as wide as its words: it is a moment, not an answer. */
.aucra-chat-row-assistant > .aucra-chat-bubble-thinking {
  flex: 0 1 auto;
  gap: 6px;
}
/* The sparkle turns and twinkles inside a breathing gold halo. */
.aucra-chat-thinking .aucra-chat-avatar {
  animation: aucra-chat-halo 2.4s ease-in-out infinite;
}
.aucra-chat-thinking .aucra-chat-avatar svg {
  animation: aucra-chat-twinkle 3.2s ease-in-out infinite;
}
@keyframes aucra-chat-halo {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px var(--output-line), 0 0 0 0 rgba(249, 191, 61, 0.45);
  }
  50% {
    box-shadow: inset 0 0 0 1px var(--gold), 0 0 0 6px rgba(249, 191, 61, 0);
  }
}
@keyframes aucra-chat-twinkle {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(0.82);
  }
  50% {
    transform: rotate(180deg) scale(1.08);
  }
  75% {
    transform: rotate(270deg) scale(0.9);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}
/* Three gold dots in a wave. They carry no meaning the words do not. */
.aucra-chat-dots {
  display: flex;
  gap: 5px;
  height: 12px;
  align-items: center;
}
.aucra-chat-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: aucra-chat-wave 1.2s ease-in-out infinite;
}
.aucra-chat-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.aucra-chat-dots span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes aucra-chat-wave {
  0%,
  60%,
  100% {
    transform: translateY(0);
    background: var(--gold);
  }
  30% {
    transform: translateY(-4px);
    background: var(--gold-deep);
  }
}
/* The words and the count run as one line of text, so a narrow drawer wraps
   them as a sentence and the count never starts a line alone. */
.aucra-chat-thinking-line {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}
/* A gold light sweeps across the service's words. Both ends of the sweep are
   text colours: muted 5.11:1 and gold deep 5.76:1 on the panel. */
.aucra-chat-thinking-words {
  background: linear-gradient(
      100deg,
      var(--muted) 0%,
      var(--muted) 38%,
      var(--gold-deep) 50%,
      var(--muted) 62%,
      var(--muted) 100%
    )
    0 0 / 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: aucra-chat-shimmer 2.4s linear infinite;
}
@keyframes aucra-chat-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}
.aucra-chat-thinking-words {
  display: inline;
}
.aucra-chat-seconds {
  display: inline;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.aucra-chat-seconds::before {
  content: "·";
  margin-right: 6px;
}
/* The scroll lands on the body's own bottom padding, not 14 px short of it. */
.aucra-chat-end {
  height: 1px;
  flex: 0 0 1px;
  margin-top: -14px;
  scroll-margin-bottom: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .aucra-chat-pop,
  .aucra-chat-thinking .aucra-chat-avatar,
  .aucra-chat-thinking .aucra-chat-avatar svg,
  .aucra-chat-dots span {
    animation: none;
  }
  .aucra-chat-dots span:nth-child(2) {
    background: var(--gold-deep);
  }
  .aucra-chat-thinking-words {
    animation: none;
    background: none;
    color: var(--muted);
  }
}
