/**
 * Magnetrix WhatsApp
 *
 * Scoped entirely under .mxw so it cannot reach any existing section.
 * Colours arrive as custom properties set inline by PHP, which keeps this
 * file static and cacheable while staying configurable.
 */

.mxw {
  position: fixed;
  bottom: 24px;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
}
.mxw--right { right: 24px; }
.mxw--left  { left: 24px; align-items: flex-start; }

/* ---- launcher ---- */
.mxw__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 999px;
  background: var(--mxw-brand, #25D366);
  color: #FFFFFF;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(4,16,15,.18), 0 2px 6px rgba(4,16,15,.10);
  overflow: hidden;
  white-space: nowrap;
  transition: width .3s cubic-bezier(.22,.61,.36,1), transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .3s ease, padding .3s cubic-bezier(.22,.61,.36,1);
  /* entrance */
  opacity: 0;
  transform: translateY(14px);
  animation: mxw-in .5s cubic-bezier(.22,.61,.36,1) .35s forwards;
}
@keyframes mxw-in { to { opacity: 1; transform: translateY(0); } }

.mxw__btn .mxw-glyph { width: 30px; height: 30px; flex: 0 0 auto; }

.mxw__label {
  max-width: 0;
  opacity: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: max-width .3s cubic-bezier(.22,.61,.36,1), opacity .2s ease, margin-left .3s cubic-bezier(.22,.61,.36,1);
}

/* Expansion only where there is a real pointer. Touch devices keep the disc. */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .mxw__btn:hover,
  .mxw__btn:focus-visible {
    width: auto;
    padding: 0 24px 0 15px;
    transform: scale(1.05);
    box-shadow: 0 10px 28px rgba(32,230,242,.42), 0 0 0 6px rgba(32,230,242,.14);
  }
  .mxw__btn:hover .mxw__label,
  .mxw__btn:focus-visible .mxw__label {
    max-width: 320px;
    opacity: 1;
    margin-left: 12px;
  }
}

.mxw__btn:focus-visible { outline: 3px solid var(--mxw-accent, #20E6F2); outline-offset: 3px; }

/* ---- pulse ---- */
.mxw__ring {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
}
.mxw.is-pulsing .mxw__ring {
  animation: mxw-pulse 1.8s cubic-bezier(.22,.61,.36,1) 2;
  box-shadow: 0 0 0 0 rgba(37,211,102,.55);
}
@keyframes mxw-pulse {
  0%   { opacity: .9; box-shadow: 0 0 0 0 rgba(37,211,102,.5); }
  70%  { opacity: 0;  box-shadow: 0 0 0 22px rgba(37,211,102,0); }
  100% { opacity: 0;  box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}
.mxw--left .mxw__ring { right: auto; left: 0; }

/* ---- popup ---- */
.mxw__popup {
  position: relative;
  width: 300px;
  max-width: calc(100vw - 40px);
  padding: 20px 20px 18px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1px solid #DCEAEA;
  box-shadow: 0 18px 44px rgba(4,16,15,.16), 0 2px 8px rgba(4,16,15,.06);
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transition: opacity .32s ease, transform .32s cubic-bezier(.22,.61,.36,1);
}
.mxw__popup[hidden] { display: none; }
.mxw__popup.is-open { opacity: 1; transform: translateY(0) scale(1); }

.mxw__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6C8A88;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.mxw__close:hover { background: #F7FCFC; color: #04100F; }
.mxw__close:focus-visible { outline: 2px solid var(--mxw-accent, #20E6F2); outline-offset: 2px; }

.mxw__wave {
  margin: 0 0 8px;
  padding-right: 24px;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #04100F;
}
.mxw__body {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #3F5C5A;
}
.mxw__status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px;
  font-size: 12.5px;
  color: #6C8A88;
}
.mxw__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 0 0 3px rgba(37,211,102,.16);
  flex: 0 0 auto;
}
.mxw__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 44px;
  border-radius: 999px;
  background: var(--mxw-brand, #25D366);
  color: #FFFFFF;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: filter .2s ease, transform .2s ease;
}
.mxw__cta:hover { filter: brightness(1.06); transform: translateY(-1px); color: #FFFFFF; }
.mxw__cta:focus-visible { outline: 3px solid var(--mxw-accent, #20E6F2); outline-offset: 2px; }
.mxw__cta .mxw-glyph { width: 19px; height: 19px; }

/* ---- tablet ---- */
@media (max-width: 1024px) {
  .mxw__popup { width: 268px; padding: 17px 17px 15px; }
  .mxw__body  { font-size: 13.5px; }
}

/* ---- phone ---- */
@media (max-width: 767px) {
  .mxw { bottom: 18px; gap: 12px; }
  .mxw--right { right: 16px; }
  .mxw--left  { left: 16px; }
  .mxw__btn { width: 55px; height: 55px; }
  .mxw__btn .mxw-glyph { width: 27px; height: 27px; }
  .mxw__ring { width: 55px; height: 55px; }
  .mxw__label { display: none; }
  .mxw__popup { width: calc(100vw - 32px); max-width: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  .mxw__btn { animation: none; opacity: 1; transform: none; }
  .mxw__btn:hover, .mxw__btn:focus-visible { transform: none; }
  .mxw.is-pulsing .mxw__ring { animation: none; }
  .mxw__popup { transition: opacity .01ms linear; transform: none; }
  .mxw__popup.is-open { transform: none; }
}

/* White on WhatsApp green (#25D366) is 2.0:1, which fails for text. The
   bubble keeps the brand colour -- it carries an icon, not words -- while
   anything with a label on it uses WhatsApp's darker green at 4.6:1. */
:root { --mxw-brand-ink: #12894A; }
.mxw__cta { background: var(--mxw-brand-ink) !important; }
.mxw__cta:hover { background: #0E6E3B !important; }
.mxw__btn .mxw__label { background: var(--mxw-brand-ink); }
