/* ========================================================================
   GongBan AI · shared public-site controls
   Language selector + English CTA overflow safeguards.
   Kept separate from page CSS so legacy case pages receive the same control.
   ======================================================================== */

.lang-switch{
  position:relative;
  z-index:3;
  display:inline-flex;
  flex:0 0 auto;
  align-items:center;
  color:var(--ink-2,#344054);
  font-family:var(--font-stack,"Inter","PingFang SC","Microsoft YaHei",sans-serif);
  line-height:1;
}
.lang-switch-trigger{
  min-width:92px;
  min-height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:8px 10px;
  border:1px solid var(--line,#DCE4F0);
  border-radius:11px;
  background:rgba(255,255,255,.92);
  box-shadow:0 1px 2px rgba(15,23,42,.04),0 6px 18px rgba(15,23,42,.04);
  color:var(--ink-2,#344054);
  font:inherit;
  font-size:13px;
  cursor:pointer;
  white-space:nowrap;
  transition:border-color .2s,box-shadow .2s,color .2s,background .2s;
}
.lang-switch-trigger:hover,
.lang-switch[data-open] .lang-switch-trigger{
  border-color:rgba(23,92,211,.38);
  background:#fff;
  color:var(--brand-dark,var(--primary,#164C9C));
  box-shadow:0 8px 24px rgba(15,23,42,.09);
}
.lang-switch-trigger:focus-visible{
  outline:3px solid rgba(37,99,235,.25);
  outline-offset:2px;
}
.lang-switch-trigger>i:first-child{font-size:17px;color:var(--brand,#175CD3)}
.lang-switch-trigger b{font-size:13px;font-weight:750;letter-spacing:.01em}
.lang-switch-chevron{font-size:17px;transition:transform .2s cubic-bezier(.22,1,.36,1)}
.lang-switch[data-open] .lang-switch-chevron{transform:rotate(180deg)}

.lang-switch-menu{
  position:absolute;
  top:calc(100% + 10px);
  right:0;
  width:190px;
  margin:0;
  padding:7px;
  list-style:none;
  border:1px solid var(--line,#DCE4F0);
  border-radius:15px;
  background:rgba(255,255,255,.98);
  box-shadow:0 20px 52px rgba(7,23,51,.16),0 4px 12px rgba(7,23,51,.06);
  backdrop-filter:blur(18px) saturate(1.15);
  transform-origin:top right;
  animation:lang-menu-in .18s cubic-bezier(.22,1,.36,1);
}
/* 脚本加载前也先隐藏菜单，避免首屏闪现。若 JavaScript 被禁用，
   聚焦语言按钮即可用 :focus-within 打开含服务端回退链接的菜单。 */
.lang-switch:not([data-open]) .lang-switch-menu{display:none}
.lang-switch:not([data-locale-ready]):hover .lang-switch-menu,
.lang-switch:not([data-locale-ready]):focus-within .lang-switch-menu{display:block}
.lang-switch-menu[hidden]{display:none!important}
.lang-switch-menu::before{
  content:"";
  position:absolute;
  top:-5px;
  right:22px;
  width:9px;
  height:9px;
  border-top:1px solid var(--line,#DCE4F0);
  border-left:1px solid var(--line,#DCE4F0);
  background:#fff;
  transform:rotate(45deg);
}
.lang-switch-option{
  position:relative;
  z-index:1;
  width:100%;
  min-height:42px;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto 18px;
  align-items:center;
  gap:9px;
  padding:9px 10px 9px 12px;
  border-radius:10px;
  color:var(--ink-2,#344054);
  font-size:13px;
  line-height:1.25;
  text-decoration:none;
  transition:background .16s,color .16s;
}
.lang-switch-option:hover,
.lang-switch-option:focus-visible{
  outline:0;
  background:var(--bg-surface,var(--surface,#EEF4FF));
  color:var(--brand-dark,var(--primary,#164C9C));
}
.lang-switch-option b{min-width:0;font-size:14px;font-weight:750}
.lang-switch-option small{color:var(--ink-3,#667085);font-size:10px;font-weight:800;letter-spacing:.08em}
.lang-switch-option i{color:transparent;font-size:17px}
.lang-switch-option.is-current{color:var(--brand-dark,var(--primary,#164C9C))}
.lang-switch-option.is-current i{color:var(--brand,#175CD3)}

/* English labels are often 2–3× the width of their Chinese counterparts.
   Let calls to action wrap inside their own box instead of painting beyond it. */
html[lang="en"] .btn,
html[lang="en"] .en-btn{
  min-width:0;
  max-width:100%;
  height:auto;
  white-space:normal;
  overflow-wrap:anywhere;
  text-align:center;
  line-height:1.35;
}
html[lang="en"] .nav-cta>.btn,
html[lang="en"] .nav-cta>.en-btn{
  max-width:none;
  white-space:nowrap;
}
/* Grid items default to min-width:auto. Long English entity names can therefore
   enlarge the one-column mobile track beyond the viewport even though the grid
   itself is width:100%. Explicitly allow that shared home section to shrink. */
.about-grid>*{min-width:0}
html[lang="en"] .about-grid,
html[lang="en"] .about-grid p,
html[lang="en"] .about-card,
html[lang="en"] .ac-name{
  min-width:0;
  overflow-wrap:anywhere;
}

@keyframes lang-menu-in{
  from{opacity:0;transform:translateY(-5px) scale(.98)}
  to{opacity:1;transform:none}
}

@media (max-width:480px){
  .lang-switch-trigger{min-width:88px;padding-inline:9px}
  .lang-switch-menu{width:184px}
}

@media (prefers-reduced-motion:reduce){
  .lang-switch-menu{animation:none}
  .lang-switch-chevron{transition:none}
}
