/* GAON - the language switcher inside the header menu. Both languages.
 * ---------------------------------------------------------------------------
 * Polylang adds the switcher as a menu item, so Elementor's Nav Menu treats it
 * as one: it inherits the widget's underline pointer and lights up on hover
 * and as the current item. But it is not a destination in the menu's sense -
 * it does not name a section of the site, it swaps the whole site - and the
 * underline reads as though it did.
 *
 * The pointer is removed with `content: none` rather than by hiding it, so the
 * pseudo element is never generated and nothing is left to animate. Elementor
 * writes its own at `.e--pointer-underline .elementor-item:after`, one class
 * short of this.
 *
 * Every rule is keyed to .lang-item, which is Polylang's own class on the list
 * item, so the ordinary menu items are untouched in both languages.
 */

.elementor-nav-menu .lang-item > .elementor-item::before,
.elementor-nav-menu .lang-item > .elementor-item::after{
  content: none;
}

/* Elementor paints the current item through the same pointer, and the item is
 * marked current on whichever language is not being viewed. Nothing to paint
 * now that the pseudo elements are gone, but the colour change came from a
 * separate rule. */
.elementor-nav-menu .lang-item > .elementor-item:hover,
.elementor-nav-menu .lang-item > .elementor-item:focus,
.elementor-nav-menu .lang-item > .elementor-item.elementor-item-active,
.elementor-nav-menu .lang-item > .elementor-item.highlighted{
  color: inherit;
}

/* The flag itself.
 *
 * Polylang's built-in flags are 16x11 PNGs and arrive with width and height
 * attributes, so today this rule changes nothing - 16px is exactly what the
 * browser was already drawing. It is here for the custom flag: an SVG has no
 * pixel size for Polylang to read, arrives with no width or height, and an
 * unsized SVG inside an <img> fills whatever box it is given.
 *
 * So the swap to a custom flag cannot surprise the header. Change
 * --gaon-flag-w when the drawn flag wants a different size. */
.elementor-nav-menu .lang-item{
  --gaon-flag-w: 16px;
}

.elementor-nav-menu .lang-item > .elementor-item img{
  inline-size: var(--gaon-flag-w);
  block-size: auto;
  max-inline-size: none;
  display: inline-block;
  vertical-align: middle;
}
