/* CMS public site locale switcher
 * Loaded only when the tenant has multiple locales enabled (see
 * `templates/public/_locale_switcher.html.twig` which renders the matching
 * <link> in the document head, gated on `cms_locale_context(organization)
 * .isMultilingual()`). */

.cms-locale-switcher {
    position: relative;
    display: inline-block;
    font-family: var(--cms-font-body, system-ui, sans-serif);
}
.cms-locale-switcher > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 9999px;
    background: #ffffff;
    /* Explicit dark text — themes often place the switcher inside a
       dark footer where `color: inherit` would pull the footer's
       white color onto a white button (illegible). */
    color: #111827;
    font-size: 0.85rem;
    font-weight: 500;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.cms-locale-switcher > summary::-webkit-details-marker { display: none; }
.cms-locale-switcher > summary:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.22);
}
.cms-locale-switcher[open] > summary { border-color: var(--cms-primary, #4f46e5); }
.cms-locale-switcher__flag { font-size: 1.05rem; line-height: 1; }
.cms-locale-switcher__code { font-size: 0.72rem; letter-spacing: 0.05em; opacity: 0.7; }
.cms-locale-switcher__caret { font-size: 0.7rem; opacity: 0.55; }
.cms-locale-switcher__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 11rem;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    color: #111827;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    z-index: 50;
}
/* The footer variant opens upwards so it doesn't push the page below
   the viewport on a narrow screen. */
.cms-locale-switcher--footer .cms-locale-switcher__menu {
    top: auto;
    bottom: calc(100% + 0.4rem);
}
.cms-locale-switcher__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.85rem;
    transition: background 0.12s ease;
}
.cms-locale-switcher__item:hover { background: #f3f4f6; }
.cms-locale-switcher__item.is-active { background: #eef2ff; font-weight: 600; }
.cms-locale-switcher__item .cms-locale-switcher__name { flex: 1; }
.cms-locale-switcher__item .cms-locale-switcher__code { margin-left: 0.5rem; }
/* Viewport split: header switcher on desktop only, footer switcher
   on mobile only — guarantees exactly one visible instance even
   when both are rendered in the same document. */
.cms-locale-switcher--footer { display: none; }
@media (max-width: 767px) {
    .cms-locale-switcher--header { display: none; }
    .cms-locale-switcher--footer { display: inline-block; margin-top: 0.75rem; }
    /* Pin the dropdown to the viewport so it can't push the footer
       layout off-axis on narrow screens, whatever the parent
       container does. */
    .cms-locale-switcher--footer .cms-locale-switcher__menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100vw - 1rem);
    }
}

/* Footer wrapper used by every theme to host the mobile switcher
   inside the `cms-site-footer__inner` container — keeps it inside
   the theme's gutters instead of flush against the viewport edge. */
.cms-site-footer__locale {
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
}
@media (min-width: 768px) {
    .cms-site-footer__locale { display: none; }
}
