/* Keep the search control compact while retaining its accessible label. */
header nav .nav-right .nav-search {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  flex: 0 0 44px;
}
header nav .nav-right .nav-search .label { display: none; }
header nav .nav-right .nav-search .mag {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  font-size: 0;
  color: #222a33;
  background: currentColor;
  border-radius: 0;
  transform: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='14.5' cy='9.5' r='6.5'/%3E%3Cpath d='M10 14 3 21'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='14.5' cy='9.5' r='6.5'/%3E%3Cpath d='M10 14 3 21'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
header nav .nav-right .nav-search .mag::before,
header nav .nav-right .nav-search .mag::after {
  content: none;
}

/* The flag identifies the language; the chevron matches the main menu. */
header nav .nav-right .wglang > summary {
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 12px;
}
header nav .nav-right .wglang > summary > .language-current-code { display: none; }
header nav .nav-right .wglang > summary > .language-chevron {
  display: block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin: 0;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font-size: 0;
  transform: translateY(-2px) rotate(45deg);
}

/* Main navigation only: dropdown items and other page tabs keep their own styles. */
header nav .pill > a,
header nav .pill > .nav-item > .nav-link {
  position: relative;
  background: transparent;
  color: var(--muted-strong);
}

header nav .pill > a::after,
header nav .pill > .nav-item > .nav-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(.75);
  transform-origin: center;
  transition: opacity .2s ease, transform .2s ease;
}

header nav .pill > .nav-item > .nav-link::after { right: 32px; }
header nav .pill.pill > a:hover,
header nav .pill.pill > .nav-item > .nav-link:hover,
header nav .pill.pill > a[aria-current],
header nav .pill.pill > .nav-item > .nav-link[aria-current] {
  background: transparent;
  color: var(--text);
}
header nav .pill.pill > a[aria-current],
header nav .pill.pill > .nav-item > .nav-link[aria-current] {
  font-weight: 700;
}
header nav .pill > a:hover::after,
header nav .pill > a:focus-visible::after,
header nav .pill > .nav-item > .nav-link:hover::after,
header nav .pill > .nav-item > .nav-link:focus-visible::after {
  opacity: .7;
  transform: scaleX(1);
}

header nav .pill .nav-link-caret {
  display: inline-block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font-size: 0;
  transform: translateY(-2px) rotate(45deg);
}

@media (max-width: 900px) {
  header nav .pill > a::after,
  header nav .pill > .nav-item > .nav-link::after { display: none; }
  header nav .pill.pill > a:hover,
  header nav .pill.pill > a:focus-visible,
  header nav .pill.pill > .nav-item > .nav-link:hover,
  header nav .pill.pill > .nav-item > .nav-link:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  header nav .pill > a::after,
  header nav .pill > .nav-item > .nav-link::after { transition: none; }
}
