/* Optional website chat layout. Loaded after site styles to coordinate chat
   and consent geometry without changing analytics choice behavior. */
.website-chat {
  position: fixed;
  z-index: 80;
  left: 16px;
  bottom: calc(var(--website-chat-viewport-bottom, 0px) + var(--website-chat-consent-space, 0px) + max(16px, env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: min(320px, calc(100vw - 32px));
  max-height: calc(var(--website-chat-viewport-height, 100dvh) - var(--website-chat-consent-space, 0px) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #fff;
  font: 400 13px/1.5 var(--sans, 'Inter', sans-serif);
}

.website-chat > * { flex-shrink: 0; }

.website-chat[hidden],
.website-chat [hidden],
.website-chat-close[hidden] {
  display: none !important;
}

.website-chat-note,
.website-chat-status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #8c9bb266;
  border-radius: 10px;
  background: #16100cf2;
  color: #e3d8d1;
  font-size: 12px;
  line-height: 1.5;
}

.website-chat-status {
  color: #ffd7b8;
}

.website-chat a {
  color: #ffac70;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.website-chat:focus-visible,
.website-chat-close:focus-visible,
.website-chat a:focus-visible,
#website-chat-fallback:focus-visible,
.website-chat-launcher:focus-visible {
  outline: 2px solid #ffac70;
  outline-offset: 2px;
}

.website-chat-launcher {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #ffac70;
  border-radius: 999px;
  background: #ffac70;
  color: #16100c;
  font: 600 14px/1.2 var(--sans, 'Inter', sans-serif);
  cursor: pointer;
}

.website-chat-launcher:hover {
  background: #ffc196;
}

.website-chat-launcher[aria-busy='true'] {
  opacity: 0.65;
  cursor: progress;
}

/* Geometry only: cookie choice and measurement behavior remain analytics-owned.
   Cap the consent surface so both it and chat can scroll in short viewports. */
html[data-website-chat] .analytics-banner {
  bottom: calc(var(--website-chat-viewport-bottom, 0px) + 16px);
  max-height: calc((var(--website-chat-viewport-height, 100dvh) - 32px) / 2);
}

/* These parent-page nodes/selectors are from the pinned stock SDK. Never reach
   into its cross-origin iframe. Exclude hidden nodes to preserve SDK hiding. */
html[data-website-chat] .woot-widget-bubble:not(.woot--hide) {
  bottom: calc(var(--website-chat-viewport-bottom, 0px) + var(--website-chat-consent-space, 0px) + max(20px, env(safe-area-inset-bottom, 0px))) !important;
}

html[data-website-chat] #cw-widget-holder:not(.woot--hide) {
  bottom: calc(var(--website-chat-viewport-bottom, 0px) + var(--website-chat-consent-space, 0px) + 104px) !important;
  max-height: calc(var(--website-chat-viewport-height, 100dvh) - var(--website-chat-consent-space, 0px) - 124px) !important;
  min-height: 0 !important;
}

.website-chat-close { display: none; }

@media (max-width: 668px), (max-height: 520px) {
  .website-chat-close {
    display: block;
    position: fixed;
    z-index: 2147483001;
    top: calc(var(--website-chat-viewport-top, 0px) + max(8px, env(safe-area-inset-top, 0px)));
    right: 12px;
    min-height: 44px;
    min-width: 44px;
    padding: 10px 18px;
    border: 1px solid #ffac70;
    border-radius: 10px;
    background: #16100c;
    color: #ffac70;
    font: 600 14px/1.2 var(--sans, 'Inter', sans-serif);
    cursor: pointer;
  }

  html[data-website-chat] #cw-widget-holder:not(.woot--hide) {
    top: calc(var(--website-chat-viewport-top, 0px) + max(8px, env(safe-area-inset-top, 0px)) + 56px) !important;
    bottom: calc(var(--website-chat-viewport-bottom, 0px) + var(--website-chat-consent-space, 0px) + 12px) !important;
    left: 12px !important;
    right: 12px !important;
    width: calc(100% - 24px) !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  /* Retain the SDK's 250px minimum conversation viewport, but scroll its parent
     instead of clipping controls when consent/keyboard leaves less room. */
  html[data-website-chat] #cw-widget-holder iframe {
    min-height: 250px !important;
  }

  html[data-website-chat] .woot-widget-bubble.woot--close {
    visibility: hidden !important;
  }
}

@media (max-width: 640px) {
  .website-chat {
    left: 12px;
    bottom: calc(var(--website-chat-viewport-bottom, 0px) + var(--website-chat-consent-space, 0px) + max(12px, env(safe-area-inset-bottom, 0px)));
    width: min(300px, calc(100vw - 24px));
  }

  html[data-website-chat] .analytics-banner {
    bottom: calc(var(--website-chat-viewport-bottom, 0px) + 12px);
  }
}
