#sp-header .sp-megamenu-parent > li:has(> .mg-language-desktop) {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

#sp-header .mg-language-desktop,
#sp-header .mg-language-mobile {
  flex: none;
  margin-inline-start: .5rem;
}

#sp-header .mg-language-mobile {
  display: none;
}

@media (max-width: 799.98px) {
  #sp-header .mg-language-desktop {
    display: none;
  }

  #sp-header .sp-megamenu-wrapper:has(> .mg-language-mobile) {
    display: flex;
    align-items: center;
  }

  #sp-header .mg-language-mobile {
    display: inline-flex;
  }
}

#sp-header .mg-language {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 2.75rem;
  min-inline-size: 1.75rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--mg-p51-solid-link, #173e5a);
  text-decoration: none;
}

#sp-header .mg-language:hover {
  text-decoration: underline;
  text-underline-offset: .23em;
}

.mg-profile-links {
  display: inline-flex;
  align-items: center;
  gap: .125rem;
  margin-inline: .18rem .7rem;
  color: var(--mg-p51-solid-link, #173e5a);
}

.mg-profile-links > a.mg-profile-link {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 2.75rem;
  padding: 0;
  color: inherit;
}

.mg-profile-link::before {
  content: "";
  width: 1rem;
  height: 1rem;
  background: currentColor;
  mask: var(--mg-profile-icon) center / contain no-repeat;
}

.mg-profile-link.mg-profile-linkedin {
  --mg-profile-icon: url("../plg_system_mghome980/icons/linkedin.svg");
}

.mg-profile-link.mg-profile-xing {
  --mg-profile-icon: url("../plg_system_mghome980/icons/xing.svg");
}

.mg-profile-label {
  position: absolute;
  z-index: 10;
  inset-block-start: calc(100% + .5rem);
  inset-inline-start: 50%;
  translate: -50% 0;
  padding: .25rem .55rem;
  border: 1px solid #b8cbd8;
  border-radius: .35rem;
  background: #fff;
  color: #173e5a;
  box-shadow: 0 2px 7px rgb(16 45 67 / .18);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.4;
  visibility: hidden;
  white-space: nowrap;
}

.mg-profile-label::before {
  content: "";
  position: absolute;
  inset: -.5rem 0 auto;
  block-size: .5rem;
}

.mg-profile-link:focus-visible .mg-profile-label,
#sp-header .mg-language:focus-visible .mg-profile-label {
  visibility: visible;
}

@media (hover: hover) {
  .mg-profile-link:hover .mg-profile-label,
  #sp-header .mg-language:hover .mg-profile-label {
    visibility: visible;
  }
}

#sp-header .mg-language:focus-visible,
.mg-profile-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 2px;
}

.offcanvas-menu .mg-profile-offcanvas {
  border-top: 1px solid currentColor;
  margin-block-start: .65rem;
  padding-block-start: .55rem;
}

.offcanvas-menu .mg-profile-links > a.mg-profile-link {
  width: 2.75rem;
}

.mg-blog-language-note {
  font-size: .875rem;
  margin: .5rem 0 0;
}

html[lang|="en"] #sp-page-builder :is(h1,h2,h3) {
  text-wrap: balance;
}

dialog.mg-native-portraits {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  color: inherit;
}

dialog.mg-native-portraits:not([open]) {
  display: none;
}

dialog.mg-native-portraits::backdrop {
  background: transparent;
}

/* Align the longer language labels with the right edge of their control. */
#sp-header .mg-language .mg-profile-label {
  inset-inline: auto 0;
  translate: none;
}

/* Gallery controls rendered by Portraits.php. */
.mg-portrait-download {
  display: block;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--mg-p3-blue, #123d60);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
  color: var(--mg-p3-blue, #123d60);
  font: 650 13px/1.35 Arial, sans-serif;
  text-align: center;
  text-decoration: none;
}

.mg-portrait-download:is(:hover, :focus-visible) {
  background: var(--mg-p3-blue, #123d60);
  color: #fff;
  text-decoration: none;
}

.mg-portrait-download:focus-visible {
  outline: 2px solid #3f7899;
  outline-offset: 2px;
}

.mg-portrait-zoom {
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  inline-size: 2.125rem;
  block-size: 2.125rem;
  border: 1px solid rgb(255 255 255 / .7);
  border-radius: 50%;
  background: rgb(18 61 96 / .9);
  color: #fff;
  opacity: 0;
  pointer-events: none;
}

.mg-portrait-zoom svg {
  inline-size: 19px;
  block-size: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mg-p33-portrait-preview:is(:hover, :focus-visible) .mg-portrait-zoom {
  opacity: 1;
}

@media (hover: none) {
  .mg-portrait-zoom {
    opacity: 1;
  }
}

.mg-native-portraits .mg-portrait-lightbox-download {
  padding: 7px 11px;
  border-radius: 5px;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mg-native-portraits .mg-portrait-lightbox-download:is(:hover, :focus-visible) {
  background: rgb(255 255 255 / .12);
  color: #fff;
}

.mg-native-portraits .mg-portrait-lightbox-download:focus-visible {
  outline: 2px solid #a8d7ea;
  outline-offset: 2px;
}

.mg-teaching-file-note {
  margin-block: .5rem .9rem;
  color: var(--mg-muted, #476277);
  font-size: .9rem;
}

.mg-legal-scope {
  margin-block: 1.4rem;
  padding: clamp(1rem, 2.4vw, 1.5rem);
  border-inline-start: 3px solid #7299b0;
  background: #eef4f8;
}
