/* ===== custom language switcher (unified inline component) ===== */
header.banner .lang-switcher {
    display: flex;
    align-items: center;
    /* spacing via item margins below (gap can't express per-edge distances) */
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: "aktiv-grotesk", sans-serif;
    font-size: 1.2rem;
    font-weight: normal;
    text-transform: uppercase;
    line-height: 1.4;
    color: #333333;
}

header.banner .lang-switcher__item {
    float: none;
    margin: 0;
}

/* code-to-code spacing */
header.banner .lang-switcher__item + .lang-switcher__item {
    margin-left: .6rem;
}

/* desktop: the globe is a mobile-only toggle, remove it from the row */
@media (min-width: 992px) {
    header.banner .lang-switcher__item--globe {
        display: none;
    }
}

header.banner .lang-switcher__item > .lang-switcher__code {
    display: inline-block;
    margin-left: 0;
    color: #333333 !important;
    text-decoration: none !important;
    line-height: inherit;
    white-space: nowrap;
    /* reserve the outline-box geometry on every code so item
       positions stay identical when the active language changes */
    border: 1px solid transparent;
    border-radius: 2px;
    padding: .1rem .4rem;
    /* pull the boxed text back up onto the sibling nav links'
       baseline (undoes the +border/+padding-top descent) */
    margin-top: calc(-.1rem - 1px);
}

header.banner .lang-switcher__code.is-current {
    border-color: rgba(51, 51, 51, .3);
}

header.banner .lang-switcher__item.is-disabled .lang-switcher__code {
    opacity: .4;
    cursor: default;
}

header.banner .lang-switcher__item--globe {
    font-size: 1.6rem;
}

header.banner .lang-switcher__item--globe .fa-globe {
    /* 1.6rem glyph inside a ~1.68rem box = the nav links' line box */
    line-height: 1.05;
    /* FA glyphs sit optically a touch low; lift into visual alignment
       with the code text and the search icon */
    display: inline-block;
    transform: translateY(-.08rem);
}

/* the globe is a toggle button, not a link — strip UA button styles */
header.banner .lang-switcher__item--globe > .lang-switcher__globe {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: #333333;
    cursor: pointer;
}

header.banner a.lang-switcher__code:hover,
header.banner a.lang-switcher__code:focus {
    text-decoration: underline !important;
}

/* tiny downward nudge so the search icon sits level with the globe */
header.banner nav.nav-secondary .li--search .fa-search {
    display: inline-block;
    transform: translateY(.18rem);
}

/* --- desktop placement: rightmost item in nav-secondary --- */
header.banner nav.nav-secondary .li--lang-switcher .lang-switcher {
    /* deliberately wider than globe -> FI */
    margin-left: 1.2rem;
}

@media (max-width: 991px) {
    /* nav-secondary lives inside the off-canvas drawer on mobile; hide the desktop instance */
    header.banner nav.nav-secondary .li--lang-switcher {
        display: none;
    }
}

/* --- mobile placement: inside banner--mobile-navigation, left of the hamburger --- */
header.banner .banner--mobile-navigation .li--lang-switcher-mobile {
    /* ~same gap as between switcher items so the globe reads as part
       of the group, not detached from the hamburger */
    margin-right: 1.2rem;
}

/* mobile: a little more room between the codes */
header.banner .banner--mobile-navigation .lang-switcher__item + .lang-switcher__item {
    margin-left: .8rem;
}

/* extra buffer before the globe toggle so globe taps don't clip EN */
header.banner .banner--mobile-navigation .lang-switcher__item + .lang-switcher__item--globe {
    margin-left: 2rem;
}


header.banner .banner--mobile-navigation .lang-switcher__code {
    line-height: 3rem;
    /* wider boxes = bigger tap areas */
    padding-left: 1rem;
    padding-right: 1rem;
}

/* fa-bars and fa-close differ in width; pin the icon box so the
   glyph swap doesn't shift the language switcher horizontally */
header.banner .banner--mobile-navigation .site--mobile-trigger i {
    display: inline-block;
    width: 3rem;
    text-align: center;
}

/* ===== sliding outline cursor (lang-switcher.js experiment) ===== */
/* a floating copy of the outline box that travels from the current
   language to the clicked/next one before navigation happens */
header.banner .lang-switcher {
    position: relative;
}

header.banner .lang-switcher__cursor {
    position: absolute;
    border: 1px solid rgba(51, 51, 51, .3);
    border-radius: 2px;
    pointer-events: none;
    opacity: 0;
    transition-property: left, width, top, height;
    transition-timing-function: ease;
}

header.banner .lang-switcher.is-sliding .lang-switcher__cursor {
    opacity: 1;
}

/* while the cursor travels, the real outline hands over visually */
header.banner .lang-switcher.is-sliding .lang-switcher__code.is-current {
    border-color: transparent;
}

/* ===== mobile/tablet: codes hidden by default, globe toggle + drawer ===== */
@media (max-width: 991px) {
    /* hidden is the default state so nothing flashes before the
       (footer-loaded, possibly delayed) JS evaluates the inputs;
       items keep their boxes so the globe never shifts position */
    header.banner .banner--mobile-navigation
    .lang-switcher__item:not(.lang-switcher__item--globe) {
        transform: translateY(-150%);
        opacity: 0;
        /* keeps the links out of tab order and the AT tree while hidden */
        visibility: hidden;
        transition: transform .25s ease, opacity .25s ease, visibility .25s;
    }

    header.banner.is-lang-visible .banner--mobile-navigation
    .lang-switcher__item:not(.lang-switcher__item--globe) {
        transform: none;
        opacity: 1;
        visibility: visible;
    }

    /* small cascade as the codes drop in (items 1-3; globe is 4th) */
    header.banner.is-lang-visible .banner--mobile-navigation .lang-switcher__item:nth-child(2) {
        transition-delay: .05s;
    }
    header.banner.is-lang-visible .banner--mobile-navigation .lang-switcher__item:nth-child(3) {
        transition-delay: .1s;
    }
}

@media (prefers-reduced-motion: reduce) {
    header.banner .banner--mobile-navigation .lang-switcher__item {
        transition: none;
    }
}
