/* 导航栏语言切换：用 details/summary 原生展开，不依赖 JS 也能点开菜单 */
.lang-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  z-index: 50;
  font-family: inherit;
  min-width: 5.5rem;
  min-height: 2.25rem;
  align-items: center;
}

.lang-switch > summary.lang-switch__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px 8px 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  line-height: 1;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  list-style: none;
}

.lang-switch > summary.lang-switch__toggle::-webkit-details-marker {
  display: none;
}

.lang-switch > summary.lang-switch__toggle:hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.42);
}

.lang-switch > summary.lang-switch__toggle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.lang-switch[open] > summary.lang-switch__toggle {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
}

.lang-switch__globe {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0.95;
}

.lang-switch__globe-svg {
  flex-shrink: 0;
  display: block;
}

.lang-switch__code {
  min-width: 1.5em;
  text-align: left;
}

.lang-switch__chev {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  opacity: 0.92;
}

.lang-switch__chev::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #fff;
  transition: transform 0.2s ease;
}

.lang-switch[open] > summary.lang-switch__toggle .lang-switch__chev::before {
  transform: rotate(180deg);
}

.lang-switch > .lang-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.28),
    0 4px 12px rgba(37, 99, 235, 0.35);
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s;
}

.lang-switch[open] > .lang-switch__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-switch__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  margin: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.25;
  transition: background 0.15s ease;
}

.lang-switch__option::before {
  content: "";
  flex-shrink: 0;
  width: 22px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.lang-switch__option[data-lang="en"]::before {
  background-image: url("/images/flags/us.svg");
}

.lang-switch__option[data-lang="es"]::before {
  background-image: url("/images/flags/es.svg");
}

.lang-switch__option:hover,
.lang-switch__option:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.lang-switch__option.is-active {
  background: rgba(255, 255, 255, 0.2);
}

.lang-switch__option.is-active:hover {
  background: rgba(255, 255, 255, 0.24);
}

header,
.nav,
.site-nav,
.mobile-drawer__panel,
.mobile-drawer__lang {
  overflow: visible;
}

@media (max-width: 640px) {
  .lang-switch > summary.lang-switch__toggle {
    padding: 7px 11px 7px 9px;
    font-size: 12px;
    gap: 6px;
  }

  .lang-switch__globe-svg {
    width: 16px;
    height: 16px;
  }

  .lang-switch__option {
    padding: 9px 12px;
    font-size: 13px;
  }

  .lang-switch > .lang-switch__menu {
    min-width: 152px;
    top: calc(100% + 6px);
  }
}
