/* 内嵌高棉字体（子集，只含页面用到的字符，约 24KB） */
@font-face {
  font-family: "KhmerSans";
  src: url("../../fonts/khmer-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* 按字符集兜底：任何界面语言下出现的柬埔寨文字都用内嵌字体，避免手机/电脑缺字体变方块 */
@font-face {
  font-family: "KhmerFallback";
  src: url("../../fonts/khmer-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+1780-17FF, U+19E0-19FF, U+200B-200D;
}
@font-face {
  font-family: "KhmerSans";
  src: url("../../fonts/khmer-semibold.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
 * 附加样式：高棉语字体 / 二维码图片 / 加载遮罩
 * ============================================================ */

/* 高棉语字体回退（系统没有会依次往下找，不影响排版） */
html[lang="km"] body {
  font-family: "KhmerSans", "Noto Sans Khmer", "Khmer OS Battambang", "Khmer OS", "Kantumruy Pro", var(--font);
  line-height: 1.95;
}
html[lang="km"] .hero h1,
html[lang="km"] .section-title { line-height: 1.6; }

/* 二维码改成静态图片（省掉生成脚本） */
#payQr img {
  display: block;
  background: #fff;
  border-radius: 10px;
  padding: 6px;
  width: 96px;
  height: 96px;
}

/* ---------- 功能按钮加载遮罩 ---------- */
.load-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 8, 26, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}
.load-gate.show { opacity: 1; visibility: visible; }

.load-gate-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 40px;
  border-radius: 16px;
  background: rgba(11, 16, 48, 0.72);
  border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.load-gate-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--accent);
  border-left-color: var(--accent-cyan);
  animation: gate-spin 0.9s linear infinite;
  will-change: transform;
  transform-origin: 50% 50%;
}

@keyframes gate-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 加载指示属于必要动效：系统开了「减少动态效果」也必须照转，否则用户以为卡死 */
@media (prefers-reduced-motion: reduce) {
  .load-gate .load-gate-spinner {
    animation-name: gate-spin !important;
    animation-duration: 1.4s !important;
    animation-timing-function: linear !important;
    animation-iteration-count: infinite !important;
  }
}

.load-gate-text {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: 0.2px;
  text-align: center;
}

/* ---------- 小屏头部：语言按钮过长时收窄，避免撑出横向滚动 ---------- */
@media (max-width: 480px) {
  .site-nav-actions .lang-switch { min-width: 0; flex-shrink: 1; }
  .site-nav-actions .lang-switch .lang-btn {
    padding-left: 9px;
    padding-right: 7px;
    gap: 4px;
    max-width: 100%;
  }
  .site-nav-actions .lang-switch .lang-globe { display: none; }
  .site-nav-actions .lang-switch .lang-cur {
    display: block;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- 小屏头部收紧（越南语按钮文案较长时也不撑破） ---------- */
@media (max-width: 480px) {
  .site-nav-inner { gap: 8px; }
  .site-nav-actions { gap: 6px; min-width: 0; flex-shrink: 1; }
  .site-nav-actions .login-reg-btn {
    padding: 0 10px;
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .site-nav-actions .lang-switch { flex-shrink: 1; min-width: 0; }
  .site-nav-actions .lang-switch .lang-btn { padding: 0 7px; font-size: 12.5px; }
  .site-nav-actions .lang-switch .lang-cur { max-width: 58px; }
  .site-nav-actions .hamburger { flex-shrink: 0; }
  .site-logo span { font-size: 15px; }
  .site-logo .logo-mark { width: 22px; height: 22px; }
}

/* ---------- 小屏语言按钮：显示语言代码，避免文案被截断 ---------- */
.site-nav-actions .lang-short { display: none; }
@media (max-width: 480px) {
  .site-nav-actions .lang-switch .lang-cur { display: none; }
  .site-nav-actions .lang-switch .lang-short {
    display: inline-block;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.4px;
  }
  .site-nav-actions .lang-switch .lang-btn { padding: 0 9px; }
}
@media (max-width: 380px) {
  .site-nav-inner { padding-left: 10px; padding-right: 10px; }
  .site-nav-actions { gap: 5px; }
  .site-nav-actions .login-reg-btn { padding: 0 8px; font-size: 12px; }
  .site-logo span { font-size: 14px; }
  .site-logo .logo-mark { width: 20px; height: 20px; }
}
