/**
 * MLAT Switcher v3 — la feuille v1 restituée : bouton-drapeau rond dans la
 * rangée d'icônes, panneau blanc déroulé VERTICALEMENT, drapeaux circulaires,
 * points de rupture 768/480/380. Le correctif mobile du thème qui cible
 * .tp-ibt et .mlat-sw-flag s'applique tel quel.
 * Ajouts v3 (les seuls) : .mlat-sw-sr (l'intitulé accessible, masqué à
 * l'écran) et .mlat-lang-note (la note du module lang de repli).
 */

/* ── Conteneur ─────────────────────────────────────────────────────────── */
.mlat-sw-wrap {
    position: relative;
    display: inline-flex;
}

/* ── Bouton : le drapeau de la langue courante, rond, sobre ────────────── */
.mlat-sw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
}

/* ── Drapeau ───────────────────────────────────────────────────────────── */
.mlat-sw-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.12);
    pointer-events: none;
}

.mlat-sw-flag svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Repli texte quand le SVG manque */
.mlat-sw-flag--text {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--ardoise, #2c2c2c);
    background: var(--creme, #f5f0e8);
    border: 1px solid var(--gc, #ddd);
}

/* ── Panneau : la liste déroulée verticalement ─────────────────────────── */
/* CACHÉ par défaut ; seul .is-open (posé par le JS) l'affiche. Le !important
   et le sélecteur dédoublé (.mlat-sw-wrap .mlat-sw-dropdown) protègent l'état
   fermé d'une feuille de thème qui imposerait un display aux <ul> après nous. */
.mlat-sw-wrap .mlat-sw-dropdown {
    display: none !important;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    margin: 0;
    padding: 8px;
    list-style: none;
    flex-direction: column;
    gap: 8px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 60;
}

.mlat-sw-wrap.is-open .mlat-sw-dropdown {
    display: flex !important;
    animation: mlat-pop 0.16s ease;
}

@keyframes mlat-pop {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.mlat-sw-dropdown li {
    margin: 0;
    padding: 0;
}

/* ── Options : drapeau seul, cerclé au survol ──────────────────────────── */
.mlat-sw-opt {
    display: flex;
    padding: 2px;
    border-radius: 50%;
}

.mlat-sw-opt:hover .mlat-sw-flag {
    box-shadow: 0 0 0 2px var(--ocre, #C4862A);
}

/* ── Focus visible RGAA ────────────────────────────────────────────────── */
.mlat-sw-btn:focus-visible,
.mlat-sw-opt:focus-visible {
    outline: 2px solid var(--ocre, #C4862A);
    outline-offset: 2px;
    border-radius: 50%;
}

/* ── Intitulé accessible : lu par les lecteurs d'écran, absent à l'écran ── */
.mlat-sw-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Note de contenu de repli (module lang de repli) ───────────────────── */
.mlat-lang-note {
    margin: 0 0 1em;
    padding: 8px 12px;
    font-size: 0.9rem;
    background: var(--creme, #f5f0e8);
    border-left: 3px solid var(--ocre, #C4862A);
}

/* ── Responsive : points de rupture v1 ─────────────────────────────────── */
@media (max-width: 768px) {
    .mlat-sw-flag {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .mlat-sw-flag {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 380px) {
    .mlat-sw-flag {
        width: 18px;
        height: 18px;
    }

    .mlat-sw-dropdown {
        right: -6px;
    }
}
