/* Language switcher: a pill that opens a menu of native language names */
.ates-lang {
    position: relative;
    margin: 0 8px;
    color: #163156;
}

.ates-lang__button {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 8px 0 10px;
    border: 1px solid rgba(22, 49, 86, 0.22);
    border-radius: 18px;
    background: #fff;
    color: inherit;
    font: 600 13px/1 inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.ates-lang__button:hover,
.ates-lang.is-open .ates-lang__button {
    border-color: #163156;
    background: #f3f6fa;
}

.ates-lang__button:focus-visible {
    outline: 2px solid #3d7fd4;
    outline-offset: 2px;
}

.ates-lang .material-icons {
    font-size: 18px;
    color: #163156;
}

/* Flags keep their own colours, slightly muted so they do not outshine the header */
.ates-lang__flag {
    flex: none;
    width: 22px;
    height: 15px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(22, 49, 86, 0.2);
}

.ates-lang__chevron {
    margin-left: -2px;
    transition: transform 0.2s;
}

.ates-lang.is-open .ates-lang__chevron { transform: rotate(180deg); }

.ates-lang__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    min-width: 190px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(22, 49, 86, 0.12);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(22, 49, 86, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.ates-lang.is-open .ates-lang__menu {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.ates-lang__menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #163156;
    font-size: 14px;
    text-decoration: none;
}

.ates-lang__menu a:hover,
.ates-lang__menu a:focus-visible {
    background: #eef3f9;
    outline: none;
}

.ates-lang__item-name { flex: 1; }

.ates-lang__item-code {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(22, 49, 86, 0.5);
}

.ates-lang__menu a[aria-current="true"] {
    font-weight: 700;
    background: #e3ecf7;
}

.ates-lang__menu a[aria-current="true"] .ates-lang__item-name { flex: 1; }

.ates-lang__item-code {
    color: #163156;
}

@media (max-width: 600px) {
    /* The centred logo needs the middle of the row, so the pill goes to the free left side */
    .ates-lang { order: -1; margin: 0 4px; }
    .ates-lang__menu { right: auto; left: 0; }
}

/* Smallest phones (320px): the header row reserves 72px for the menu button, so pull the pill in */
@media (max-width: 340px) {
    .ates-lang { margin-left: -12px; }
    .ates-lang__button { padding: 0 4px 0 6px; }
}
