/* Language switcher on landings and blog (shared component «Переключатель языка»).
   The pill itself (.language-switcher, .language-current) is styled by landing.css / blog.css;
   this file adds the SVG flag and the popover that language-switcher.js builds in place of the
   native list. Flags come from language-flags.css (.rp-flag--<country>), never emoji. */
.language-current .rp-flag,
.language-current-flag.rp-flag {
    font-size: 15px;
}

.language-switcher.has-language-menu .language-select {
    display: none;
}

.language-toggle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.language-toggle:focus-visible {
    outline: 2px solid rgba(255, 59, 111, 0.8);
    outline-offset: 2px;
}

.language-switcher.is-open::after {
    transform: translateY(-65%) rotate(180deg);
}

.language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    display: grid;
    gap: 2px;
    width: min(250px, calc(100vw - 32px));
    max-height: min(360px, 62vh);
    padding: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 15px;
    background: #1a2140;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
    text-transform: none;
}

.language-menu[hidden] {
    display: none;
}

.language-menu-option {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.language-menu-option .rp-flag {
    font-size: 18px;
}

.language-menu-option:hover {
    background: rgba(255, 255, 255, 0.07);
}

.language-menu-option[aria-selected="true"] {
    background: rgba(74, 108, 247, 0.2);
}

.language-menu-option:focus-visible {
    outline: 2px solid #4a6cf7;
    outline-offset: -2px;
}

@media (prefers-reduced-motion: no-preference) {
    .language-menu:not([hidden]) {
        transform-origin: calc(100% - 24px) 0;
        animation: language-menu-in 200ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
    }

    .language-menu-option {
        transition: background-color 160ms ease, scale 160ms ease;
    }

    .language-menu-option:active {
        scale: 0.97;
    }
}

@keyframes language-menu-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-4px);
    }
}
