/* Shared shell refinement. Loaded after premium.css and premium-inner.css.
   Preserve existing menu attributes, route destinations and application handlers. */
html body.fm-premium .fm-site-header {
  min-height: 0 !important;
}

html body.fm-premium .fm-site-header .fm-site-nav {
  display: grid !important;
  grid-template-columns: 170px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

html body.fm-premium .fm-site-header .fm-site-brand {
  width: 170px !important;
  max-width: 100%;
  min-width: 0;
  flex: 0 1 auto !important;
  margin: 0;
  justify-self: start;
  overflow: visible !important;
}

html body.fm-premium .fm-site-header .fm-site-brand img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 34px !important;
  object-fit: contain;
  object-position: left center;
}

html body.fm-premium .fm-site-header .fm-site-actions {
  min-width: 0;
  justify-self: end;
}

/* Match the existing JS breakpoint instead of leaving a 1241–1280px gap. */
@media (max-width: 1280px) {
  html body.fm-premium .fm-site-header .fm-site-nav {
    grid-template-columns: minmax(0, 1fr) max-content 44px;
    gap: 16px;
  }

  html body.fm-premium .fm-site-header .fm-site-menu-toggle {
    display: inline-flex !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 10px !important;
    justify-self: end;
    flex: 0 0 44px;
  }

  html body.fm-premium .fm-site-header .fm-site-links {
    display: none !important;
  }

  html body.fm-premium .fm-site-header.is-menu-open .fm-site-links {
    display: grid !important;
    position: absolute;
    top: calc(100% + 12px);
    left: auto;
    right: 0;
    width: min(640px, 100%);
    max-height: calc(100dvh - 130px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
    padding: 20px !important;
    overflow-x: hidden;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    background: var(--fm-surface, #1b201a) !important;
    border-radius: 4px;
    box-shadow: none;
  }

  html body.fm-premium .fm-site-header.is-menu-open .fm-site-links a {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 0;
    white-space: normal;
    font-size: 15px !important;
    line-height: 1.4;
    justify-content: flex-start;
  }

  html body.fm-premium .fm-site-header .fm-site-links .fm-site-mobile-only {
    display: inline-flex !important;
  }
}

@media (max-width: 600px) {
  html body.fm-premium .fm-site-header {
    padding-inline: 16px !important;
  }

  html body.fm-premium .fm-site-header .fm-site-nav {
    min-height: 46px;
    grid-template-columns: minmax(0, 1fr) 126px 44px;
    gap: 8px;
  }

  html body.fm-premium .fm-site-header .fm-site-brand {
    width: 126px !important;
    height: 30px !important;
  }

  html body.fm-premium .fm-site-header .fm-site-brand img {
    height: 30px !important;
  }

  html body.fm-premium .fm-site-header .fm-site-actions {
    width: 126px;
    gap: 0;
  }

  html body.fm-premium .fm-site-header .fm-site-action--primary {
    width: 126px !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 10px 8px !important;
    font-size: 11px !important;
    line-height: 1.25;
    white-space: nowrap;
  }

  html body.fm-premium .fm-site-header.is-menu-open .fm-site-links {
    max-height: calc(100dvh - 160px);
    gap: 8px 14px;
    padding: 16px !important;
  }
}

@media (max-width: 340px) {
  html body.fm-premium .fm-site-header .fm-site-nav {
    grid-template-columns: minmax(0, 1fr) 118px 44px;
  }

  html body.fm-premium .fm-site-header .fm-site-actions,
  html body.fm-premium .fm-site-header .fm-site-action--primary {
    width: 118px !important;
  }

  html body.fm-premium .fm-site-header .fm-site-action--primary {
    font-size: 10.5px !important;
  }
}

/* Root owns the two-link HTML: .fm-mobile-contact and [data-open-lead]. */
html body.fm-premium.fm-home-page .mobile-bar {
  display: none !important;
}

@media (max-width: 760px) {
  html body.fm-premium.fm-home-page {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html body.fm-premium.fm-home-page .mobile-bar {
    display: grid !important;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
    gap: 6px !important;
    left: 12px !important;
    right: 12px !important;
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    padding: 6px !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: var(--fm-surface, #1b201a) !important;
    box-shadow: none !important;
    backdrop-filter: none;
  }

  html body.fm-premium.fm-home-page .mobile-bar a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 48px !important;
    padding: 10px 8px !important;
    border-radius: 3px !important;
    font: 500 14px/1.3 'Manrope', sans-serif !important;
    text-align: center;
    text-decoration: none;
  }

  html body.fm-premium.fm-home-page .mobile-bar .fm-mobile-contact {
    color: var(--fm-muted, #bdc5b7) !important;
    background: transparent !important;
  }

  html body.fm-premium.fm-home-page .mobile-bar a[data-open-lead] {
    color: var(--fm-dark, #151a10) !important;
    background: var(--fm-accent, #caff32) !important;
  }
}
