/* ===================== OPTIMIZED NIER BUTTON ===================== */

/* Core keyframes - simplified and optimized */
@keyframes glitchEffect {
  0%, 100% { opacity: 0; transform: translateX(0); }
  10% { opacity: 0.2; transform: translateX(-2px); clip-path: inset(10% 0 80% 0); }
  20% { opacity: 0.2; transform: translateX(2px); clip-path: inset(30% 0 50% 0); }
  30% { opacity: 0.1; transform: translateX(-1px); clip-path: inset(50% 0 20% 0); }
}

@keyframes scanLine {
  from { opacity: 0.5; left: -100%; }
  to { opacity: 0; left: 100%; }
}

@keyframes flash {
  from { opacity: 0.2; }
  to { opacity: 0; }
}

/* Button base styles */
.button-custom {
  cursor: pointer;
  background-color: var(--color-nier-mid);
  color: var(--color-nier-dark);
  position: relative;
  border: 1px solid transparent;
  border-left: none;
  border-right: none;
  overflow: hidden;
  transition: all 0.2s ease;
}

/* Fill effect */
.button-custom::before {
  content: "";
  position: absolute;
  inset: 3px 0;
  width: 0;
  background-color: var(--color-nier-dark);
  transition: width 0.2s ease;
  z-index: 0;
}

/* Glitch text overlay */
.button-custom::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-nier-text-light);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}

/* Scan line element */
.button-custom .scan-line {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 1px;
  background-color: var(--color-nier-text-light);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

/* ===================== HOVER STATES ===================== */

.button-custom:hover,
.button-custom:focus {
  color: var(--color-nier-text-light);
  background-color: transparent;
  border-color: var(--color-nier-dark);
}

.button-custom:hover::before,
.button-custom:focus::before {
  width: 100%;
}

.button-custom:hover::after {
  animation: glitchEffect 0.6s ease forwards;
}

.button-custom:hover .scan-line {
  animation: scanLine 0.3s ease forwards;
}

/* ===================== ACTIVE STATES ===================== */

.button-custom:active {
  transform: scale(0.98);
}

.button-custom:active::after {
  background-color: rgba(255, 255, 255, 0.1);
  animation: flash 0.2s ease;
}
