/* Language switcher — works on both the editions header (.ed-top) and the
 * older .site-header nav. Colours come from CSS system colours (Canvas /
 * CanvasText), which follow the `color-scheme` each stylesheet already sets
 * on :root, so no coupling to either design's custom properties. */

.ed-lang {
  position: relative;
  flex: 0 0 auto;
  font-size: 13.5px;
  line-height: 1.4;
}

.ed-lang > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-color: color-mix(in srgb, currentColor 28%, transparent);
  color: inherit;
  opacity: 0.85;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, background 0.15s;
}
.ed-lang > summary::-webkit-details-marker { display: none; }
.ed-lang > summary:hover { opacity: 1; background: rgba(128, 128, 128, 0.14); }
.ed-lang > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.ed-lang[open] > summary { opacity: 1; }

.ed-lang-globe { width: 15px; height: 15px; flex: none; display: block; }
.ed-lang-code { font-weight: 600; letter-spacing: 0.02em; }

.ed-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  min-width: 172px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 14px;
  background: Canvas;
  color: CanvasText;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-color: color-mix(in srgb, CanvasText 20%, transparent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.ed-lang-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.ed-lang-menu a:hover,
.ed-lang-menu a:focus-visible {
  background: rgba(128, 128, 128, 0.18);
  background: color-mix(in srgb, CanvasText 12%, transparent);
}
.ed-lang-menu a[aria-current="true"] { font-weight: 650; }
.ed-lang-menu a[aria-current="true"]::after {
  content: "\2713";
  float: right;
  margin-left: 14px;
  opacity: 0.75;
}

/* Fallback mount when a page has no recognisable header. */
.ed-lang-fixed {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 140;
}
.ed-lang-fixed .ed-lang-menu { top: auto; bottom: calc(100% + 8px); }

/* Editions header: sits next to the CTA pill / hamburger. */
.ed-top-actions .ed-lang { margin-right: 4px; }

/* Older header: sits before the theme toggle. */
.site-header .ed-lang { margin-left: 6px; }

@media (max-width: 980px) {
  .ed-top-actions .ed-lang > summary { height: 36px; padding: 0 9px; }
  .ed-lang-menu { min-width: 160px; }
}
