/* Menu delle lingue (templates/includes/language-switcher.html.twig), tutti i design.
   Eredita font e colore dell'header; il menu a tendina ha colori propri,
   con varianti per i design scuri o con uno stile molto diverso. */
.lang-switcher {
    position: relative;
    margin-left: .75rem;
    flex: 0 0 auto;
    font-size: .9rem;
    z-index: 60;
}
.lang-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .65rem;
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 35%, transparent);
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    letter-spacing: .03em;
    line-height: 1;
    user-select: none;
    transition: background-color .2s ease, border-color .2s ease;
}
.lang-switcher__toggle::-webkit-details-marker { display: none; }
.lang-switcher__toggle::marker { content: ''; }
.lang-switcher__toggle:hover,
.lang-switcher[open] .lang-switcher__toggle {
    background: color-mix(in srgb, currentColor 10%, transparent);
}
.lang-switcher__toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.lang-switcher__caret { transition: transform .2s ease; }
.lang-switcher[open] .lang-switcher__caret { transform: rotate(180deg); }

.lang-switcher__menu {
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    min-width: 11rem;
    margin: 0;
    padding: .35rem;
    list-style: none;
    background: var(--lang-menu-bg, #fff);
    color: var(--lang-menu-text, #1f2937);
    border: 1px solid var(--lang-menu-border, rgba(15, 23, 42, .1));
    border-radius: var(--lang-menu-radius, 12px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
    animation: lang-switcher-in .18s ease-out;
}
.lang-switcher__menu a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .65rem;
    border-radius: calc(var(--lang-menu-radius, 12px) - 4px);
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.lang-switcher__menu a:hover,
.lang-switcher__menu a:focus-visible { background: var(--lang-menu-hover, rgba(37, 99, 235, .08)); }
.lang-switcher__menu a.is-active { font-weight: 700; }
.lang-switcher__menu a.is-active::after { content: '✓'; margin-left: auto; opacity: .7; }
.lang-switcher__item-code {
    display: inline-block;
    min-width: 1.9rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    opacity: .6;
}

@keyframes lang-switcher-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .lang-switcher__menu { animation: none; }
}

/* Telefono: la nav è un menu a scomparsa, il selettore resta accanto al pulsante */
@media (max-width: 900px) {
    .lang-switcher { margin-left: auto; margin-right: .75rem; order: 2; }
    .header-inner:has(.lang-switcher) .nav-toggle { order: 3; }
    .lang-switcher__toggle { padding: .35rem .55rem; }
}

/* ---------- Varianti dei design ---------- */
.theme-modern .lang-switcher__toggle { border-width: 2px; }
.theme-modern { --lang-menu-radius: 18px; }
.theme-clean { --lang-menu-radius: 6px; --lang-menu-border: rgba(15, 23, 42, .14); }
.theme-clean .lang-switcher__toggle { font-weight: 500; border-radius: 6px; }
.theme-immersive--dark {
    --lang-menu-bg: #15151b;
    --lang-menu-text: #f2f2f5;
    --lang-menu-border: rgba(255, 255, 255, .12);
    --lang-menu-hover: rgba(255, 255, 255, .08);
}
.theme-fresh { --lang-menu-radius: 16px; --lang-menu-hover: rgba(132, 169, 140, .16); }
.theme-brick { --lang-menu-radius: 4px; --lang-menu-border: rgba(0, 0, 0, .25); }
.theme-brick .lang-switcher__toggle { border-radius: 4px; border-width: 2px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.theme-brick--nero {
    --lang-menu-bg: #1b1b1b;
    --lang-menu-text: #f5f5f5;
    --lang-menu-border: rgba(255, 255, 255, .15);
    --lang-menu-hover: rgba(255, 255, 255, .08);
}
.theme-album {
    --lang-menu-bg: #fffaf0;
    --lang-menu-text: #3b2f2a;
    --lang-menu-border: rgba(59, 47, 42, .2);
    --lang-menu-radius: 3px;
    --lang-menu-hover: rgba(196, 73, 54, .08);
}
.theme-album .lang-switcher { color: #FFFDF8; }
.theme-album .lang-switcher__toggle { font-family: 'Courier Prime', ui-monospace, monospace; border-style: dashed; border-radius: 3px; }
.theme-album .lang-switcher__menu { transform: rotate(-1deg); font-family: 'Courier Prime', ui-monospace, monospace; }
