/* Desktop keeps its normal Astra header/search; do not inject a visible form there. */
@media screen and (min-width: 1025px) {
  #masthead .ast-mobile-header-wrap .soa-header-search-v8 { display: none !important; }
}
@media screen and (max-width: 1024px) {
  /* Keep the form within the actual primary header row, not a search popover. */
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .soa-header-search-v8 {
    box-sizing: border-box !important;
    display: flex !important;
    flex: 1 1 110px !important;
    align-items: center !important;
    align-self: center !important;
    min-width: 75px !important;
    max-width: 240px !important;
    width: auto !important;
    height: 39px !important;
    min-height: 39px !important;
    max-height: 39px !important;
    padding: 0 !important;
    margin: 0 5px 0 auto !important;
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    z-index: 1 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .soa-header-search-v8 input[type="search"] {
    box-sizing: border-box !important;
    display: block !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 100% !important;
    height: 39px !important;
    min-height: 39px !important;
    min-width: 0 !important;
    max-height: 39px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid #d2b356 !important;
    border-radius: 9px !important;
    background: #fffdf8 !important;
    color: #101c2c !important;
    font: 500 13px/1.3 system-ui,-apple-system,"Segoe UI",sans-serif !important;
    box-shadow: none !important;
    outline: none !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .soa-header-search-v8 input::placeholder {
    color: #5a6370 !important;
    opacity: 1 !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .soa-header-search-v8 input:focus-visible {
    border-color: #b78f19 !important;
    box-shadow: 0 0 0 2px rgba(212,175,55,.25) !important;
  }
  /* Hide only the old search builder unit AFTER the replacement was inserted. */
  #masthead .ast-mobile-header-wrap .soa-original-search-hidden-v8 {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  /* Reserve real room for search; the original v5 header used every pixel for
     the brand and icon. Touch targets for cart/menu remain unchanged. */
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .site-header-primary-section-left {
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .site-header-primary-section-right,
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .site-header-primary-section-center {
    flex: 0 0 auto !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .site-header-primary-section-left > .ast-builder-layout-element:has(.custom-logo-link),
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .site-header-primary-section-left > .site-branding {
    flex: 0 1 auto !important;
    max-width: 145px !important;
  }
}
@media screen and (max-width: 544px) {
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .custom-logo-link img,
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .site-branding img {
    max-width: 100px !important;
    max-height: 35px !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .soa-header-search-v8 {
    margin-right: 0 !important;
    min-width: 70px !important;
    flex-basis: 84px !important;
  }
  #masthead .ast-mobile-header-wrap .ast-primary-header-bar .soa-header-search-v8 input[type="search"] {
    padding: 0 8px !important;
    font-size: 12px !important;
  }
}
