/*
 * Webiyo site chat widget (wchat-).
 * Floating assistant launcher + panel, wired to the n8n "Webiyo site chat"
 * workflow. Matches the live site: Inter Tight at light weights, white
 * surfaces with a 1px line and a soft shadow (like the header pill), the
 * coral gradient button, and nothing heavy. Small and quiet on purpose.
 * Site tokens are scoped per page, so this file carries its own copies.
 */

@font-face{font-family:"Inter Tight";font-style:normal;font-weight:400 600;font-display:swap;src:url("/fonts/inter-tight.woff2") format("woff2")}

.wchat-root {
  --wchat-ink: #0D0A12;
  --wchat-soft: #6B7280;
  --wchat-line: #E7E7E4;
  --wchat-bubble: #F1F2F6;
  --wchat-ease: cubic-bezier(.16, 1, .3, 1);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  font-family: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--wchat-ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- launcher ---------- */

.wchat-launcher {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--wchat-ink);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 32px -12px rgb(11 14 20 / .5);
  transition: transform .3s var(--wchat-ease), box-shadow .3s var(--wchat-ease);
}

.wchat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px -12px rgb(11 14 20 / .55);
}

.wchat-launcher:focus-visible {
  outline: 2px solid var(--wchat-ink);
  outline-offset: 3px;
}

.wchat-launcher-icon {
  display: grid;
  place-items: center;
}

.wchat-launcher-icon svg {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  transition: opacity .25s ease, transform .35s var(--wchat-ease);
}

.wchat-launcher-icon .wchat-x {
  opacity: 0;
  transform: rotate(-45deg) scale(.6);
}

.wchat-root[data-open="true"] .wchat-launcher-icon .wchat-chat-icon {
  opacity: 0;
  transform: rotate(45deg) scale(.6);
}

.wchat-root[data-open="true"] .wchat-launcher-icon .wchat-x {
  opacity: 1;
  transform: none;
}

.wchat-nudge {
  position: absolute;
  right: 4px;
  bottom: calc(100% + 12px);
  width: max-content;
  max-width: 240px;
  padding: .55rem .85rem;
  background: #fff;
  border: 1px solid var(--wchat-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px -14px rgb(11 14 20 / .25);
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .4s var(--wchat-ease), transform .4s var(--wchat-ease);
  pointer-events: none;
}

.wchat-nudge.show {
  opacity: 1;
  transform: none;
}

.wchat-nudge::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-right: 1px solid var(--wchat-line);
  border-bottom: 1px solid var(--wchat-line);
  transform: rotate(45deg);
}

/* ---------- panel ---------- */

.wchat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: 330px;
  max-width: calc(100vw - 40px);
  height: 440px;
  max-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--wchat-line);
  border-radius: 16px;
  box-shadow: 0 9px 32px rgb(11 14 20 / .12), 0 30px 60px -30px rgb(11 14 20 / .25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .4s var(--wchat-ease), transform .4s var(--wchat-ease), visibility 0s .4s;
}

.wchat-root[data-open="true"] .wchat-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .4s var(--wchat-ease), transform .4s var(--wchat-ease), visibility 0s;
}

/* header: plain white, logo mark and name */
.wchat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .45rem .5rem .75rem;
  background: #fff;
  border-bottom: 1px solid var(--wchat-line);
}

.wchat-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.wchat-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.wchat-head-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wchat-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 560;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.wchat-sub {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  color: var(--wchat-soft);
}

.wchat-head-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.wchat-close,
.wchat-new {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--wchat-soft);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.wchat-close:hover,
.wchat-new:hover {
  background: var(--wchat-bubble);
  color: var(--wchat-ink);
}

.wchat-close:focus-visible,
.wchat-new:focus-visible {
  outline: 2px solid var(--wchat-ink);
  outline-offset: 1px;
}

.wchat-close svg,
.wchat-new svg {
  width: 13px;
  height: 13px;
}

/* ---------- messages ---------- */

.wchat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .75rem .75rem .4rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgb(11 14 20 / .16) transparent;
}

.wchat-body::-webkit-scrollbar {
  width: 5px;
}

.wchat-body::-webkit-scrollbar-track {
  background: transparent;
}

.wchat-body::-webkit-scrollbar-thumb {
  background: rgb(11 14 20 / .14);
  border-radius: 999px;
}

.wchat-msg {
  max-width: 88%;
  padding: .4rem .65rem;
  font-size: 13px;
  line-height: 1.45;
  animation: wchat-pop .4s cubic-bezier(.2, .9, .3, 1.2);
  overflow-wrap: break-word;
}

.wchat-msg p {
  margin: 0;
}

.wchat-msg p + p {
  margin-top: .5em;
}

/* assistant: soft grey bubble */
.wchat-bot {
  align-self: flex-start;
  background: var(--wchat-bubble);
  color: var(--wchat-ink);
  border-radius: 14px 14px 14px 4px;
}

/* visitor: ink */
.wchat-user {
  align-self: flex-end;
  background: var(--wchat-ink);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.wchat-msg a {
  color: inherit;
  font-weight: 560;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wchat-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: .75rem .85rem;
  background: var(--wchat-bubble);
  border-radius: 14px 14px 14px 4px;
}

.wchat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--wchat-soft);
  opacity: .4;
  animation: wchat-blink 1.2s ease infinite;
}

.wchat-typing span:nth-child(2) { animation-delay: .15s; }
.wchat-typing span:nth-child(3) { animation-delay: .3s; }

/* ---------- starter questions: small outlined pills ---------- */

.wchat-chips {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: 0 .75rem .55rem;
  background: #fff;
}

.wchat-chips[hidden] {
  display: none;
}

.wchat-chip {
  padding: .3rem .6rem;
  border: 1px solid var(--wchat-line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--wchat-ink);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.wchat-chip:hover {
  border-color: var(--wchat-ink);
  background: var(--wchat-bubble);
}

.wchat-chip:focus-visible {
  outline: 2px solid var(--wchat-ink);
  outline-offset: 2px;
}

/* ---------- input ---------- */

.wchat-foot {
  flex: none;
  padding: .15rem .65rem .5rem;
  background: #fff;
}

.wchat-form {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .2rem .2rem .7rem;
  border: 1px solid var(--wchat-line);
  border-radius: 10px;
  background: #fff;
  transition: border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.wchat-form:focus-within {
  border-color: #B9BBC4;
}

.wchat-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--wchat-ink);
  outline: none;
  -webkit-tap-highlight-color: transparent;
  padding: .4rem 0;
}

.wchat-input:focus {
  outline: none;
  box-shadow: none;
}

.wchat-input::placeholder {
  color: #9CA3AF;
}

/* send: the site's coral gradient button, scaled down */
.wchat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0.67px solid rgb(197 77 46 / .7);
  border-radius: 7px;
  background: linear-gradient(rgb(238, 124, 85), rgb(225, 101, 64));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .2), 0 1px 2px rgb(0 0 0 / .06);
  color: #fff;
  cursor: pointer;
  transition: filter .2s ease, transform .2s var(--wchat-ease), opacity .2s ease;
}

.wchat-send:hover {
  filter: brightness(.95);
}

.wchat-send:active {
  transform: scale(.94);
}

.wchat-send:focus-visible {
  outline: 2px solid var(--wchat-ink);
  outline-offset: 2px;
}

.wchat-send svg {
  width: 14px;
  height: 14px;
}

.wchat-send:disabled {
  opacity: .4;
  cursor: default;
  transform: none;
}

.wchat-proof {
  margin: .35rem 0 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: #9CA3AF;
  text-align: center;
}

/* ---------- motion ---------- */

@keyframes wchat-pop {
  from { opacity: 0; transform: translateY(6px); }
}

@keyframes wchat-blink {
  0%, 100% { opacity: .35; transform: none; }
  50% { opacity: 1; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .wchat-typing span {
    animation: none;
  }
  .wchat-panel,
  .wchat-launcher,
  .wchat-launcher-icon svg,
  .wchat-nudge,
  .wchat-msg {
    transition: none;
    animation: none;
  }
  .wchat-body {
    scroll-behavior: auto;
  }
  .wchat-root[data-open="true"] .wchat-panel {
    transform: none;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .wchat-root {
    right: 14px;
    bottom: 14px;
  }
  body:has(.stickycta.is-show) .wchat-root[data-open="false"] {
    bottom: 84px;
  }
}

@media (max-width: 480px) {
  .wchat-input {
    font-size: 16px; /* 16px+ stops iOS zooming the page on focus */
  }
  .wchat-panel {
    position: fixed;
    right: 14px;
    bottom: 72px;
    width: min(330px, calc(100vw - 28px));
    max-width: none;
    height: min(440px, calc(100dvh - 100px));
    max-height: none;
  }
  .wchat-nudge {
    right: 0;
  }
}
