.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--header-border);
  transition: background var(--transition-normal);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--header-text);
  letter-spacing: -0.5px;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.header-logo:hover {
  opacity: 1;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--header-text);
  transition: transform var(--transition-normal), opacity var(--transition-fast);
  border-radius: 2px;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav-list {
  display: none;
  flex-direction: column;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--header-border);
  padding: 0.5rem 0;
}

.nav-list.open {
  display: flex;
}

.nav-list a {
  display: block;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  color: var(--header-text);
  opacity: 0.7;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.nav-list a:hover,
.nav-list a:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.nav-list a[aria-current="page"] {
  opacity: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--toggle-bg);
  border-radius: 13px;
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background var(--transition-normal);
  flex-shrink: 0;
}

.theme-toggle-ball {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--toggle-ball);
  border-radius: 50%;
  transition: transform var(--transition-normal), background var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .theme-toggle-ball {
  transform: translateX(22px);
}

.theme-toggle-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="dark"] .theme-toggle-icon { stroke: #ffffff; }
[data-theme="light"] .theme-toggle-icon { stroke: #ffdd00; }

@media (max-width: 767px) {
  .header .container > nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
  }
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .nav-list {
    display: flex;
    flex-direction: row;
    position: static;
    background: none;
    backdrop-filter: none;
    border: none;
    padding: 0;
    gap: 0.25rem;
  }

  .nav-list a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
  }

  .nav-list a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.08);
  }
}
