/* Language picker: header button flag, the dialog, and the note on translated legal pages. */

.lang-flag {
  display: block;
  flex-shrink: 0;
  width: 28px;
  height: 21px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
}

.lang-flag--round {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

a.switcher-lang__btn {
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.switcher-lang__box span {
  font-weight: 700;
  letter-spacing: .02em;
}

/* Dialog. Hidden by default; :target keeps it usable without JavaScript. */
.lang-picker {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.lang-picker.is-open,
.lang-picker:target {
  display: flex;
}

.lang-picker-js .lang-picker:target:not(.is-open) {
  display: none;
}

.lang-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 20, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lang-picker__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  max-height: min(900px, calc(100dvh - 48px));
  padding: 24px 24px 20px;
  border: 1px solid rgba(61, 220, 132, .28);
  border-radius: 24px;
  background: #0f2234;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
  color: #fff;
}

.lang-picker__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.lang-picker__title {
  margin: 0;
  font-family: "RobotoCondensed-SemiBold", "Inter_18pt-Bold", sans-serif;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
}

/* The title is a fixed trilingual string set left-to-right (dir="ltr" in the
   markup) so its separators keep their order; on RTL pages it still hugs the right. */
[dir="rtl"] .lang-picker__title {
  text-align: right;
}

.lang-picker__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -6px -6px 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s, color .2s;
}

.lang-picker__close:hover,
.lang-picker__close:focus-visible {
  background: rgba(255, 255, 255, .08);
  color: #3ddc84;
  outline: none;
}

.lang-picker__search {
  width: 100%;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 2px solid rgba(61, 220, 132, .45);
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.lang-picker__search::placeholder {
  color: rgba(255, 255, 255, .5);
}

.lang-picker__search:focus {
  border-color: #3ddc84;
  box-shadow: 0 0 0 4px rgba(61, 220, 132, .18);
}

.lang-picker__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 0;
  padding: 0 4px 4px 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.lang-picker__item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 16px;
  color: #fff;
  text-decoration: none;
  transition: background-color .2s, color .2s;
}

.lang-picker__item:hover,
.lang-picker__item:focus-visible {
  background: rgba(255, 255, 255, .07);
  outline: none;
}

.lang-picker__item:focus-visible {
  box-shadow: 0 0 0 2px #3ddc84;
}

.lang-picker__item.is-current {
  background: rgba(61, 220, 132, .12);
}

.lang-picker__names {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

/* Each name hugs the start edge of the item, so a right-to-left native name
   (العربية) sits under the English name instead of drifting to the far side. */
.lang-picker__name,
.lang-picker__native {
  align-self: flex-start;
  max-width: 100%;
}

.lang-picker__name {
  font-family: "Inter_18pt-Bold", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.lang-picker__native {
  color: rgba(255, 255, 255, .62);
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.lang-picker__check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #3ddc84;
  visibility: hidden;
}

.lang-picker__item.is-current .lang-picker__check {
  visibility: visible;
}

.lang-picker__empty {
  margin: 8px 0 4px;
  color: rgba(255, 255, 255, .6);
  text-align: center;
}

html.lang-picker-open,
html.lang-picker-open body {
  overflow: hidden;
}

@media (max-width: 900px) {
  .lang-picker__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .lang-picker {
    align-items: flex-end;
    padding: 0;
  }

  .lang-picker__panel {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }

  .lang-picker__title {
    font-size: 20px;
  }

  .lang-picker__search {
    padding: 12px 14px;
    font-size: 16px;
  }

  .lang-picker__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .lang-picker__item {
    min-height: 56px;
  }
}

/* Note above machine-assisted translations of legal pages. */
.translation-note {
  margin: 0 0 24px;
  padding: 14px 18px;
  border: 1px solid rgba(61, 220, 132, .3);
  border-radius: 16px;
  background: rgba(61, 220, 132, .07);
  color: rgba(255, 255, 255, .85);
  font-size: 14px;
  line-height: 1.5;
}

.translation-note a {
  color: #3ddc84;
  text-decoration: underline;
}

/* Scripts whose glyphs need more room than the Latin fonts of the site. */
html:lang(hi) body,
html:lang(bn) body,
html:lang(am) body {
  line-height: 1.45;
}

html:lang(ur) body {
  line-height: 1.5;
}

/* The chat launcher and its invite bubble sit above every layer of the page; hide
   them while the language dialog is open so they do not cover its last rows. */
html.lang-picker-open #support-chat-root {
  visibility: hidden;
}
