/* Native Nexus EN / ES / FR switcher, desktop and mobile. */

/* --- Legacy dictionary selector: permanently hidden, wherever it is
   rendered (header or footer) and however often it is re-created.
   The elements stay in the DOM — platform.js and the homepage bundle
   look for them — but they can never be seen or tapped. This replaces
   the old JS-only hiding, which a re-render could undo. --- */
select[data-nexus-language],
.nexusLanguageControl,
.headerLanguage,
.headerLanguageGlobal,
.nexusLangLegacyHidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* --- Custom switcher control (matches header pill styling) --- */
.nexusLangSwitch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid #d5e1ea;
  border-radius: 12px;
  padding: 3px;
  margin-left: auto;
  font-family: Manrope, system-ui, sans-serif;
}
.nexusLangSwitchCaption {
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1;
  color: #0f2744;
  padding: 0 0.3rem 0 0.5rem;
  white-space: nowrap;
}
/* Desktop: the menu is transparent to layout, so the three buttons sit
   in the pill exactly like a normal segmented control. */
.nexusLangMenu {
  display: contents;
}
.nexusLangBtn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: #0f2744;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1;
  padding: 0.5rem 0.55rem;
  min-height: 38px;
  min-width: 44px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.nexusLangBtn:hover {
  background: #eef4f9;
}
.nexusLangBtn[aria-pressed="true"] {
  background: #0f2744;
  color: #fff;
}
.nexusLangBtn:focus-visible,
.nexusLangToggle:focus-visible {
  outline: 3px solid #0ea5e9;
  outline-offset: 2px;
}
.nexusLangBtnName {
  display: none;
}
/* Toggle button: mobile only (desktop shows the full pill). */
.nexusLangToggle {
  display: none;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: #0f2744;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 0.45rem;
  border-radius: 9px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.nexusLangToggleCaret {
  font-size: 0.6rem;
}

/* --- Mobile: one 44px toggle; all three languages in the drop-down --- */
@media (max-width: 760px) {
  .nexusLangSwitchCaption {
    display: none;
  }
  .nexusLangToggle {
    display: inline-flex;
  }
  .nexusLangMenu {
    display: none;
  }
  .nexusLangSwitch.open .nexusLangMenu {
    display: block;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    min-width: 196px;
    background: #fff;
    border: 1px solid #d5e1ea;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(7, 31, 55, 0.18);
    padding: 6px;
  }
  .nexusLangSwitch.open .nexusLangBtn {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    min-height: 48px;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
  }
  .nexusLangBtnName {
    display: inline;
    font-weight: 700;
  }
  .nexusLangBtnCode {
    min-width: 30px;
    text-align: left;
  }

  /* Adaptive mobile header (platform.js adds .nexusAdaptiveMobileHeader
     at <=760px): the actions container becomes display:contents and the
     nav is a 6-column grid. Take the language slot (column 2) the legacy
     control used to occupy, as a bare 44px toggle. */
  header.nexusAdaptiveMobileHeader .nexusLangSwitch {
    grid-column: 2 !important;
    grid-row: 1 !important;
    place-self: center !important;
    margin: 0 !important;
    padding: 0;
    border: 0;
    background: transparent;
  }
  header.nexusAdaptiveMobileHeader .nexusLangToggle {
    border: 1px solid #d5e1ea;
    background: #fff;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }
  header.nexusAdaptiveMobileHeader .nexusLangSwitch.open .nexusLangMenu {
    top: calc(100% + 8px);
    right: auto;
    left: 0;
  }
}
@media print {
  .nexusLangSwitch {
    display: none !important;
  }
}

.nexusLangError {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1002;
  width: max-content; max-width: min(270px, calc(100vw - 32px));
  padding: 9px 12px; border: 1px solid #f1b9b9; border-radius: 9px;
  background: #fff; color: #8b1d1d; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
