/* The widget's whole appearance. Every colour is a variable, every variable is
   defined twice, and the second definition is the dark scheme. The numbers are
   the ones the approved wireframes were drawn to: a 380 by 560 panel, a 48px
   head row, 13.5px in the conversation, 12.5px on a link card.

   Everything is prefixed hb- and everything sits inside .hb-root, because this
   stylesheet is loaded onto somebody else's page and may not touch a single
   element it did not draw. */

.hb-root {
  --hb-panel: #ffffff;
  --hb-sunken: #f4f4f2;
  --hb-hover: #efefed;
  --hb-ink: #111111;
  --hb-ink2: #2e2e2c;
  --hb-muted: #6b6b68;
  --hb-faint: #8f8f8b;
  --hb-line: #e7e7e5;
  --hb-line2: #d4d4d1;
  --hb-accent: #2450d8;
  --hb-mark: #c81e3a;
  --hb-radius-ctl: 8px;
  --hb-radius-card: 10px;
  --hb-radius-panel: 16px;
  --hb-shadow: 0 12px 36px rgba(0, 0, 0, .14);
  --hb-font: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: var(--hb-font);
  color: var(--hb-ink2);
  font-size: 13.5px;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  .hb-root {
    --hb-panel: #1b1b1b;
    --hb-sunken: #242424;
    --hb-hover: #2c2c2c;
    --hb-ink: #f0efec;
    --hb-ink2: #dedcd7;
    --hb-muted: #a3a29d;
    --hb-faint: #85847f;
    --hb-line: #333331;
    --hb-line2: #444442;
    --hb-accent: #8ba7ff;
    --hb-shadow: 0 12px 36px rgba(0, 0, 0, .5);
  }
}

.hb-root * { box-sizing: border-box; }
.hb-root button { font: inherit; color: inherit; cursor: pointer; }

.hb-srOnly {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The panel. */
.hb-panel {
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 48px);
  background: var(--hb-panel);
  border: 1px solid var(--hb-line2);
  border-radius: var(--hb-radius-panel);
  box-shadow: var(--hb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hb-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--hb-line);
}
.hb-headText { min-width: 0; flex: 1; }
.hb-headText b { display: block; font-size: 14px; font-weight: 600; color: var(--hb-ink); }
.hb-headText small { display: block; font-size: 11.5px; color: var(--hb-muted); line-height: 1.4; margin-top: 2px; }

.hb-icon {
  flex: none;
  width: 44px; height: 44px; margin: -10px -8px -10px 0;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--hb-radius-ctl);
  color: var(--hb-muted);
}
.hb-icon:hover { background: var(--hb-hover); color: var(--hb-ink); }
.hb-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.hb-body {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.hb-body:focus-visible { outline: 2px solid var(--hb-accent); outline-offset: -2px; }

/** The live region: what a screen reader is told, and what nobody sees.
 *
 *  It has to be in the document and it has to have a box, because a region
 *  with `display: none` is announced by nothing. Without these seven lines it
 *  is an ordinary block in a flex column, so it takes the answer's height, the
 *  conversation above it is squeezed to nothing, and the customer reads the
 *  answer's raw markdown painted over the panel. That is what it did. */
.hb-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.hb-you {
  align-self: flex-end;
  max-width: 288px;
  padding: 8px 12px;
  background: var(--hb-sunken);
  border-radius: 14px 14px 4px 14px;
  color: var(--hb-ink);
}

.hb-answer > p { margin: 0 0 8px; }
.hb-answer > p:last-child { margin-bottom: 0; }
.hb-answer strong { font-weight: 600; color: var(--hb-ink); }
.hb-answer code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--hb-sunken); padding: 1px 4px; border-radius: 4px; }
.hb-answer a { color: var(--hb-accent); text-decoration: underline; }
.hb-answer ol, .hb-answer ul { margin: 0 0 8px; padding-left: 20px; }
.hb-answer li { margin: 0 0 4px; }
.hb-contact { color: var(--hb-muted); font-size: 12.5px; }

/* A link into the docs. */
.hb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-top: 7px;
  border: 1px solid var(--hb-line); border-radius: var(--hb-radius-ctl);
  background: var(--hb-panel); text-decoration: none; color: inherit;
  min-height: 44px;
}
.hb-link:hover { background: var(--hb-hover); }
.hb-link > i { width: 26px; height: 26px; border-radius: 7px; background: var(--hb-sunken); border: 1px solid var(--hb-line); display: grid; place-items: center; flex: none; color: var(--hb-muted); }
.hb-link > i svg, .hb-link > svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hb-link > i svg { width: 13px; height: 13px; }
.hb-link > svg { margin-left: auto; width: 12px; height: 12px; color: var(--hb-faint); flex: none; }
.hb-link span { min-width: 0; }
.hb-link b { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.35; color: var(--hb-ink); }
.hb-link small { display: block; font-size: 11.5px; color: var(--hb-muted); line-height: 1.4; margin-top: 1px; }

.hb-sources { margin-top: 8px; }
.hb-sources summary { font-size: 12px; color: var(--hb-muted); cursor: pointer; padding: 6px 0; min-height: 44px; display: flex; align-items: center; }
.hb-sources summary:hover { color: var(--hb-ink); }
/** The cards inside the fold. The first one would otherwise sit against the
 *  summary, because a link card spaces itself from the card above it and the
 *  first card has no card above it. */
.hb-sourceList { display: block; padding-bottom: 2px; }
.hb-sourceList .hb-link:first-child { margin-top: 2px; }

.hb-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--hb-muted); margin-top: 10px; }
.hb-quiet {
  min-height: 26px; padding: 4px 8px; font-size: 12px;
  background: none; border: 0; border-radius: 6px; color: var(--hb-muted);
}
.hb-quiet:hover { background: var(--hb-hover); color: var(--hb-ink); }

/* Screenshots with their markers. */
.hb-shot { margin: 10px 0 0; }
.hb-shotFrame { position: relative; display: block; border: 1px solid var(--hb-line); border-radius: var(--hb-radius-card); overflow: hidden; }
.hb-shotFrame img { display: block; width: 100%; height: auto; }
.hb-shot figcaption { font-size: 11.5px; color: var(--hb-muted); margin-top: 5px; line-height: 1.45; }

/** The key to the numbers on the picture. Without it the red boxes are three
 *  rectangles and a customer has no way to know why any of them was drawn. */
.hb-legend { list-style: none; margin: 5px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.hb-legend li { display: flex; align-items: flex-start; gap: 6px; }
.hb-key {
  flex: none; min-width: 15px; height: 15px; padding: 0 4px;
  background: var(--hb-mark); color: #fff; border-radius: 999px;
  font-size: 10px; line-height: 15px; text-align: center; font-weight: 600;
}
.hb-frame { position: absolute; border: 2px solid var(--hb-mark); border-radius: 3px; pointer-events: none; }
.hb-badge {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--hb-mark); color: #fff; border-radius: 999px;
  font-size: 11px; line-height: 17px; text-align: center; font-weight: 600;
  pointer-events: none;
}
.hb-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hb-arrows line { stroke: var(--hb-mark); stroke-width: .6; vector-effect: non-scaling-stroke; }

/* The introduction card. */
.hb-intro { border: 1px solid var(--hb-line); border-radius: var(--hb-radius-card); padding: 12px 14px; background: var(--hb-sunken); }
.hb-intro b { display: block; font-size: 13px; font-weight: 600; color: var(--hb-ink); }
.hb-intro p { margin: 6px 0 0; font-size: 12.5px; color: var(--hb-muted); }
.hb-introNot { color: var(--hb-faint); }
.hb-introLabel { display: block; margin-top: 10px; font-size: 11.5px; color: var(--hb-faint); text-transform: uppercase; letter-spacing: .06em; }
.hb-examples { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.hb-example {
  text-align: left; font-size: 12.5px; padding: 9px 10px; min-height: 44px;
  background: var(--hb-panel); border: 1px solid var(--hb-line); border-radius: var(--hb-radius-ctl); color: var(--hb-ink);
}
.hb-example:hover { background: var(--hb-hover); }

/* The composer. */
.hb-composer { flex: none; padding: 0 12px 12px; }
/** The one field a customer types in.
 *
 *  `font-family: inherit` is not decoration. A textarea does not inherit the
 *  page's font the way a paragraph does: left alone it renders in the
 *  browser's own default, which is monospace. Every other surface here is
 *  Inter, so the question a customer is typing was the one piece of text in
 *  the panel in a different typeface. Buttons have the same habit and are
 *  handled by the `font: inherit` on `.hb-root button` above.
 */
.hb-input {
  width: 100%; resize: none; min-height: 44px; max-height: 120px;
  padding: 11px 12px; font-family: inherit; font-size: 13.5px; line-height: 1.5;
  color: var(--hb-ink); background: var(--hb-panel);
  border: 1px solid var(--hb-line2); border-radius: 16px 16px 4px 16px;
}
.hb-input::placeholder { color: var(--hb-faint); }
.hb-input:focus-visible { outline: 2px solid var(--hb-accent); outline-offset: 1px; }
.hb-composerRow { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.hb-send {
  margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--hb-ink); color: var(--hb-panel); border: 0; border-radius: 999px;
}
.hb-send svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hb-send:hover { opacity: .88; }

.hb-pending { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--hb-muted); }
.hb-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--hb-faint); animation: hb-pulse 1.1s ease-in-out infinite; }
@keyframes hb-pulse { 0%, 100% { opacity: .3 } 50% { opacity: 1 } }

.hb-failed { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--hb-muted); }
/** The jump button: in the column, not floating over it.
 *
 *  It was absolutely positioned 88px above the bottom of the widget, which is
 *  inside the composer: the composer is 106px tall with an empty box and
 *  taller once the textarea grows, so the pill sat on the text field and on
 *  the last line of the answer at the same time. The button is inserted
 *  between the transcript and the composer, so as an ordinary item of that
 *  column it lands between them at every composer height and covers neither.
 *  The transcript is `flex: 1` and gives up the 40px.
 */
.hb-jump {
  flex: none; align-self: center; margin-bottom: 8px;
  padding: 7px 12px; min-height: 32px; font-size: 12px;
  background: var(--hb-ink); color: var(--hb-panel); border: 0; border-radius: 999px;
}

.hb-chats { display: flex; flex-direction: column; gap: 4px; }
.hb-chatRow { display: flex; align-items: center; gap: 4px; }
.hb-chatOpen {
  flex: 1; text-align: left; min-width: 0; min-height: 44px; padding: 8px 10px;
  background: none; border: 1px solid var(--hb-line); border-radius: var(--hb-radius-ctl);
}
.hb-chatOpen:hover { background: var(--hb-hover); }
.hb-chatOpen b { display: block; font-size: 12.5px; font-weight: 500; color: var(--hb-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-chatOpen small { display: block; font-size: 11px; color: var(--hb-faint); }

/* The launcher, the minimised bar and the teaser. */
.hb-launch, .hb-bar {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: var(--hb-ink); color: var(--hb-panel);
  border: 0; border-radius: 999px; box-shadow: var(--hb-shadow);
  font-size: 13px; font-weight: 500;
}
.hb-bar { border-radius: var(--hb-radius-ctl); }
.hb-launch svg, .hb-bar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hb-launch:hover, .hb-bar:hover { opacity: .9; }

.hb-teaser {
  position: absolute; right: 0; bottom: 56px; width: 230px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 12.5px;
  background: var(--hb-panel); color: var(--hb-ink);
  border: 1px solid var(--hb-line2); border-radius: var(--hb-radius-card);
  box-shadow: var(--hb-shadow);
}

/* The lightbox. */
.hb-lightbox {
  position: fixed; inset: 0; z-index: 2147483001;
  display: grid; place-items: center; padding: 32px;
  background: rgba(17, 17, 17, .72);
}
.hb-lightInner { max-width: min(1100px, 92vw); }
.hb-lightInner p { color: #f0efec; font-size: 13px; margin: 10px 0 0; }
.hb-lightInner .hb-shotFrame { border-color: rgba(255, 255, 255, .2); }
.hb-lightClose { position: absolute; top: 16px; right: 16px; color: #f0efec; margin: 0; }
.hb-lightClose:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* Inside the product the panel sits a little tighter to the corner, which is
   what the approved frame draws. */
.hb-inProduct { }
.hb-root:has(.hb-inProduct) { right: 20px; bottom: 20px; }

@media (max-width: 460px) {
  .hb-root { right: 8px; bottom: 8px; left: 8px; }
  .hb-panel { width: 100%; height: calc(100vh - 32px); }
  .hb-you { max-width: 82%; }
  .hb-teaser { width: auto; left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-root *, .hb-root *::before, .hb-root *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
