/* Shared pinned header behavior */
#masthead.is-pinned {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;

  transform: translateY(0);

  background-color: rgba(17, 41, 64, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);

  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);

  transition:
    transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.35s ease,
    box-shadow 0.35s ease,
    border-color 0.35s ease,
    backdrop-filter 0.35s ease;
}

/* Hide while scrolling down */
#masthead.is-pinned.nav-hidden {
  transform: translateY(-105%);
}

#masthead.is-pinned.fast-hide {
  transition:
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    -webkit-backdrop-filter 0.25s ease,
    backdrop-filter 0.25s ease;
}

/* Near the hero/top area: fade from frosted to transparent */
#masthead.is-pinned.is-hero-blend {
  background-color: rgba(17, 41, 64, 0);
  -webkit-backdrop-filter: blur(0) saturate(100%);
  backdrop-filter: blur(0) saturate(100%);
  box-shadow: none;
  border-bottom-color: rgba(255, 255, 255, 0);
}

/* Prevent initial flash */
#masthead.no-anim {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #masthead.is-pinned {
    transition: none;
  }
}