.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  background-color: var(--color-bg-primary);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.header._scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/*
 * On a wide screen the header shrinks by 16px when scrolled (.header-top's
 * padding below) and grows back over 0.35s. The page is laid out under the
 * full header, so flung back to the top it arrived before the header had
 * grown, and for that moment the white of the page showed between the
 * header's bar and a navy page header. The page header now starts 17px
 * higher, tucked under the full header, with a transparent top border of
 * the same depth that its own background shows through: at rest the header
 * covers it, and while the header grows it is the page header itself that
 * shows, not white. Its content stays where it was. Only a .page-hero (and
 * the alumni opening) that comes first and follows the general rule for the
 * first section; a page whose own CSS places its first section otherwise
 * keeps that.
 */
@media (min-width: 992px) {
  main > section.page-hero:first-of-type,
  main > section.alumni-intro:first-of-type {
    margin-top: calc(var(--header-height-1px, 119px) - 17px);
    border-top: 17px solid transparent;
    background-origin: border-box;
  }
}

.header-top {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-bg-primary);
  padding: 1rem 0;
  transition: padding 0.35s ease-in-out;
  color: var(--color-text-secondary);
}

.header._scrolled .header-top {
  padding: 0.5rem 0;
}

.header-top__item {
  position: relative;
  z-index: 1;
}

.header-top__item:nth-child(1) {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-bottom {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-blue-200);
  color: var(--color-white);
}

.header-bottom::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 100vw;
  height: 100%;
  background-color: var(--color-blue-200);
  transition: transform 0.35s ease-in-out;
  z-index: -1;
  transform-origin: center;
}

.header._scrolled .header-bottom::before {
  transform: translateX(-50%) scaleX(1);
}

.header-bottom__item {
  position: relative;
  width: 100%;
}

.header-bottom__item a {
  padding: 1.1rem 0;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.3s ease;
}

@media (min-width: 1600px) {
  .header-top {
    font-size: 1.125rem;
  }
  .header-bottom {
    font-size: 1.2rem;
  }
  
}

@media (min-width: 1200px) {
  .header-top {
    font-size: 1rem;
  }
  .header-top__item:nth-child(2) {
    display: flex;
    width: 100%;
    justify-content: flex-end;
  }
  .header-bottom {
    font-size: 1rem;
    font-weight: 500;
  }
}

@media (max-width: 1199px) {
  .header._scrolled {
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.05),
      0 12px 32px rgba(0, 0, 0, 0.1);

    background-color: rgba(var(--color-bg-primary--rgb), 0.98);
  }

  .header-top__item:nth-child(3) {
    max-width: 90%;
    width: 100%;
  }
  .header-bottom {
    display: none;
  }
}

/*
 * Small screens: the controls take only their own width and the logo gets
 * the rest of the bar, shrinking its wordmark instead of overflowing
 * (logo.css).
 */
@media (max-width: 767px) {
  .header-top__item:nth-child(1) {
    flex-shrink: 1;
    min-width: 0;
  }

  .header-top__item:nth-child(3) {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 899px) {
  .header-top {
    padding: 0.5rem 0;
  }
  .categories__container {
    padding: 0 !important;
  }
}

