/* Chat card: header + orb, transcript bubbles, suggestion chips, composer, notice. */

.demo {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 44rem;
  margin: 0 auto;
  background: transparent;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.5rem 0.9rem;
  animation: rise 0.7s var(--ease) both;
}

.chat-id {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

/* Breathing gradient orb */
.orb {
  width: 2.6rem; height: 2.6rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #E8A87C, #C96F4A, #B77BB5, #E8A87C);
  box-shadow: 0 4px 14px -2px rgba(201, 111, 74, 0.45), inset 0 -2px 6px rgba(0,0,0,0.12), inset 0 2px 4px rgba(255,255,255,0.4);
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 14px -2px rgba(201, 111, 74, 0.45), inset 0 -2px 6px rgba(0,0,0,0.12), inset 0 2px 4px rgba(255,255,255,0.4); }
  50%      { transform: scale(1.07); box-shadow: 0 8px 22px -2px rgba(201, 111, 74, 0.55), inset 0 -2px 6px rgba(0,0,0,0.12), inset 0 2px 4px rgba(255,255,255,0.4); }
}

.chat-head h1 { font-size: 1.15rem; }

.chat-subtitle {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--raised);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  flex-shrink: 0;
  animation: rise 0.7s var(--ease) 0.15s both;
}

.tag-ok { color: var(--ok); border-color: rgba(79, 125, 91, 0.35); }
.tag-warn { color: var(--warn); border-color: rgba(154, 107, 30, 0.35); }

/* ---------- Transcript ---------- */

.chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.75rem 1.5rem 1.25rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.bubble {
  max-width: 84%;
  padding: 0.75rem 1.05rem;
  border-radius: var(--r-lg);
  font-size: 0.9375rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  animation: pop-in 0.5s var(--ease-bounce) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble-bot {
  background: var(--raised);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
}

.bubble-you {
  background: linear-gradient(135deg, var(--accent), #D98B62);
  color: var(--on-accent);
  border-bottom-right-radius: 6px;
  align-self: flex-end;
  box-shadow: 0 6px 18px -4px rgba(201, 111, 74, 0.4);
}

.bubble-wait {
  color: var(--ink-faint);
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* Typing dots injected by script */
.dots { display: inline-flex; gap: 4px; }
.dots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-quiet);
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* Failed answer keeps the bubble, takes severity colour */
.bubble-stop {
  color: var(--stop);
  border-color: rgba(179, 70, 60, 0.4);
  background: rgba(179, 70, 60, 0.06);
}

/* ---------- Suggestion chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0 1.5rem 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.6rem 1rem 0.6rem 0.8rem;
  min-height: 44px;                       /* comfortable touch target */
  max-width: 100%;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent-soft);
  background: linear-gradient(135deg, var(--accent-soft), rgba(201, 111, 74, 0.05));
  color: var(--accent-text);
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(120, 85, 50, 0.05), 0 3px 12px -2px rgba(201, 111, 74, 0.12);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  animation: rise 0.6s var(--ease) both;
}

/* Tiny terracotta seed — echoes the orb, marks the pill as tappable */
.chip::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-quiet);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}

.chip:nth-child(1) { animation-delay: 0.25s; }
.chip:nth-child(2) { animation-delay: 0.33s; }
.chip:nth-child(3) { animation-delay: 0.41s; }

.chip:hover {
  transform: translateY(-2px);
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.chip:hover::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: scale(1.15);
}

.chip:active { transform: translateY(0) scale(0.97); }

/* ---------- Composer ---------- */

.choices {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem 1.5rem;
  animation: rise 0.7s var(--ease) 0.2s both;
}

.choices textarea {
  flex: 1;
  font: inherit;
  font-size: 0.9375rem;
  resize: none;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--raised);
  color: var(--ink);
  max-height: 8rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}

.choices textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}

.choices textarea::placeholder { color: var(--ink-faint); }

.send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem; height: 3rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #D98B62);
  color: var(--on-accent);
  cursor: pointer;
  box-shadow: 0 6px 18px -4px rgba(201, 111, 74, 0.5);
  transition: transform var(--t-fast) var(--ease-bounce), box-shadow var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}

.send svg { transition: transform var(--t-fast) var(--ease); }

.send:hover { transform: scale(1.08); box-shadow: 0 10px 24px -4px rgba(201, 111, 74, 0.6); }
.send:hover svg { transform: translateX(2px); }
.send:active { transform: scale(0.94); }

.send:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
  filter: grayscale(0.4);
}

/* Per-run metrics line under the latest bot bubble. */
.metrics {
  margin: -0.35rem 0 0.9rem;
  padding-left: 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft, #6b6b60);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.metrics-wait { opacity: 0.55; font-style: italic; }

/* Stop state: while the agent generates, the send button becomes stop. */
.send-stop,
.send-stop:hover {
  background: var(--raised);
  color: var(--stop);
  border: 1px solid rgba(179, 70, 60, 0.45);
  box-shadow: 0 6px 18px -4px rgba(179, 70, 60, 0.35);
  animation: pulse-stop 1.6s ease-in-out infinite;
}

.send-stop:hover { transform: scale(1.08); }
.send-stop:active { transform: scale(0.94); }

@keyframes pulse-stop {
  0%, 100% { box-shadow: 0 6px 18px -4px rgba(179, 70, 60, 0.35); }
  50%      { box-shadow: 0 6px 22px -2px rgba(179, 70, 60, 0.6); }
}

/* ---------- Composer model lock ---------- */

/* Sits at the bottom edge of the composer; while the model loads the
   textarea + send are disabled and the bar drains right → left. */
.composer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  overflow: hidden;
  background: var(--accent-soft);
  pointer-events: none;
}

.composer-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #D98B62);
  transform-origin: right center;   /* anchored right, drains leftwards */
  transform: scaleX(1);
  transition: transform 0.45s var(--ease);
}

/* No byte counts yet — gentle shimmer until progress arrives. */
.composer-bar-indeterminate .composer-bar-fill {
  animation: lock-drain 1.4s var(--ease) infinite;
  transition: none;
}

@keyframes lock-drain {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Ready: quick fade then the bar hides itself. */
.composer-bar-done { animation: lock-leave 0.7s var(--ease) both; }

@keyframes lock-leave {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.choices { position: relative; }

.choices textarea:disabled {
  background: var(--accent-soft);
  color: var(--ink-soft);
  cursor: wait;
  border-color: var(--accent-soft);
}

.choices textarea:disabled::placeholder { color: var(--accent-text); opacity: 0.85; }

.send:disabled { opacity: 0.45; cursor: wait; }

/* ---------- Notice ---------- */

.notice {
  display: flex;
  gap: 0.75rem;
  margin: 0 1.5rem 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--raised);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  animation: rise 0.5s var(--ease) both;
}

.notice .bar {
  width: 3px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--warn);
}

.notice-stop .bar { background: var(--stop); }
.notice-ok .bar { background: var(--ok); }

/* ---------- Shared entrance animation ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 560px) {
  .chat-head, .chat, .chips, .choices { padding-left: 1rem; padding-right: 1rem; }
  .notice { margin: 0 1rem 1rem; }
  .bubble { max-width: 92%; }
  .orb { width: 2.2rem; height: 2.2rem; }
}