/* Website chat assistant (js/chat.js) — sits above the page, below the intro animation */
.chat-open { position: fixed; z-index: 90; right: 24px; bottom: 24px; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--lime); color: var(--on-lime); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chat-open:hover { background: var(--lime-dim); }
.chat-open[hidden] { display: none; }
.chat-open svg { width: 18px; height: 18px; fill: currentColor; }
.chat { position: fixed; z-index: 90; right: 24px; bottom: 24px; width: 384px; height: min(600px, calc(100svh - 48px)); display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-deep); color: var(--text); font-size: 14px; line-height: 1.5; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); }
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--border); }
.chat-head div { flex: 1; min-width: 0; }
.chat-head b { display: block; font-weight: 600; }
.chat-head small { color: var(--muted); font-size: 12px; }
.chat-link { min-height: 40px; padding: 0 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chat-link:hover { color: var(--text); }
.chat-x { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 4px; background: none; color: var(--text); cursor: pointer; }
.chat-x:hover { background: var(--border); }
.chat-x svg, .chat-form svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.chat-msg { max-width: 85%; margin: 0; padding: 8px 12px; border-radius: 8px; white-space: pre-line; overflow-wrap: anywhere; }
.chat-msg.bot { align-self: flex-start; background: var(--border); }
.chat-msg.me { align-self: flex-end; background: var(--lime); color: var(--on-lime); }
.chat-msg.typing { display: flex; gap: 4px; padding: 12px; }
.chat-msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chat-dot 1s infinite; }
.chat-msg.typing i:nth-child(2) { animation-delay: .15s; }
.chat-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 50% { opacity: .3; } }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }
.chat-chips:not(:empty) { padding-bottom: 12px; }
.chat-chips button { min-height: 36px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 4px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.chat-chips button:hover { border-color: var(--lime); }
.chat-chips button.primary { border-color: var(--lime); background: var(--lime); color: var(--on-lime); font-weight: 600; }
.chat-chips button.primary:hover { background: var(--lime-dim); }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.chat-form[hidden] { display: none; }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.chat-form input::placeholder { color: var(--muted); }
.chat-form button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 4px; background: var(--lime); color: var(--on-lime); cursor: pointer; }
.chat-form button:hover { background: var(--lime-dim); }
.chat-err { margin: 0; padding: 0 16px; color: #FF9A8B; font-size: 13px; }
.chat-err:not(:empty) { padding-bottom: 12px; }
.chat-note { margin: 0; padding: 0 16px 12px; color: var(--muted); font-size: 12px; }
.chat-note a { color: inherit; text-decoration: underline; }
@media (max-width: 560px) {
  .chat-open { right: 16px; bottom: 16px; }
  .chat { inset: auto 8px 8px; width: auto; height: min(640px, calc(100svh - 16px)); }
}
@media (prefers-reduced-motion: reduce) { .chat-msg.typing i { animation: none; } }
