/*
 * The language picker.
 *
 * A two letter chip in the top bar and a list under it, each language written
 * in its own script with the English name beside it, because somebody looking
 * for their language knows what it looks like but may not know what we call
 * it. No flags: a language is not a country.
 */

.lang {
  position: relative;
}

.lang-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.lang-chip:hover {
  color: var(--text);
  border-color: var(--line-2);
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  max-height: min(70vh, 430px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lang-menu[hidden] {
  display: none;
}

.lang-menu button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.lang-menu button:hover {
  background: #16233a;
}

.lang-menu button.is-on {
  background: #16233a;
  box-shadow: inset 2px 0 0 var(--gold);
}

.lang-native {
  font-weight: 600;
}

.lang-english {
  font-size: 11px;
  color: var(--text-faint);
}

/* Right to left languages: the shell mirrors, the numbers do not. */
html[dir='rtl'] .topbar-right {
  margin-left: 0;
  margin-right: auto;
}

html[dir='rtl'] .lang-menu {
  right: auto;
  left: 0;
}

@media (max-width: 900px) {
  .lang-chip {
    padding: 0 8px;
  }
}
