/* Bouton WhatsApp flottant : dégradé, reflet, halo qui pulse, texte qui se déplie au survol */

.fm-wa {
  --size: 62px;

  position: fixed;
  inset-block-end: max(20px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  inset-inline-end: 20px;
  z-index: 90;
  display: flex;
  align-items: center;
  height: var(--size);
  border-radius: var(--radius-rounded, 999px);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
  background: linear-gradient(
    150deg,
    color-mix(in srgb, var(--wa) 72%, #fff) 0%,
    var(--wa) 42%,
    color-mix(in srgb, var(--wa) 70%, #000) 100%
  );
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.45),
    inset 0 0 0 1px rgb(255 255 255 / 0.16),
    0 14px 34px color-mix(in srgb, var(--wa) 42%, transparent),
    0 4px 10px rgb(0 0 0 / 0.14);
  -webkit-tap-highlight-color: transparent;
  outline: 2px solid transparent;
  outline-offset: 4px;
  transition:
    translate 0.5s var(--lux-ease, ease),
    scale 0.3s var(--lux-ease, ease),
    box-shadow 0.5s ease;
  animation: wa-in 0.9s var(--lux-ease, ease) 1.4s backwards;
}

.fm-wa[data-pos="left"] {
  inset-inline-end: auto;
  inset-inline-start: 20px;
}

.fm-wa:focus-visible {
  outline-color: var(--wa);
}

/* Reflet brillant en haut à gauche */
.fm-wa::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 90% at 22% 8%, rgb(255 255 255 / 0.42), transparent 46%);
}

/* Halo qui pulse doucement */
.fm-wa::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  pointer-events: none;
  animation: wa-pulse 2.8s ease-out 2.4s infinite;
}

.fm-wa-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
}

.fm-wa-icon svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.25));
}

.fm-wa-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font: 500 16px/1 var(--font-family, sans-serif);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition:
    max-width 0.7s var(--lux-ease, ease),
    padding 0.7s var(--lux-ease, ease);
}

.fm-wa:active {
  scale: 0.95;
}

@media (hover: hover) and (min-width: 770px) {
  .fm-wa:hover,
  .fm-wa:focus-visible {
    translate: 0 -4px;
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.5),
      inset 0 0 0 1px rgb(255 255 255 / 0.2),
      0 20px 44px color-mix(in srgb, var(--wa) 52%, transparent),
      0 6px 14px rgb(0 0 0 / 0.16);
  }

  .fm-wa:hover .fm-wa-label,
  .fm-wa:focus-visible .fm-wa-label {
    max-width: 260px;
    padding-inline-end: 26px;
  }

  /* Le texte se déplie une fois, quelques secondes après l'arrivée sur la page, pour attirer l'œil */
  .fm-wa-label {
    animation: wa-hint 5.5s var(--lux-ease, ease) 3s backwards;
  }
}

@media (max-width: 769px) {
  .fm-wa {
    --size: 58px;

    inset-inline-end: 16px;
  }

  .fm-wa[data-pos="left"] {
    inset-inline-start: 16px;
  }

  .fm-wa-icon svg {
    width: 30px;
    height: 30px;
  }
}

@keyframes wa-in {
  from {
    opacity: 0;
    translate: 0 28px;
    scale: 0.5;
  }
}

@keyframes wa-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--wa) 55%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 22px transparent;
  }
}

@keyframes wa-hint {
  0%,
  100% {
    max-width: 0;
    padding-inline-end: 0;
  }
  14%,
  78% {
    max-width: 260px;
    padding-inline-end: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fm-wa,
  .fm-wa::before,
  .fm-wa-label {
    animation: none;
    transition: none;
  }
}

/* Impression : pas de bouton */
@media print {
  .fm-wa {
    display: none;
  }
}
