/* Floating contact widget — launcher button + popover panel.
   Plain CSS (passthrough-copied, not Tailwind-processed): use hsl(var(--token)).
   The panel carries the Tailwind `bg-card` class so the site's
   `.on-primary .bg-card` rule resets text to dark, matching the /contact/ page. */

.contact-widget {
  font-family: 'Inter', sans-serif;
}

/* Freeze the page behind the open dialog (aria-modal). JS adds the
   compensating padding so removing the scrollbar doesn't shift the layout. */
body.contact-widget-open {
  overflow: hidden;
}

/* ── Launcher ─────────────────────────────────────────────────────────── */
.contact-widget-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998; /* below the cookie banner (9999) */
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9999px;
  background: hsl(var(--primary));
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.contact-widget-launcher:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-hover);
}

.contact-widget-launcher:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Panel ────────────────────────────────────────────────────────────── */
.contact-widget-panel {
  position: fixed;
  bottom: 96px; /* clears the 60px launcher + 24px gap */
  right: 24px;
  z-index: 9998;
  width: 400px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  /* Keep the form's scroll inside the panel — never chain to the page behind it. */
  overscroll-behavior: contain;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  /* Closed state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0s linear 0.2s;
}

.contact-widget-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0s;
}

.contact-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--border));
}

.contact-widget-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.contact-widget-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -6px -6px -6px 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.2s ease-out, color 0.2s ease-out;
}

.contact-widget-close:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.contact-widget-body {
  padding: 16px 20px;
}

/* ── Mobile: full-width sheet ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .contact-widget-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px 12px 0 0;
  }
}

/* ── Reduced motion: fade only, no slide ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .contact-widget-launcher,
  .contact-widget-panel,
  .contact-widget-close {
    transition: none;
  }
  .contact-widget-panel {
    transform: none;
  }
  .contact-widget-panel.is-open {
    transform: none;
  }
}
