/*
  Floating contact widget styles.
  Collapsed by default, expands left on tap. The primary call button stays obvious
  for older users, while the other channels stay available without crowding the page.
*/

.contact-widget {
  position: fixed;
  right: var(--space-2);
  bottom: var(--space-2);
  z-index: 999;
  /* Force its own compositing layer so iOS Safari doesn't let it lag behind
     during scroll momentum (the classic "fixed element drifts mid-scroll"
     glitch on iOS). */
  transform: translateY(24px) translateZ(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-widget.is-visible {
  opacity: 1;
  transform: translateY(0) translateZ(0);
  pointer-events: auto;
}

.contact-widget__stack {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 0;
  display: flex;
  flex-direction: row-reverse;
  gap: 12px;
  align-items: center;
}

.contact-widget__actions {
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
  align-items: center;
}

.contact-widget__item,
.contact-widget__toggle,
.contact-widget__phone {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-widget);
  color: #fff;
}

.contact-widget__toggle,
.contact-widget__phone {
  position: relative;
  z-index: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.contact-widget__toggle {
  background: var(--color-teal);
  cursor: pointer;
}

.contact-widget__toggle:hover,
.contact-widget__toggle:focus-visible {
  background: var(--color-teal-dark);
}

.contact-widget__phone {
  background: var(--color-navy);
}

.contact-widget__phone:hover,
.contact-widget__phone:focus-visible {
  background: var(--color-navy-dark);
}

/* Symmetrical, slow organic ripple */
.contact-widget__toggle::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: var(--color-teal);
  opacity: 0;
  z-index: -1;
  pointer-events: none;
  animation: contactWidgetRipple 4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  animation-delay: 2.6s;
}

.contact-widget__item {
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(22px) scale(0.78);
  transition:
    transform 0.58s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.42s ease,
    box-shadow 0.18s ease;
  transition-delay: 0ms;
  will-change: transform, opacity;
}

.contact-widget.is-open .contact-widget__item {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  transition-delay: calc(var(--item-index, 0) * 95ms);
}

.contact-widget.is-open .contact-widget__toggle {
  animation: none;
}

.contact-widget__item:hover,
.contact-widget__item:focus-visible,
.contact-widget__toggle:hover,
.contact-widget__toggle:focus-visible,
.contact-widget__phone:hover,
.contact-widget__phone:focus-visible {
  transform: translateY(-1px) scale(1.03);
}

.contact-widget__icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}

.contact-widget__icon svg {
  width: 100%;
  height: 100%;
}

/* The brand SVGs (from simpleicons.org) ship with their own brand-color fill
   baked into the path. That's invisible when the circle behind it is the
   exact same brand color (WhatsApp/Viber were rendering as blank colored
   circles for this reason). Force every glyph white so it always reads
   against its own colored circle, consistently across all five channels. */
.contact-widget__item--whatsapp svg path,
.contact-widget__item--viber svg path,
.contact-widget__item--messenger svg path,
.contact-widget__item--facebook svg path {
  fill: #fff !important;
}

.contact-widget__item--whatsapp {
  background: var(--color-whatsapp);
}

.contact-widget__item--viber {
  background: var(--color-viber);
}

.contact-widget__item--messenger {
  background: var(--color-messenger);
}

.contact-widget__item--facebook {
  background: var(--color-facebook);
}

@keyframes contactWidgetRipple {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  30% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@media (max-width: 480px) {
  .contact-widget {
    display: none;
  }
}

@media (min-width: 481px) and (max-width: 900px) {
  .contact-widget {
    display: none;
  }
}

@media (max-width: 480px) {
  .contact-widget {
    right: var(--space-1);
    bottom: var(--space-1);
    gap: 10px;
  }

  .contact-widget__stack {
    right: calc(100% + 10px);
    gap: 8px;
  }

  .contact-widget__item,
  .contact-widget__toggle,
  .contact-widget__phone {
    width: 52px;
    height: 52px;
  }

  .contact-widget__icon {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 380px) {
  .contact-widget__item,
  .contact-widget__toggle,
  .contact-widget__phone {
    width: 48px;
    height: 48px;
  }

  .contact-widget__stack {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-widget__toggle {
    animation: none;
  }

  .contact-widget__item,
  .contact-widget__toggle,
  .contact-widget__phone {
    transition: none;
  }
}
