/* The site's chat balloon (assets/chat-widget.js): a launcher in the corner and, on larger screens,
   a panel with /chat inside. Quiet like the chat itself: thin lines, the cyan light only as a detail.
   Above the site's fixed nav (z-index 900) and never under it: the panel stops below the nav. */

/* the light that travels around the launcher's border */
@property --chatw-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.chatw-launcher {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 950;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 24px 0 10px;
  font: 500 15px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.005em;
  color: #eef2f8;
  background: rgba(8, 12, 20, 0.92);
  border: 1px solid rgba(127, 208, 255, 0.26);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  animation: chatw-breathe 3.6s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s, border-color 0.2s;
}

/* a slow breath of light around it */
@keyframes chatw-breathe {
  0%, 100% { box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 16px rgba(127, 208, 255, 0.12); }
  50% { box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 34px rgba(127, 208, 255, 0.3); }
}

.chatw-launcher__ring {
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--chatw-angle), transparent 0 64%, rgba(127, 208, 255, 0.95) 80%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: chatw-orbit 4.5s linear infinite;
}

@keyframes chatw-orbit { to { --chatw-angle: 360deg; } }

/* the assistant's mark, same as in the chat, its light pulsing gently */
.chatw-launcher__mark,
.chatw-avatar {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0a0f19;
  border: 1px solid rgba(170, 200, 255, 0.22);
}

.chatw-avatar { width: 30px; height: 30px; }

.chatw-launcher__mark::after,
.chatw-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7fd0ff;
  box-shadow: 0 0 8px 2px rgba(127, 208, 255, 0.5);
}

.chatw-avatar::after { width: 6px; height: 6px; }

.chatw-launcher__mark::after { animation: chatw-pulse 3.6s ease-in-out infinite; }

@keyframes chatw-pulse {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(127, 208, 255, 0.45); }
  50% { box-shadow: 0 0 14px 4px rgba(127, 208, 255, 0.75); }
}

.chatw-launcher svg { display: none; position: relative; width: 24px; height: 24px; flex-shrink: 0; }

.chatw-launcher__label { position: relative; }

.chatw-launcher:hover { border-color: rgba(127, 208, 255, 0.55); transform: translateY(-2px); }

.chatw-launcher:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.6); outline-offset: 4px; }

.chatw-launcher.is-hidden,
.chatw-launcher.is-away { opacity: 0; pointer-events: none; transform: translateY(8px); }

/* phones: a round button with the chat icon, same light */
@media (max-width: 719px) {
  .chatw-launcher { width: 58px; height: 58px; padding: 0; justify-content: center; }
  .chatw-launcher__mark, .chatw-launcher__label { display: none; }
  .chatw-launcher svg { display: block; }
}

.chatw-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: 380px;
  height: min(640px, calc(100vh - 116px)); /* stays below the site's nav */
  overflow: hidden;
  background: #04060b;
  border: 1px solid rgba(170, 200, 255, 0.18);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.22s, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.3s;
}

.chatw-panel.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.chatw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 62px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid rgba(170, 200, 255, 0.12);
  font-family: "Inter", system-ui, sans-serif;
}

.chatw-who { display: flex; align-items: center; gap: 11px; }

.chatw-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }

.chatw-name { font-size: 14.5px; font-weight: 500; color: #eef2f8; }

.chatw-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(238, 242, 248, 0.45); }

.chatw-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #7fd0ff; opacity: 0.8; }

/* expand · full page · close */
.chatw-actions { display: flex; align-items: center; gap: 6px; }

.chatw-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: rgba(238, 242, 248, 0.7);
  background: none;
  border: 1px solid rgba(170, 200, 255, 0.16);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.chatw-icon svg { width: 16px; height: 16px; }

.chatw-icon:hover { color: #fff; border-color: rgba(238, 242, 248, 0.4); background: rgba(255, 255, 255, 0.04); }

.chatw-icon:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }

.chatw-expand svg + svg,
.chatw-panel.is-wide .chatw-expand svg:first-child { display: none; }

.chatw-panel.is-wide .chatw-expand svg + svg { display: block; }

/* expanded: wider and as tall as the space below the nav allows */
.chatw-panel.is-wide { width: min(760px, calc(100vw - 40px)); height: calc(100vh - 116px); }

.chatw-panel { transition: opacity 0.22s, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.3s, width 0.3s cubic-bezier(0.22, 1, 0.36, 1), height 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

.chatw-panel.is-open { transition: opacity 0.22s, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s, width 0.3s cubic-bezier(0.22, 1, 0.36, 1), height 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

.chatw-frame { flex: 1; width: 100%; border: 0; background: #04060b; }

@media (prefers-reduced-motion: reduce) {
  .chatw-launcher, .chatw-panel { transition: none; }
  /* the light stays, still */
  .chatw-launcher { animation: none; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 24px rgba(127, 208, 255, 0.22); }
  .chatw-launcher__ring, .chatw-launcher__mark::after { animation: none; }
}
