/* Floating Centered Header Navigation */

.header-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  padding: 20px 24px;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

.header-nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 20px;
  background: rgba(18, 18, 18, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 0 rgba(232, 232, 232, 0.05);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-nav.header-cta-hover {
  padding: 5px 5px 5px 16px;
}

.header-nav.scrolled {
  padding: 6px 6px 6px 16px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(32px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 0 rgba(232, 232, 232, 0.08);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  padding-right: 16px;
  border-right: 1px solid var(--glass-border);
  margin-right: 8px;
  text-decoration: none;
  transition: filter 0.35s ease, transform 0.35s ease;
}

.header-nav.header-cta-hover .header-logo {
  filter: blur(2px);
  transform: scale(0.92);
}

.header-nav.header-cta-hover .header-logo-img {
  height: 24px;
}

.header-logo-img {
  height: 28px;
  width: auto;
  display: block;
  transition: height 0.35s ease;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-link {
  position: relative;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: 100px;
  transition: all 0.25s ease;
}

.header-link:hover {
  color: var(--gray-900);
  background: rgba(42, 42, 42, 0.5);
}

.header-link.active {
  color: var(--gray-900);
  background: rgba(58, 58, 58, 0.6);
}

.header-link-text {
  position: relative;
  display: inline-block;
}

/* Glitch / encrypted state - strong chromatic aberration */
.header-link:not(.active) .header-link-text {
  text-shadow:
    3px 0 rgba(255, 50, 50, 0.5),
    -3px 0 rgba(50, 200, 255, 0.5),
    1px 1px rgba(255, 50, 50, 0.3),
    -1px -1px rgba(50, 200, 255, 0.3);
  animation: idleGlitch 3s infinite;
  transition: text-shadow 0.1s ease, filter 0.3s ease;
}

/* Decrypt animation on hover */
.header-link:hover .header-link-text {
  animation: decryptText 0.5s ease forwards;
}

.header-link.active .header-link-text {
  text-shadow: none;
  animation: none;
}

/* Glitch overlay - RED channel */
.header-link-text::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  color: rgba(255, 50, 50, 0.5);
  text-shadow: none;
  clip-path: inset(0 0 60% 0);
  transform: translateX(-3px);
  opacity: 0.8;
  transition: clip-path 0.4s ease, opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

/* Glitch overlay - CYAN channel */
.header-link-text::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  color: rgba(50, 200, 255, 0.5);
  text-shadow: none;
  clip-path: inset(40% 0 0 0);
  transform: translateX(3px);
  opacity: 0.8;
  transition: clip-path 0.4s ease, opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

/* Hover: glitch layers collapse and fade */
.header-link:hover .header-link-text::before,
.header-link.active .header-link-text::before {
  clip-path: inset(0 0 100% 0);
  transform: translateX(0);
  opacity: 0;
}

.header-link:hover .header-link-text::after,
.header-link.active .header-link-text::after {
  clip-path: inset(100% 0 0 0);
  transform: translateX(0);
  opacity: 0;
}

/* Idle glitch animation - subtle jitter */
@keyframes idleGlitch {
  0%, 100% {
    text-shadow:
      3px 0 rgba(255, 50, 50, 0.5),
      -3px 0 rgba(50, 200, 255, 0.5);
  }
  25% {
    text-shadow:
      2px 1px rgba(255, 50, 50, 0.6),
      -2px -1px rgba(50, 200, 255, 0.6);
  }
  50% {
    text-shadow:
      4px 0 rgba(255, 50, 50, 0.4),
      -4px 0 rgba(50, 200, 255, 0.4);
  }
  75% {
    text-shadow:
      1px -1px rgba(255, 50, 50, 0.5),
      -3px 1px rgba(50, 200, 255, 0.5);
  }
}

/* Decrypt animation - scramble then settle */
@keyframes decryptText {
  0% {
    text-shadow:
      5px 0 rgba(255, 50, 50, 0.7),
      -5px 0 rgba(50, 200, 255, 0.7);
    filter: blur(1px);
  }
  20% {
    text-shadow:
      -4px 2px rgba(255, 50, 50, 0.8),
      4px -2px rgba(50, 200, 255, 0.8);
    filter: blur(2px);
  }
  40% {
    text-shadow:
      3px -1px rgba(255, 50, 50, 0.5),
      -3px 1px rgba(50, 200, 255, 0.5);
    filter: blur(1px);
  }
  60% {
    text-shadow:
      -2px 0 rgba(255, 50, 50, 0.3),
      2px 0 rgba(50, 200, 255, 0.3);
    filter: blur(0.5px);
  }
  80% {
    text-shadow:
      1px 0 rgba(255, 50, 50, 0.1),
      -1px 0 rgba(50, 200, 255, 0.1);
    filter: blur(0);
  }
  100% {
    text-shadow: none;
    filter: blur(0);
  }
}

.header-link::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 4px;
  height: 4px;
  background: var(--gray-700);
  border-radius: 50%;
  transition: transform 0.25s ease;
}

.header-link:hover::after,
.header-link.active::after {
  transform: translateX(-50%) scale(1);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 8px 20px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: #6B7B6B;
  background: transparent;
  border: 1px solid rgba(74, 90, 74, 0.6);
  border-radius: 9999px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-cta:hover {
  color: #8A9A8A;
  background: rgba(74, 90, 74, 0.2);
  border-color: rgba(100, 120, 100, 0.7);
  box-shadow: 0 0 20px rgba(74, 90, 74, 0.4), 0 0 40px rgba(74, 90, 74, 0.2);
  transform: scale(1.06);
}

/* Mobile Header */
@media (max-width: 768px) {
  .header-nav {
    padding: 8px 12px;
    gap: 0;
  }

  .header-logo {
    border: none;
    padding-right: 8px;
    margin-right: 0;
  }

  .header-links {
    display: none;
  }

  .header-cta {
    margin-left: auto;
  }

  .header-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: 8px;
  }

  .header-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--gray-700);
    position: relative;
  }

  .header-menu-btn span::before,
  .header-menu-btn span::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: var(--gray-700);
    left: 0;
  }

  .header-menu-btn span::before {
    top: -6px;
  }

  .header-menu-btn span::after {
    bottom: -6px;
  }
}
