/* Shared floating WhatsApp button + greeting bubble (templates/_whatsapp_float.html).
   Used on the homepage and on public pages for logged-out visitors. Self-contained:
   no dependency on style.css or home.css. */
.hp-wa-wrap, .hp-wa-wrap * { box-sizing: border-box; }
.hp-wa-wrap { font-family: "DM Sans", "DM Sans Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
.hp-wa-wrap svg { display: block; }
/* ---------- Floating WhatsApp + greeting bubble ---------- */
/* Fixed-size container: the bubble is absolutely positioned and the bob is a transform,
   so neither ever changes layout (no layout shift). */
.hp-wa-wrap {
  position: fixed; z-index: 9997;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 62px; height: 62px;
  pointer-events: none;
}
.hp-wa-wrap > * { pointer-events: auto; }
/* Tucked away (phones, inner pages, before the first scroll) or hidden behind an open lightbox/modal.
   Opacity + transform only, so it never shifts layout. */
.hp-wa-wrap { transition: opacity .25s ease, transform .3s cubic-bezier(.22, .61, .36, 1), visibility 0s linear 0s; }
.hp-wa-wrap.is-tucked, .hp-wa-wrap.is-suppressed {
  opacity: 0; transform: translateY(24px); visibility: hidden;
  transition: opacity .2s ease, transform .25s ease, visibility 0s linear .25s;
}
.hp-wa-wrap.is-tucked > *, .hp-wa-wrap.is-suppressed > * { pointer-events: none; }
.hp-wa {
  display: block; width: 62px; height: 62px; border-radius: 50%; text-decoration: none;
  animation: hp-wa-float 2.8s ease-in-out infinite;
  will-change: transform;
}
.hp-wa-btn {
  position: relative; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: #25d366; box-shadow: 0 10px 26px rgba(37, 211, 102, .5), 0 3px 8px rgba(0, 0, 0, .14);
  transition: transform .2s cubic-bezier(.22, .61, .36, 1), box-shadow .2s cubic-bezier(.22, .61, .36, 1);
}
.hp-wa-btn svg { position: relative; z-index: 1; }
.hp-wa-btn::before, .hp-wa-btn::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(37, 211, 102, .45);
  animation: hp-wa-pulse 2.4s ease-out infinite; z-index: 0;
}
.hp-wa-btn::after { animation-delay: 1.2s; }
.hp-wa:hover .hp-wa-btn, .hp-wa:focus-visible .hp-wa-btn { transform: scale(1.08); box-shadow: 0 14px 32px rgba(37, 211, 102, .6), 0 3px 8px rgba(0, 0, 0, .14); }
.hp-wa:focus-visible { outline: 3px solid #128c7e; outline-offset: 4px; border-radius: 50%; }
@keyframes hp-wa-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes hp-wa-pulse { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.7); opacity: 0; } }

.hp-wa-bubble {
  position: absolute; right: 4px; bottom: calc(100% + 14px);
  width: max-content; max-width: 280px;
  background: #fff; border-radius: 16px 16px 4px 16px; border: 1px solid #e5e7eb;
  box-shadow: 0 14px 36px rgba(17, 24, 39, .18), 0 2px 6px rgba(17, 24, 39, .06);
  opacity: 0; transform: translateY(10px) scale(.85); transform-origin: bottom right;
  transition: opacity .28s cubic-bezier(.22, .61, .36, 1), transform .38s cubic-bezier(.34, 1.56, .64, 1);
}
.hp-wa-bubble[hidden] { display: none; }
.hp-wa-bubble.is-open { opacity: 1; transform: none; }
.hp-wa-bubble::after {
  content: ""; position: absolute; right: 22px; bottom: -7px; width: 14px; height: 14px; background: #fff;
  border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; transform: rotate(45deg);
}
.hp-wa-bubble-link {
  display: block; padding: 12px 38px 13px 16px; text-decoration: none; color: #111827 !important; border-radius: inherit;
}
.hp-wa-bubble-link:focus-visible { outline: 3px solid #25d366; outline-offset: 2px; }
.hp-wa-bubble-name { display: flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; color: #0f7a6e; letter-spacing: .02em; }
.hp-wa-bubble-name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #25d366; }
.hp-wa-bubble-text { display: block; margin-top: 2px; font-size: .95rem; font-weight: 500; line-height: 1.35; }
.hp-wa-bubble-close {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: #f3f4f6; color: #4b5563; cursor: pointer;
  transition: background .2s, color .2s;
}
.hp-wa-bubble-close:hover { background: #e5e7eb; color: #111827; }

@media (max-width: 640px) {
  .hp-wa-wrap { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 60px; height: 60px; }
  .hp-wa { width: 60px; height: 60px; }
  .hp-wa-bubble { max-width: 220px; bottom: calc(100% + 12px); }
  .hp-wa-bubble-link { padding: 10px 34px 11px 13px; }
  .hp-wa-bubble-text { font-size: .86rem; }
  .hp-wa-bubble-name { font-size: .7rem; }
}

/* Desktop: lifted above the footer near the page bottom so it never covers the footer map or its link
   (wa_float.js sets --wa-lift); a transform only, so no layout shift. Its tail is dropped while lifted, and it
   fades out when there is no room above the footer. Phones are unchanged. */
@media (min-width: 641px) {
  .hp-wa-bubble.is-open { transform: translateY(calc(-1 * var(--wa-lift, 0px))); }
  .hp-wa-bubble.is-lifted::after { display: none; }
  .hp-wa-bubble.is-lifted { border-radius: 16px; }
  .hp-wa-bubble.is-footer-off { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }
}

/* Keep page-bottom content clear of the button on phones (the homepage pads its footer instead). */
@media (max-width: 640px) {
  body.has-wa-float:not(.hp-body),
  body:not(.hp-body):has(.hp-wa-wrap):not(:has(.hp-footer)) { padding-bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .hp-wa, .hp-wa-btn::before, .hp-wa-btn::after { animation: none !important; }
  .hp-wa-btn::before, .hp-wa-btn::after { display: none; }
  .hp-wa-bubble { transform: none; transition-duration: .01ms !important; }
}

/* Phones: stepped aside while the button would cover a form field or the sticky /samples search
   (wa_float.js). Fades out and slides fully below the viewport, so it never sits over the field. */
.hp-wa-wrap.is-aside {
  opacity: 0; transform: translateY(calc(100% + 40px)); visibility: hidden;
  transition: opacity .2s ease, transform .25s ease, visibility 0s linear .25s;
}
.hp-wa-wrap.is-aside > * { pointer-events: none; }

/* Hidden while the phone menu is open (site_shell.js adds body.hp-menu-open); back when it closes. */
body.hp-menu-open .hp-wa-wrap {
  opacity: 0; transform: translateY(calc(100% + 40px)); visibility: hidden;
  transition: opacity .2s ease, transform .25s ease, visibility 0s linear .25s;
}
body.hp-menu-open .hp-wa-wrap > * { pointer-events: none; }
