/*
 * Language switcher.
 *
 * Kept out of the SCSS bundle on purpose: the Vite sources are not present on
 * this server, so the bundle cannot be rebuilt here. Everything is scoped to
 * .lang-switch / .lang-drop and uses the theme's own custom properties, so
 * it can be pasted into the SCSS unchanged on the next real build.
 */

/* ---------------- Top bar dropdown ---------------- */

.lang-switch {
    position: relative;
    line-height: 1;
}

/* The default disclosure triangle would sit next to our own caret. */
.lang-switch > summary {
    list-style: none;
}
.lang-switch > summary::-webkit-details-marker {
    display: none;
}

.lang-switch__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--topbar-text);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .06em;
    padding: 4px 2px;
    transition: color .15s;
    user-select: none;
}

.lang-switch__toggle:hover,
.lang-switch[open] .lang-switch__toggle {
    color: #fff;
}

.lang-switch__toggle:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 2px;
}

.lang-switch__caret {
    transition: transform .15s;
    opacity: .7;
}
.lang-switch[open] .lang-switch__caret {
    transform: rotate(180deg);
}

.lang-switch__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 60;
    margin: 0;
    padding: 4px;
    min-width: 150px;
    list-style: none;
    background: var(--body-bg, #fff);
    color: var(--text-color, #18191a);
    border: 1px solid var(--line, rgba(0, 0, 0, .12));
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.lang-switch__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 13px;
    letter-spacing: 0;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .12s;
}

.lang-switch__item:hover {
    background: var(--grey-bg, rgba(0, 0, 0, .05));
    color: inherit;
}

.lang-switch__item.is-current {
    font-weight: 600;
}

/* ---------------- Выбор языка в боковом меню ---------------- */

/*
 * Подпись отдельной строкой сверху, под ней — строка-кнопка с текущим языком.
 * Остальные языки раскрываются вниз, как подпункты меню.
 *
 * Ряд плашек, который был здесь раньше, помещался только пока языков было три:
 * четвёртый переносился на вторую строку и уезжал под подпись. Список от числа
 * языков не зависит вовсе.
 */
.lang-drop {
    /* Отступ по бокам тот же, что у строки «Тёмная тема» рядом: без него блок
       прижимался к краям панели, а подпись налезала на разделитель. */
    padding: 14px 24px 18px;
    border-top: 1px solid var(--line, rgba(0, 0, 0, .1));
}

.lang-drop__label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--grey, #8a8a8a);
}

.lang-drop__box {
    position: relative;
}

/* Своя стрелка вместо системного треугольника. */
.lang-drop__box > summary {
    list-style: none;
}
.lang-drop__box > summary::-webkit-details-marker {
    display: none;
}

.lang-drop__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line, rgba(0, 0, 0, .15));
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    color: inherit;
    background: transparent;
}

.lang-drop__current {
    /* Название языка забирает свободное место, стрелка прижата к правому краю. */
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-drop__caret {
    flex: 0 0 auto;
    transition: transform .18s ease;
}

.lang-drop__box[open] .lang-drop__caret {
    transform: rotate(180deg);
}

.lang-drop__menu {
    list-style: none;
    margin: 6px 0 0;
    padding: 4px;
    border: 1px solid var(--line, rgba(0, 0, 0, .12));
    border-radius: 8px;
    background: var(--body-bg, #fff);
}

.lang-drop__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 6px;
    font-size: 15px;
    color: inherit;
    text-decoration: none;
}

.lang-drop__item:hover,
.lang-drop__item:focus-visible {
    background: var(--primary-bg, rgba(0, 0, 0, .04));
    text-decoration: none;
}

.lang-drop__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-drop__item.is-current {
    font-weight: 600;
}

.lang-drop__check {
    flex: 0 0 auto;
    color: var(--primary, #B86830);
}

/* ---------------- Shared ---------------- */

.lang-flag {
    display: block;
    flex: 0 0 auto;
    border-radius: 2px;
}
