/* Globe language picker for signed-out visitors (LangSwitcher.js).
   Globe, code and select are all server-rendered; the real <select>
   sits invisibly over the face from the first paint, so taps open the
   native picker and nothing flashes while the script loads. */

lang-switcher {
  display: inline-block;
  color: inherit;
}

lang-switcher form {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
}

lang-switcher-face {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  min-width: 2.5rem;
  min-height: 2.5rem; /* keeps a comfortable tap target while looking small */
  padding-inline: 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  opacity: 0.8;
  transition:
    background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
}

/* Globe icon loaded via CSS mask — automatically adapts to currentColor */
lang-switcher-face::before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: none;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3a14 14 0 0 1 0 18a14 14 0 0 1 0-18z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3a14 14 0 0 1 0 18a14 14 0 0 1 0-18z'/%3E%3C/svg%3E") no-repeat center / contain;
}

lang-switcher select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  outline: none; /* Removes browser default focus rect */
  font-size: 16px; /* Prevents iOS auto-zoom on click */
}

/* Soft hover */
lang-switcher:hover lang-switcher-face {
  opacity: 1;
  background-color: color-mix(in srgb, currentColor 6%, transparent);
}

/* Focus: same soft background as hover */
lang-switcher:focus-within lang-switcher-face {
  opacity: 1;
  background-color: color-mix(in srgb, currentColor 6%, transparent);
}

lang-switcher[aria-busy="true"] lang-switcher-face {
  opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
  lang-switcher-face {
    transition: none;
  }
}