/* GLITCH TEXT */

.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-glitch);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  clip-path: inset(0 0 0 0);
  opacity: 0.8;
}

.glitch::before {
  transform: translate(-1px, 0);
  text-shadow: -2px 0 rgba(255, 0, 102, 0.7);
  animation: glitch-1 2s infinite linear alternate-reverse;
}

.glitch::after {
  transform: translate(1px, 0);
  text-shadow: 2px 0 rgba(0, 255, 255, 0.8);
  animation: glitch-2 1.7s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
  0% { clip-path: inset(0 0 80% 0); }
  10% { clip-path: inset(10% 0 40% 0); }
  20% { clip-path: inset(80% 0 0 0); }
  35% { clip-path: inset(40% 0 30% 0); }
  50% { clip-path: inset(20% 0 50% 0); }
  70% { clip-path: inset(0 0 80% 0); }
  100% { clip-path: inset(30% 0 40% 0); }
}

@keyframes glitch-2 {
  0% { clip-path: inset(80% 0 0 0); }
  15% { clip-path: inset(30% 0 40% 0); }
  30% { clip-path: inset(10% 0 60% 0); }
  45% { clip-path: inset(50% 0 20% 0); }
  60% { clip-path: inset(0 0 80% 0); }
  100% { clip-path: inset(40% 0 30% 0); }
}

/* RESPONSIVE GLITCH DISABLE ON SMALL SCREEN */
@media (max-width: 480px) {
  .glitch::before,
  .glitch::after {
    display: none;
  }
}

/* TYPING CURSOR (untuk terminal text) */
.typing-cursor::after {
  content: "_";
  display: inline-block;
  margin-left: 2px;
  animation: blink-cursor 0.7s steps(1) infinite;
}

@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.gallery-item:hover {
  animation: glitch-img .4s steps(2) alternate;
}

@keyframes glitch-img {
  0% { clip-path: inset(0 0 0 0); }
  20% { clip-path: inset(10% 0 30% 0); }
  40% { clip-path: inset(0 0 50% 0); }
  60% { clip-path: inset(30% 0 10% 0); }
  80% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(5% 0 20% 0); }
}

@media (max-width: 600px) {
  .glitch::before,
  .glitch::after {
    display: none;
  }

  .gallery-item:hover {
    animation: none;
  }
}

/* =========================
   DISABLE HEAVY ANIMATION ON MOBILE
========================= */
@media (max-width: 768px) {
  .glitch::before,
  .glitch::after {
    display: none !important;
  }

  .typing-cursor::after {
    animation: none !important;
  }

  .gallery-item:hover {
    animation: none !important;
  }
}