@font-face {
    font-family: "Baru Sans";
    src: url("font/BaruSans-SemiBold.woff") format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Baru Sans";
    src: url("font/BaruSans-Light.woff") format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

/* Variables */
.evai-shell {
  --evai-black: #1c1c1c;
  --evai-white: #ffffff;
  --evai-light-gray: #eaeaea;
  --evai-medium-gray: #cdcdcd;
  --evai-dark-gray: #9b9b9b;
  --evai-transp-white-10: rgba(255, 255, 255, 0.1);

  --evai-rad-2: 0.125em;
  --evai-rad-4: 0.25em;
  --evai-rad-6: 0.375em;
  --evai-rad-12: 0.75em;

  --evai-pad-4: 0.25em;
  --evai-pad-6: 0.375em;
  --evai-pad-8: 0.5em;
  --evai-pad-10: 0.625em;
  --evai-pad-12: 0.75em;
  --evai-pad-20: 1.25em;
  --evai-pad-24: 1.5em;

  --evai-gap-4: 0.25em;
  --evai-gap-8: 0.5em;
  --evai-gap-12: 0.75em;
  --evai-gap-24: 1.5em;

  height: 100%;

  /* Local equivalent of the host site's fluid-scale script (html{font-size:...}),
     but tied to .evai-shell instead of html — doesn't depend on whether the
     host's script actually reaches this document/container */
  font-size: calc(100vw / 1244 * 14);
}

@media (max-width: 980px) {
  .evai-shell {
    font-size: calc(100vw / 375 * 12);
  }
}

@media (max-width: 480px) {
  .evai-shell {
    font-size: calc(100vw / 375 * 18);
  }
}

body {
    display: block;
    margin: 0em;
}

/* Chat Button */
.evai-chat-button {
  width: 2.75em;
  height: 2.75em;
  padding: var(--evai-pad-10);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: none;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  background: transparent;
  cursor: pointer;
}

.evai-chat-button__icon {
  width: 1.5em;
  height: 1.5em;
  border-radius: var(--evai-rad-4);
  background-color: var(--evai-light-gray);
  color: var(--evai-black);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.20s ease, color 0.20s ease;
}

.evai-chat-button__icon svg {
  display: block;
  width: 0.625em;
  height: 0.75em;
}

.evai-chat-button.is-active .evai-chat-button__icon {
  background-color: var(--evai-black);
  color: var(--evai-white);
}

/* Limit Counter Button */
.evai-counter-btn {
  width: 1.625em;
  height: 1.625em;
  padding: var(--evai-pad-6);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  background: transparent;
  border-radius: var(--evai-rad-2);
  cursor: pointer;
}

.evai-counter-btn__icon {
  width: 0.875em;
  height: 0.875em;
  border-radius: var(--evai-rad-2);
  color: var(--evai-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.evai-counter-btn__icon svg {
  display: block;
  width: 0.5em;
  height: 0.5em;
}

.evai-counter-btn:hover .evai-counter-btn__icon {
  background-color: var(--evai-transp-white-10);
}

/* Suggested Question Box */
.evai-sgd-q {
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  width: calc(100% - (2 * var(--evai-pad-20)));
  margin-inline: var(--evai-pad-20);
  display: flex;
  align-items: flex-start;
  gap: var(--evai-gap-4);
  padding: var(--evai-pad-8);
  border-radius: var(--evai-rad-4);
  background: var(--evai-light-gray);
  border: 0.0625em solid var(--evai-light-gray);
  color: var(--evai-dark-gray);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-align: left;
}

.evai-sgd-q:hover {
  border-color: var(--evai-medium-gray);
}

.evai-sgd-q__icon {
  width: 0.875em;
  height: 0.875em;
  flex-shrink: 0;
  /* .evai-sgd-q is align-items:flex-start (so a 2-line question doesn't
     center the icon against the whole block) — this nudges the icon down
     by half the gap between its own height and the text's line-height
     (0.75em × 140% = 1.05em), so it lines up with the first line only */
  margin-top: 0.0875em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.evai-sgd-q__icon svg {
  display: block;
  width: 0.5em;
  height: 0.4375em;
}

.evai-sgd-q__text {
  margin: 0em;
  font-size: 0.75em;
  line-height: 140%;
  letter-spacing: -0.01em;
  /* flex items default to min-width:auto, which can stop this text from
     shrinking/wrapping properly inside the row and throw off the row's
     height/alignment once it needs 2 lines — this lets it wrap normally */
  min-width: 0em;
}

/* Suggested Question Line */
.evai-sgd-line {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--evai-gap-8);
}

/* Chat Log Greeting (chat-log-line / chat-log-box / h1) */
.chat-log-line {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--evai-gap-8);
  padding-inline: var(--evai-pad-20);
}

.chat-log-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-log-box h1 {
  width: 100%;
  margin: 0em;
  font-family: "Baru Sans", sans-serif;
  font-weight: 600;
  font-size: 1.5em;
  line-height: 110%;
  letter-spacing: -0.04em;
  color: var(--evai-black);
}

/* Response content (inside .chat-log-line): text / link */

.response-text {
  width: 100%;
  margin: 0em;
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  font-size: 0.75em;
  line-height: 140%;
  letter-spacing: -0.02em;
  color: var(--evai-black);
}

.response-text a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.response-text strong {
  font-weight: 600;
}

.response-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--evai-gap-4);
}

.response-link__text {
  margin: 0em;
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  font-size: 0.75em;
  line-height: 140%;
  letter-spacing: -0.01em;
  color: var(--evai-black);
  white-space: nowrap;
}

.link-button {
  display: flex;
  align-items: center;
  justify-content: center;
  /* pad-4/pad-6/rad-2 are recomputed relative to THIS element's OWN font-size
     (0.6875em), not .evai-shell's — otherwise, with a local font-size on this
     same element, the sizes would collapse (em would compound on itself) */
  padding: 0.36363636em 0.54545455em;
  border-radius: 0.18181818em;
  background: var(--evai-light-gray);
  color: var(--evai-black);
  text-decoration: none;
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  font-size: 0.6875em;
  line-height: 100%;
  letter-spacing: 0em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.link-button:hover {
  background-color: var(--evai-medium-gray);
}

.response-link-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--evai-gap-8);
}

/* Question bubble (the user's question) */
.question-log-line {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-left: var(--evai-pad-20);
  padding-right: var(--evai-pad-20);
}

.question-box {
  max-width: 15em;
  padding: var(--evai-pad-12);
  border-radius: var(--evai-rad-12) var(--evai-rad-4) var(--evai-rad-12) var(--evai-rad-12);
  background: var(--evai-light-gray);
}

.question-box__text {
  margin: 0em;
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  font-size: 0.75em;
  line-height: 140%;
  letter-spacing: -0.02em;
  color: var(--evai-black);
}

/* AI Chat Box (limit bar + input line) */
.evai-chat-box {
  position: absolute;
  bottom: 0em;
  width: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-inline: var(--evai-pad-8);
  padding-block-end: var(--evai-pad-8);
  background-color: var(--evai-white);
  /* own bottom radius matching .evai-shell's — this is a position:absolute,
     z-indexed, scrollable layer, so Chrome can promote it to its own
     composited layer and occasionally skip the parent's overflow:hidden
     clip for a frame, making the corner flicker between round and square.
     Rounding it here too means it looks right even if that clip glitches */
  border-radius: 0em 0em var(--evai-rad-12) var(--evai-rad-12);
  /* so a grown input doesn't take over the whole screen — beyond this, a
     standard internal scroll kicks in, no visible scrollbar (same trick as
     on the input itself). Covers even the worst case (limit bar open + input
     at all 4 lines): limit-body (2.75) + padding-block-end (0.5) + input-line
     border (0.125) + input at max (7.93333334 self-em × 0.75 = 5.95 shell-em)
     = 9.325em, rounded up with a small margin to 9.5em */
  max-height: 9.5em;
  overflow-y: auto;
  scrollbar-width: none;
}

.evai-chat-box::-webkit-scrollbar {
  display: none;
}


.evai-chat-box__limit-body {
  width: calc(100% - (2 * var(--evai-pad-12)));
  max-height: 2.75em;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-inline: var(--evai-pad-12);
  padding-left: var(--evai-pad-8);
  background-color: var(--evai-black);
  border-radius: var(--evai-rad-6) var(--evai-rad-6) 0em 0em;
  /* Mask reveal out: the content is "erased" by a mask top-to-bottom (clip-path),
     the round radius matches the block's own border-radius so the mask doesn't
     cut the rounded corners with a straight square edge.
     max-height collapses the layout in sync (needed for --evai-chat-box-h from JS) */
  clip-path: inset(0% 0 0 0 round var(--evai-rad-6) var(--evai-rad-6) 0em 0em);
  transition: max-height 0.2s ease-in-out, clip-path 0.2s ease-in-out;
}

.evai-chat-box__limit-body.is-hidden {
  max-height: 0em;
  clip-path: inset(100% 0 0 0 round var(--evai-rad-6) var(--evai-rad-6) 0em 0em);
  pointer-events: none;
}

.evai-chat-box__limit-text {
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  font-size: 0.625em;
  line-height: 110%;
  /* letter-spacing and gap are recomputed relative to THIS element's OWN font-size (0.625em) */
  letter-spacing: 0em;
  color: var(--evai-white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
}

.evai-chat-box__limit-text p {
  margin: 0em;
}

.evai-chat-box__input-line {
  width: 100%;
  height: auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
  background: var(--evai-white);
  border: 0.0625em solid var(--evai-light-gray);
  border-radius: var(--evai-rad-6);
}

.evai-chat-box__input {
  font-family: "Baru Sans", sans-serif;
  font-weight: 300;
  font-size: 0.75em;
  line-height: 140%;
  /* letter-spacing and padding are recomputed relative to THIS element's OWN font-size (0.75em) */
  letter-spacing: -0.02em;
  color: var(--evai-black);
  flex: 1 0 0em;
  min-width: 0em;
  padding-block: 1.16666667em;
  padding-inline-start: 1.16666667em;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  /* height grows with content (see autoGrowInput in widget.js), beyond
     max-height a normal internal textarea scroll takes over, but without a
     visible native scrollbar (scrolling by wheel/keyboard still works).
     Tuned so EXACTLY 4 full lines fit with top/bottom padding, no clipped
     5th line: padding-block (2 × 1.16666667) + 4 × line-height (140% of
     font-size, i.e. 1.4em) = 2.33333334 + 5.6 = 7.93333334em.
     .evai-chat-box is tuned to match this (see below) */
  max-height: 7.93333334em;
  overflow-y: auto;
  scrollbar-width: none;
}

.evai-chat-box__input::-webkit-scrollbar {
  display: none;
}

.evai-chat-box__input::placeholder {
  color: var(--evai-medium-gray);
}

.evai-chat-log {
  width: 100%;
  height: 100%;
  /* --evai-chat-box-h is set from widget.js onto .evai-shell — the actual height
     of .evai-chat-box, which changes when the limit bar collapses; 6.375em is
     a fallback value in case JS hasn't computed it yet (before the first render) */
  padding-block-end: calc(var(--evai-chat-box-h, 6.375em) + 1.5em);
  overflow-y: auto;
  /* We draw our own scrollbar (.evai-scrollbar) on top — the native one is hidden,
     but actual scrolling (wheel/trackpad/keyboard) still happens on this element */
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 0 0em;
  align-self: stretch;
}

.evai-chat-log::-webkit-scrollbar {
  display: none;
}

/* Custom scrollbar — its bottom edge follows the dynamic height of
   .evai-chat-box (see --evai-chat-box-h) */
.evai-scrollbar {
  position: absolute;
  top: 1em;
  bottom: var(--evai-chat-box-h, 6.375em);
  right: 0em;
  width: 0.75em;
  padding-right: 0.1875em;
  display: none;
  justify-content: flex-end;
  z-index: 11;
  pointer-events: none;
}

.evai-scrollbar.is-visible {
  display: flex;
}

.evai-scrollbar__thumb {
  width: 0.3125em;
  border-radius: var(--evai-rad-12);
  background: var(--evai-light-gray);
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
}

.evai-scrollbar__thumb:active {
  cursor: grabbing;
}

.evai-chat-log__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--evai-gap-24);
  align-self: stretch;
  padding-block-start: var(--evai-pad-24);
  /* without flex-shrink:0, the .evai-chat-log container would compress the
     content instead of letting it overflow and trigger a scroll */
  flex-shrink: 0;
  /* margin-top:auto instead of justify-content:flex-end on .evai-chat-log —
     this still pins content to the bottom when it's shorter than the window,
     but when it overflows (lots of messages) the browser computes scrollHeight
     correctly and a real scroll appears — with justify-content:flex-end on a
     scrolling container, part of the start-direction "overflow" content
     wasn't counted in scrollHeight (a known flexbox + overflow quirk) */
  margin-top: auto;
}

/* Base styles — a starting point. Adjust colors/fonts to match the site's brand */

.evai-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  font-family: "Baru Sans", sans-serif;
  background: var(--evai-white);
  color: var(--evai-black);
  box-sizing: border-box;
  border: 0.0625em solid var(--evai-light-gray);
  border-radius: var(--evai-rad-12);
  overflow: hidden;
}

.evai-shell * {
  box-sizing: border-box;
}

.evai-typing-dots {
  display: flex;
  align-items: center;
  gap: 0.25em;
  padding-block: 0.25em;
}

.evai-typing-dots span {
  width: 0.375em;
  height: 0.375em;
  border-radius: 50%;
  background-color: var(--evai-black);
  animation: evai-typing-bounce 1.2s ease-in-out infinite;
}

.evai-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.evai-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes evai-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0em);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-0.25em);
    opacity: 1;
  }
}
