.language-switcher {
  position: relative;
  margin-left: 0.25rem;
  font-family: var(--font-sans, sans-serif);
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
}

.language-trigger {
  display: inline-grid;
  grid-template-columns: 18px auto 6px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  vertical-align: middle;
  gap: 0.45rem;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: inherit;
  background: rgba(19, 15, 12, 0.16);
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}

.language-icon {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  align-self: center;
  flex: 0 0 auto;
  opacity: 0.9;
}

.language-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.language-trigger::after {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  flex: 0 0 auto;
  align-self: center;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 180ms ease;
}

.language-switcher.is-open .language-trigger::after {
  transform: translateY(2px) rotate(225deg);
}

.language-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 0.7rem);
  right: 0;
  display: grid;
  width: 210px;
  padding: 0.45rem;
  border: 1px solid rgba(116, 86, 53, 0.2);
  border-radius: 4px;
  background: rgba(250, 247, 240, 0.98);
  box-shadow: 0 18px 45px rgba(20, 14, 10, 0.2);
  color: #241c16;
  backdrop-filter: blur(16px);
}

.language-menu[hidden] { display: none; }

.language-option {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0.65rem 0.75rem !important;
  border-radius: 2px;
  color: #2e241c !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.02em !important;
  text-decoration: none;
}

.language-option:hover,
.language-option:focus-visible {
  background: #eee5d8;
}

.language-option[aria-current="page"] {
  background: #e5d3b8;
  font-weight: 600;
}

.language-recommended {
  margin-left: 0.6rem;
  color: #88643d;
  font-size: 0.68rem;
  font-weight: 400;
}

@media (max-width: 760px) {
  .language-switcher { margin-left: auto; }
  .language-trigger { height: 36px; min-height: 36px; padding: 0 11px; font-size: 13px; }
  .language-menu { position: fixed; top: 68px; right: 14px; left: 14px; width: auto; }
}

.language-label { display: block; line-height: 20px; padding: 0; margin: 0; }

/* Align the navigation row itself, including the language control. */
header .links,
header .navlinks {
  align-items: center;
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: .06em;
}
header .links > a,
header .navlinks > a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  line-height: 20px;
  white-space: nowrap;
}
@media (min-width: 761px) {
  header .links, header .navlinks { gap: 26px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  header .links, header .navlinks { gap: 18px; font-size: 13px; letter-spacing: .03em; }
  .language-trigger { font-size: 13px; }
}
@media (max-width: 760px) {
  header .site-menu-open > a { min-height: 40px; }
}
