/* =========================================================
   SITE HEADER - PostX header template
   Pinal Post child theme - css/header.css

   Everything that styles the PostX header: top row (logo,
   tagline, buttons), nav row (menu, search), the mobile menu
   open state, and all breakpoints. Loaded on every page.

   Enqueued from functions.php, versioned by filemtime() so
   edits bust the cache automatically. Split out of style.css
   2026-10-03; rules unchanged.
   ========================================================= */

/* =========================================================
   POSTX ID-PROOFING
   All header selectors use stable hooks instead of generated
   ultp-block-XXXXXX IDs, so re-saving the PostX header template
   no longer breaks this CSS:
     top row    -> .wp-block-ultimate-post-row.alignwide
     nav row    -> .wp-block-ultimate-post-row.alignfull
     logo col   -> column :has(.wp-block-site-logo)
     tagline    -> column :has(.wp-block-heading)
     buttons    -> column :has(.wp-block-buttons)
     nav col    -> column :has(.header-menu-col)   (custom class set in PostX)
     search col -> column :has(.header-search-col) (custom class set in PostX)
   Keep rows as alignwide/alignfull and keep the two custom
   classes on the nav + search blocks in the PostX editor.
   ========================================================= */

/* =========================================================
   TOP ROW ALIGNMENT - force ultp-row-content to full width
   ========================================================= */

#ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-content {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-wrapper {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#ultp-header-template .wp-block-ultimate-post-row.alignwide.alignwide,
#ultp-header-template .wp-block-ultimate-post-row.alignwide {
  max-width: 100% !important;
  width: 100% !important;
}

/* =========================================================
   SUBMENU Z-INDEX (above ticker)
   ========================================================= */

header .wp-block-navigation__submenu-container {
  z-index: 9999 !important;
  position: absolute !important;
}
/* NOTE: ID from a different PostX template (ticker?). Update if ticker template is re-saved. */
/* .ultp-block-4cc064 {
  z-index: 100 !important;
  position: relative !important;
} */

/* =========================================================
   NAV ROW - global

   ========================================================= */

header .wp-block-ultimate-post-row.alignfull,
header .wp-block-ultimate-post-row.alignfull .ultp-row-wrapper {
  overflow: visible !important;
}

header .wp-block-ultimate-post-column:has(.header-menu-col) nav.wp-block-navigation,
header .wp-block-ultimate-post-column:has(.header-menu-col) .wp-block-group {
  margin: 0 !important;
  padding: 2px 0 0 0 !important;
  display: flex !important;
  align-items: center !important;
}

/* =========================================================
   SEARCH BAR - remove blue outline
   ========================================================= */

header .ultp-searchres-input:focus {
  outline: none !important;
  box-shadow: none !important;
}
header .ultp-searchform-content,
header .ultp-search-container {
  outline: none !important;
  box-shadow: none !important;
}

/* =========================================================
   MOBILE MENU OPEN STATE (all screen sizes)
   ========================================================= */

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
  position: static !important;
  display: none !important;
  background: rgba(255,255,255,0.08) !important;
  border-radius: 8px !important;
  padding: 0.5rem !important;
  margin-top: 0.25rem !important;
  width: 100% !important;
  box-shadow: none !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.open > .wp-block-navigation__submenu-container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu.open > .wp-block-navigation__submenu-container {
  display: block !important;
}

.wp-block-navigation__responsive-container.is-menu-open {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  background: #3c2a1c !important;
  background-color: #3c2a1c !important;
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
  padding: 0 !important;
  display: block !important;
  overflow-y: auto !important;
}

#ultp-header-template .wp-block-navigation__responsive-container.is-menu-open,
body .wp-block-navigation__responsive-container.is-menu-open {
  background: #3c2a1c !important;
  background-color: #3c2a1c !important;
  background-image: none !important;
  opacity: 1 !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
  background-color: #3c2a1c !important;
  background-image: none !important;
}

.wp-block-navigation__responsive-container.is-menu-open ul.wp-block-navigation__container[style] {
  background-color: #3c2a1c !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open ul.wp-block-navigation__container {
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.75rem 1.5rem 2rem 1.5rem !important;
  list-style: none !important;
  flex-wrap: nowrap !important;
  box-sizing: border-box !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
  display: block !important;
  width: 78% !important;
  text-align: center !important;
  list-style: none !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
  display: block !important;
  width: 100% !important;
  padding: 1rem 1.5rem !important;
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: #ffffff !important;
  text-decoration: none !important;
  transition: background 0.2s ease !important;
  box-sizing: border-box !important;
  text-align: center !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__label {
  display: inline !important;
  color: #ffffff !important;
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close,
.wp-block-navigation__responsive-container-close {
  position: absolute !important;
  top: 1rem !important;
  right: 1rem !important;
  background: rgba(255,255,255,0.12) !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 0.6rem !important;
  cursor: pointer !important;
  z-index: 10000 !important;
}

.wp-block-navigation__responsive-container-close svg {
  fill: #f0dfc0 !important;
  stroke: #f0dfc0 !important;
  width: 22px !important;
  height: 22px !important;
  display: block !important;
}

/* =========================================================
   MOBILE (max 650px)
   ========================================================= */

@media (max-width: 650px) {

  header .custom-logo,
  header img[alt="Pinal Post"],
  header .wp-block-site-logo img {
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    object-fit: cover !important;
    object-position: center !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide.ultpBgPadding {
    padding: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide.xsL {
    padding-left: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide.xsR {
    padding-right: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide.smL {
    padding-left: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide.smR {
    padding-right: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    row-gap: 0 !important;
    gap: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-heading) {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    flex: 0 0 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    margin: 0 !important;
    padding: 8px 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .ultp-column-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-buttons {
    justify-content: center !important;
    align-items: center !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-button {
    margin: 0 !important;
    align-self: center !important;
  }

  header .wp-block-button.support-cta .wp-block-button__link,
  header .wp-block-button.advertise-cta .wp-block-button__link {
    padding: 4px 10px !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    opacity: 0.90 !important;
    width: 200px !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  /* Nav row: allow wrapping so search can sit below hamburger */
  header .wp-block-ultimate-post-row.alignfull .ultp-row-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  header .wp-block-ultimate-post-row.alignfull .ultp-row-content {
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 12px !important;
    gap: 12px !important;
    box-sizing: border-box !important;
  }

  header .wp-block-ultimate-post-column:has(.header-menu-col) {
    position: static !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    height: 50px !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    margin: 0 !important;
  }

  header .wp-block-ultimate-post-column:has(.header-menu-col) * { pointer-events: auto !important; }

  header .wp-block-ultimate-post-column:has(.header-menu-col) .wp-block-navigation__responsive-container.is-menu-open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
  }

  /* *** MOBILE SEARCH FIX ***
     Show search full-width below the hamburger/nav row */
  header .wp-block-ultimate-post-column:has(.header-search-col),
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) {
    display: flex !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
  }

  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-column-wrapper,
  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-block-wrapper,
  header .wp-block-ultimate-post-column:has(.header-search-col) .wp-block-ultimate-post-wrapper,
  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-wrapper-block,
  header .wp-block-ultimate-post-column:has(.header-search-col) .wp-block-ultimate-post-advanced-search,
  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-search-container,
  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-searchform-content,
  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-searchform-content.ultp-searchform-input3 {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
  }

  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-search-inputwrap {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-searchres-input {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    font-size: 1rem !important;
    padding: 10px 14px !important;
    height: 44px !important;
    box-sizing: border-box !important;
  }

  header .wp-block-ultimate-post-column:has(.header-search-col) .ultp-search-button {
    height: 44px !important;
    padding: 0 16px !important;
    font-size: 1rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  /* *** END MOBILE SEARCH FIX *** */

  header .wp-block-heading { display: none !important; }

  header .wp-block-navigation__responsive-container-open,
  header button.wp-block-navigation__responsive-container-open,
  header .wp-block-navigation .wp-block-navigation__responsive-container-open {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 1rem !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    width: 100px !important;
    min-height: 48px !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 100 !important;
  }

  header .wp-block-navigation__responsive-container-open svg {
    width: 26px !important;
    height: 26px !important;
    fill: white !important;
    display: block !important;
  }
}

/* =========================================================
   VERY SMALL MOBILE (max 419px) - stack buttons vertically
   ========================================================= */

@media (max-width: 419px) {
  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-buttons {
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
  }
}

/* =========================================================
   HIDE HAMBURGER ABOVE MOBILE
   ========================================================= */

@media (min-width: 600px) {
  header .wp-block-navigation__responsive-container-open {
    display: none !important;
  }
}

/* 600-650px: force mobile-only nav (hamburger), hide inline nav */
@media (min-width: 600px) and (max-width: 650px) {
  header .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: none !important;
    visibility: hidden !important;
  }
  header .wp-block-navigation__responsive-container-open {
    display: inline-flex !important;
    visibility: visible !important;
  }
}

/* =========================================================
   NARROW TABLET (651px - 767px)
   top row: logo + buttons inline, tagline hidden
   nav row: nav on top, search below
   ========================================================= */

@media (min-width: 651px) and (max-width: 767px) {

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-heading) { display: none !important; }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide {
    max-width: 100% !important;
    width: 100% !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide > .ultp-row-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-content {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 1rem 0 0.5rem !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .ultp-column-wrapper {
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-site-logo) { flex: 0 0 auto !important; }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin-left: auto !important;
    overflow: visible !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-buttons {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 4px !important;
    width: 100% !important;
  }

  header .wp-block-button.support-cta .wp-block-button__link,
  header .wp-block-button.advertise-cta .wp-block-button__link {
    font-size: 0.75rem !important;
    padding: 4px 7px !important;
    white-space: nowrap !important;
    border-radius: 4px !important;
    opacity: 0.90 !important;
    font-weight: 500 !important;
    width: 161.141px !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignfull .ultp-row-content {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0 !important;
    padding: 2px 0.5rem !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignfull .ultp-row-wrapper {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.header-menu-col) {
    width: 100% !important;
    flex: 0 0 100% !important;
  }

  /* search column - unchanged */
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) {
    display: flex !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    padding: 2px 0 4px 0 !important;
  }

  header .wp-block-navigation-item__content {
    padding: 0.4rem 0.4rem !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    color: white !important;
    text-decoration: none !important;
  }
}

/* =========================================================
   TABLET (768px - 1041px)
   top row: logo + buttons inline, tagline hidden
   nav row: nav + search on same line
   ========================================================= */

@media (min-width: 768px) and (max-width: 1041px) {

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-heading) { display: none !important; }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide {
    max-width: 100% !important;
    width: 100% !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide > .ultp-row-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-content {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 1rem 0 0.5rem !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .ultp-column-wrapper {
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-site-logo) { flex: 0 0 auto !important; }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) {
    flex-grow: 0 !important;
    flex-shrink: 1 !important;
    flex-basis: auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: 0.75rem !important;
    overflow: visible !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-buttons {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: flex-end !important;
    gap: 4px !important;
    width: 100% !important;
  }

  header .wp-block-button.support-cta .wp-block-button__link,
  header .wp-block-button.advertise-cta .wp-block-button__link {
    font-size: 0.78rem !important;
    padding: 4px 8px !important;
    white-space: nowrap !important;
    border-radius: 4px !important;
    opacity: 0.90 !important;
    font-weight: 500 !important;
    width: 161.141px !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignfull .ultp-row-wrapper,
  #ultp-header-template .wp-block-ultimate-post-row.alignfull.ultpBgPadding,
  #ultp-header-template .wp-block-ultimate-post-row.alignfull .lgL,
  #ultp-header-template .wp-block-ultimate-post-row.alignfull .lgR {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Override PostX lgL lgR padding utility classes on nav row AND top row */
  #ultp-header-template .wp-block-ultimate-post-row.alignfull.lgL { padding-left: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignfull.lgR { padding-right: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignfull.ultpBgPadding { padding-left: 0 !important; padding-right: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignwide.lgL { padding-left: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignwide.lgR { padding-right: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignwide.ultpBgPadding { padding-left: 0 !important; padding-right: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-wrapper { padding-left: 0 !important; padding-right: 0 !important; }
  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-wrapper .ultp-row-content { padding-left: 0.5rem !important; padding-right: 1.75rem !important; }
  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-button__link { font-size: 0.75rem !important; }

  #ultp-header-template .wp-block-ultimate-post-row.alignfull .ultp-row-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 1rem !important;
    padding: 0 1rem !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.header-menu-col) { flex: 1 1 auto !important; }

  /* search column - unchanged */
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col),
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) .ultp-column-wrapper,
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) .ultp-block-wrapper,
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) .ultp-search-container,
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) .ultp-searchform-content {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  header .wp-block-navigation-item__content {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
    color: white !important;
    text-decoration: none !important;
    border-radius: 3px !important;
    transition: background 0.3s ease !important;
  }

  header .wp-block-navigation-item__content:hover {
    background: rgba(255, 255, 255, 0.15) !important;
  }

  header .wp-block-site-logo img {
    height: 100px !important;
    object-fit: contain !important;
  }
}

/* =========================================================
   TABLET WIDE (992px - 1041px) - extra right padding for buttons
   ========================================================= */

@media (min-width: 992px) and (max-width: 1041px) {
  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-wrapper .ultp-row-content {
    padding-right: 3rem !important;
  }
}

/* =========================================================
   DESKTOP (1042px+)
   top row: logo + tagline hidden until 1300px + buttons
   nav row: nav + search on same line
   ========================================================= */

@media (min-width: 1042px) {

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-heading) { display: none !important; }

  /* Stretch top row to full width and match nav row padding */
  #ultp-header-template .wp-block-ultimate-post-row.alignwide {
    max-width: 100% !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide > .ultp-row-wrapper {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #ultp-header-template .wp-block-ultimate-post-row.alignwide .ultp-row-content {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-site-logo) { flex-shrink: 0 !important; }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    overflow: visible !important;
    max-width: 400px !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-buttons) .wp-block-buttons {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    justify-content: flex-end !important;
    align-items: center !important;
    width: 100% !important;
  }

  header .wp-block-button.support-cta .wp-block-button__link,
  header .wp-block-button.advertise-cta .wp-block-button__link {
    padding: 4px 10px !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    opacity: 0.90 !important;
    white-space: nowrap !important;
  }

  header .wp-block-ultimate-post-row.alignfull .ultp-row-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    padding: 0 1rem !important;
    gap: 15px !important;
  }

  #ultp-header-template .wp-block-ultimate-post-column:has(.header-menu-col) { flex: 1 1 auto !important; }

  /* search column - unchanged */
  #ultp-header-template .wp-block-ultimate-post-column:has(.header-search-col) { flex: 0 0 auto !important; width: auto !important; }

  header .wp-block-ultimate-post-column:has(.header-menu-col) .ultp-column-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
  }

  header .wp-block-site-logo img {
    height: 100% !important;
    min-height: 85px !important;
    max-height: 120px !important;
    width: auto !important;
    object-fit: contain !important;
  }

  header .alignleft.wp-block-site-logo,
  header .custom-logo-link {
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
  }
}

/* Show tagline only at wide desktop */
@media (min-width: 1327px) {
  #ultp-header-template .wp-block-ultimate-post-column:has(.wp-block-heading) {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
}
