/* Space Button — borde gradiente animado + starfield + glow pulsante.
   Override total del estilo nativo del boton: la identidad del efecto ES el fondo dark con borde gradiente. */

.elementor-button.pe-space-active {
  position: relative;
  overflow: hidden !important;
  background-size: 300% 300% !important;
  background-image:
    linear-gradient(var(--pe-space-bg, #212121), var(--pe-space-bg, #212121)),
    linear-gradient(137.48deg,
      var(--pe-space-g1, #ffdb3b) 10%,
      var(--pe-space-g2, #fe53bb) 45%,
      var(--pe-space-g3, #8f51ea) 67%,
      var(--pe-space-g4, #0044ff) 87%) !important;
  background-origin: border-box !important;
  background-clip: padding-box, border-box !important;
  border: double 4px transparent !important;
  color: var(--pe-space-text, #fff) !important;
  transition: transform 0.5s ease !important;
  animation: pe-space-gradient calc(5s / var(--pe-space-speed, 1)) ease infinite !important;
  isolation: isolate;
}

.elementor-button.pe-space-active:hover {
  transform: scale(var(--pe-space-scale, 1.1)) !important;
}

.elementor-button.pe-space-active .elementor-button-content-wrapper,
.elementor-button.pe-space-active .elementor-button-text {
  position: relative;
  z-index: 2;
  color: var(--pe-space-text, #fff) !important;
  text-shadow: 0 0 4px currentColor;
}

.elementor-button.pe-space-active .elementor-button-icon,
.elementor-button.pe-space-active .elementor-button-icon i,
.elementor-button.pe-space-active .elementor-button-icon svg {
  color: var(--pe-space-text, #fff) !important;
  fill: var(--pe-space-text, #fff) !important;
  position: relative;
  z-index: 2;
}

/* Stars container */
.pe-space-active .pe-space-stars-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  transition: background-color 0.5s ease;
  pointer-events: none;
  display: block;
}
.pe-space-active:hover .pe-space-stars-container {
  background-color: var(--pe-space-bg, #212121);
  z-index: 1;
}

/* Starfield — 100rem² (mitad del Uiverse original) */
.pe-space-active .pe-space-stars {
  position: absolute;
  top: -50rem;
  left: -50rem;
  width: 100rem;
  height: 100rem;
  display: block;
  background: transparent;
}
.pe-space-active .pe-space-stars::before,
.pe-space-active .pe-space-stars::after {
  content: "";
  position: absolute;
  background-image: radial-gradient(#fff 1px, transparent 1%);
  background-size: 50px 50px;
}
.pe-space-active .pe-space-stars::after {
  top: -10rem;
  left: -50rem;
  width: 100%;
  height: 100%;
  animation: pe-space-star-rotate calc(90s / var(--pe-space-speed, 1)) linear infinite;
}
.pe-space-active .pe-space-stars::before {
  top: 0;
  left: -50%;
  width: 170%;
  height: 500%;
  opacity: 0.5;
  animation: pe-space-star-scroll calc(60s / var(--pe-space-speed, 1)) linear infinite;
}

/* Glow circles */
.pe-space-active .pe-space-glow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 0;
  padding: 0 1rem;
}
.pe-space-active .pe-space-circle {
  flex: 1;
  height: 30px;
  filter: blur(2rem);
  animation: pe-space-pulse calc(4s / var(--pe-space-speed, 1)) infinite;
  display: block;
}
.pe-space-active .pe-space-circle:nth-child(1) { background: var(--pe-space-glow1, rgba(254,83,186,0.636)); }
.pe-space-active .pe-space-circle:nth-child(2) { background: var(--pe-space-glow2, rgba(142,81,234,0.704)); }

/* Keyframes */
@keyframes pe-space-gradient {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes pe-space-star-rotate {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0); }
}
@keyframes pe-space-star-scroll {
  from { transform: translateY(0); }
  to   { transform: translateY(-70rem); }
}
@keyframes pe-space-pulse {
  0%   { transform: scale(0.75); box-shadow: 0 0 0 0 rgba(0,0,0,0.7); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 10px rgba(0,0,0,0); }
  100% { transform: scale(0.75); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* Accesibilidad: reducir movimiento desactiva todas las animaciones y el scale */
@media (prefers-reduced-motion: reduce) {
  .elementor-button.pe-space-active,
  .pe-space-active .pe-space-stars::before,
  .pe-space-active .pe-space-stars::after,
  .pe-space-active .pe-space-circle {
    animation: none !important;
  }
  .elementor-button.pe-space-active:hover {
    transform: none !important;
  }
}
