/* Back by Teatime site kit: the website chat (chat.js). A generic copy of Back by Teatime's own chat window,
   in the client's colours: the same CSS variables as site.css, from brand.json's palette.
   --bg is the dark brand colour (white text sits on it), --accent its highlight (with --bg text on it, as on
   the buttons), --accent-dark the highlight dark enough for text on white, --paper and --ink the page. */
.chat-launch { position: fixed; right: 20px; bottom: 20px; z-index: 45; display: inline-flex; align-items: center; gap: 10px; padding: 7px 18px 7px 7px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px; background: var(--bg); color: #fff; font: 700 0.98rem var(--body); text-align: left; cursor: pointer; box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.5); }
.chat-launch:hover { box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.6); }
.chat-launch:focus-visible, .chat-chip:focus-visible, .chat-send:focus-visible, .chat-x:focus-visible, .chat-start:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chat-launch small { display: block; font-weight: 500; font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); }
.chat-face { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--bg); position: relative; }
.chat-face svg { width: 19px; height: 19px; }
.chat-launch .chat-face::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #3DDC84; border: 2px solid var(--bg); }
.chat-on .chat-launch { display: none; }

/* The window */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 60; margin: 0; padding: 0; box-sizing: border-box; width: min(400px, calc(100vw - 40px)); height: min(640px, calc(100dvh - 40px)); display: flex; flex-direction: column; border-radius: max(var(--r, 12px), 14px); overflow: hidden; background: var(--paper); color: var(--ink); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.55); border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--bg); color: #fff; }
.chat-head div { flex: 1; min-width: 0; }
.chat-head b { display: block; font-family: var(--head); font-size: 1.15rem; }
.chat-head small { display: block; font-size: 0.8rem; color: rgba(255, 255, 255, 0.72); }
.chat-x { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.24); background: none; color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.chat-quick { display: flex; gap: 8px; padding: 10px 16px; background: var(--bg2); }
.chat-quick a { flex: 1; padding: 7px 10px; border-radius: 999px; text-align: center; font-size: 0.86rem; font-weight: 700; text-decoration: none; color: var(--bg); background: var(--accent); }
.chat-quick a + a { color: #fff; background: rgba(255, 255, 255, 0.14); }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.chat-msg { max-width: 85%; padding: 11px 14px; border-radius: 18px; font-size: 0.97rem; line-height: 1.5; overflow-wrap: anywhere; }
.chat-bot { align-self: flex-start; background: #fff; border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); border-bottom-left-radius: 6px; }
.chat-me { align-self: flex-end; background: var(--bg); color: #fff; border-bottom-right-radius: 6px; }
.chat-msg a { color: var(--accent-dark); font-weight: 700; }
.chat-me a { color: #fff; }
.chat-sys { background: color-mix(in srgb, var(--accent) 16%, #fff); border-color: transparent; }
.chat-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-btn { display: inline-flex; padding: 8px 14px; border-radius: 999px; font-size: 0.86rem; font-weight: 700; text-decoration: none; background: var(--accent); color: var(--bg) !important; }
.chat-btn.alt { background: var(--bg); color: #fff !important; }
.chat-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 50%, transparent); animation: chat-dot 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.chat-chips:empty { display: none; }
.chat-chip { padding: 8px 13px; border-radius: 999px; border: 1.5px solid var(--accent-dark); background: #fff; color: var(--accent-dark); font: 700 0.86rem var(--body); cursor: pointer; }
.chat-chip:hover { background: color-mix(in srgb, var(--accent) 12%, #fff); }
.chat-form { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 8px 8px 8px 14px; border-radius: 22px; background: #fff; border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); }
.chat-form:focus-within { border-color: var(--accent-dark); }
.chat-form textarea { flex: 1; min-height: 24px; max-height: 140px; padding: 6px 0; border: 0; resize: none; background: none; color: var(--ink); font: 500 1rem/1.4 var(--body); outline: none; }
.chat-send { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--accent); color: var(--bg); font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.chat-send:disabled { opacity: 0.5; cursor: default; }
.chat-note { margin: 0; padding: 8px 16px 12px; font-size: 0.74rem; line-height: 1.4; color: color-mix(in srgb, var(--ink) 62%, transparent); text-align: center; }
.chat-note a, .chat-note button { color: inherit; font: inherit; font-weight: 700; }
.chat-note button { padding: 0; border: 0; background: none; text-decoration: underline; cursor: pointer; }
.chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* "Chat with …" in the contact section, and the privacy page's chat heading */
.chat-start { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.prose h2 { margin-top: 10px; font-size: clamp(1.4rem, 3vw, 1.8rem); }

@keyframes chat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Preview builds: keep clear of the PREVIEW banner along the bottom */
[data-preview] .chat-launch { bottom: 68px; }
[data-preview] .chat { bottom: 68px; height: min(640px, calc(100dvh - 88px)); }

@media (max-width: 560px) {
  .chat-launch { right: 16px; bottom: 16px; padding-right: 16px; }
  .chat-launch small { display: none; }
  .chat { inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .chat-on body { overflow: hidden; }
  .chat-form textarea { font-size: 16px; }
  [data-preview] .chat-launch { bottom: 64px; }
  [data-preview] .chat { bottom: 48px; height: calc(100dvh - 48px); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-typing span { transition: none; animation: none; }
}
