/* Site chrome: the header, footer and npm lockup that <site-header> and
   <site-footer> render. */

site-header,
site-footer {
  display: block;
}

/* The host element is the one that sticks: a sticky child can only travel
   inside its parent, and this parent is exactly as tall as the bar. */
site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 61px; /* keeps the page from jumping while the element upgrades */
}

.site-header {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition:
    background-color 0.3s,
    border-color 0.3s;
}

/* Over a dark or blue section the bar takes that section's color. */
site-header[dark] .site-header {
  background: color-mix(in srgb, var(--header-tone, #0a1329) 86%, transparent);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

site-header[dark] .brand,
site-header[dark] .site-nav a:not(.npm-lockup) {
  color: #fff;
}

site-header[dark] .brand-mark {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

site-header[dark] .npm-lockup {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.brand,
.site-nav a {
  transition:
    color 0.3s,
    background-color 0.3s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--signal);
  display: grid;
  place-items: center;
}

.brand-mark svg {
  width: 14px;
  height: 14px;
}

.site-nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
  align-items: center;
}

.site-nav a:not(.npm-lockup) {
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* The npm logo and the live version, as one link. */
.npm-lockup {
  display: inline-flex;
  align-items: stretch;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.npm-lockup:hover {
  border-color: #cb3837;
  box-shadow: 0 0 0 3px rgba(203, 56, 55, 0.14);
}

.npm-mark {
  display: grid;
  place-items: center;
  width: 30px;
  background: #cb3837;
  color: #fff;
}

.npm-mark svg {
  width: 18px;
  height: 18px;
}

.npm-version {
  display: grid;
  place-items: center;
  padding: 0 11px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
  color: var(--ink-2);
  font-size: 0.92rem;
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 16px;
}

@media (max-width: 900px) {
  .site-nav {
    gap: 14px;
  }
}

@media (max-width: 600px) {
  .site-header .wrap {
    gap: 14px;
  }
  .site-nav {
    gap: 12px;
  }
  .brand {
    font-size: 0.95rem;
  }
}

@media (max-width: 520px) {
  .brand-text {
    display: none;
  }
  /* The brand icon already links home. */
  .site-nav a:first-child {
    display: none;
  }
}
