/* =====================================================
   TranslateXYZ — Language switcher
   Sits next to the header logo. Uses <details>/<summary>
   for accessible keyboard + no-JS support.
   ===================================================== */

.lang-switcher {
    position: relative;
    display: inline-block;
    margin-left: var(--sp-1);
}

/* Hide default <details> marker (arrow) — we use our own SVG caret */
.lang-switcher > summary {
    list-style: none;
}
.lang-switcher > summary::-webkit-details-marker {
    display: none;
}

/* ---- Toggle button (always visible) ---- */
.lang-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-on-dark);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.lang-switcher__toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}
.lang-switcher[open] .lang-switcher__toggle {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
}

.lang-switcher__flag {
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.lang-switcher__flag img {
    display: block;
    width: 18px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.lang-switcher__code {
    letter-spacing: 0.04em;
}
.lang-switcher__caret {
    width: 10px;
    height: 10px;
    transition: transform var(--t-fast);
}
.lang-switcher[open] .lang-switcher__caret {
    transform: rotate(180deg);
}

/* ---- Dropdown menu ---- */
.lang-switcher__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 100;
    min-width: 220px;
    max-height: 340px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    color: var(--text-on-light);
}

.lang-switcher__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--text-on-light);
    font-size: var(--fs-sm);
    transition: background var(--t-fast), color var(--t-fast);
    white-space: nowrap;
}
.lang-switcher__item:hover,
.lang-switcher__item:focus-visible {
    background: var(--green-50);
    color: var(--green-700);
    outline: none;
}
.lang-switcher__item.is-current {
    background: var(--green-100);
    color: var(--green-800);
    font-weight: var(--fw-semibold);
}
.lang-switcher__item .lang-switcher__flag {
    font-size: 18px;
    flex-shrink: 0;
}
.lang-switcher__item .lang-switcher__flag img {
    width: 22px;
}
.lang-switcher__native {
    font-weight: var(--fw-medium);
}
.lang-switcher__name {
    color: var(--text-on-light-muted);
    font-size: var(--fs-xs);
    margin-left: auto;
}
.lang-switcher__item.is-current .lang-switcher__name {
    color: var(--green-700);
}

/* ---- Responsive: smaller on phones, drop the English-label column ---- */
@media (max-width: 640px) {
    .lang-switcher {
        margin-left: var(--sp-2);
    }
    .lang-switcher__toggle {
        padding: 5px 8px;
    }
    .lang-switcher__name {
        display: none;
    }
    .lang-switcher__menu {
        min-width: 180px;
    }
}

/* ---- Header context: shrink toggle slightly when header is in shrunk state ---- */
.site-header.is-shrunk .lang-switcher__toggle {
    padding: 4px 8px;
}
