/* Selettore lingua (functions/i18n.php → cosmo_language_switcher). Colori dalla palette del sito. */

.cosmo-lang-switcher .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cosmo-lang-switcher__flag {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

/* ---------- Dropdown (header desktop) ---------- */
.cosmo-lang-switcher.is--dropdown {
  position: relative;
  margin-right: 8px;
}
.cosmo-lang-switcher__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid rgba(var(--white-rgb, 241, 251, 232), .18);
  border-radius: 12px;
  color: var(--white);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.cosmo-lang-switcher__toggle:hover,
.cosmo-lang-switcher__toggle[aria-expanded="true"] {
  border-color: var(--accent);
}
.cosmo-lang-switcher__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cosmo-lang-switcher__caret {
  transition: transform .2s ease;
}
.cosmo-lang-switcher__toggle[aria-expanded="true"] .cosmo-lang-switcher__caret {
  transform: rotate(180deg);
}

.cosmo-lang-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 100%;
  margin: 0;
  padding: 6px;
  list-style: none;
  background-color: var(--black);
  border: 1px solid rgba(var(--white-rgb, 241, 251, 232), .18);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.cosmo-lang-switcher__menu[hidden] {
  display: none;
}
.cosmo-lang-switcher__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--white);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.cosmo-lang-switcher__option:hover,
.cosmo-lang-switcher__option:focus-visible {
  background-color: var(--accent-opacity-10);
  color: var(--accent);
  outline: none;
}
.cosmo-lang-switcher__option.is--current {
  color: var(--accent);
}
.cosmo-lang-switcher__option.is--no-translation {
  opacity: .6;
}

/* Sotto i 991px compare il menu hamburger, che contiene già il selettore esteso. */
@media screen and (max-width: 991px) {
  .cosmo-lang-switcher.is--dropdown {
    display: none;
  }
}

/* ---------- Lista estesa (menu mobile): lingue in colonna sopra i social ---------- */
.cosmo-lang-switcher.is--mobile {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  align-content: center;
  justify-content: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 32px;
  padding: 0;
}
.cosmo-lang-switcher__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(var(--white-rgb, 241, 251, 232), .18);
  border-radius: 12px;
  color: var(--white);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.cosmo-lang-switcher__item:hover {
  border-color: rgba(var(--white-rgb, 241, 251, 232), .5);
}
.cosmo-lang-switcher__item.is--current {
  border-color: var(--accent);
  color: var(--accent);
}
.cosmo-lang-switcher__item.is--no-translation {
  opacity: .6;
}

/* Il menu mobile ora contiene anche le lingue: permetti lo scroll sugli schermi bassi. */
@media screen and (max-width: 991px) {
  .menu-adaptation {
    overflow-y: auto;
  }
  .container.is--menu-open {
    height: auto;
    min-height: 100vh;
  }
}
