/* Website chat bubble (chat.v1.js), talks to /chat/. Uses the colour tokens in index.html (dark site). */
.vchat-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--ink);
  font: 600 15px/1 'IBM Plex Sans', system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 16px 40px oklch(0 0 0 / 0.45);
  transition: transform 150ms ease, background 150ms ease;
}
.vchat-launch:hover { transform: translateY(-1px); }
.vchat-launch:focus-visible, .vchat-close:focus-visible, .vchat-send:focus-visible, .vchat-input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.vchat-launch svg { width: 20px; height: 20px; flex: none; }
.vchat-launch[hidden] { display: none; }

.vchat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 901;
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 40px oklch(0 0 0 / 0.45);
  font: 400 15px/1.5 'IBM Plex Sans', system-ui, sans-serif;
}
.vchat-panel[hidden] { display: none; }

.vchat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line-soft);
  background: var(--ink-2);
}
.vchat-title { flex: 1; min-width: 0; }
.vchat-title strong { display: block; font: 500 18px/1.2 'IBM Plex Sans', system-ui, sans-serif; }
.vchat-title span { display: block; color: var(--fg-dim); font: 500 11px/1.4 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .04em; text-transform: uppercase; }
.vchat-close {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: var(--fg); cursor: pointer; font-size: 22px; line-height: 1;
}
.vchat-close:hover { background: var(--accent-dim); }

.vchat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.vchat-msg { max-width: 85%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.vchat-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.vchat-msg.is-bot { align-self: flex-start; background: var(--ink-2); border-bottom-left-radius: 4px; }
.vchat-msg.is-me { align-self: flex-end; background: var(--accent); color: var(--ink); border-bottom-right-radius: 4px; }
.vchat-msg.is-note { align-self: center; background: transparent; color: var(--fg-dim); font-size: 13px; text-align: center; padding: 2px 8px; }
.vchat-typing { display: inline-flex; gap: 4px; }
.vchat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-dim); animation: vchat-dot 1s infinite ease-in-out; }
.vchat-typing i:nth-child(2) { animation-delay: .15s; }
.vchat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes vchat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.vchat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.vchat-suggest[hidden] { display: none; }
.vchat-suggest button {
  border: 1px solid var(--line); background: transparent; color: var(--fg);
  border-radius: 999px; padding: 6px 11px; font: 500 13px/1.2 'IBM Plex Sans', system-ui, sans-serif; cursor: pointer;
}
.vchat-suggest button:hover { background: var(--accent-dim); }

.vchat-form { display: flex; gap: 8px; padding: 10px 12px 8px; border-top: 1px solid var(--line-soft); }
.vchat-input {
  flex: 1; min-width: 0; resize: none; max-height: 120px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--ink); color: var(--fg); font: inherit;
}
.vchat-send {
  flex: none; padding: 0 16px; border: 0; border-radius: 6px;
  background: var(--accent); color: var(--ink); font: 600 14px/1 'IBM Plex Sans', system-ui, sans-serif; cursor: pointer;
}
.vchat-send:disabled { opacity: .5; cursor: default; }
.vchat-foot { margin: 0; padding: 0 14px 10px; color: var(--fg-dim); font-size: 11.5px; line-height: 1.4; }
.vchat-foot a { color: inherit; }

@media (max-width: 520px) {
  /* Icon only on phones so it doesn't cover the page's own buttons; the label stays for screen readers. */
  .vchat-launch { right: 12px; bottom: 12px; padding: 13px; }
  .vchat-launch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .vchat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .vchat-launch { transition: none; }
  .vchat-typing i { animation: none; opacity: .6; }
}

/* Voice mode */
.vchat-mic {
  flex: none; width: 44px; border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--fg); cursor: pointer; display: grid; place-items: center;
}
.vchat-mic svg { width: 20px; height: 20px; }
.vchat-mic:hover { background: var(--accent-dim); }
.vchat-mic:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vchat-mic[aria-pressed="true"] { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.vchat-mic[hidden] { display: none; }
.vchat-voice {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--line-soft);
  background: var(--ink-2); font-size: 13.5px; color: var(--fg-muted);
}
.vchat-voice[hidden] { display: none; }
.vchat-level { width: 10px; height: 10px; border-radius: 50%; background: var(--fg-dim); flex: none; transition: transform 80ms linear; }
.vchat-voice[data-state="listening"] .vchat-level { background: #c0392b; }
.vchat-voice[data-state="speaking"] .vchat-level { background: var(--accent); animation: vchat-dot 1s infinite ease-in-out; }
.vchat-voice[data-state="thinking"] .vchat-level { background: var(--accent-2); animation: vchat-dot .8s infinite ease-in-out; }
.vchat-voice-text { flex: 1; }
.vchat-voice button {
  border: 1px solid var(--line); background: transparent; color: var(--fg);
  border-radius: 999px; padding: 5px 11px; font: 600 12.5px/1 'IBM Plex Sans', system-ui, sans-serif; cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
  .vchat-voice .vchat-level { animation: none !important; transition: none; }
}
