/* Sticky header behavior for desktop and mobile. */

/* Unlike hidden, clip does not create a scroll container that can disable
   position: sticky on the Bricks header. */
html,
body.og-brand-design {
  overflow-x: clip;
}

html {
  scroll-padding-top: 104px;
}

#brx-header {
  position: -webkit-sticky !important;
  position: sticky !important;
  z-index: 1000;
  top: 0 !important;
  width: 100%;
  isolation: isolate;
}

#brx-header .og-header-shell {
  transition: min-height .22s ease;
}

/* Keep the storefront header below the WordPress toolbar for signed-in users. */
body.admin-bar #brx-header {
  top: 32px !important;
}

@media (min-width: 821px) {
  #brx-header.is-scrolled .og-header-shell {
    min-height: 76px;
  }
}

@media (max-width: 820px) {
  html {
    scroll-padding-top: 88px;
  }

  #brx-header .og-header-shell {
    z-index: 2;
  }

  /* The open menu always begins directly below the compact sticky row. */
  #brx-header .og-mobile-nav {
    top: 100%;
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
    overscroll-behavior: contain;
  }

  /* Keep the social strip at the top of the page, then reclaim its height
     while scrolling so the sticky header does not crowd the viewport. */
  #brx-header .og-mobile-socials {
    max-height: 62px;
    overflow: hidden;
    opacity: 1;
    transition:
      min-height .22s ease,
      max-height .22s ease,
      border-color .22s ease,
      opacity .16s ease;
  }

  #brx-header.is-scrolled .og-mobile-socials {
    min-height: 0;
    max-height: 0;
    border-top-color: transparent;
    border-bottom-color: transparent;
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 782px) {
  body.admin-bar #brx-header {
    top: 46px !important;
  }
}

@media (max-width: 600px) {
  /* WordPress stops fixing its toolbar at this width, so the storefront
     header can occupy the top edge again after the toolbar scrolls away. */
  body.admin-bar #brx-header {
    top: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #brx-header .og-header-shell,
  #brx-header .og-mobile-socials {
    transition: none;
  }
}
