/**
 * TRISESTRI Language Switcher
 *
 * Globe icon + active language code in the header.
 * A dropdown reveals all available languages on click.
 */

/* ============================================
   WRAPPER — the <li> that holds the switcher.
   Use inline-block (not flex) so it sits inline
   with sibling Max Mega Menu items.  High-specificity
   selectors below match MMM's own rules so this item
   is treated identically to its siblings.
   ============================================ */
#mega-menu-wrap-primary #mega-menu-primary > li.trisestri-lang-switcher-item,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.trisestri-lang-switcher-item,
ul#mega-menu-primary > li.trisestri-lang-switcher-item,
li.trisestri-lang-switcher-item {
    position: relative !important;
    display: inline-block !important;
    float: none !important;
    vertical-align: middle !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    line-height: normal !important;
    background: transparent !important;
}

/* ============================================
   TOGGLE BUTTON
   ============================================ */
.trisestri-lang-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--trisestri-primary, #1a1a1a);
    transition: opacity 0.2s ease;
    font-family: inherit;
}

.trisestri-lang-switcher__toggle:hover {
    opacity: 0.65;
}

.trisestri-lang-switcher__toggle svg {
    fill: currentColor;
    flex-shrink: 0;
    display: block;
}

/* Chevron rotates when open */
.trisestri-lang-switcher__chevron {
    transition: transform 0.2s ease;
}

.trisestri-lang-switcher__toggle[aria-expanded="true"] .trisestri-lang-switcher__chevron {
    transform: rotate(180deg);
}

/* ============================================
   DROPDOWN
   ============================================ */
.trisestri-lang-switcher__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    min-width: 140px;
    z-index: 100002; /* above hero logo (100001) */
}

.trisestri-lang-switcher__dropdown li {
    margin: 0;
    padding: 0;
}

.trisestri-lang-switcher__dropdown a,
body.home .trisestri-lang-switcher__dropdown a,
body.home .site-header .trisestri-lang-switcher__dropdown a,
#mega-menu-wrap-primary .trisestri-lang-switcher__dropdown a {
    display: block;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--trisestri-primary, #1a1a1a) !important;
    text-decoration: none !important;
    text-transform: capitalize;
    white-space: nowrap;
    transition: background 0.15s ease;
    opacity: 1 !important;
}

.trisestri-lang-switcher__dropdown a:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Active / current language row — explicit class wins over theme selectors. */
.trisestri-lang-switcher__dropdown a.is-current-language,
.trisestri-lang-switcher__dropdown li.is-current-language > a,
body.home .trisestri-lang-switcher__dropdown a.is-current-language,
body.home .site-header .trisestri-lang-switcher__dropdown a.is-current-language,
#mega-menu-wrap-primary .trisestri-lang-switcher__dropdown a.is-current-language {
    font-weight: 700;
    text-decoration: underline !important;
    text-underline-offset: 0.18em;
}

/* ============================================
   DESKTOP — add breathing room on the right of
   the primary mega-menu so it doesn't crowd the
   header edge / WooCommerce icons.
   ============================================ */
@media (min-width: 922px) {
    #mega-menu-wrap-primary #mega-menu-primary {
        margin-right: 30px;
    }
}

/* ============================================
   FRONT PAGE — transparent header → white
   ============================================ */
body.home .trisestri-lang-switcher__toggle {
    color: #fff;
}

/* Front page + header-solid state → back to primary */
body.home.header-solid .trisestri-lang-switcher__toggle {
    color: var(--trisestri-primary, #1a1a1a) !important;
}

/* ============================================
   MOBILE — Max Mega Menu collapses to a vertical
   stack on small screens (and uses its own
   .mega-menu-mobile / .mega-menu-tabbed wrapper
   classes regardless of breakpoint when the
   "mobile menu" mode is configured).
   ============================================ */
@media (max-width: 921px) {
    #mega-menu-wrap-primary #mega-menu-primary > li.trisestri-lang-switcher-item,
    #mega-menu-wrap-primary.mega-menu-mobile #mega-menu-primary > li.trisestri-lang-switcher-item,
    #mega-menu-wrap-primary.mega-menu-accordion #mega-menu-primary > li.trisestri-lang-switcher-item,
    ul#mega-menu-primary > li.trisestri-lang-switcher-item,
    li.trisestri-lang-switcher-item {
        display: block !important;
        width: 100% !important;
        float: none !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    li.trisestri-lang-switcher-item > .trisestri-lang-switcher__toggle {
        display: flex !important;
        width: 100%;
        justify-content: flex-start;
        padding: 14px 20px;
        font-size: 0.85rem;
        color: var(--trisestri-primary, #1a1a1a) !important;
    }

    .trisestri-lang-switcher__dropdown {
        position: static !important;
        right: auto;
        left: auto;
        box-shadow: none;
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 0;
        background: rgba(0, 0, 0, 0.02);
        min-width: 0;
        width: 100%;
        padding: 0;
    }

    .trisestri-lang-switcher__dropdown a {
        padding: 12px 40px;
    }
}

/* ============================================
   MMM "mobile" mode — applies regardless of
   viewport width when MMM is configured to
   always show the mobile toggle.
   ============================================ */
#mega-menu-wrap-primary.mega-menu-mobile li.trisestri-lang-switcher-item,
#mega-menu-wrap-primary.mega-menu-accordion li.trisestri-lang-switcher-item {
    display: block !important;
    width: 100% !important;
    float: none !important;
}









