/* ===================== OPTIMIZED SVG BUTTONS & LINKS ===================== */

/* Core keyframes - reused across components */
@keyframes glitchEffect {
  0%, 100% { opacity: 0; transform: translateX(0); clip-path: inset(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; }
}

/* ===================== SVG BUTTON CONTAINER ===================== */

.svg-button-container {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border: 1px solid transparent;
  border-left: none;
  border-right: none;
}

.svg-icon {
  fill: var(--color-nier-dark, #5a5a50);
  position: relative;
  z-index: 1;
  transition: fill 0.3s ease;
}

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

/* Glitch text overlay */
.svg-button-container::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-nier-text-light, rgba(230, 230, 230, 0.9));
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-family: "Noto Sans JP", monospace;
}

/* Scan line */
.svg-button-container .scan-line {
  position: absolute;
  inset: 0 0 auto -100%;
  width: 100%;
  height: 1px;
  background-color: var(--color-nier-text-light, rgba(230, 230, 230, 0.9));
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

/* Hover states */
.svg-button-container:hover,
.svg-button-container:focus {
  border-color: var(--color-nier-dark);
}

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

.svg-button-container:hover .svg-icon,
.svg-button-container:active .svg-icon {
  fill: var(--color-nier-text-light, #dcd8c0);
}

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

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

/* Active state */
.svg-button-container:active {
  transform: scale(0.98);
}

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

/* ===================== TEXT LINKS ===================== */

a[data-label] {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.3s ease;
  padding: 0 2px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border-bottom: 1px solid transparent;
}

a[data-label]::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-nier-dark, #5a5a50);
  transition: width 0.3s ease;
  z-index: 0;
}

a[data-label] .scan-line {
  position: absolute;
  inset: 0 0 auto -100%;
  width: 100%;
  height: 1px;
  background-color: var(--color-nier-dark, rgba(230, 230, 230, 0.9));
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

/* Link hover states */
a[data-label]:hover {
  color: var(--color-nier-dark, #dcd8c0);
  border-bottom-color: var(--color-nier-dark);
}

a[data-label]:hover::before {
  width: 100%;
}

a[data-label]:hover span:first-child {
  animation: glitchEffect 0.6s ease;
}

a[data-label]:hover .scan-line {
  animation: scanLine 0.3s ease forwards;
}

a[data-label]:active {
  transform: scale(0.98);
}

/* ===================== ICON STYLES ===================== */

.icon-email {
  width: 150px;
  height: 150px;
  background-color: var(--color-nier-text-dark);
  -webkit-mask: url('/images/email_qr_black.svg') no-repeat center / contain;
  mask: url('/images/email_qr_black.svg') no-repeat center / contain;
}

/* ===================== TOUCH DEVICES ===================== */

@media (hover: none) {
  .svg-button-container:active::before {
    width: 100%;
  }

  .svg-button-container:active .scan-line {
    animation: scanLine 0.3s ease forwards;
  }

  .svg-button-container:active .svg-icon {
    fill: var(--color-nier-dark, #dcd8c0);
  }

  a[data-label]:active::before {
    width: 100%;
  }

  a[data-label]:active .scan-line {
    animation: scanLine 0.3s ease forwards;
  }

  a[data-label]:active {
    color: var(--color-nier-dark, #dcd8c0);
  }
}
