/* The support chat's round button and start card (owner decisions 2026-10-24; web/src/assets/js/support-chat.js). Loaded only
   while CHATWOOT_WEBSITE_TOKEN is set (server/src/support-chat.mjs). Look: the site's own tokens, the same card as the cookie
   banner beside it (web/src/assets/css/ad-consent.css, Stitch screen 74c3db71bcab4d92a6cfe818911c34fd); the Stitch run for this
   card timed out on 2026-10-24 (design/stitch/support-chat-2026-10-24/notes.md). "Start chat" and "Not now" are drawn by ONE
   rule: the same size, weight, colour and border (gate: scripts/invariants/support-chat.mjs SC3). The button is the size and
   place of Chatwoot's own button (64 px, 20 px from the corner, chatwoot v4.18.0 sdk/sdk.css), so nothing jumps when
   Chatwoot's button takes over after the visitor agreed. support-chat.js lifts both above the cookie banner, the cookie notice
   and the app's bottom bar (--chat-lift) and tucks them away while they would cover a main button (html.chat-tucked). */
.support-chat {
  --chat-size: 64px;
  --chat-edge: 20px;
  --chat-orange: #ea580c;
  --chat-orange-deep: #c2410c;
  --chat-ink: #0f172a;
  --chat-body: #475569;
  --chat-line: #e2e8f0;
  --chat-control-line: #cbd5e1;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.support-chat-button {
  position: fixed;
  z-index: 58;
  bottom: calc(var(--chat-edge) + var(--chat-lift, 0px));
  right: var(--chat-edge);
  display: grid;
  place-items: center;
  width: var(--chat-size);
  height: var(--chat-size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--chat-orange);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  transition: background-color 160ms ease-out, box-shadow 160ms ease-out, opacity 160ms ease-out, transform 200ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}
.support-chat[data-side="left"] .support-chat-button { right: auto; left: var(--chat-edge); }
.support-chat-button svg { display: block; width: 24px; height: 24px; }
.support-chat-button:hover { background: var(--chat-orange-deep); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24); }
.support-chat-button:focus-visible { outline: 2px solid #f97316; outline-offset: 3px; }
.support-chat-button[aria-busy="true"] { cursor: progress; }
.support-chat-button[aria-busy="true"] svg { animation: support-chat-wait 1.2s ease-in-out infinite; }
@keyframes support-chat-wait { 50% { opacity: 0.45; } }

/* Tucked away while it would cover one of the page's main buttons (never while its card is open). */
html.chat-tucked:not(.chat-card-open) .support-chat-button {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.94);
  transition: opacity 160ms ease-out, transform 160ms ease-out, visibility 0s linear 160ms;
}

/* The start card: right above the button, on the same side. */
.support-chat-card {
  position: fixed;
  z-index: 58;
  right: var(--chat-edge);
  bottom: calc(var(--chat-edge) + var(--chat-lift, 0px) + var(--chat-size) + 12px);
  box-sizing: border-box;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - var(--chat-edge) - var(--chat-lift, 0px) - var(--chat-size) - 28px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--chat-line);
  border-radius: 16px;
  background: #ffffff;
  color: var(--chat-body);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 18px 40px -24px rgba(15, 23, 42, 0.35);
  text-align: start;
  animation: support-chat-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.support-chat-card[hidden] { display: none; }
.support-chat[data-side="left"] .support-chat-card { right: auto; left: var(--chat-edge); }
.support-chat-card:focus { outline: none; }
.support-chat-card:focus-visible { outline: 2px solid #f97316; outline-offset: 2px; }
@keyframes support-chat-in { from { opacity: 0; transform: translateY(6px); } }

.support-chat-title {
  margin: 0 0 4px;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--chat-ink);
}
.support-chat-line,
.support-chat-legal,
.support-chat-error {
  margin: 0;
  font-size: 14px;
  line-height: 21px;
  color: var(--chat-body);
}
.support-chat-legal { margin-top: 8px; font-size: 13px; line-height: 19px; }
.support-chat-error { margin-top: 8px; color: var(--chat-orange-deep); font-weight: 500; }
.support-chat-error[hidden] { display: none; }
.support-chat-card a {
  color: var(--chat-orange-deep);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.support-chat-card a:hover { color: #9a3412; }
.support-chat-card a:focus-visible { outline: 2px solid #f97316; outline-offset: 2px; border-radius: 3px; }

/* Start chat and Not now: one row, the same width, ONE rule for both. */
.support-chat-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.support-chat-choice {
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--chat-control-line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--chat-ink);
  font: 600 14px/20px "Inter", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.support-chat-choice:hover { border-color: #94a3b8; background: #f8fafc; }
.support-chat-choice:focus-visible { outline: 2px solid #f97316; outline-offset: 2px; }
.support-chat-choice:disabled { cursor: progress; color: #64748b; background: #f8fafc; }

/* Phone: the card spans the screen with 16 px gutters, the button keeps Chatwoot's place. */
@media (max-width: 480px) {
  .support-chat-card,
  .support-chat[data-side="left"] .support-chat-card { left: 16px; right: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .support-chat-button,
  html.chat-tucked:not(.chat-card-open) .support-chat-button { transform: none; transition: opacity 120ms linear, visibility 0s linear 120ms; }
  .support-chat-card { animation: none; }
  .support-chat-button[aria-busy="true"] svg { animation: none; }
}

/* After the visitor agreed, Chatwoot's own button and window (class names of chatwoot v4.18.0 app/javascript/sdk/sdk.css)
   follow the same lift, and its button steps aside the same way while the window is closed. */
html .woot-widget-bubble:not(.woot--hide) { bottom: calc(20px + var(--chat-lift, 0px)) !important; }
@media only screen and (min-width: 667px) {
  html .woot-widget-holder:not(.woot--hide) { bottom: calc(104px + var(--chat-lift, 0px)) !important; }
  html .woot-widget-holder.has-unread-view:not(.woot--hide) { bottom: calc(94px + var(--chat-lift, 0px)) !important; }
}
html.chat-tucked:not(.chat-open) #cw-bubble-holder { visibility: hidden !important; opacity: 0; pointer-events: none; }
