.th-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: linear-gradient(to bottom, rgba(5, 7, 18, 0.95), rgba(5, 7, 18, 0.86));
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

.th-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  gap: var(--space-4);
}

.th-header__brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.th-header__logo-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
}

.th-header__logo-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 20% 0, #22d3ee 0, #2563eb 40%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.7);
  position: relative;
  overflow: hidden;
}

.th-header__logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #e5f0ff;
  box-shadow: 0 0 18px rgba(248, 250, 252, 0.95);
}

.th-header__brand-text {
  display: flex;
  flex-direction: column;
}

.th-header__site-name {
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: var(--font-size-sm);
}

.th-header__site-tagline {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.th-header__nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

.th-header__nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
}

.th-header__nav-link {
  position: relative;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  padding: 0.25rem 0;
}

.th-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #22d3ee);
  transition: width var(--transition-base);
}

.th-header__nav-link:hover,
.th-header__nav-link:focus-visible {
  color: var(--color-text);
}

.th-header__nav-link:hover::after,
.th-header__nav-link:focus-visible::after {
  width: 100%;
}

.th-header__cta-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-4);
}

.th-header__cta-link {
  font-size: var(--font-size-sm);
}

/* Mobile menu toggle */

.th-header__menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text);
  background: rgba(15, 23, 42, 0.9);
  cursor: pointer;
}

.th-header__menu-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.th-header__menu-toggle-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.th-header__menu-toggle-line {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--color-text);
  transition: transform var(--transition-base), opacity var(--transition-base);
}

/* Open state animation */

.th-header__menu-toggle--open .th-header__menu-toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.th-header__menu-toggle--open .th-header__menu-toggle-line:nth-child(2) {
  opacity: 0;
}

.th-header__menu-toggle--open .th-header__menu-toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Responsive behaviour */

@media (max-width: 960px) {
  .th-header__site-tagline {
    display: none;
  }

  .th-header__menu-toggle {
    display: inline-flex;
  }

  .th-header__nav {
    position: fixed;
    inset: 0 0 auto 0;
    top: 60px;
    background: radial-gradient(circle at top, #020617 0, #020617 55%);
    border-top: 1px solid rgba(148, 163, 184, 0.24);
    padding: var(--space-4) var(--space-4) calc(env(safe-area-inset-bottom) + var(--space-4));
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-base), opacity var(--transition-base);
  }

  .th-header__nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .th-header__cta-group {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .th-header__cta-group .btn {
    width: auto;
  }

  .th-header__nav--open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  .th-header__inner {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }
}

/* Utility when menu is open to prevent body scroll (JS toggles class on body) */

body.th-menu-open {
  overflow: hidden;
}
