.lang-switcher {
  /* Shrinks to the button inside its wide grid column. */
  display: inline-block;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  /* Lines the flag up with the dt/dd text above; the button is alone in its dd. */
  padding-left: 0;
}

.lang-btn .lang-flag {
  font-size: 1.1rem;
  line-height: 1;
}

.lang-btn .lang-name {
  font-size: 0.85rem;
}

.lang-menu {
  /* Fixed, centred on the modal card by ui/menus.js rather than on the narrow switcher. */
  position: fixed;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 1200;
}

.lang-search {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.9rem;
}

.lang-search:focus {
  outline: none;
  border-color: var(--color-primary);
}

.lang-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.lang-option:hover {
  background: var(--color-surface-2);
}

.lang-option[aria-selected='true'] {
  background: var(--color-surface-2);
  font-weight: 600;
}

.lang-option .lang-flag {
  font-size: 1.2rem;
  line-height: 1;
}

.lang-option .lang-code {
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.hidden {
  display: none !important;
}

/* Read by screen readers, not shown: the page's <h1>. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
