/*
 * Support bot widget.
 *
 * Uses the tokens styles.css already defines. The one place it deviates is the
 * z-index stack and fixed positioning, which nothing else on the site needs.
 */

.sb {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 9998;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* ---------------------------------------------------------------- *
 * Launcher
 * ---------------------------------------------------------------- */

.sb__launcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  cursor: pointer;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  background: var(--grad-green);
  color: #04231a;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 16px 34px rgba(16, 190, 130, .38);
  transition: transform .18s ease, box-shadow .18s ease;
}

.sb__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(16, 190, 130, .46);
}

.sb__launcher-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

/* The label is the affordance; once the panel is open the button is just a
   close target, so it collapses to the icon rather than shouting "Help". */
.sb.is-open .sb__launcher-label { display: none; }
.sb.is-open .sb__launcher { padding: 14px; }

/* ---------------------------------------------------------------- *
 * Panel
 * ---------------------------------------------------------------- */

.sb__panel {
  width: min(392px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 32px 80px rgba(13, 24, 34, .22);
  animation: sb-in .18s ease-out;
}

.sb__panel[hidden] { display: none; }

@keyframes sb-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.sb__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 16px 20px;
  background: var(--navy);
  color: #fff;
}

.sb__head-text { display: flex; flex-direction: column; line-height: 1.3; }
.sb__head-text strong { font-size: 15.5px; font-weight: 700; }
.sb__head-text span { font-size: 12.5px; color: rgba(255, 255, 255, .68); }

.sb__close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sb__close:hover { background: rgba(255, 255, 255, .22); }

/* ---------------------------------------------------------------- *
 * Log
 * ---------------------------------------------------------------- */

.sb__log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--bg-hero);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sb__log::-webkit-scrollbar { width: 6px; }
.sb__log::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.sb__msg { max-width: 88%; }
.sb__msg p {
  margin: 0;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
}

.sb__msg--bot { align-self: flex-start; }
.sb__msg--bot p {
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  color: var(--ink);
}

.sb__msg--user { align-self: flex-end; }
.sb__msg--user p {
  background: var(--grad-green);
  border-bottom-right-radius: 5px;
  color: #04231a;
  font-weight: 600;
}

.sb__contact { margin-top: 8px !important; background: transparent !important; border: 0 !important; padding: 0 !important; }
.sb__contact a { color: var(--green-ink); font-weight: 700; }

/* ---------------------------------------------------------------- *
 * Result cards
 * ---------------------------------------------------------------- */

.sb__results { display: flex; flex-direction: column; gap: 9px; }

.sb__card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.sb__card:hover {
  border-color: var(--green);
  box-shadow: 0 10px 26px rgba(18, 40, 35, .1);
  transform: translateY(-1px);
}

.sb__card-thumb {
  flex: none;
  width: 58px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-hero);
  border: 1px solid var(--line);
}

.sb__card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sb__card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.sb__card-body strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.sb__card-snip {
  font-family: var(--font-para);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  /* Two lines is enough to confirm the match without turning the card into the
     answer — the guide page is the answer. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------------- *
 * Suggestion chips
 * ---------------------------------------------------------------- */

.sb__chips { display: flex; flex-wrap: wrap; gap: 7px; }

.sb__chip {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--green-ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}

.sb__chip:hover { background: rgba(22, 217, 152, .1); border-color: var(--green); }

/* ---------------------------------------------------------------- *
 * Composer
 * ---------------------------------------------------------------- */

.sb__form {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--white);
  border-top: 1px solid var(--line);
}

.sb__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.sb__input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 217, 152, .16);
}

.sb__send {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--grad-green);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sb__send svg { width: 19px; height: 19px; fill: #04231a; }
.sb__send:hover { filter: brightness(1.05); }

/* ---------------------------------------------------------------- *
 * Small screens
 * ---------------------------------------------------------------- */

@media (max-width: 520px) {
  .sb { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .sb__panel { width: 100%; height: min(72vh, 540px); }
  .sb__launcher { align-self: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .sb__panel { animation: none; }
  .sb__launcher, .sb__card { transition: none; }
}
