/**
 * Premium directory header — RTL-first, AA contrast, 44px targets.
 * Restyles Astra + Max Mega Menu. Does not replace menu items.
 */
body.prowpsite-has-premium-header {
  --psh-bg: #ffffff;
  --psh-text: #0f172a;
  --psh-muted: #334155;
  --psh-border: rgba(15, 23, 42, 0.1);
  --psh-accent: var(--primary, #0f766e);
  --psh-cta-bg: #0b3d91;
  --psh-cta-fg: #ffffff;
  --psh-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

body.prowpsite-has-premium-header.prowpsite-has-premium-header-dark,
body.prowpsite-has-premium-header.prowpsite-places-dark {
  --psh-bg: #0b1220;
  --psh-text: #f8fafc;
  --psh-muted: #cbd5e1;
  --psh-border: rgba(241, 245, 249, 0.12);
  --psh-accent: var(--primary-light, #a5b4fc);
  --psh-cta-bg: #3b82f6;
  --psh-cta-fg: #ffffff;
  --psh-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* Scrolls away with the page — never sticky/fixed. */
body.prowpsite-has-premium-header #masthead,
body.prowpsite-has-premium-header .ast-primary-header-bar,
body.prowpsite-has-premium-header .main-header-bar,
body.prowpsite-has-premium-header .ast-above-header-bar,
body.prowpsite-has-premium-header .ast-below-header-bar,
body.prowpsite-has-premium-header .site-header,
body.prowpsite-has-premium-header .ast-sticky-active,
body.prowpsite-has-premium-header .ast-header-sticky-active,
body.prowpsite-has-premium-header #masthead.ast-sticky-active,
body.prowpsite-has-premium-header .main-header-bar.ast-sticky-active {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  inset: auto !important;
  z-index: 40;
  background: var(--psh-bg) !important;
  color: var(--psh-text);
  border-block-end: 1px solid var(--psh-border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.admin-bar.prowpsite-has-premium-header #masthead {
  top: auto !important;
}

body.prowpsite-has-premium-header .site-primary-header-wrap,
body.prowpsite-has-premium-header .ast-builder-grid-row {
  min-height: 4.5rem;
  align-items: center;
  width: 100%;
  max-width: min(80rem, 100%);
  margin-inline: auto;
  padding-inline: clamp(0.85rem, 2.4vw, 1.75rem);
  gap: 1rem;
}

body.prowpsite-has-premium-header .ast-builder-grid-row.ast-builder-grid-row-has-sides {
  display: flex !important;
  flex-wrap: nowrap;
  justify-content: space-between;
  column-gap: 1rem;
}

body.prowpsite-has-premium-header .site-header-primary-section-left,
body.prowpsite-has-premium-header .site-header-primary-section-right,
body.prowpsite-has-premium-header .site-header-primary-section-center {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

body.prowpsite-has-premium-header .site-header-primary-section-left {
  flex: 0 0 auto;
}

body.prowpsite-has-premium-header .site-header-primary-section-right,
body.prowpsite-has-premium-header .site-header-primary-section-center,
body.prowpsite-has-premium-header .ast-main-header-bar-alignment {
  flex: 1 1 auto;
  justify-content: flex-end;
}

body.prowpsite-has-premium-header .site-branding,
body.prowpsite-has-premium-header .ast-site-identity {
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
}

body.prowpsite-has-premium-header .site-title a,
body.prowpsite-has-premium-header .site-title a:visited {
  color: var(--psh-text) !important;
  font-weight: 800;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.prowpsite-has-premium-header .custom-logo-link img,
body.prowpsite-has-premium-header .site-logo-img img {
  max-height: 2.75rem;
  width: auto;
  display: block;
}

/* Kill Astra/Mega Menu solid blue islands — one integrated header surface. */
body.prowpsite-has-premium-header .main-header-menu,
body.prowpsite-has-premium-header .main-header-bar .main-header-menu,
body.prowpsite-has-premium-header .ast-builder-menu .main-header-menu,
body.prowpsite-has-premium-header .ast-nav-menu,
body.prowpsite-has-premium-header #mega-menu-wrap-primary,
body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary,
body.prowpsite-has-premium-header #mega-menu-wrap-primary ul.mega-menu {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  min-width: 0;
}

body.prowpsite-has-premium-header .ast-builder-menu,
body.prowpsite-has-premium-header .ast-main-header-bar-alignment,
body.prowpsite-has-premium-header .main-header-bar-navigation {
  background: transparent !important;
  width: 100%;
}

@media (min-width: 769px) {
  body.prowpsite-has-premium-header .ast-mobile-menu-buttons,
  body.prowpsite-has-premium-header .menu-toggle,
  body.prowpsite-has-premium-header .ast-button-wrap,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-menu-toggle {
    display: none !important;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary ul.mega-menu.mega-menu-horizontal,
  body.prowpsite-has-premium-header .main-header-menu,
  body.prowpsite-has-premium-header .ast-builder-menu .main-header-menu {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 0.55rem;
    margin: 0;
    padding: 0.15rem 0;
    list-style: none !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    visibility: visible !important;
    background: transparent !important;
    background-color: transparent !important;
    position: static !important;
    width: 100% !important;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item {
    display: flex !important;
    align-items: center;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item > a,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > a,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > .menu-link,
  body.prowpsite-has-premium-header .ast-builder-menu .menu-item > .menu-link {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding-block: 0.45rem !important;
    padding-inline: 0.95rem !important;
    color: var(--psh-text) !important;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.35;
    text-decoration: none;
    border-radius: 10px;
    background: transparent !important;
    background-color: transparent !important;
    white-space: nowrap;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item > a:hover,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item.mega-current-menu-item > a,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > a:hover,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > .menu-link:hover,
  body.prowpsite-has-premium-header .main-header-menu > .current-menu-item > a,
  body.prowpsite-has-premium-header .main-header-menu > .current-menu-item > .menu-link {
    color: var(--psh-text) !important;
    background: color-mix(in srgb, var(--psh-accent) 12%, transparent) !important;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item > a:focus-visible,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > a:focus-visible,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > .menu-link:focus-visible {
    outline: 2px solid var(--psh-accent);
    outline-offset: 2px;
  }

  body.prowpsite-has-premium-header .main-header-menu .dropdown-menu-toggle,
  body.prowpsite-has-premium-header .main-header-menu .ast-header-navigation-arrow,
  body.prowpsite-has-premium-header .mega-indicator {
    margin-inline-start: 0.4rem !important;
    margin-inline-end: 0 !important;
    opacity: 0.75;
    flex-shrink: 0;
  }
}

[dir="rtl"] body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary,
[dir="rtl"] body.prowpsite-has-premium-header #mega-menu-wrap-primary ul.mega-menu.mega-menu-horizontal {
  justify-content: flex-start;
}

body.prowpsite-has-premium-header .ast-header-button-1 a,
body.prowpsite-has-premium-header .ast-builder-button-wrap a,
body.prowpsite-has-premium-header #mega-menu-wrap-primary a[href*="add"],
body.prowpsite-has-premium-header .menu-item a[href*="add-listing"],
body.prowpsite-has-premium-header .menu-item a[href*="submit"],
body.prowpsite-has-premium-header .prowpsite-header-cta,
body.prowpsite-has-premium-header a.prowpsite-header-cta,
body.prowpsite-has-premium-header .menu-item.prowpsite-header-cta-item > a,
body.prowpsite-has-premium-header .menu-item.prowpsite-header-cta-item > .menu-link {
  background: var(--psh-cta-bg) !important;
  background-color: var(--psh-cta-bg) !important;
  color: var(--psh-cta-fg) !important;
  border-radius: 999px !important;
  min-height: 44px;
  padding-inline: 1.15rem !important;
  font-weight: 700 !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.prowpsite-has-premium-header .ast-header-button-1 .ast-custom-button,
body.prowpsite-has-premium-header .ast-header-button-wrap a.ast-custom-button,
body.prowpsite-has-premium-header .prowpsite-header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding-inline: 1.15rem;
  border-radius: 999px;
  background: var(--psh-cta-bg) !important;
  background-color: var(--psh-cta-bg) !important;
  color: var(--psh-cta-fg) !important;
  border: 0;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

body.prowpsite-has-premium-header .prowpsite-header-cta:hover,
body.prowpsite-has-premium-header .prowpsite-header-cta:focus-visible {
  filter: brightness(1.08);
}

@media (max-width: 768px) {
  body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-menu-toggle,
  body.prowpsite-has-premium-header .menu-toggle,
  body.prowpsite-has-premium-header .ast-mobile-menu-buttons .menu-toggle,
  body.prowpsite-has-premium-header .ast-button-wrap button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--psh-border);
    background: color-mix(in srgb, var(--psh-text) 6%, transparent);
    color: var(--psh-text);
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary.mega-menu-open #mega-menu-primary,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-menu-open,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary ul.mega-menu,
  body.prowpsite-has-premium-header .main-header-menu.toggled,
  body.prowpsite-has-premium-header .ast-builder-menu-mobile .main-header-menu {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    width: 100%;
    max-height: min(80vh, 32rem);
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--psh-bg) !important;
    background-color: var(--psh-bg) !important;
    border-block-end: 1px solid var(--psh-border);
    box-shadow: var(--psh-shadow);
    z-index: 1000;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item > a,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > a,
  body.prowpsite-has-premium-header .main-header-menu > .menu-item > .menu-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 0.9rem;
    color: var(--psh-text) !important;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    white-space: normal;
    background: transparent !important;
  }
}

body.prowpsite-has-premium-header #mega-menu-wrap-primary #mega-menu-primary > .mega-menu-item > a .mega-indicator {
  color: var(--psh-muted);
}

@media (min-width: 769px) {
  body.prowpsite-has-premium-header .ast-mobile-header-wrap,
  body.prowpsite-has-premium-header .ast-mobile-header-content,
  body.prowpsite-has-premium-header.ast-header-break-point .ast-mobile-header-wrap .ast-button-wrap {
    display: none !important;
  }

  body.prowpsite-has-premium-header .ast-desktop-header-content,
  body.prowpsite-has-premium-header .ast-desktop .ast-primary-header-bar,
  body.prowpsite-has-premium-header #masthead .ast-desktop-header-wrap {
    display: block !important;
  }

  body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-toggle-blocks-right,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-toggle-blocks-left,
  body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-toggle-on,
  body.prowpsite-has-premium-header .max-mega-menu .mega-menu-toggle {
    display: none !important;
  }
}

body.prowpsite-has-premium-header .prowpsite-header-cta-wrap {
  display: flex;
  align-items: center;
  margin-inline-start: 0.5rem;
}

body.prowpsite-has-premium-header li.prowpsite-header-cta-item {
  list-style: none;
  display: flex;
  align-items: center;
  margin-inline-start: 0.35rem;
}

body.prowpsite-has-premium-header .prowpsite-header-cta-wrap + .prowpsite-header-cta-wrap,
body.prowpsite-has-premium-header .prowpsite-header-cta-item + .prowpsite-header-cta-wrap,
body.prowpsite-has-premium-header .prowpsite-header-cta-wrap:has(+ * .prowpsite-header-cta) {
  display: none;
}

@media (max-width: 768px) {
  body.prowpsite-has-premium-header .prowpsite-header-cta-wrap {
    margin-inline-start: 0;
  }

  body.prowpsite-has-premium-header li.prowpsite-header-cta-item {
    margin-inline: 0.5rem;
    margin-block: 0.35rem;
  }

  body.prowpsite-has-premium-header .prowpsite-header-cta {
    width: 100%;
  }
}

body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-sub-menu,
body.prowpsite-has-premium-header .main-header-menu .sub-menu,
body.prowpsite-has-premium-header .ast-builder-menu .sub-menu {
  background: var(--psh-bg) !important;
  color: var(--psh-text);
  border: 1px solid var(--psh-border);
  border-radius: 14px;
  box-shadow: var(--psh-shadow);
  padding: 0.45rem;
  min-width: 14rem;
}

body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-sub-menu a,
body.prowpsite-has-premium-header .main-header-menu .sub-menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.85rem;
  border-radius: 10px;
  color: var(--psh-text) !important;
  font-weight: 600;
}

body.prowpsite-has-premium-header #mega-menu-wrap-primary .mega-sub-menu a:hover,
body.prowpsite-has-premium-header .main-header-menu .sub-menu a:hover {
  background: color-mix(in srgb, var(--psh-accent) 14%, transparent);
}

body.prowpsite-has-premium-header .ast-search-menu-icon,
body.prowpsite-has-premium-header .ast-header-search {
  min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  body.prowpsite-has-premium-header #masthead,
  body.prowpsite-has-premium-header a {
    transition: none !important;
  }
}

body.prowpsite-has-premium-header .prowpsite-fallback-header,
body.prowpsite-has-premium-header .ast-main-header-bar-alignment:has(.prowpsite-fallback-nav) {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

body.prowpsite-has-premium-header .ast-primary-header-bar:has(.prowpsite-fallback-header) {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

body.prowpsite-has-premium-header .prowpsite-fallback-brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 16rem;
  color: var(--psh-text) !important;
  font-weight: 800;
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.prowpsite-has-premium-header .prowpsite-fallback-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.prowpsite-has-premium-header .prowpsite-fallback-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.85rem;
  color: var(--psh-text) !important;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: 999px;
}

body.prowpsite-has-premium-header .prowpsite-fallback-nav a:hover,
body.prowpsite-has-premium-header .prowpsite-fallback-nav a:focus-visible {
  background: color-mix(in srgb, var(--psh-accent) 14%, transparent);
}

body.prowpsite-has-premium-header .prowpsite-fallback-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--psh-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--psh-text) 6%, transparent);
  cursor: pointer;
}

body.prowpsite-has-premium-header .prowpsite-fallback-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--psh-text);
}

body.prowpsite-has-premium-header-dark .prowpsite-fallback-toggle,
body.prowpsite-places-dark .prowpsite-fallback-toggle {
  border: 2px solid #f8fafc;
  background: #1e293b;
  color: #f8fafc;
}

body.prowpsite-has-premium-header-dark .prowpsite-fallback-toggle span,
body.prowpsite-places-dark .prowpsite-fallback-toggle span {
  background: #f8fafc;
}

[dir="rtl"] body.prowpsite-has-premium-header .prowpsite-fallback-nav,
[dir="rtl"] body.prowpsite-has-premium-header .ast-main-header-bar-alignment:has(.prowpsite-fallback-nav) {
  justify-content: flex-start;
}

body.prowpsite-has-premium-header #masthead:has(.main-header-menu a) .prowpsite-fallback-header,
body.prowpsite-has-premium-header #masthead:has(#mega-menu-wrap-primary .mega-menu-item) .prowpsite-fallback-header,
body.prowpsite-has-premium-header #masthead:has(.ast-builder-menu a) .prowpsite-fallback-header {
  display: none !important;
}

body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .ast-mobile-menu-buttons,
body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .mega-menu-toggle,
body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) button.menu-toggle:not(.prowpsite-fallback-toggle) {
  display: none !important;
}

@media (min-width: 769px) {
  body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .ast-below-header-wrap,
  body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .ast-below-header-bar,
  body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .ast-below-header,
  body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .ast-header-button-wrap,
  body.prowpsite-has-premium-header:has(.prowpsite-fallback-header) .ast-header-button-1 {
    display: none !important;
  }

  body.prowpsite-has-premium-header .ast-primary-header-bar:has(.prowpsite-fallback-header) {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }
}

@media (max-width: 768px) {
  body.prowpsite-has-premium-header .prowpsite-fallback-toggle {
    display: inline-flex;
  }

  body.prowpsite-has-premium-header .ast-mobile-header-wrap .prowpsite-fallback-header,
  body.prowpsite-has-premium-header #ast-mobile-header .prowpsite-fallback-header {
    display: flex !important;
    visibility: visible !important;
    opacity: 1;
    z-index: 1002;
    position: relative;
  }

  /* Astra hides #ast-desktop-header at this breakpoint; keep it if the fallback never moved. */
  body.prowpsite-has-premium-header #ast-desktop-header:has(.prowpsite-fallback-header) {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }

  body.prowpsite-has-premium-header .ast-primary-header-bar:has(.prowpsite-fallback-header),
  body.prowpsite-has-premium-header .prowpsite-fallback-header {
    position: relative;
  }

  body.prowpsite-has-premium-header .prowpsite-fallback-nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--psh-bg);
    border-block-end: 1px solid var(--psh-border);
    box-shadow: var(--psh-shadow);
    z-index: 1001;
  }

  body.prowpsite-has-premium-header .prowpsite-fallback-nav.is-open {
    display: flex;
  }

  body.prowpsite-has-premium-header .prowpsite-fallback-nav a {
    width: 100%;
  }
}
