/* Chat widget, on the Lumen tokens (aliases declared in styles.css) */
.chat-launcher {
  position: fixed; right: var(--space-lg); bottom: var(--space-lg); z-index: var(--z-sticky);
  width: 60px; height: 60px; border-radius: var(--radius-pill); border: 0; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-ink);
  display: grid; place-items: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.chat-launcher:hover { background: var(--btn-hover); transform: scale(1.06); }
.chat-launcher svg { width: 28px; height: 28px; stroke: var(--btn-ink); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chat-panel {
  position: fixed; right: var(--space-lg); bottom: 96px; z-index: var(--z-sticky);
  width: 380px; max-width: calc(100% - 2 * var(--space-md));
  height: min(560px, calc(100dvh - 120px));
  background: var(--card); color: var(--text);
  border: var(--rule-hair) solid var(--line); border-radius: var(--radius-card);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel[hidden] { display: none; }

.chat-head { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: var(--rule-hair) solid var(--line); }
.chat-head img { width: 28px; height: 28px; }
.chat-head strong { flex: 1; font-size: var(--text-md); font-weight: 500; }
.chat-close { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: var(--text-xl); line-height: 1; min-width: 44px; min-height: 44px; margin: calc(var(--space-xs) * -1) calc(var(--space-sm) * -1) calc(var(--space-xs) * -1) 0; }
.chat-close:hover { color: var(--text); }

.chat-msgs { flex: 1; overflow-y: auto; padding: var(--space-md); display: flex; flex-direction: column; gap: var(--space-sm); }
.msg { max-width: 85%; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-card); font-size: var(--text-sm); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--bg-alt); }
.msg.user { align-self: flex-end; background: var(--btn-bg); color: var(--btn-ink); }
.msg a { color: inherit; text-decoration: underline; }

.typing { display: inline-flex; gap: var(--space-2xs); padding: var(--space-md); }
.typing i { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: 0.6; } .chat-launcher { transition: none; } }

.chat-chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); padding: 0 var(--space-md) var(--space-sm); }
.chat-chip { font: inherit; font-size: var(--text-sm); min-height: 36px; padding: 0 var(--space-md); border-radius: var(--radius-pill); border: var(--rule-hair) solid var(--color-rule-2); background: transparent; color: var(--text); cursor: pointer; transition: background-color var(--dur-short) var(--ease-out); }
.chat-chip:hover { background: var(--bg-alt); }

.chat-form { display: flex; gap: var(--space-xs); padding: var(--space-sm) var(--space-md) var(--space-xs); border-top: var(--rule-hair) solid var(--line); }
.chat-form input { flex: 1; min-width: 0; border-radius: var(--radius-pill); padding: var(--space-sm) var(--space-md); font-size: var(--text-md); }
.chat-send { flex: none; width: 44px; height: 44px; border-radius: var(--radius-pill); border: 0; cursor: pointer; background: var(--btn-bg); color: var(--btn-ink); display: grid; place-items: center; }
.chat-send:hover { background: var(--btn-hover); }
.chat-send:disabled { background: var(--bg-alt); color: var(--muted); cursor: not-allowed; }
.chat-send svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-note { margin: 0; padding: 0 var(--space-md) var(--space-sm); font-size: var(--text-sm); color: var(--muted); }
.chat-note a { color: var(--muted); text-decoration: underline; }

@media (max-width: 30rem) {
  .chat-launcher { right: var(--space-md); bottom: var(--space-md); }
  .chat-panel { right: var(--space-xs); left: var(--space-xs); width: auto; max-width: none; bottom: 88px; height: min(560px, calc(100dvh - 100px)); }
}
