/* Site header. It stays at the top while the page scrolls, so the
   brochure download is always in view. It spans the viewport, a gutter
   from each edge, not the content column. Once the hero has scrolled
   away the tagline gives way to the wordmark (where scroll-driven
   animations are supported; otherwise the tagline stays). */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  box-sizing: border-box;
  height: var(--theme-header-height);
  padding: 0 var(--theme-gutter);
  background: var(--theme-color-highlight);
  color: var(--theme-color-text);
}

/* On the home page the header lies over the top of the hero instead of
   pushing it down, so the hero can be exactly one screen tall. */
.site-header:has(+ .home) {
  margin-bottom: calc(-1 * var(--theme-header-height));
}

/* 404 page: a plain wordmark link. */
.site-header__logo {
  display: block;
}

.site-header__logo img {
  display: block;
  width: clamp(10rem, 20vw, 14rem);
  height: auto;
}

/* Tagline and wordmark share one cell and swap on scroll. */
.site-header__home {
  display: grid;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.site-header__tagline,
.site-header__wordmark {
  grid-area: 1 / 1;
}

.site-header__tagline {
  font-size: 0.75rem;
  font-weight: var(--theme-font-weight-bold);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--theme-color-secondary);
}

.site-header__developer {
  display: block;
  margin-top: 4px;
  font-size: var(--theme-text-sm);
  font-weight: var(--theme-font-weight-regular);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--theme-color-text);
}

.site-header__wordmark {
  display: block;
  width: clamp(9rem, 16vw, 13rem);
  height: auto;
  visibility: hidden;
}

.site-header__home:focus-visible {
  outline: 2px solid var(--theme-color-secondary);
  outline-offset: 6px;
}

.site-header__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
}

.site-header__campus {
  display: block;
  width: var(--theme-header-logo);
  height: auto;
}

@media (width <= 640px) {
  .site-header__campus,
  .site-header__developer {
    display: none;
  }

  .site-header__tagline {
    font-size: 0.625rem;
    letter-spacing: 0.18em;
  }
}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .site-header {
      animation: theme-header-raise linear both;
      animation-timeline: scroll(root);
      animation-range: 0 160px;
    }

    .site-header__tagline {
      animation: theme-fade-out linear both;
      animation-timeline: scroll(root);
      animation-range: 35vh 55vh;
    }

    .site-header__wordmark {
      visibility: visible;
      animation: theme-fade-in linear both;
      animation-timeline: scroll(root);
      animation-range: 45vh 65vh;
    }

    @keyframes theme-header-raise {
      to {
        box-shadow: 0 12px 32px -20px color-mix(in srgb, var(--theme-color-primary) 45%, transparent);
      }
    }

    @keyframes theme-fade-out {
      to {
        opacity: 0;
        visibility: hidden;
      }
    }

    @keyframes theme-fade-in {
      from {
        opacity: 0;
        translate: 0 6px;
      }

      to {
        opacity: 1;
        translate: 0 0;
      }
    }
  }
}
