/* Floating WhatsApp contact button
   - hidden until the visitor has scrolled a little way down the page
   - collapses to a circular icon, expands leftwards into a "Message us"
     pill on hover/focus and on a gentle timed pulse
   Behaviour is driven by /assets/whatsapp-float.js (class hooks only). */

.whatsapp-float {
  position: fixed;
  /* Sits roughly 13% up from the bottom of the viewport (centre at 87%). */
  top: 87%;
  right: clamp(.75rem, 2vw, 1.4rem);
  z-index: 90;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;

  width: 3.6rem;
  height: 3.6rem;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  box-shadow: 0 .65rem 1.8rem rgba(10, 57, 45, .26), 0 0 0 .35rem rgba(37, 211, 102, .12);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;

  /* Hidden state - revealed by .is-visible once the page is scrolled. */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateY(.75rem) scale(.86);

  transition:
    width .42s cubic-bezier(.22, .9, .3, 1),
    opacity .3s ease,
    visibility .3s ease,
    transform .42s cubic-bezier(.22, .9, .3, 1),
    background-color .22s ease,
    box-shadow .22s ease;
}

.whatsapp-float.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%);
}

/* The label. Clipped by the container's overflow while collapsed. */
.whatsapp-float::before {
  content: "Message us";
  flex: 0 0 auto;
  padding-left: 1.05rem;
  font: 600 .84rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .01em;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(.5rem);
  transition: opacity .2s ease, transform .34s cubic-bezier(.22, .9, .3, 1);
}

.whatsapp-float svg {
  flex: 0 0 auto;
  width: 1.95rem;
  height: 1.95rem;
  margin: 0 .82rem;
  display: block;
  fill: currentColor;
}

/* Expanded - either the timed pulse (.is-expanded) or pointer/keyboard focus. */
.whatsapp-float.is-visible.is-expanded,
.whatsapp-float.is-visible:hover,
.whatsapp-float.is-visible:focus-visible {
  width: 10.9rem;
  background: #1fbd5a;
  box-shadow: 0 .75rem 2rem rgba(10, 57, 45, .34), 0 0 0 .45rem rgba(37, 211, 102, .17);
}

.whatsapp-float.is-visible.is-expanded::before,
.whatsapp-float.is-visible:hover::before,
.whatsapp-float.is-visible:focus-visible::before {
  opacity: 1;
  transform: translateX(0);
}

.whatsapp-float:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Keep it out of the way while the booking dialog or menu is open. */
body.timely-widget-open .whatsapp-float,
body.menu-open .whatsapp-float {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 640px) {
  .whatsapp-float {
    top: 86%;
    right: max(.7rem, env(safe-area-inset-right));
    width: 3.25rem;
    height: 3.25rem;
  }

  .whatsapp-float svg {
    width: 1.75rem;
    height: 1.75rem;
    margin: 0 .75rem;
  }

  .whatsapp-float::before {
    padding-left: .95rem;
    font-size: .8rem;
  }

  .whatsapp-float.is-visible.is-expanded,
  .whatsapp-float.is-visible:hover,
  .whatsapp-float.is-visible:focus-visible {
    width: 10.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-float,
  .whatsapp-float.is-visible {
    transition: opacity .2s ease, visibility .2s ease, width .2s ease;
    transform: translateY(-50%);
  }

  .whatsapp-float::before {
    transition: opacity .2s ease;
    transform: none;
  }
}

@media print {
  .whatsapp-float { display: none !important; }
}
