/* A compact flag trigger opens a floating language card without a visible field label. */
html[data-i18n-embedded] [data-language-control] { display: none; }
.language-control { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; max-width: 100%; font: 500 12px/1.4 Manrope, sans-serif; color: var(--text, #243944); }
.language-dropdown { position: relative; }
.language-dropdown[open] { z-index: 100; }
/* Only the flag is visible in the trigger; the dropdown retains full language names. */
.language-dropdown summary { display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; padding: 0; box-sizing: border-box; border: 1px solid var(--border, #dce5e7); border-radius: 12px; background: var(--surface, #fff); color: inherit; box-shadow: 0 2px 5px #183c4610; cursor: pointer; list-style: none; user-select: none; }
.language-dropdown summary [data-current-language], .language-dropdown summary .language-chevron { display: none; }
.language-dropdown summary::-webkit-details-marker { display: none; }
.language-dropdown summary:hover, .language-dropdown[open] summary { border-color: var(--primary, #087f73); }
.language-flag { display: inline-flex; width: 23px; height: 16px; flex: 0 0 23px; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px #183c4614; }
.language-flag svg { display: block; width: 100%; height: 100%; }
/* Both static flags occupy the same space; the saved page language selects the visible one. */
.language-flag [data-flag-language] { display: none; }
.language-flag [data-flag-language="en"] { display: block; }
html:is([lang="es"], [lang="nl"], [lang="de"], [lang="fr"]) .language-flag [data-flag-language="en"] { display: none; }
html[lang="es"] .language-flag [data-flag-language="es"],
html[lang="nl"] .language-flag [data-flag-language="nl"],
html[lang="de"] .language-flag [data-flag-language="de"],
html[lang="fr"] .language-flag [data-flag-language="fr"] { display: block; }
.language-chevron { width: 14px; height: 14px; margin-left: 3px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
.language-dropdown[open] .language-chevron { transform: rotate(180deg); }
/* Native buttons preserve tab navigation, focus rings, and an announced selected state. */
.language-options { position: absolute; top: calc(100% + 8px); right: 0; width: 176px; max-height: max(58px, min(320px, calc(100vh - var(--nav-height, 84px) - 24px))); max-height: max(58px, min(320px, calc(100dvh - var(--nav-height, 84px) - 24px))); overflow-y: auto; overscroll-behavior: contain; padding: 6px; box-sizing: border-box; border: 1px solid var(--border, #dce5e7); border-radius: 14px; background: var(--surface, #fff); box-shadow: 0 12px 32px #183c4624; }
.language-options button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.language-options button:hover { background: var(--surface-muted, #f1f6f5); }
.language-options button[aria-pressed="true"] { color: var(--primary, #087f73); background: var(--surface-muted, #e7eef8); }
.language-check { margin-left: auto; visibility: hidden; }
.language-options button[aria-pressed="true"] .language-check { visibility: visible; }
.language-dropdown summary:focus-visible, .language-options button:focus-visible { outline: 2px solid var(--primary, #087f73); outline-offset: 3px; }
.language-control-standalone { z-index: 100; display: flex; justify-content: flex-end; width: 100%; padding: 10px 16px; box-sizing: border-box; }
.language-control small { max-width: 180px; }
/* Login language selection sits beneath the form and opens upward to stay within the page. */
.language-control-login { display: flex; justify-content: flex-end; margin-top: 22px; }
.language-control-login .language-options { top: auto; bottom: calc(100% + 8px); }
/* Translated labels may wrap without widening the toolbar or hiding other actions. */
html:is([lang="es"], [lang="nl"], [lang="de"], [lang="fr"]) .nav-link > span, html:is([lang="es"], [lang="nl"], [lang="de"], [lang="fr"]) .button { overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .site-header .header-inner { flex-wrap: wrap; }
}

/* Loading feedback floats below the selector without widening the header. */
.language-control > [role="status"] { position: absolute; top: calc(100% + 8px); right: 0; z-index: 110; width: 220px; max-width: 80vw; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border, #dce5e7); border-radius: 9px; color: var(--text, #243944); background: var(--surface, #fff); box-shadow: 0 6px 18px #183c4624; }
.language-control > [role="status"][hidden] { display: none; }
.language-control-public-header { margin-left: 8px; }
.fortunex-modern .header .language-control { color: var(--fx-ink, #f2f6f3); font-family: "Inter", sans-serif; }
.fortunex-modern .header .language-control :is(summary, .language-options, [role="status"]) { color: inherit; background: var(--fx-surface, #1b2620); border-color: var(--fx-border, #34463b); }
.fortunex-modern .header .language-options button:is(:hover, [aria-pressed="true"]) { color: var(--fx-accent, #85e9b4); background: #2b3c31; }
@media (max-width: 420px) {
    body.fortunex-modern.fortunex-classic .header .header__inner { gap: 6px; }
    body.fortunex-modern.fortunex-classic .header .header__logo { width: 100px; }
    body.fortunex-modern.fortunex-classic .header .header__btns-mob > a { width: 36px; height: 40px; }
    body.fortunex-modern.fortunex-classic .header .header__burger { flex-basis: 36px; width: 36px; }
    .fortunex-modern .header .language-control-public-header { margin-left: 0; }
    .fortunex-modern .header .language-dropdown summary { width: 36px; min-height: 40px; border-radius: 7px; }
}
