/* Site header, laid out like the RockValue site: logo left, the menu
   truly centred, the sign-up button right (a 1fr auto 1fr grid on wide
   screens, auto 1fr auto a step narrower so the menu keeps its room).
   Light, it stays at the top while the page scrolls. */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
  height: var(--theme-header-height);
  padding: 0 var(--theme-gutter);

  /* Solid: a backdrop blur here smeared a faint line along the bottom
     edge. */
  background: var(--theme-color-background);
  color: var(--theme-color-text);
}

.site-header__logo {
  display: block;
  justify-self: start;
  color: inherit;
}

.site-header > .button {
  justify-self: end;
}

.site-header__logo svg,
.site-header__logo img {
  display: block;
  width: clamp(7.5rem, 10vw, 9rem);
  height: auto;
  fill: var(--theme-color-heading);
}

.site-header__logo:focus-visible,
.site-header__nav a:focus-visible {
  outline: 2px solid var(--theme-color-heading);
  outline-offset: 4px;
}

.site-header__nav {
  display: flex;
  justify-self: center;
  gap: clamp(16px, 2.4vw, 36px);
  font-size: var(--theme-text-sm);
  font-weight: var(--theme-font-weight-medium);
}

/* The underline grows in from the left and leaves to the right, as on the
   RockValue site. */
.site-header__nav a {
  position: relative;
  padding-block: 0.4rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.site-header__nav a::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1.5px;
  background: currentcolor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--theme-ease-signature);
}

.site-header__nav a:hover::after,
.site-header__nav a[aria-current='true']::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* The section in view (main.js): its link in the heading color with the
   underline drawn. */
.site-header__nav a[aria-current='true'] {
  color: var(--theme-color-heading);
}

@media (800px < width <= 1200px) {
  .site-header {
    grid-template-columns: auto 1fr auto;
  }
}

@media (width <= 800px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-header__nav {
    display: none;
  }
}
