/* AFEM header layout: keep branding, actions and contact details as one system. */
#sp-header {
  background: #fff;
  border-bottom: 1px solid #e7edf4;
}

#sp-header > .container > .row {
  display: flex;
  align-items: center;
}

#sp-header #sp-logo {
  display: flex;
  align-items: center;
}

#sp-header #sp-logo .sp-column,
#sp-header #sp-contact .sp-column {
  width: 100%;
}

#sp-header #sp-logo .logo {
  display: flex;
  align-items: center;
  height: auto;
  min-height: 88px;
}

#sp-header #sp-logo .logo a {
  display: flex;
  align-items: center;
}

#sp-header #sp-logo .logo img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 300px;
}

/* The two Joomla logo slots point to the same composite asset in this copy. */
#sp-header #sp-logo .logo img.sp-retina-logo {
  display: none !important;
}

#sp-header #sp-contact {
  display: flex;
  align-items: center;
}

#sp-header #sp-contact .sp-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#sp-header #sp-contact .sp-module,
#sp-header #sp-contact .sp-module-content {
  width: 100%;
  margin: 0;
}

#sp-header #sp-contact .afem-header-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 12px !important;
  width: 100%;
  margin: 0 !important;
}

#sp-header #sp-contact .afem-header-actions a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px !important;
  border: 0;
  border-radius: 6px !important;
  box-shadow: 0 3px 8px rgba(11, 45, 92, 0.14);
  color: #fff !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

#sp-header #sp-contact .afem-header-actions a:first-child {
  background: #0b2d5c !important;
}

#sp-header #sp-contact .afem-header-actions a:last-child {
  background: #1bb978 !important;
}

#sp-header #sp-contact .afem-header-actions a:hover,
#sp-header #sp-contact .afem-header-actions a:focus {
  color: #fff !important;
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(11, 45, 92, 0.2);
}

#sp-header #sp-contact .sp-contact-info {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  width: 100%;
  padding: 0 !important;
  margin: 0 !important;
  float: none;
}

#sp-header #sp-contact .sp-contact-info li {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0 !important;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
}

#sp-header #sp-contact .sp-contact-info li i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin: 0 8px 0 0;
  border: 1px solid #dce6f0;
  border-radius: 50%;
  background: #f5f8fb;
  color: #0b2d5c;
  font-size: 16px;
  line-height: 1;
}

#sp-header #sp-contact .sp-contact-info li a {
  color: #536273;
  text-decoration: none;
}

#sp-header #sp-contact .sp-contact-info li a:hover,
#sp-header #sp-contact .sp-contact-info li a:focus {
  color: #0b2d5c;
}

/* On phones, use a compact two-column action row and a readable contact stack. */
@media only screen and (max-width: 991px) {
  #sp-header {
    padding: 12px 0 14px;
  }

  #sp-header > .container {
    padding-right: 15px;
    padding-left: 15px;
  }

  #sp-header > .container > .row {
    display: block;
    margin-right: -15px;
    margin-left: -15px;
  }

  #sp-header #sp-logo,
  #sp-header #sp-contact {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
  }

  #sp-header #sp-logo .logo {
    justify-content: center;
    min-height: 0;
    padding: 0 0 10px;
  }

  #sp-header #sp-logo .logo a {
    justify-content: center;
    width: 100%;
  }

  #sp-header #sp-logo .logo img {
    width: 100%;
    max-width: 320px;
  }

  #sp-header #sp-contact .sp-column {
    align-items: stretch;
    gap: 12px;
  }

  #sp-header #sp-contact .afem-header-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
  }

  #sp-header #sp-contact .afem-header-actions a {
    width: 100%;
    min-height: 42px;
    padding: 0 10px !important;
    font-size: 12px;
  }

  #sp-header #sp-contact .sp-contact-info {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    justify-content: stretch;
  }

  #sp-header #sp-contact .sp-contact-info li {
    justify-content: center;
    width: 100%;
    max-width: none !important;
    font-size: 13px;
  }
}

@media only screen and (max-width: 480px) {
  #sp-header #sp-contact .sp-contact-info {
    grid-template-columns: 1fr;
  }

  #sp-header #sp-contact .sp-contact-info li {
    justify-content: center;
  }
}

/* Keep the complete header available while scrolling instead of hiding it. */
body.sticky-header #sp-header {
  position: sticky;
  top: 0;
  z-index: 10001;
}

/* Helix sets overflow-x:hidden on this wrapper; clip it without creating a
   scrolling ancestor so native sticky positioning can work on mobile. */
body.sticky-header .body-innerwrapper {
  overflow: visible !important;
}

body.sticky-header #sp-main-menu,
body.sticky-header #sp-main-menu.menu-fixed,
body.sticky-header #sp-main-menu.menu-fixed-out {
  position: sticky !important;
  top: 89px !important;
  left: auto !important;
  width: 100% !important;
  z-index: 10000;
}

body.sticky-header .nav-placeholder {
  display: none !important;
  height: 0 !important;
}

@media only screen and (max-width: 991px) {
  /* A touch-friendly horizontal navigation replaces the framework off-canvas menu. */
  body.sticky-header #sp-main-menu,
  body.sticky-header #sp-main-menu.menu-fixed,
  body.sticky-header #sp-main-menu.menu-fixed-out {
    top: 259px !important;
  }

  #sp-main-menu,
  #sp-main-menu > .container,
  #sp-main-menu .row,
  #sp-main-menu .sp-column,
  #sp-main-menu .sp-megamenu-wrapper {
    height: 56px;
  }

  #sp-main-menu #offcanvas-toggler {
    display: none !important;
  }

  #sp-main-menu .sp-megamenu-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #sp-main-menu .sp-megamenu-wrapper::-webkit-scrollbar {
    display: none;
  }

  #sp-main-menu .sp-megamenu-parent {
    display: flex !important;
    align-items: stretch;
    float: none !important;
    width: max-content;
    min-width: 100%;
    height: 56px;
    white-space: nowrap;
  }

  #sp-main-menu .sp-megamenu-parent > li {
    display: block;
    flex: 0 0 auto;
  }

  #sp-main-menu .sp-megamenu-parent > li > a,
  #sp-main-menu .sp-megamenu-parent > li > span {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 15px;
    font-size: 12px;
    line-height: 1 !important;
    white-space: nowrap;
  }

  .offcanvas-menu {
    display: none !important;
  }

  body.afem-header-compact #sp-header {
    max-height: 72px;
    overflow: hidden;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  body.afem-header-compact #sp-header #sp-logo .logo {
    padding: 0;
  }

  body.afem-header-compact #sp-header #sp-logo .logo img {
    max-width: 190px;
  }

  body.afem-header-compact #sp-header #sp-contact .sp-module,
  body.afem-header-compact #sp-header #sp-contact .sp-contact-info {
    display: none !important;
  }

  body.afem-header-compact.sticky-header #sp-main-menu,
  body.afem-header-compact.sticky-header #sp-main-menu.menu-fixed,
  body.afem-header-compact.sticky-header #sp-main-menu.menu-fixed-out {
    top: 72px !important;
  }
}
