/* Low Altitude Analytics website chat. Uses the theme's tokens (style.css :root), with the same values as fallbacks. */
.laa-chat {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 60; /* above the sticky header (50); the Book a call pop-up is a modal dialog, so it sits above everything */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  max-width: calc(100vw - 32px);
  font-family: var(--font-body, "IBM Plex Sans", "Segoe UI", system-ui, sans-serif);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text, #e7ebf0);
}
.laa-chat [hidden] { display: none !important; }
.laa-chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.laa-chat :focus-visible { outline: 2px solid var(--amber, #f2a93b); outline-offset: 2px; }

/* Chat button */
.laa-chat-launcher {
  position: relative;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 52px; max-width: 100%;
  padding: 8px 18px 8px 12px;
  border: 2px solid var(--amber, #f2a93b);
  border-radius: 999px;
  background: var(--card-2, #222a35);
  color: var(--text, #e7ebf0);
  font: 600 1rem/1.2 var(--font-body, "IBM Plex Sans", "Segoe UI", system-ui, sans-serif);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  cursor: pointer;
}
.laa-chat-launcher:hover { background: var(--card, #1b212a); border-color: #ffbb57; }
.laa-chat-launcher:focus-visible { outline-offset: 3px; }
.laa-chat-mark { flex: none; width: 26px; height: 26px; }
.laa-chat-launcher-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.laa-chat-badge {
  position: absolute; top: -3px; right: -3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--online, #5cc28a); border: 2px solid var(--panel, #12161c);
}
.laa-chat.is-open .laa-chat-launcher { border-color: var(--field-line, #707b8b); }
/* Hovering the button: a soft amber glow around it. The light that follows the mouse across it is the theme's, the same
   as on every other button (theme assets/pointer-light.js; Kendall, 2026-11-27). Mouse only, so a tap on a phone
   doesn't leave it glowing. */
@media (hover: hover) and (pointer: fine) {
  .laa-chat-launcher:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 24px rgba(242, 169, 59, .35); }
}
/* Steps aside while it would cover a button in the first screen of a page (small phones); see checkTuck() in chat-widget.js. */
.laa-chat-tucked:not(.is-open) .laa-chat-launcher { visibility: hidden; opacity: 0; }

/* Panel */
.laa-chat-panel {
  display: flex; flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 100px));
  height: min(620px, calc(100dvh - 100px));
  overflow: hidden;
  background: var(--card, #1b212a);
  border: 1px solid var(--line, #2a323d);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.laa-chat-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--line, #2a323d);
  background: var(--card-2, #222a35);
}
.laa-chat-heading { min-width: 0; }
.laa-chat-title {
  margin: 0; font: 600 1.15rem/1.2 var(--font-display, "IBM Plex Sans Condensed", "Arial Narrow", "Segoe UI", sans-serif);
  color: var(--text, #e7ebf0); letter-spacing: .01em;
}
.laa-chat-title:focus { outline: none; }
.laa-chat-title:focus-visible { outline: 2px solid var(--amber, #f2a93b); outline-offset: 2px; }
.laa-chat-sub { display: flex; align-items: center; gap: 7px; margin: 3px 0 0; font-size: .82rem; color: var(--muted, #98a3b2); }
.laa-chat-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--online, #5cc28a); }
.laa-chat[data-status="waiting"] .laa-chat-dot { background: var(--amber, #f2a93b); }
.laa-chat[data-status="offline"] .laa-chat-dot { background: var(--field-line, #707b8b); }
.laa-chat-close {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin: -4px 0;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--text, #e7ebf0);
  font-size: 28px; line-height: 1; cursor: pointer;
}
.laa-chat-close:hover { background: rgba(255, 255, 255, .08); border-color: var(--line, #2a323d); }

/* Messages */
.laa-chat-messages {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 14px;
  background: var(--panel, #12161c);
}
.laa-chat-messages:focus-visible { outline-offset: -2px; }
.laa-chat-connecting { margin: auto; color: var(--muted, #98a3b2); font-size: .9rem; }
.laa-chat-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: .95rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.laa-chat-msg-bot { align-self: flex-start; background: var(--card-2, #222a35); border: 1px solid var(--line, #2a323d); }
.laa-chat-msg-agent { align-self: flex-start; background: rgba(242, 169, 59, .12); border: 1px solid rgba(242, 169, 59, .4); }
.laa-chat-msg-visitor { align-self: flex-end; background: #2a3442; border: 1px solid #364254; }
.laa-chat-msg-note { align-self: stretch; max-width: none; background: transparent; border: 1px dashed var(--field-line, #707b8b); color: var(--muted, #98a3b2); font-size: .88rem; }
.laa-chat-who {
  display: block; margin-bottom: 3px;
  font: 500 .7rem/1.3 var(--font-mono, "IBM Plex Mono", ui-monospace, Consolas, monospace);
  letter-spacing: .04em; color: var(--muted, #98a3b2);
}
.laa-chat-msg-agent .laa-chat-who { color: var(--amber, #f2a93b); }
.laa-chat-msg a { color: var(--amber, #f2a93b); text-underline-offset: 2px; }
.laa-chat-typing {
  align-self: flex-start; display: inline-flex; gap: 4px; align-items: center;
  padding: 12px 14px; border-radius: 10px;
  background: var(--card-2, #222a35); border: 1px solid var(--line, #2a323d);
}
.laa-chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted, #98a3b2); opacity: .6; }

/* Quick replies */
.laa-chat-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px 2px;
  border-top: 1px solid var(--line, #2a323d);
}
.laa-chat-chip {
  display: inline-flex; align-items: center;
  min-height: 36px; max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--field-line, #707b8b); border-radius: 999px;
  background: transparent; color: var(--text, #e7ebf0);
  font: 500 .85rem/1.25 var(--font-body, "IBM Plex Sans", "Segoe UI", system-ui, sans-serif);
  text-align: left; text-decoration: none; cursor: pointer;
}
.laa-chat-chip:hover { border-color: var(--amber, #f2a93b); color: var(--amber, #f2a93b); }
.laa-chat-chip-book { background: var(--amber, #f2a93b); border-color: var(--amber, #f2a93b); color: var(--amber-ink, #1a1205); font-weight: 600; }
.laa-chat-chip-book:hover { background: #ffbb57; border-color: #ffbb57; color: var(--amber-ink, #1a1205); }
.laa-chat-chip:disabled { opacity: .55; cursor: default; }

/* Message box */
.laa-chat-form { display: flex; gap: 8px; padding: 10px 12px 6px; }
.laa-chat-input {
  flex: 1 1 auto; min-width: 0; height: 44px;
  padding: 0 12px;
  border: 1px solid var(--field-line, #707b8b); border-radius: 8px;
  background: var(--panel, #12161c); color: var(--text, #e7ebf0);
  font: 400 16px/1.2 var(--font-body, "IBM Plex Sans", "Segoe UI", system-ui, sans-serif); /* 16px keeps iPhones from zooming */
}
.laa-chat-input::placeholder { color: var(--muted, #98a3b2); opacity: 1; }
.laa-chat-input:focus { outline: none; border-color: var(--amber, #f2a93b); box-shadow: 0 0 0 1px var(--amber, #f2a93b); }
.laa-chat-send {
  flex: none; height: 44px; padding: 0 16px;
  border: 0; border-radius: 8px;
  background: var(--amber, #f2a93b); color: var(--amber-ink, #1a1205);
  font: 600 .95rem/1 var(--font-body, "IBM Plex Sans", "Segoe UI", system-ui, sans-serif);
  cursor: pointer;
}
.laa-chat-send:hover { background: #ffbb57; }
.laa-chat-send:disabled { opacity: .6; cursor: progress; }
.laa-chat-note { margin: 0; padding: 0 12px 10px; font-size: .74rem; line-height: 1.35; color: var(--muted, #98a3b2); }

/* Phones: a compact button, and the panel uses the screen's width. */
@media (max-width: 480px) {
  .laa-chat { right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 24px); gap: 10px; }
  .laa-chat-panel { width: calc(100vw - 24px); height: calc(100vh - 86px); height: calc(100dvh - 86px); max-height: 640px; }
  .laa-chat-launcher { min-height: 48px; padding: 6px 14px 6px 10px; font-size: .95rem; }
  .laa-chat-msg { max-width: 92%; }
}
@media (max-height: 520px) {
  .laa-chat-panel { height: calc(100vh - 80px); height: calc(100dvh - 80px); }
  .laa-chat-note { display: none; }
}

/* Motion only for visitors who haven't asked for less. */
@media (prefers-reduced-motion: no-preference) {
  .laa-chat-launcher { transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .3s ease, opacity .2s ease, visibility .2s; }
  .laa-chat-launcher:hover { transform: translateY(-1px); }
  .laa-chat.is-open .laa-chat-panel { animation: laa-chat-in .18s ease-out both; }
  .laa-chat-typing span { animation: laa-chat-blink 1.1s infinite ease-in-out; }
  .laa-chat-typing span:nth-child(2) { animation-delay: .18s; }
  .laa-chat-typing span:nth-child(3) { animation-delay: .36s; }
}
@keyframes laa-chat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes laa-chat-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

@media print { .laa-chat { display: none !important; } }
