/* [hmw_language_switcher] — custom dropdown (button + listbox) with
 * per-item locale flags (bundled flag-icons). Two styles:
 *   default — bordered trigger, boxed dropdown (original design)
 *   alt     — minimal ghost trigger, borderless floating menu (Figma design)
 * Use via shortcode attribute: [hmw_language_switcher style="alt"]. */

.hmw-language-switcher {
    display: inline-block;
    position: relative;
    font-family: inherit;
    font-size: 0.95em;
}

/* ---------- Trigger button ---------- */

.hmw-language-switcher__toggle {
    align-items: center;
    background-color: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: inherit;
    gap: 5px;
    padding: 6px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hmw-language-switcher__toggle:hover {
    border-color: #94a3b8;
}

.hmw-language-switcher__toggle:focus-visible {
    border-color: #2271b1;
    outline: 1px solid #2271b1;
}

.hmw-language-switcher__caret {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s;
}

.hmw-language-switcher.is-open .hmw-language-switcher__caret {
    transform: rotate(180deg);
}

/* ---------- Dropdown list ---------- */

.hmw-language-switcher__list {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
    left: 0;
    list-style: none;
    margin: 4px 0 0;
    min-width: 100%;
    padding: 4px 0;
    position: absolute;
    top: 100%;
    z-index: 9999;
}

.hmw-language-switcher__item a {
    align-items: center;
    color: inherit;
    display: flex;
    gap: 5px;
    padding: 7px 12px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s;
}

.hmw-language-switcher__item a:hover {
    background: #f0f0f1;
    color: inherit;
}

.hmw-language-switcher__item.is-current a {
    font-weight: 600;
}

.hmw-language-switcher .fi {
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 8%);
    flex: 0 0 auto;
}

/* Optional flag span mode (used when the switcher renders as a list). */
.hmw-language-switcher__flag {
    background-size: contain;
    background-position: 50%;
    background-repeat: no-repeat;
    display: inline-block;
    height: 1em;
    vertical-align: -0.1em;
    width: 1.3333em;
}

/* ============================================================
 * ALT style (Figma: node 215-6538) — minimal, transparent UI.
 * Ghost trigger with no border, chevron-only affordance, circular
 * flags, and a borderless floating menu with soft shadow.
 * ============================================================ */

.hmw-language-switcher--alt .hmw-language-switcher__toggle {
    background: transparent;
    border-color: transparent;
    border-radius: 999px;
    font-size: 15px;
    padding: 6px 10px;
}

.hmw-language-switcher--alt .hmw-language-switcher__toggle:hover {
    background: rgb(0 0 0 / 5%);
    border-color: transparent;
}

.hmw-language-switcher--alt .hmw-language-switcher__toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgb(0 0 0 / 12%);
}

.hmw-language-switcher--alt .hmw-language-switcher__flag {
    width: 20px;
    height: auto;
    aspect-ratio: 4/3;
}

/* Borderless floating menu. */
.hmw-language-switcher--alt .hmw-language-switcher__list {
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgb(0 0 0 / 14%);
    min-width: 180px;
    padding: 6px;
}

.hmw-language-switcher--alt .hmw-language-switcher__item a {
    border-radius: 8px;
    font-size: 15px;
    padding: 9px 12px;
}

.hmw-language-switcher--alt .hmw-language-switcher__item a:hover {
    background: rgb(0 0 0 / 6%);
}

/* Current item: tinted pill instead of bold-only. */
.hmw-language-switcher--alt .hmw-language-switcher__item.is-current a {
    background: rgb(0 0 0 / 6%);
    font-weight: 600;
}

.hmw-language-switcher--alt .hmw-language-switcher__label {
    order: 1;
}

.hmw-language-switcher--alt .hmw-language-switcher__caret {
    order: 2;
}

.hmw-language-switcher--alt .hmw-language-switcher__flag {
    order: 3;
    margin-left: 5px;
}