/* =========================================================
   "Ask a question" AI assistant widget
   Brand: navy #121F3B, gold #C9A45C. Relies on variables from styles.css.
   ========================================================= */

.chat-launcher {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 90;
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 52px; padding: .7rem 1.15rem .7rem 1rem;
  font: inherit; font-weight: 700; font-size: 1rem;
  color: var(--white); background: var(--navy);
  border: 2px solid var(--gold); border-radius: 999px;
  box-shadow: 0 6px 20px rgba(18, 31, 59, .35);
  cursor: pointer;
}
.chat-launcher:hover { background: var(--navy-600); }
.chat-launcher:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.chat-launcher svg { color: var(--gold); flex: none; }
.chat-launcher[hidden] { display: none; }

.chat-panel {
  position: fixed; z-index: 95;
  inset: 0; /* mobile: full screen */
  display: flex; flex-direction: column;
  background: var(--white); color: var(--ink);
  --focus: var(--navy);
}
.chat-panel[hidden] { display: none; }

.chat-head {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .9rem 1rem .9rem 1.4rem;
  background: var(--navy); color: var(--white);
  border-bottom: 1px solid var(--gold);
  --focus: var(--gold);
}
.chat-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--gold); }
.chat-title { margin: 0; color: var(--white); font-family: var(--serif); font-size: 1.2rem; line-height: 1.2; }
.chat-subtitle { margin: .1rem 0 0; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.chat-close {
  flex: none; display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: transparent; color: var(--white);
  border: 2px solid rgba(201, 164, 92, .7); cursor: pointer;
}
.chat-close:hover { background: rgba(255, 255, 255, .08); }

.chat-log {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  list-style: none; margin: 0; padding: 1rem;
  display: flex; flex-direction: column; gap: .75rem;
  background: var(--ivory);
}
.chat-msg { max-width: 88%; padding: .7rem .95rem; border-radius: 14px; line-height: 1.5; font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg p { margin: 0; }
.chat-msg-bot { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 4px 14px 14px 14px; }
.chat-msg-user { align-self: flex-end; background: var(--navy); color: var(--white); border-radius: 14px 14px 4px 14px; }
.chat-msg-bot a { color: var(--navy); font-weight: 700; }
.chat-msg-error { border-left-color: #a3261b; }
.chat-who { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: .2rem; }
.chat-msg-user .chat-who { color: var(--gold); }

.chat-typing { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-muted); }
.chat-dots { display: inline-flex; gap: 4px; }
.chat-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-ink); opacity: .35; }
@media (prefers-reduced-motion: no-preference) {
  .chat-dots span { animation: chat-blink 1.2s infinite ease-in-out; }
  .chat-dots span:nth-child(2) { animation-delay: .2s; }
  .chat-dots span:nth-child(3) { animation-delay: .4s; }
}
@keyframes chat-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem 0; background: var(--ivory); }
.chat-suggest[hidden] { display: none; }
.chat-chip {
  font: inherit; font-size: .9rem; font-weight: 700; text-align: left;
  min-height: 40px; padding: .45rem .85rem;
  color: var(--navy); background: var(--white);
  border: 2px solid var(--gold); border-radius: 999px; cursor: pointer;
}
.chat-chip:hover { background: #f6eedd; }

.chat-form { display: flex; gap: .5rem; align-items: flex-end; padding: .75rem 1rem .5rem; border-top: 1px solid var(--line); background: var(--white); }
.chat-input {
  flex: 1 1 auto; min-height: 48px; max-height: 140px; resize: none;
  font: inherit; font-size: 1rem; line-height: 1.4; color: var(--ink);
  padding: .65rem .8rem; border: 2px solid #7a8a96; border-radius: var(--radius-sm); background: var(--white);
}
.chat-input:focus-visible { border-color: var(--navy); outline: 3px solid var(--gold-ink); outline-offset: 1px; }
.chat-send {
  flex: none; min-height: 48px; padding: 0 1.1rem;
  font: inherit; font-weight: 700; color: var(--navy);
  background: var(--gold); border: 2px solid var(--gold); border-radius: var(--radius-sm); cursor: pointer;
}
.chat-send:hover { background: var(--gold-soft); }
.chat-send:disabled { opacity: .6; cursor: progress; }
.chat-send:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.chat-disclaimer { margin: 0; padding: .25rem 1rem .8rem; font-size: .8rem; color: var(--ink-muted); background: var(--white); }

/* Keep footer content clear of the floating button */
.site-footer { padding-bottom: 6rem; }

/* Desktop: floating panel */
@media (min-width: 640px) {
  .chat-launcher { right: 1.5rem; bottom: 1.5rem; }
  .chat-panel {
    inset: auto 1.5rem 1.5rem auto;
    width: 400px; height: min(700px, calc(100vh - 3rem));
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid rgba(18, 31, 59, .15);
    box-shadow: 0 18px 50px rgba(18, 31, 59, .35);
  }
}

@media (forced-colors: active) {
  .chat-launcher, .chat-panel, .chat-chip, .chat-send, .chat-close { border: 2px solid ButtonText; }
}
