/* Language names need room to wrap at spaces, including in the RTL theme. */
#header #fh-portal-language-choices {
    box-sizing: border-box;
    width: min(516px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    max-height: min(520px, calc(100dvh - 64px));
    overflow: auto;
    overscroll-behavior: contain;
}

#header #fh-portal-language-choices > ul,
.fh-storefront-language > ul {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
    margin: 0;
    padding: 8px;
    gap: 4px;
    list-style: none;
}

#header #fh-portal-language-choices > ul > li,
.fh-storefront-language > ul > li {
    display: block;
    float: none !important;
    width: auto !important;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#header #fh-portal-language-choices > ul > li > a,
.fh-storefront-language > ul > li > a {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-height: 44px;
    height: 100%;
    max-width: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: normal !important;
    text-decoration: none;
}

#header #fh-portal-language-choices > ul > li > a:focus-visible,
.fh-storefront-language :is(summary, a):focus-visible {
    outline: 2px solid #ffdf00;
    outline-offset: -2px;
}

@media (min-width: 660px) {
    #header #fh-portal-language-choices > ul,
    .fh-storefront-language > ul {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

.fh-storefront-language {
    position: relative;
    justify-self: end;
    align-self: center;
    color: #f2f6f9;
}

.fh-storefront-language > summary {
    display: flex;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.fh-storefront-language > summary::-webkit-details-marker { display: none; }
.fh-storefront-language > summary::after { content: '\25be'; }

.fh-storefront-language > ul {
    position: absolute;
    z-index: 1100;
    inset-inline-end: 0;
    inset-block-start: 100%;
    width: min(516px, calc(100vw - 24px));
    max-height: min(520px, calc(100dvh - 72px));
    overflow: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    background: #15212a;
    border: 1px solid #405461;
    border-radius: 10px;
    box-shadow: 0 8px 26px rgb(0 0 0 / 35%);
}

.fh-storefront-language:not([open]) > ul { display: none !important; }
.fh-storefront-language > ul > li > a { color: #f2f6f9; }
.fh-storefront-language > ul > li > a:is(:hover, [aria-current="true"]) {
    color: #ffdf00;
    background: #263d4b;
}

.fh-heading-language { display: flex; justify-content: end; padding-inline: 12px; background: #101920; }
html[dir="rtl"] .fh-heading-language { direction: rtl; }
