/* --- Glitch Text Effect (Inspirado en React Bits) --- */

.viudas-glitch {
  position: relative;
  display: inline-block;
  color: var(--gold-main, #d4af37);
}

.viudas-glitch::before,
.viudas-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.viudas-glitch::before {
  left: 2px;
  text-shadow: -1px 0 red;
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.viudas-glitch::after {
  left: -2px;
  text-shadow: -1px 0 blue;
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

/* Image Glitch */
.viudas-glitch-img-container {
  position: relative;
  display: inline-block;
}

.viudas-glitch-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
  mix-blend-mode: screen;
}

.viudas-glitch-img:nth-child(2) {
  left: 2px;
  filter: drop-shadow(-2px 0 red) hue-rotate(-50deg);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.viudas-glitch-img:nth-child(3) {
  left: -2px;
  filter: drop-shadow(2px 0 blue) hue-rotate(50deg);
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% { clip-path: inset(20% 0 80% 0); }
  20% { clip-path: inset(60% 0 10% 0); }
  40% { clip-path: inset(40% 0 50% 0); }
  60% { clip-path: inset(80% 0 5% 0); }
  80% { clip-path: inset(10% 0 70% 0); }
  100% { clip-path: inset(30% 0 20% 0); }
}

@keyframes glitch-anim-2 {
  0% { clip-path: inset(10% 0 60% 0); }
  20% { clip-path: inset(30% 0 20% 0); }
  40% { clip-path: inset(70% 0 10% 0); }
  60% { clip-path: inset(20% 0 50% 0); }
  80% { clip-path: inset(90% 0 5% 0); }
  100% { clip-path: inset(5% 0 80% 0); }
}

/* Variante que solo hace glitch en hover o cada cierto tiempo */
.viudas-glitch-intermittent .viudas-glitch-img {
  animation-play-state: paused;
  opacity: 0;
}

.viudas-glitch-intermittent.is-glitching .viudas-glitch-img,
.viudas-glitch-intermittent:hover .viudas-glitch-img {
  animation-play-state: running;
  opacity: 0.8;
}
