/* Axeddam — bouton « shiny » du bloc contact.

   Portage natif du composant React `ShinyButton` : une bordure en dégradé
   conique tourne en continu, doublée d'une trame de points et d'un reflet
   interne, le tout accéléré au survol.

   Écarts par rapport à la source : la police Inter est remplacée par la
   Space Grotesk du site, et le bleu par le violet de la charte. */

@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --gradient-angle-offset {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --gradient-percent {
  syntax: "<percentage>";
  initial-value: 5%;
  inherits: false;
}

@property --gradient-shine {
  syntax: "<color>";
  initial-value: #F4F3F6;
  inherits: false;
}

.shiny-cta {
  --shiny-bg: var(--ink);
  --shiny-bg-subtle: #1B1D24;
  --shiny-fg: var(--paper);
  --shiny-highlight: var(--violet);
  --shiny-highlight-subtle: var(--violet-soft);

  --animation: gradient-angle linear infinite;
  --duration: 3s;
  --shadow-size: 2px;
  --transition: 800ms cubic-bezier(0.25, 1, 0.5, 1);

  isolation: isolate;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  outline-offset: 4px;

  /* Gabarit repris du bouton d'origine pour ne rien déplacer dans le bloc. */
  display: inline-block;
  padding: 16px 30px;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;

  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--shiny-fg);
  background:
    linear-gradient(var(--shiny-bg), var(--shiny-bg)) padding-box,
    conic-gradient(
      from calc(var(--gradient-angle) - var(--gradient-angle-offset)),
      transparent,
      var(--shiny-highlight) var(--gradient-percent),
      var(--gradient-shine) calc(var(--gradient-percent) * 2),
      var(--shiny-highlight) calc(var(--gradient-percent) * 3),
      transparent calc(var(--gradient-percent) * 4)
    ) border-box;
  box-shadow: inset 0 0 0 1px var(--shiny-bg-subtle);
  transition: var(--transition);
  transition-property: --gradient-angle-offset, --gradient-percent, --gradient-shine;
}

.shiny-cta:hover {
  color: var(--shiny-fg);
}

.shiny-cta::before,
.shiny-cta::after,
.shiny-cta span::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 50%;
  translate: -50% -50%;
  z-index: -1;
}

.shiny-cta:active {
  translate: 0 1px;
}

/* Trame de points */
.shiny-cta::before {
  --size: calc(100% - var(--shadow-size) * 3);
  --position: 2px;
  --space: calc(var(--position) * 2);
  width: var(--size);
  height: var(--size);
  background: radial-gradient(
    circle at var(--position) var(--position),
    var(--paper) calc(var(--position) / 4),
    transparent 0
  ) padding-box;
  background-size: var(--space) var(--space);
  background-repeat: space;
  -webkit-mask-image: conic-gradient(
    from calc(var(--gradient-angle) + 45deg),
    black,
    transparent 10% 90%,
    black
  );
  mask-image: conic-gradient(
    from calc(var(--gradient-angle) + 45deg),
    black,
    transparent 10% 90%,
    black
  );
  border-radius: inherit;
  opacity: 0.4;
  z-index: -1;
}

/* Reflet interne — arrondi en disque pour qu'aucun angle ne balaie le bouton
   pendant la rotation. */
.shiny-cta::after {
  --animation: shimmer linear infinite;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(
    -50deg,
    transparent,
    var(--shiny-highlight),
    transparent
  );
  -webkit-mask-image: radial-gradient(circle at bottom, transparent 40%, black);
  mask-image: radial-gradient(circle at bottom, transparent 40%, black);
  opacity: 0.6;
}

.shiny-cta span {
  position: relative;
  z-index: 1;
}

/* Halo qui « respire » sous le libellé, révélé au survol.

   `border-radius` absent de la source : ce bloc est plus petit que le bouton,
   donc `overflow: hidden` ne rogne pas ses angles et l'ombre interne dessinait
   un rectangle net au survol. Arrondi en pilule pour épouser le bouton. */
.shiny-cta span::before {
  --size: calc(100% + 1rem);
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  box-shadow: inset 0 -1ex 2rem 4px var(--shiny-highlight);
  opacity: 0;
  transition: opacity var(--transition);
  animation: calc(var(--duration) * 1.5) breathe linear infinite;
}

/* Rotation continue + seconde passe inversée, débloquée au survol. */
.shiny-cta,
.shiny-cta::before,
.shiny-cta::after {
  animation:
    var(--animation) var(--duration),
    var(--animation) calc(var(--duration) / 0.4) reverse paused;
  animation-composition: add;
}

.shiny-cta:is(:hover, :focus-visible) {
  --gradient-percent: 20%;
  --gradient-angle-offset: 95deg;
  --gradient-shine: var(--shiny-highlight-subtle);
}

.shiny-cta:is(:hover, :focus-visible),
.shiny-cta:is(:hover, :focus-visible)::before,
.shiny-cta:is(:hover, :focus-visible)::after {
  animation-play-state: running;
}

.shiny-cta:is(:hover, :focus-visible) span::before {
  opacity: 1;
}

@keyframes gradient-angle {
  to {
    --gradient-angle: 360deg;
  }
}

@keyframes shimmer {
  to {
    rotate: 360deg;
  }
}

@keyframes breathe {
  from, to {
    scale: 1;
  }
  50% {
    scale: 1.2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shiny-cta,
  .shiny-cta::before,
  .shiny-cta::after,
  .shiny-cta span::before {
    animation: none;
  }
}
