/* Load after site.css. Only controls moved into the mobile menu are changed. */
@media (max-width: 1050px) {
  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale {
    grid-column: 1 / -1;
    grid-row: 2;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    color: var(--bm-text);
  }

  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > summary {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--bm-line);
    border-radius: 8px;
    background: var(--bm-surface);
    color: var(--bm-accent-ink);
    font-size: 13px;
    line-height: 20px;
    text-align: start;
    list-style: none;
    cursor: pointer;
  }

  /* Reuse the existing translated label instead of introducing new copy. */
  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > summary::before {
    content: attr(aria-label);
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > summary > span {
    order: 2;
    flex: 0 0 auto;
    font-size: inherit;
  }

  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > summary > svg {
    display: block;
    order: 0;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    color: var(--bm-accent-ink);
  }

  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > summary > svg:last-child {
    order: 3;
    flex-basis: 14px;
    width: 14px;
    height: 14px;
  }

  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > summary:focus-visible {
    outline: 2px solid var(--bm-accent-ink);
    outline-offset: 2px;
  }

  /* Keep the list inside the scrollable menu, including narrow/short screens. */
  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > .bm-locale-options {
    position: static;
    inset: auto;
    box-sizing: border-box;
    width: 100%;
    inline-size: 100%;
    min-width: 0;
    min-inline-size: 0;
    max-width: 100%;
    max-inline-size: 100%;
    max-height: min(320px, 45dvh);
    margin: 8px 0 0;
    padding: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--bm-line);
    border-radius: 8px;
    background: var(--bm-card);
    color: var(--bm-text);
    box-shadow: none;
  }

  #bm-s .bm-site[data-theme][data-current-page] .bm-mobile-menu .bm-header-menu-tools > .bm-locale > .bm-locale-options > a {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    gap: 12px;
    padding: 10px 12px;
    color: var(--bm-text);
    line-height: 20px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
