/* BOTONES con borde que brilla y letras que bajan al pasar el mouse (botones.js arma las letras y la capa de luz).
   Uso: <a class="boton-linea" href="...">Contactanos por WhatsApp</a>  (o <button class="boton-giro">)
   CONFIGURÁ acá abajo; por defecto sale todo de base.css (texto, letra, curva, tiempos). En web clara (data-tema="claro")
   el borde y la luz se ajustan solos: la luz pasa a ser oscura y se mezcla con multiply.

   Valores probados: borde de 1 px al 10%; encima una capa <i> con un conic-gradient enmascarado solo al borde (dos luces
   opuestas, en 25% y 75%) que da una vuelta cada 5 s y se pausa fuera de pantalla (--play). Al pasar el mouse el borde
   sube al 40% y cada letra baja 4em en 0,5 s con 0,02 s de diferencia, reemplazada por su copia (text-shadow a -4em).
   En celular (< 1024 px) la luz gira como capa rotada en vez de animar el ángulo: animar --angulo con mezcla repintaba
   todos los botones en cada cuadro (ver la skill web-celular). */
:root {
  --boton-texto: var(--color-texto, #fff);
  --boton-borde: color-mix(in srgb, var(--boton-texto) 10%, transparent);
  --boton-borde-hover: color-mix(in srgb, var(--boton-texto) 40%, transparent);
  --boton-luz: var(--boton-texto);
  --boton-mezcla: var(--mezcla-luz, screen);
  --boton-fondo: color-mix(in srgb, var(--color-fondo, #000) 10%, transparent);
  --boton-letra: var(--letra-texto, inherit);
  --boton-curva: var(--curva, cubic-bezier(0.43, 0.195, 0.02, 1));
  --boton-vuelta: 5s;             /* una vuelta de la luz */
}
@property --angulo {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes boton-luz {
  to { --angulo: 360deg; }
}
.boton-linea, .boton-giro {
  --play: running;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: max-content;
  padding: 1.3rem 2.2rem;
  border: 1px solid var(--boton-borde);
  border-radius: 0;
  background: var(--boton-fondo);
  font-family: var(--boton-letra);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
  color: var(--boton-texto);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.5s ease-in-out;
}
.boton__texto {
  display: block;
  position: relative;
  z-index: 1;
  overflow: clip;
  transition: opacity 0.5s ease-in-out;
}
.boton__texto span {
  display: inline-block;
  text-shadow: color-mix(in srgb, var(--boton-texto) 60%, transparent) 0 -4em 0;
  transition: transform var(--tiempo-hover, 0.5s) var(--boton-curva);
  transition-delay: calc(var(--i, 0) * var(--paso-letra, 0.02s));
}
.boton-linea > i, .boton-giro > i {
  --p: 5%;
  position: absolute;
  inset: -1px;
  z-index: 0;
  padding: 1px;
  pointer-events: none;
  mix-blend-mode: var(--boton-mezcla);
  background: conic-gradient(
    from var(--angulo) at center,
    transparent calc(25% - var(--p) * 2),
    transparent calc(25% - var(--p)),
    var(--boton-luz) 25%,
    transparent calc(25% + var(--p)),
    transparent calc(25% + var(--p) * 2),
    transparent calc(75% - var(--p) * 2),
    transparent calc(75% - var(--p)),
    var(--boton-luz) 75%,
    transparent calc(75% + var(--p)),
    transparent calc(75% + var(--p) * 2)
  );
  /* Máscara de anillo: solo se pinta el borde, el centro queda transparente */
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: boton-luz var(--boton-vuelta) linear infinite var(--play);
}
@media (hover: hover) and (pointer: fine) {
  .boton-linea:hover, .boton-giro:hover { border-color: var(--boton-borde-hover); }
  .boton-linea:hover .boton__texto, .boton-giro:hover .boton__texto { opacity: 0.6; }
  .boton-linea:hover .boton__texto span, .boton-giro:hover .boton__texto span { transform: translateY(4em); }
}
.boton-linea:focus, .boton-giro:focus { outline: none; }
.boton-linea:focus-visible, .boton-giro:focus-visible { outline: 1px dashed color-mix(in srgb, var(--boton-texto) 60%, transparent); outline-offset: 2px; }
.boton-giro:disabled { opacity: 0.4; pointer-events: none; }
.boton-giro:disabled > i { animation-play-state: paused; opacity: 0; }
@media (prefers-reduced-motion: reduce) and (min-width: 1024px) {
  .boton-linea > i, .boton-giro > i { animation: none; }
}

/* Celular: la luz gira como una capa rotada (barata) en vez de animar el ángulo del degradé */
@media (max-width: 1023px) {
  .boton-linea > i, .boton-giro > i { animation: none; background: none; overflow: hidden; }
  .boton-linea > i::before, .boton-giro > i::before {
    content: ''; position: absolute; left: 50%; top: 50%; width: 300%; aspect-ratio: 1; translate: -50% -50%;
    background: conic-gradient(transparent 15%, var(--boton-luz) 25%, transparent 35%, transparent 65%, var(--boton-luz) 75%, transparent 85%);
    animation: boton-giro-capa var(--boton-vuelta) linear infinite var(--play);
  }
}
@keyframes boton-giro-capa { to { rotate: 360deg; } }
