/* =========================================================
   In Terris — Language Switcher
   Styled to match the theme (Lato, navy #173a52, teal #1b6d93,
   griffin red #e5332a, surface #f4f7f9).
   ========================================================= */

.itg-lang-switcher {
  --itg-navy: #173a52;
  --itg-teal: #1b6d93;
  --itg-red: #e5332a;
  --itg-surface: #f4f7f9;
  --itg-parchment: #eaf2f6;
  --itg-border: rgba(23, 58, 82, 0.12);
  position: relative;
  display: inline-block;
  font-family: "Lato", system-ui, -apple-system, sans-serif;
}

/* ---------- Trigger (header) ---------- */
/* Matches theme nav links (.itg-nav a): 15px / 700 / #46555f,
   hover teal — so the switcher reads as part of the menu. */
.itg-lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  padding: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: inherit;
  color: #46555f;
  text-decoration: none;
  transition: color 0.15s ease;
  cursor: pointer;
}

.itg-lang-switcher__trigger:hover {
  color: var(--itg-teal);
}

.itg-lang-switcher__trigger:focus,
.itg-lang-switcher__trigger:active,
.itg-lang-switcher__trigger:focus-visible {
  border: none;
  outline: none;
  box-shadow: none;
}

.itg-lang-switcher__trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
  pointer-events: none;
  opacity: 0.85;
}

.itg-lang-switcher__trigger[aria-expanded="true"]::after {
  transform: translateY(1px) rotate(-135deg);
}

/* ---------- Menu (header) ---------- */
.itg-lang-switcher__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 104px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--itg-border);
  border-radius: 14px;
  box-shadow: 0 14px 32px -10px rgba(23, 58, 82, 0.32),
    0 2px 6px rgba(23, 58, 82, 0.08);
  z-index: 9999;
}

/* little arrow pointing to the trigger */
.itg-lang-switcher__menu::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 20px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1px solid var(--itg-border);
  border-top: 1px solid var(--itg-border);
  transform: rotate(45deg);
}

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

.itg-lang-switcher__menu:not([hidden]) {
  animation: itg-menu-in 0.16s ease-out;
}

@keyframes itg-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Options ---------- */
.itg-lang-switcher__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--itg-navy);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* trailing indicator dot (transparent unless active) */
.itg-lang-switcher__option::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
  transition: background-color 0.15s ease;
}

.itg-lang-switcher__option:hover,
.itg-lang-switcher__option:focus-visible {
  background: var(--itg-surface);
  color: var(--itg-teal);
  outline: none;
}

.itg-lang-switcher__option.is-active {
  color: var(--itg-red);
  font-weight: 700;
  background: var(--itg-parchment);
}

.itg-lang-switcher__option.is-active::after {
  background: var(--itg-red);
}

/* Domain mode: options are links. site-custom-css sets
   a { color: inherit !important; text-decoration: none !important }, so the
   option colours need !important here as well. */
a.itg-lang-switcher__option {
  box-sizing: border-box;
  color: var(--itg-navy) !important;
  text-decoration: none !important;
}

a.itg-lang-switcher__option:hover,
a.itg-lang-switcher__option:focus-visible {
  color: var(--itg-teal) !important;
}

a.itg-lang-switcher__option.is-active {
  color: var(--itg-red) !important;
}

/* =========================================================
   Footer variant — pill trigger on dark background
   ========================================================= */
.itg-lang-switcher--footer .itg-lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 150px;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 10px 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.itg-lang-switcher--footer .itg-lang-switcher__trigger:hover,
.itg-lang-switcher--footer .itg-lang-switcher__trigger:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
}

.itg-lang-switcher--footer .itg-lang-switcher__trigger::after {
  border-color: #fff;
  opacity: 0.9;
}

.itg-lang-switcher--footer .itg-lang-switcher__menu {
  top: auto;
  bottom: calc(100% + 10px);
  right: auto;
  left: 0;
  min-width: 180px;
}

/* footer menu arrow points downward toward the pill */
.itg-lang-switcher--footer .itg-lang-switcher__menu::before {
  top: auto;
  bottom: -5px;
  left: 24px;
  right: auto;
  border-left: none;
  border-top: none;
  border-right: 1px solid var(--itg-border);
  border-bottom: 1px solid var(--itg-border);
}

.itg-lang-switcher--footer .itg-lang-switcher__menu:not([hidden]) {
  animation: itg-menu-in-up 0.16s ease-out;
}

@keyframes itg-menu-in-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   Mobile — switcher injected into the open nav overlay
   ========================================================= */
.itg-mobile-lang-wrap {
  display: none;
}

@media (max-width: 600px) {
  .itg-lang-switcher--desktop {
    display: none !important;
  }

  .wp-block-navigation__responsive-container.is-menu-open .itg-mobile-lang-wrap {
    display: flex;
    justify-content: flex-start;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid rgba(23, 58, 82, 0.12);
  }

  .wp-block-navigation__responsive-container.is-menu-open
    .itg-mobile-lang-wrap
    .itg-lang-switcher__trigger {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--itg-navy);
  }

  .wp-block-navigation__responsive-container.is-menu-open
    .itg-mobile-lang-wrap
    .itg-lang-switcher__menu {
    right: auto;
    left: 0;
  }
}
