/* SPAX Direct approved standard header: all non-test customers. */
@media (min-width: 992px) {
  #header .header_middle .wrapper {
    display: flex;
    align-items: center;
    gap: 24px;
  }
  #header .header_middle .wrapper > #logo { flex: 0 0 auto; }

  /* Centre the controls and search as two stacked blocks. */
  #header .header_middle .wrapper > .header2-right-stack {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center;
    gap: 12px;
    flex: 0 1 580px;
    width: min(100%, 580px);
    min-width: 0;
    margin-left: auto;
  }
  #header .header2-right-stack > .header_middle_right {
    order: 1;
    display: flex;
    justify-content: center !important;
    width: 100%;
	z-index: 99999 !important;
  }
  #header .header2-right-stack > .header-search {
    order: 2;
    flex: 0 1 auto;
    width: min(100%, 580px) !important;
    max-width: 580px;
    margin: 0 auto !important;
    align-self: center !important;
  }
}
@media (max-width: 991px) {
  #header .header2-right-stack { min-width: 0; }
  #header .header2-right-stack .header-search { max-width: 100%; }
  #header .header2-right-stack .header-search input,
  #header .header2-right-stack .header-search select { font-size: 16px !important; }
}

/* Static straplines only — no changes to menu, logo, account, basket or search. */
#header .header2-messages {
  text-align: center;
  min-width: 0;
  padding: 6px 10px;
}
#header .header2-primary-message {
  display: inline-block;
  color: #008849;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(17px, 1.5vw, 25px);
  line-height: 1.25;
  padding-bottom: 5px;
  border-bottom: 3px solid #008849;
}
#header .header2-secondary-message {
  color: #252525;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 8px;
}
@media (min-width: 992px) {
  #header .header_middle .wrapper > .header2-messages {
    flex: 1 1 240px;
    min-width: 0;
  }
}
@media (max-width: 767px) {
  #header .header_middle .wrapper > .header2-messages {
    width: 100%;
    flex: 0 0 100%;
    order: 1;
    padding: 8px 10px 12px;
  }
  #header .header2-primary-message {
    font-size: clamp(16px, 4.1vw, 19px);
    border-bottom-width: 2px;
  }
  #header .header2-secondary-message {
    font-size: 12px;
    max-width: 340px;
    margin: 6px auto 0;
  }
}

/* Mobile: keep Avanam's existing header controls; wrap messages onto their own row. */
@media (max-width: 767px) {
  #header .header_middle .wrapper {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
  }
  #header .header_middle .wrapper > #logo { order: 0; }
  #header .header_middle .wrapper > .header2-messages {
    order: 1;
    box-sizing: border-box;
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    white-space: normal;
  }
  #header .header_middle .wrapper > .header2-right-stack {
    order: 2;
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }
  #header .header2-primary-message { max-width: 100%; white-space: normal; }
}

/* Mobile-only: place the EXISTING account/basket controls beside the logo.
   Do not move or duplicate the controls or alter the search block. */
@media (max-width: 767px) {
  #header .header_middle .wrapper {
    position: relative;
  }
  #header .header_middle .wrapper > .header2-right-stack {
    position: static;
  }
  #header .header2-right-stack > .header_middle_right {
    position: absolute !important;
    top: 20px;
    right: 0;
    width: auto !important;
    margin: 0 !important;
    z-index: 2;
    display: flex !important;
    align-items: center;
    justify-content: flex-end !important;
  }
  #header .header2-right-stack > .header_middle_right > ul {
    margin-bottom: 0;
  }
  #header .header2-right-stack > .header-search {
    width: 100% !important;
    max-width: 100%;
  }
  #header .header2-right-stack .header-search input {
    font-size: 16px !important;
  }
}

/* Mobile strapline typography only; desktop and header positioning unchanged. */
@media (max-width: 767px) {
  #header .header2-primary-message {
    font-size: 15px;
  }
  #header .header2-secondary-message {
    font-size: 11px;
  }
}

/* Shorter secondary tagline on phones; desktop wording remains unchanged. */
#header .header2-secondary-mobile { display: none; }
@media (max-width: 767px) {
  #header .header2-secondary-desktop { display: none; }
  #header .header2-secondary-mobile { display: inline; }
}

/* Desktop/mobile primary message selection (Stage 2). */
#header .header2-primary-mobile { display: none; }
@media (max-width: 767px) {
  #header .header2-primary-desktop { display: none; }
  #header .header2-primary-mobile { display: inline-block; }
}

/* Stage 3B: text fades in place, never slides. */
#header [data-header2-slot] { transition: opacity 0.45s ease; }
#header [data-header2-slot].header2-fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  #header [data-header2-slot] { transition: none !important; }
}
