/*
 * The site header, the same on the docs pages and the API reference.
 */

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  flex: none;
}

.brand-mark {
  display: inline-flex;
  color: var(--accent);
}

.brand-name {
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-docs {
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 450;
}

.navbar-sections {
  display: flex;
  align-items: center;
  gap: 4px;
  /* the sections keep their width; the search field gives way when the header is short of room */
  flex: 1 0 auto;
}

.section-link {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms, color 120ms;
}

.section-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.section-link.is-current {
  background: var(--accent-subtle);
  color: var(--accent-strong);
}

/* the docs search: a field in the header; its results drop down below it (search.css) */
.navbar-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 280px;
  min-width: 0;
  height: 36px;
  padding: 0 8px 0 10px;
  gap: 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.navbar-search:hover {
  border-color: var(--border-strong);
}

.navbar-search:focus-within {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.navbar-search-icon {
  flex: none;
}

.navbar-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 400 14px/1 var(--font-sans);
}

.navbar-search input::placeholder {
  color: var(--text-muted);
}

.navbar-search input:disabled {
  cursor: progress;
}

.navbar-search-key {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-muted);
  font: 500 11px/16px var(--font-sans);
  text-align: center;
}

.navbar-search:focus-within .navbar-search-key {
  display: none;
}

.navbar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.di-switch {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 4px 0 12px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.8125rem;
  cursor: pointer;
  margin-right: 4px;
}

.di-switch:hover {
  border-color: var(--border-strong);
}

.di-switch-label {
  color: var(--text-muted);
}

.di-switch select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 6px center;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 4px 24px 4px 2px;
  cursor: pointer;
  outline: none;
}

.di-switch select option {
  background: var(--bg);
  color: var(--text);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 120ms, color 120ms, border-color 120ms;
}

.icon-button:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: block;
  }
}

/* the switches' labels go first when room runs short: each switch keeps its title, and its value says what it is */
@media (max-width: 1280px) {
  .di-switch-label {
    display: none;
  }

  .di-switch {
    padding-left: 8px;
  }
}

@media (max-width: 960px) {
  :root {
    --header-height: 56px;
  }

  .navbar-sections,
  .brand-docs,
  .di-switch-label {
    display: none;
  }

  .navbar {
    justify-content: space-between;
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  .navbar {
    gap: 12px;
  }

  .brand-name {
    display: none;
  }

  .navbar-search {
    flex: 1 1 auto;
  }

  .navbar-search-key {
    display: none;
  }
}
