/*
 * Market language switcher — the only skin the toggle needs.
 *
 * The paired-span hide rules that actually switch the languages ship as inline
 * critical CSS from TMC_Market_Language::head_bootstrap(), so a missing or
 * stale copy of this file can only cost styling, never produce doubled text.
 *
 * Structure mirrors the shop grid/list switcher so both segmented pills in this
 * theme read as one control family.
 */

.market-lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-neutral-light);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
}

.market-lang-switcher__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-neutral-mid);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

/* The glyph is the language: Latin A for English, Devanagari अ for नेपाली. */
.market-lang-switcher__glyph {
    font-size: 0.8125rem;
    line-height: 1;
}

.market-lang-switcher__btn:hover {
    color: var(--color-primary-dark);
    background: rgba(46, 125, 50, 0.08);
}

/*
 * The highlight follows the html attribute, not aria-pressed: the pre-paint
 * bootstrap script already knows the visitor's stored choice, so the control
 * shows the right half active even before this file's own JS binds.
 */
html[data-market-lang="en"] .market-lang-switcher__btn[data-market-lang-toggle="en"],
html[data-market-lang="ne"] .market-lang-switcher__btn[data-market-lang-toggle="ne"] {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.market-lang-switcher__btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/*
 * The header row is crowded on a phone: drop the words, grow the hit area to the
 * WCAG 2.5.5 minimum, and let the two glyphs carry the choice alone.
 */
@media (max-width: 479.98px) {
    .market-lang-switcher__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .market-lang-switcher__btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0 8px;
    }

    .market-lang-switcher__glyph {
        font-size: 0.9375rem;
    }
}
