/* 语言切换：蓝色导航上的低调文本胶囊 */
.header-lang {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.header-lang:hover,
.header-lang:focus-visible {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.header-lang:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* 固定导航下的锚点定位，避免标题被 64px 的 header 盖住 */
main > section[id] {
  scroll-margin-top: 72px;
}

main > section#hero {
  scroll-margin-top: 0;
}

footer[id] {
  scroll-margin-top: 72px;
}

/* 桌面导航从 1272px 开始；768–1271 用移动端菜单，避免导航挤压和页面横向滚动 */
.header-brand-desktop,
.header-nav-desktop {
  display: none;
}

.header-brand-mobile,
.header-menu-mobile {
  display: flex;
}

@media (min-width: 768px) and (max-width: 1271.98px) {
  .header-menu-panel {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }

  .header-menu-panel.open {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
  }
}

@media (min-width: 1272px) {
  header nav {
    padding-inline: clamp(16px, 2.5vw, 32px);
  }

  .header-brand-desktop,
  .header-brand-desktop > *,
  .header-nav-desktop > a,
  .header-nav-desktop > div,
  .header-nav-desktop > div > button {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .header-brand-mobile,
  .header-menu-mobile,
  .header-menu-panel {
    display: none;
  }

  .header-brand-desktop,
  .header-nav-desktop {
    display: flex;
  }
}

/* 1272–1535 是最挤的一段：收紧导航间距，保证中文 7 项 + 语言切换不换行 */
@media (min-width: 1272px) and (max-width: 1535.98px) {
  .header-nav-desktop.header-nav-desktop > :not(:last-child) {
    margin-inline-end: 0.875rem;
  }

  .header-brand-desktop .text-xs {
    font-size: 11px;
  }
}

/* 1536+ 恢复宽间距，但比 32px 略紧，给品牌和导航留出呼吸位 */
@media (min-width: 1536px) {
  .header-nav-desktop.header-nav-desktop > :not(:last-child) {
    margin-inline-end: 1.25rem;
  }
}

/* 移动端平台滑动提示：放到轨道上方，避免压住卡片 */
@media (max-width: 767.98px) {
  .swipe-hint {
    top: -28px;
    right: 0;
    transform: none;
  }
}

/* 移动端菜单展开后与蓝色 Hero 分开 */
@media (max-width: 1271.98px) {
  .header-menu-panel.open {
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.5);
  }
}

/* 移动端平台卡片等高：英文描述换行时不再一高一低 */
@media (max-width: 767.98px) {
  .platforms-grid > .snap-start > div {
    height: 100%;
  }
}

/* 移动端新闻列表标题：允许换行，不再单行截断 */
@media (max-width: 767.98px) {
  main .space-y-8 h2 a {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}
