/* Seletor de idiomas BR | EN | ES */

.lang-switcher {
  --lang-accent: #f0771b;
  --lang-accent-hover: #d9620c;
  --lang-ink: #2b2620;
  --lang-border: rgba(43, 38, 32, 0.16);
  --lang-surface: #fff;
  --lang-focus: #1d4ed8;

  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--lang-border);
  border-radius: 999px;
  background: var(--lang-surface);
  padding: 3px;
  font-family: inherit;
  line-height: 1;
}

.lang-switcher__btn {
  display: inline-flex;
  width: 40px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.lang-switcher__flag {
  display: block;
  width: 26px;
  height: 18px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  object-fit: cover;
  opacity: 0.55;
  filter: saturate(0.7);
  transition:
    opacity 180ms ease,
    filter 180ms ease,
    transform 180ms ease;
}

.lang-switcher__btn:hover {
  background: rgba(240, 119, 27, 0.1);
}

.lang-switcher__btn:hover .lang-switcher__flag {
  opacity: 1;
  filter: none;
}

.lang-switcher__btn[aria-pressed="true"] {
  background: rgba(240, 119, 27, 0.14);
  box-shadow: inset 0 0 0 2px var(--lang-accent);
  cursor: default;
}

.lang-switcher__btn[aria-pressed="true"] .lang-switcher__flag {
  opacity: 1;
  filter: none;
}

.lang-switcher__btn:focus-visible {
  outline: 2px solid var(--lang-focus);
  outline-offset: 2px;
}

.lang-switcher__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

/* Header: à direita do botão de inscrição no desktop. */
.site-nav .lang-switcher {
  margin-inline-start: 6px;
}

/* Celular: aparece no topo do menu aberto. */
@media (max-width: 767px) {
  .site-nav .lang-switcher {
    order: -1;
    align-self: flex-start;
    margin: 0 0 8px;
  }

  .lang-switcher__btn {
    width: 52px;
    height: 42px;
  }

  .lang-switcher__flag {
    width: 30px;
    height: 21px;
  }
}

/* Evita mostrar o português por um instante antes de traduzir. */
html.i18n-pending body {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .lang-switcher__btn,
  .lang-switcher__flag {
    transition: none;
  }
}
