/* Sticky header: stays at the top of the window, shrinks while scrolling down
   and grows again when scrolling back up or reaching the top.
   The header keeps its full height in the page flow; only the green bar inside
   it changes size, so the page content never jumps when the bar shrinks. */

html {
  scroll-padding-top: calc(var(--fdm-header-height) + 12px);
}

.fdm-header {
  position: sticky;
  top: 0;
  height: var(--fdm-header-height);
  background: transparent;
  pointer-events: none;
}

/* The green bar itself */
.fdm-header::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  height: var(--fdm-header-height);
  background: var(--fdm-green-900);
  transition: height 0.22s ease, box-shadow 0.22s ease;
}

.fdm-header__inner {
  pointer-events: auto;
  transition: min-height 0.22s ease;
}

.fdm-brand__logo {
  transition: width 0.22s ease, height 0.22s ease;
}

.fdm-brand__name,
.fdm-brand__name-short {
  transition: font-size 0.22s ease;
}

.fdm-header-search,
.fdm-nav__item--cta .fdm-btn {
  transition: padding 0.22s ease;
}

/* Shrunk state, set by header-sticky.js */
.fdm-header.is-compact::before {
  height: 60px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
}

.fdm-header.is-compact .fdm-header__inner {
  min-height: 60px;
}

.fdm-header.is-compact .fdm-brand__logo {
  width: 32px;
  height: 32px;
}

.fdm-header.is-compact .fdm-brand__name {
  font-size: 20px;
}

.fdm-header.is-compact .fdm-header-search {
  padding-top: 5px;
  padding-bottom: 5px;
}

.fdm-header.is-compact .fdm-nav__item--cta .fdm-btn {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Keep the Resources card just under the shorter bar */
.fdm-header.is-compact .fdm-menu {
  top: calc(100% + 12px);
}

/* Signed-in editors: sit below the WordPress toolbar */
.admin-bar .fdm-header {
  top: 32px;
}

@media (max-width: 1023.98px) {
  html {
    scroll-padding-top: calc(var(--fdm-header-height-phone) + 12px);
  }

  .fdm-header {
    height: var(--fdm-header-height-phone);
  }

  .fdm-header::before {
    height: var(--fdm-header-height-phone);
  }

  .fdm-header.is-compact::before {
    height: 52px;
  }

  .fdm-header.is-compact .fdm-header__inner {
    min-height: 52px;
  }

  .fdm-header.is-compact .fdm-brand__logo {
    width: 30px;
    height: 30px;
  }

  .fdm-header.is-compact .fdm-brand__name,
  .fdm-header.is-compact .fdm-brand__name-short {
    font-size: 18px;
  }

  /* The open phone menu is taller than the bar: let the header grow with it */
  .fdm-header.is-nav-open {
    height: auto;
    min-height: var(--fdm-header-height-phone);
  }

  .fdm-header.is-compact .fdm-menu {
    top: auto;
  }
}

@media (max-width: 782px) {
  .admin-bar .fdm-header {
    top: 46px;
  }
}

@media (max-width: 600px) {
  .admin-bar .fdm-header {
    top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fdm-header::before,
  .fdm-header__inner,
  .fdm-brand__logo,
  .fdm-brand__name,
  .fdm-brand__name-short,
  .fdm-header-search,
  .fdm-nav__item--cta .fdm-btn {
    transition: none;
  }
}

@media print {
  .fdm-header {
    position: static;
  }
}
