/*
 * The language switcher of the header (module multilingual). With two or three languages it is a pair of small pills, the current
 * language filled: a choice is one click, not a list. With more languages it is a dropdown, kept as narrow as its entries.
 * Colours, spacing and radius are the tokens of theme.json.
 */

header .wp-block-navigation .lang-item > a {
  border: 1px solid var(--wp--preset--color--outline, #d8d2c2);
  border-radius: var(--wp--custom--radius--pill, 999px);
  font-size: var(--wp--preset--font-size--xs, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.4;
  padding: 0.2rem 0.65rem;
}

header .wp-block-navigation .lang-item > a:hover,
header .wp-block-navigation .lang-item > a:focus-visible {
  border-color: var(--wp--preset--color--primary, #2f5d46);
}

/* two or three languages are one joined control, not separate buttons: the gap of the menu is taken back between them */
header .wp-block-navigation__container > .lang-item + .lang-item {
  margin-inline-start: calc(-1 * var(--wp--style--block-gap, 1.5rem) - 1px);
}

header .wp-block-navigation__container > .lang-item:has(+ .lang-item) > a {
  border-end-end-radius: 0;
  border-start-end-radius: 0;
}

header .wp-block-navigation__container > .lang-item + .lang-item > a {
  border-end-start-radius: 0;
  border-start-start-radius: 0;
}

header .wp-block-navigation .lang-item.current-lang > a {
  background: var(--wp--preset--color--primary, #2f5d46);
  border-color: var(--wp--preset--color--primary, #2f5d46);
  color: var(--wp--preset--color--primary-contrast, #fff);
}

/* the dropdown (four or more languages): the item shows the current language, the list is as wide as its entries */
header .wp-block-navigation .lang-item .wp-block-navigation__submenu-container {
  min-width: 0;
  width: max-content;
}

.wp-block-navigation .wp-block-navigation__submenu-container .lang-item > a {
  border: 0;
  border-radius: 0;
  padding: 0.35rem 0.9rem;
}

.wp-block-navigation .wp-block-navigation__submenu-container .lang-item.current-lang > a {
  background: transparent;
  color: var(--wp--preset--color--primary, #2f5d46);
}
