/* ============================================================================
   §11 — SUPPORT BUBBLE + PANEL. Matches the source's widget.
   Reference: owner screenshots 2026-09-10 (www.raptorlabs.is/checkout, 375px).

   Source shell:
     <div role="dialog" aria-label="Support chat"
          class="fixed z-[60] inset-x-3 bottom-20 top-16
                 sm:inset-x-auto sm:top-auto sm:bottom-24 sm:right-5
                 sm:h-[min(44rem,calc(100dvh-7rem))] sm:w-[min(26rem,calc(100vw-2.5rem))]
                 border-2 border-foreground bg-background
                 shadow-[6px_6px_0_0_rgba(0,0,0,1)]">
   i.e. near-fullscreen on a phone, a 26rem panel pinned bottom-right from sm.
   The FAB itself is already styled in rl-tokens.css.
   ========================================================================= */

.rl-support {
  position: fixed;
  z-index: 60;
  left: .75rem;
  right: .75rem;
  top: 4rem;
  bottom: 5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: var(--border-width) solid hsl(var(--foreground));
  background: hsl(var(--background));
  box-shadow: var(--shadow-hard-6);
}

@media (min-width: 640px) {
  .rl-support {
    left: auto;
    top: auto;
    right: 1.25rem;
    bottom: 6rem;
    width: min(26rem, calc(100vw - 2.5rem));
    height: min(44rem, calc(100dvh - 7rem));
  }
}

/* [hidden] loses to `display:flex` — the attribute needs to win outright. */
.rl-support[hidden] { display: none; }

/* --------------------------------------------------------------- header --- */
.rl-support__head {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 1rem;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.rl-support__title {
  /* ⚠ `color: inherit` IS REQUIRED. rl-tokens.css styles every `h2` with
     `color: hsl(var(--foreground))` — black — and this heading sits on the
     black header bar, so without this it renders black-on-black and the word
     SUPPORT is simply invisible. */
  color: inherit;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--tracking-chip);
}

.rl-support__close {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 .25rem;
  opacity: .8;
}

.rl-support__close:hover { opacity: 1; }

/* ----------------------------------------------------------------- body --- */
.rl-support__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.rl-support__auto {
  border: var(--border-width) solid hsl(var(--foreground));
  background: hsl(var(--secondary));
  padding: .875rem;
}

.rl-support__autoLabel {
  display: flex;
  align-items: center;
  gap: .375rem;
  margin: 0 0 .5rem;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--tracking-chip);
  color: hsl(var(--muted-foreground));
}

.rl-support__autoLabel svg { width: 13px; height: 13px; }

.rl-support__autoText {
  margin: 0;
  font-size: .875rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
}

/* Sent messages echo back so the customer can see what they sent. */
.rl-support__log { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }

.rl-support__log:empty { margin-top: 0; }

.rl-support__bubble {
  align-self: flex-end;
  max-width: 85%;
  border: var(--border-width) solid hsl(var(--foreground));
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  padding: .625rem .75rem;
  font-size: .875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------- foot --- */
.rl-support__foot {
  flex-shrink: 0;
  border-top: var(--border-width) solid hsl(var(--foreground));
  padding: .875rem 1rem 1rem;
  background: hsl(var(--background));
}

.rl-support__label {
  display: flex;
  align-items: center;
  gap: .375rem;
  margin-bottom: .375rem;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--tracking-chip);
  color: hsl(var(--muted-foreground));
}

.rl-support__email,
.rl-support__msg {
  width: 100%;
  border: var(--border-width) solid hsl(var(--foreground));
  border-radius: 0;
  background: hsl(var(--background));
  padding: .625rem .75rem;
  font-family: var(--font-body);
  font-size: .9375rem;
  color: hsl(var(--foreground));
}

.rl-support__email { min-height: 44px; margin-bottom: .5rem; }

.rl-support__email:focus-visible,
.rl-support__msg:focus-visible {
  outline: 3px solid #DC2626;
  outline-offset: 2px;
}

.rl-support__send { display: flex; align-items: stretch; gap: .5rem; }

.rl-support__msg { flex: 1 1 auto; min-height: 60px; resize: vertical; line-height: 1.45; }

.rl-support__btn {
  flex: 0 0 auto;
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-width) solid hsl(var(--foreground));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  cursor: pointer;
  box-shadow: var(--shadow-hard-3);
  transition: transform .12s, box-shadow .12s;
}

.rl-support__btn:hover:not(:disabled) { transform: translate(-1px, -1px); }
.rl-support__btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.rl-support__btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.rl-support__status {
  margin: .625rem 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  overflow-wrap: anywhere;
}

.rl-support__status.is-error { color: #B91C1C; font-weight: 700; }
.rl-support__status.is-ok { color: #047857; font-weight: 700; }
.rl-support__status:empty { display: none; }

/* -------------------------------------------------------------- honeypot --- */
/* Off-screen rather than display:none: some bots skip hidden inputs but will
   happily fill one they can "see". Never make this visible. */
.rl-support__hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ------------------------------------------------------------------ FAB --- */
/* The bubble hides while the panel is open so it cannot cover the send button
   on a small screen — the source does the same. */
.rl-support-open .rl-support-fab { display: none; }

@media (min-width: 640px) {
  .rl-support-open .rl-support-fab { display: flex; }
}
