/* Cyberpunk glitch nav — adapted from https://codepen.io/xdega/pen/dyqXarJ (Cyberpunk Glitch: Nav Bar) */

@font-face {
  font-family: Cyber;
  src: url("https://assets.codepen.io/605876/Blender-Pro-Bold.otf");
  font-display: swap;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 4px 12px 6px;
  border-bottom: 1px solid rgba(0, 255, 170, 0.12);
  background: rgba(0, 8, 4, 0.72);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 3;
}

.site-brand {
  font-family: Cyber, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b8ffe8;
  text-decoration: none;
  text-shadow: 0 0 12px rgba(0, 255, 200, 0.35);
}

.site-brand:hover {
  color: #e8fff8;
}

.site-brand small {
  display: block;
  font-family: var(--font-body, system-ui);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: rgba(180, 255, 220, 0.45);
  margin-top: 2px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
}

.cybr-btn {
  --primary-hue: 160;
  --primary: hsl(var(--primary-hue), 18%, 8%);
  --primary-lightness: 2;
  --color: hsl(150, 40%, 92%);
  --font-size: 13px;
  --label-size: 9px;
  --shadow-secondary-hue: 300;
  --shadow-secondary: hsl(var(--shadow-secondary-hue), 100%, 55%);
  --shadow-primary-hue: 165;
  --shadow-primary: hsl(var(--shadow-primary-hue), 100%, 42%);
  --border: 0px;
  --shimmy-distance: 10;
  --clip: var(--clip-four);
  --clip-one: polygon(
    0 2%,
    100% 2%,
    100% 95%,
    95% 95%,
    95% 90%,
    85% 90%,
    85% 95%,
    8% 95%,
    0 70%
  );
  --clip-two: polygon(
    0 78%,
    100% 78%,
    100% 100%,
    95% 100%,
    95% 90%,
    85% 90%,
    85% 100%,
    8% 100%,
    0 78%
  );
  --clip-three: polygon(
    0 44%,
    100% 44%,
    100% 54%,
    95% 54%,
    95% 54%,
    85% 54%,
    85% 54%,
    8% 54%,
    0 54%
  );
  --clip-four: polygon(0 0, 100% 0, 100% 0, 95% 0, 95% 0, 85% 0, 85% 0, 8% 0, 0 0);
  --clip-five: polygon(0 0, 100% 0, 100% 0, 95% 0, 95% 0, 85% 0, 85% 0, 8% 0, 0 0);

  font-family: Cyber, system-ui, sans-serif;
  color: var(--color);
  background: transparent;
  text-transform: uppercase;
  font-size: var(--font-size);
  outline: transparent;
  letter-spacing: 0.1em;
  position: relative;
  font-weight: 700;
  border: 0;
  height: 32px;
  line-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.cybr-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 255, 200, 0.5);
}

.cybr-btn[aria-current="page"] {
  --color: #fff;
  filter: brightness(1.15);
}

.cybr-btn[aria-current="page"]::after {
  background: hsl(160, 25%, 14%);
}

.cybr-btn::after,
.cybr-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  clip-path: var(--clip);
  z-index: -1;
}

.cybr-btn::before {
  background: var(--shadow-primary);
  transform: translate(var(--border), 0);
}

.cybr-btn::after {
  background: var(--primary);
}

.cybr-btn__tag {
  position: absolute;
  padding: 1px 3px;
  letter-spacing: 1px;
  line-height: 1;
  bottom: -4px;
  right: 6%;
  color: hsl(0, 0%, 0%);
  font-size: var(--label-size);
  pointer-events: none;
}

.cybr-btn__glitch {
  position: absolute;
  top: calc(var(--border) * -1);
  left: calc(var(--border) * -1);
  right: calc(var(--border) * -1);
  bottom: calc(var(--border) * -1);
  background: var(--shadow-primary);
  text-shadow: 2px 2px var(--shadow-primary), -2px -2px var(--shadow-secondary);
  clip-path: var(--clip);
  animation: nav-glitch 2.2s infinite;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size);
  letter-spacing: 0.1em;
}

.cybr-btn:hover .cybr-btn__glitch,
.cybr-btn:focus-visible .cybr-btn__glitch {
  display: flex;
}

.cybr-btn__glitch::before {
  content: "";
  position: absolute;
  top: calc(var(--border) * 1);
  right: calc(var(--border) * 1);
  bottom: calc(var(--border) * 1);
  left: calc(var(--border) * 1);
  clip-path: var(--clip);
  background: var(--primary);
  z-index: -1;
}

.cybr-btn__text {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .cybr-btn__glitch {
    animation: none;
  }

  .cybr-btn:hover .cybr-btn__glitch {
    display: none;
  }
}

@keyframes nav-glitch {
  0% {
    clip-path: var(--clip-one);
  }
  2%,
  8% {
    clip-path: var(--clip-two);
    transform: translate(calc(var(--shimmy-distance) * -1%), 0);
  }
  6% {
    clip-path: var(--clip-two);
    transform: translate(calc(var(--shimmy-distance) * 1%), 0);
  }
  9% {
    clip-path: var(--clip-two);
    transform: translate(0, 0);
  }
  10% {
    clip-path: var(--clip-three);
    transform: translate(calc(var(--shimmy-distance) * 1%), 0);
  }
  13% {
    clip-path: var(--clip-three);
    transform: translate(0, 0);
  }
  14%,
  21% {
    clip-path: var(--clip-four);
    transform: translate(calc(var(--shimmy-distance) * 1%), 0);
  }
  31%,
  61%,
  100% {
    clip-path: var(--clip-four);
    transform: translate(0, 0);
  }
}
