/* MATIS LABS – Sprachwahl (Premium, abgestimmt auf nav-premium.css) */
#main-nav .ml-lang-switcher {
    margin-left: auto;
}

@media (min-width: 769px) {
    ul#main-nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 30px;
    }
}

ul#main-nav .ml-lang-nav-slot {
    margin-left: auto;
    list-style: none;
}

.ml-lang-switcher {
    position: relative;
    flex-shrink: 0;
    z-index: 3100;
}

.ml-lang-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-height: 40px;
    min-width: 44px;
    padding: 0 12px 0 10px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 2px 8px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition:
        border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.ml-lang-trigger:hover,
.ml-lang-switcher.open .ml-lang-trigger {
    border-color: rgba(212, 175, 55, 0.65);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 4px 18px rgba(212, 175, 55, 0.2),
        0 2px 8px rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 252, 245, 0.95) 100%);
}

.ml-lang-trigger:focus {
    outline: none;
}

.ml-lang-trigger:focus-visible {
    outline: 2px solid var(--gold-primary, #d4af37);
    outline-offset: 3px;
}

.ml-lang-trigger svg:first-of-type {
    width: 26px;
    height: 20px;
    display: block;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.ml-lang-code {
    display: none;
    font-family: var(--code-font, "Space Mono", ui-monospace, monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted, #64748b);
    line-height: 1;
}

@media (min-width: 1025px) {
    .ml-lang-code {
        display: inline-block;
    }
}

.ml-lang-trigger .ml-lang-chevron {
    width: 10px;
    height: 10px;
    margin-left: 2px;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
    stroke: var(--text-muted, #64748b);
    opacity: 0.75;
}

.ml-lang-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 176px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.75) inset,
        0 28px 56px -16px rgba(15, 23, 42, 0.14),
        0 12px 24px -10px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition:
        opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.ml-lang-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #c9a227, #f8e6b8, #c9a227);
    pointer-events: none;
    z-index: 1;
}

.ml-lang-switcher.open .ml-lang-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ml-lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    cursor: pointer;
    text-align: left;
    position: relative;
    z-index: 2;
    transition:
        background 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        border-left-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.ml-lang-option:hover {
    background: rgba(15, 23, 42, 0.04);
    border-left-color: var(--gold-primary, #d4af37);
}

.ml-lang-option:focus-visible {
    outline: 2px solid var(--gold-primary, #d4af37);
    outline-offset: 2px;
}

.ml-lang-option[aria-current="true"] {
    background: rgba(212, 175, 55, 0.1);
    border-left-color: var(--gold-primary, #d4af37);
    color: var(--gold-primary, #d4af37);
}

.ml-lang-option svg {
    width: 26px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ml-lang-switcher.ml-lang--fixed {
    position: fixed;
    top: 16px;
    right: 16px;
}

/* Mobile: Sprachblock als eigene Sektion im Drawer */
@media (max-width: 1024px) {
    #main-nav .ml-lang-switcher {
        width: 100%;
        max-width: 100%;
        margin-top: 1.25rem;
        padding: 14px 16px 16px;
        box-sizing: border-box;
        background: rgba(15, 23, 42, 0.03);
        border: 1px solid rgba(212, 175, 55, 0.22);
        border-radius: 14px;
        box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    }

    #main-nav .ml-lang-switcher::before {
        content: "Sprache / Language";
        display: block;
        font-size: 0.62rem;
        font-weight: 700;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: var(--text-muted, #64748b);
        margin-bottom: 10px;
        font-family: var(--code-font, "Space Mono", monospace);
    }

    #main-nav .ml-lang-trigger {
        width: 100%;
        justify-content: flex-start;
        border-radius: 12px;
    }

    #main-nav .ml-lang-code {
        display: inline-block;
    }

    #main-nav .ml-lang-panel {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 10px;
        display: none;
        border: 1px dashed rgba(148, 163, 184, 0.5);
        box-shadow: none;
        background: rgba(255, 255, 255, 0.85);
    }

    #main-nav.active .ml-lang-switcher.open .ml-lang-panel,
    #main-nav .ml-lang-switcher.open .ml-lang-panel {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ml-lang-trigger,
    .ml-lang-panel,
    .ml-lang-option {
        transition-duration: 0.01ms !important;
    }
}
