.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  min-height: var(--header-height);
  background-color: transparent;
  transition: background-color 0.2s ease, backdrop-filter 0.2s ease;
}

.site-header[data-scrolled="true"] {
  background-color: var(--bg-header-scroll);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-width);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0.5rem var(--pad-x);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.header-brand {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.25rem;
  list-style: none;
}

.header-nav a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.header-nav a:hover,
.header-nav a:focus-visible {
  color: var(--text);
}

.theme-toggle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
}

@media (max-width: 767px) {
  .header-inner {
    position: relative;
    padding: 0.65rem var(--pad-x);
  }

  .header-controls {
    width: 100%;
  }

  .theme-toggle {
    position: absolute;
    top: 0.65rem;
    right: var(--pad-x);
    font-size: 12px;
    padding: 0;
  }

  .header-nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem 0.5rem;
  }

  .header-nav a {
    font-size: 12px;
    padding: 0.15rem 0;
  }
}
