/* ===================== Lexie chat widget ===================== */
/* Uses the site's existing --navy/--gold/--ink/--muted/--ivory/--paper/--line
   variables from site.css. No border-radius anywhere, matching the rest
   of the site's sharp-corner visual language. */

#lexie-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--gold);
  cursor: pointer;
  font: 700 11px Manrope, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 14px 34px rgba(6, 27, 41, 0.28);
  transition: transform 0.2s, box-shadow 0.2s;
}
#lexie-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(6, 27, 41, 0.34);
}
#lexie-launcher .lexie-dot {
  width: 8px;
  height: 8px;
  background: var(--gold2);
  flex-shrink: 0;
}
#lexie-launcher.is-open {
  display: none;
}

#lexie-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 71;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(6, 27, 41, 0.32);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: DM Sans, sans-serif;
}
#lexie-panel.is-open {
  display: flex;
}

.lexie-head {
  background: var(--navy);
  color: #fff;
  padding: 18px 18px 16px;
  flex-shrink: 0;
}
.lexie-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lexie-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 800 16px Manrope, sans-serif;
  letter-spacing: 0.04em;
}
.lexie-head-title .lexie-dot {
  width: 8px;
  height: 8px;
  background: var(--gold2);
  flex-shrink: 0;
}
.lexie-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: none;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.lexie-close:hover {
  border-color: var(--gold2);
  color: var(--gold2);
}
.lexie-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--gold2);
  letter-spacing: 0.02em;
}
.lexie-disclaimer {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #bac8cd;
  line-height: 1.5;
}

.lexie-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  background: var(--ivory);
}

.lexie-starters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 14px;
}
.lexie-starter {
  text-align: left;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font: 600 12px DM Sans, sans-serif;
  cursor: pointer;
  transition: 0.2s;
}
.lexie-starter:hover {
  border-color: var(--gold);
  color: #8a6331;
}

.lexie-msg {
  margin-bottom: 12px;
  display: flex;
}
.lexie-msg.user {
  justify-content: flex-end;
}
.lexie-msg.assistant {
  justify-content: flex-start;
}
.lexie-bubble {
  max-width: 84%;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.lexie-msg.user .lexie-bubble {
  background: var(--navy);
  color: #fff;
}
.lexie-msg.assistant .lexie-bubble {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
}
.lexie-msg.error .lexie-bubble {
  background: var(--paper);
  border: 1px solid #c0392b;
  color: #7a2419;
}

.lexie-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.lexie-typing span {
  width: 5px;
  height: 5px;
  background: var(--muted);
  display: inline-block;
  animation: lexie-blink 1.2s infinite ease-in-out;
}
.lexie-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.lexie-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes lexie-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.lexie-input-row {
  flex-shrink: 0;
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.lexie-input {
  flex: 1;
  border: none;
  padding: 14px;
  font: 400 13.5px DM Sans, sans-serif;
  color: var(--ink);
  background: transparent;
  resize: none;
}
.lexie-input:focus {
  outline: none;
}
.lexie-send {
  flex-shrink: 0;
  width: 56px;
  border: none;
  border-left: 1px solid var(--line);
  background: var(--gold);
  color: #fff;
  font: 700 11px Manrope, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.lexie-send:hover {
  background: #b5873a;
}
.lexie-send:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: default;
}

@media (max-width: 600px) {
  #lexie-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border: none;
  }
  #lexie-launcher {
    right: 16px;
    bottom: 16px;
    padding: 12px 16px;
  }
}
