/* Sphere Construction — chat assistant widget */

.chat-launcher {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px 13px 16px;
  border: 2px solid var(--accent);
  background: var(--ink);
  color: #fff;
  font-family: var(--body); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  transition: background 0.25s, color 0.25s;
}
.chat-launcher:hover, .chat-launcher:focus-visible { background: var(--accent); color: var(--ink); }
.chat-launcher svg { width: 20px; height: 20px; }
.chat-open .chat-launcher { display: none; }
.menu-open .chat-launcher { display: none; }

/* The prompt that rises from the launcher after a visitor has been on the site a while. */
.chat-nudge {
  position: fixed;
  right: 24px; bottom: 88px;
  z-index: 60;
  display: flex; align-items: flex-start; gap: 14px;
  width: 350px; max-width: calc(100vw - 32px);
  padding: 16px 16px 16px 18px;
  background: var(--ink); color: #fff;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  font-family: var(--body); letter-spacing: 0.02em;
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.chat-nudge.is-in { opacity: 1; transform: none; }
/* The tail pointing down at the launcher. */
.chat-nudge::after {
  content: "";
  position: absolute; right: 30px; bottom: -8px;
  width: 14px; height: 14px;
  background: var(--ink);
  border-right: 1px solid var(--accent); border-bottom: 1px solid var(--accent);
  transform: rotate(45deg);
}
.chat-nudge img { width: 38px; height: 38px; flex: none; margin-top: 2px; }
.chat-nudge button { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.chat-nudge__open { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 0; text-align: left; }
.chat-nudge__open strong { font-family: var(--display); font-weight: 500; font-size: 15px; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; }
.chat-nudge__open span { font-size: 13px; line-height: 1.55; color: rgba(255, 255, 255, 0.82); }
.chat-nudge__open em {
  margin-top: 4px;
  font-style: normal; font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.chat-nudge__open em i { display: inline-block; font-style: normal; transition: transform 0.2s; }
.chat-nudge__open:hover em, .chat-nudge__open:focus-visible em { color: #fff; border-color: #fff; }
.chat-nudge__open:hover em i, .chat-nudge__open:focus-visible em i { transform: translateX(4px); }
.chat-nudge__close { flex: none; margin: -8px -6px 0 0; padding: 4px 8px; font-size: 20px; line-height: 1; color: rgba(255, 255, 255, 0.6); }
.chat-nudge__close:hover, .chat-nudge__close:focus-visible { color: #fff; }
.chat-open .chat-nudge, .menu-open .chat-nudge { display: none; }
@media (prefers-reduced-motion: reduce) {
  .chat-nudge { transition: none; transform: none; }
  .chat-nudge__open em i { transition: none; }
}

.chat-panel {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 61;
  display: none; flex-direction: column;
  width: 380px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  font-family: var(--body); font-size: 14px; line-height: 1.6; letter-spacing: 0.02em;
  color: var(--text);
}
.chat-open .chat-panel { display: flex; animation: fade 0.25s ease; }

.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--ink); color: #fff;
}
.chat-head img { width: 34px; height: 34px; }
.chat-head h2 { font-size: 16px; text-transform: uppercase; }
.chat-head p { margin: 0; font-size: 11px; letter-spacing: 0.08em; color: var(--accent); }
.chat-head div { flex: 1; }
.chat-icon-btn {
  width: 34px; height: 34px;
  border: 0; background: transparent; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.chat-icon-btn:hover, .chat-icon-btn:focus-visible { color: var(--accent); }
.chat-icon-btn.chat-restart { font-size: 11px; width: auto; padding: 0 6px; letter-spacing: 0.1em; text-transform: uppercase; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--stone);
}
.chat-msg {
  max-width: 86%;
  padding: 10px 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.chat-msg--user { align-self: flex-end; background: var(--accent-deep); color: #fff; }
.chat-msg--error { align-self: flex-start; background: #fff; border-left: 4px solid #a33; font-size: 13px; }
.chat-msg--note { align-self: center; max-width: 100%; padding: 0; background: none; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chat-msg--typing::after { content: "…"; animation: chat-blink 1.2s infinite; }
@keyframes chat-blink { 50% { opacity: 0.25; } }

.chat-lead {
  align-self: stretch;
  padding: 14px 16px;
  background: var(--ink); color: #fff;
  border-left: 4px solid var(--accent);
}
.chat-lead strong { display: block; font-family: var(--display); font-weight: 500; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.chat-lead span { font-size: 12px; color: var(--accent); }

.chat-upload {
  align-self: stretch;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px dashed var(--accent-deep);
}
.chat-upload strong { font-weight: 500; font-size: 13px; }
.chat-upload button {
  padding: 9px 16px;
  border: 0; background: var(--accent-deep); color: #fff;
  font-family: var(--body); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer;
}
.chat-upload button:disabled { opacity: 0.45; cursor: default; }
.chat-upload button:not(:disabled):hover { background: var(--ink); }
.chat-upload__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-upload .chat-upload__skip { background: transparent; color: var(--accent-deep); box-shadow: inset 0 0 0 1px var(--accent-deep); }
.chat-upload .chat-upload__skip:not(:disabled):hover { background: var(--accent-deep); color: #fff; }
.chat-upload span { font-size: 11px; color: var(--muted); }

.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-chip {
  padding: 7px 12px;
  border: 1px solid var(--accent-deep); background: #fff; color: var(--accent-deep);
  font-family: var(--body); font-size: 12px; letter-spacing: 0.04em;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.chat-chip:hover, .chat-chip:focus-visible { background: var(--accent-deep); color: #fff; }

.chat-form { display: flex; border-top: 1px solid var(--line); background: #fff; }
.chat-form textarea {
  flex: 1;
  min-height: 52px; max-height: 120px;
  padding: 15px 14px;
  border: 0; resize: none;
  font: inherit; color: var(--text); background: transparent;
}
.chat-form textarea:focus { outline: 2px solid var(--accent-deep); outline-offset: -2px; }
.chat-form .chat-attach {
  padding: 0 4px 0 12px;
  background: transparent; color: var(--accent-deep);
}
.chat-form .chat-attach svg { width: 20px; height: 20px; display: block; }
.chat-form .chat-attach:not(:disabled):hover { background: transparent; color: var(--ink); }
.chat-form button {
  padding: 0 18px;
  border: 0; background: var(--ink); color: #fff;
  font-family: var(--body); font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer;
}
.chat-form button:disabled { opacity: 0.45; cursor: default; }
.chat-form button:not(:disabled):hover { background: var(--accent-deep); }

.chat-foot { padding: 7px 12px; background: #fff; border-top: 1px solid var(--line); font-size: 10.5px; letter-spacing: 0.02em; color: var(--muted); text-align: center; }
.chat-foot a { color: var(--accent-deep); }

@media (max-width: 640px) {
  .chat-launcher { right: 16px; bottom: 16px; }
  .chat-nudge { right: 16px; bottom: 80px; width: 300px; padding: 14px 12px 14px 14px; gap: 12px; }
  .chat-nudge__open strong { font-size: 14px; }
  .chat-nudge::after { right: 18px; }
  .chat-nudge img { width: 32px; height: 32px; }
  .chat-launcher span { display: none; }
  .chat-launcher { padding: 14px; }
  .chat-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; border: 0; }
}
