/* =====================================================================
 * Header / Footer / Page Banner — kffund-aligned
 * =====================================================================*/

/* ========== Header ========== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: #fff;
  transition: .4s;
}
.site-header:hover,
.site-header.down,
body.scrolled .site-header { box-shadow: var(--shadow-1); }
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-logo { display: flex; align-items: center; gap: 10px; }
.site-logo img, .site-logo svg { height: 34px; display: block; }
.site-logo-text {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-1, #1a1a2e);
  letter-spacing: 2px;
  white-space: nowrap;
  line-height: 1;
}

/* 给固定 header 腾出顶部空间 */
body { padding-top: 60px; }

.nav-primary {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-primary > li {
  position: relative;
  list-style: none;
}
.nav-primary > li > a {
  display: block;
  padding: 16.5px 12px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: var(--fw-normal);
  transition: .4s;
}
.nav-primary > li:hover > a,
.nav-primary > li.active > a { color: #fff; background-color: rgba(42, 117, 188, .96); }

.nav-sub {
  display: none;
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  left: auto;
  min-width: 120px;
  background: rgba(42, 117, 188, .96);
  border-radius: 0 0 3px 3px;
  padding: 0;
  margin: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, .2);
}
.nav-primary > li:hover .nav-sub,
.nav-primary > li:focus-within .nav-sub { display: block; }
.nav-sub li { list-style: none; }
.nav-sub a {
  display: block;
  padding: 8px 16px;
  color: #fff;
  white-space: nowrap;
  font-size: 13px;
  text-align: center;
  transition: .4s;
}
.nav-sub a:hover { background: var(--primary-hover); color: #fff; }
.nav-sub a:last-child { border-radius: 0 0 3px 3px; }

/* 登录入口（特殊 item，不走常规 hover 蓝底） */
.nav-primary > li.nav-user { margin-left: 15px; }
.nav-primary > li.nav-user > a,
.nav-primary .login-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 16.5px 12px;
  color: var(--text-2);
  font-size: 14px;
  background: transparent !important;
}
.nav-primary > li.nav-user:hover > a { background: transparent !important; color: var(--primary) !important; }
.nav-primary .login-link .iconfont { color: var(--primary); font-size: 16px; margin-right: 4px; }

/* ========== Lang Switch ========== */
.nav-primary .lang-switch { display: inline-flex; align-items: center; gap: 4px; margin: 0 8px; color: var(--text-3); font-size: 13px; }
.nav-primary .lang-switch .lang-opt { color: var(--text-2); padding: 2px 6px; border-radius: var(--radius-sm); transition: .4s; }
.nav-primary .lang-switch .lang-opt:hover,
.nav-primary .lang-switch .lang-opt.active { color: var(--primary); background: var(--primary-soft); }
.nav-primary .lang-switch .lang-sep { color: var(--text-4); }

/* Responsive breakpoints — align kffund sizing + Bootstrap 4 grid */
@media (min-width: 576px) {
  .site-header .container { height: 64px; }
  body { padding-top: 64px; }
}
@media (min-width: 768px) {
  .site-header .container { height: 66px; }
  body { padding-top: 66px; }
}
@media (min-width: 992px) {
  .site-header .container { height: 70px; }
  .site-logo img { height: 38px; }
  .site-logo-text { font-size: 20px; }
  body { padding-top: 70px; }
}
@media (min-width: 1200px) {
  .site-header .container { height: 76px; }
  body { padding-top: 76px; }
}
@media (min-width: 1366px) {
  .site-header .container { height: 86px; }
  .site-logo img { height: 44px; }
  .site-logo-text { font-size: var(--fs-xl); letter-spacing: 3px; }
  body { padding-top: 86px; }
  .nav-primary > li > a { padding: 26.5px 18px; font-size: 15px; }
  .nav-primary .lang-switch { font-size: 14px; }
  .nav-primary .login-link { padding: 26.5px 14px; font-size: 15px; }
  .nav-sub a { padding: 13px 18px; font-size: 15px; }
}
@media (min-width: 1680px) {
  .nav-primary > li > a { padding: 26.5px 22px; font-size: 16px; }
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0 12px;
  font-size: 24px;
  color: var(--text-1);
  cursor: pointer;
}
@media (max-width: 991.98px) {
  .nav-toggle { display: block; }
  .nav-primary {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 15px;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-1);
  }
  .nav-primary.open { display: flex; align-items: stretch; }
  .nav-primary > li { width: 100%; }
  .nav-primary > li > a { padding: 12px 15px; color: var(--text-1); font-size: 16px; }
  .nav-primary > li:hover > a,
  .nav-primary > li.open > a { color: var(--primary); background: var(--border); }
  .nav-sub {
    position: static;
    box-shadow: none;
    background: transparent;
    padding: 10px 0 5px;
    border-top: 0;
  }
  .nav-sub a { color: var(--text-2); text-align: left; padding: 10px 30px; font-size: 15px; }
  .nav-sub a:hover { color: var(--primary); background: transparent; }
  .nav-primary > li:hover .nav-sub { display: none; }
  .nav-primary > li.open .nav-sub { display: block; }
}

/* ========== Page Banner（对齐 kffund .topimg-focus 纯图，1920x440 无覆盖蒙层） ========== */
.page-banner {
  position: relative;
  height: 200px;
  overflow: hidden;
  color: #fff;
  background: #333;
}
.page-banner-gradient { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }
.page-banner-bg { position: absolute; inset: 0; z-index: 0; }
.page-banner-bg picture, .page-banner-bg img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* h1 留在 DOM 供 SEO + 屏幕阅读器，但不遮挡图本身（kffund 原站 banner 无文字） */
.page-banner .container {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 20px;
}
.page-banner h1 {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.page-banner p {
  /* 副标题也隐藏到 sr-only，保持视觉与 kffund 原站一致 */
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (min-width: 768px) { .page-banner { height: 320px; } }
@media (min-width: 1366px) { .page-banner { height: 440px; } }

/* ========== Footer（对齐 kffund .ft-wrapper，深色 bg-img 图） ========== */
.site-footer {
  background-color: var(--bg-dark);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  color: rgba(255,255,255,.8);
  padding: 60px 0 30px;
  margin-top: 0;
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(65, 65, 65, .7);
  z-index: 0;
}
.site-footer > .container { position: relative; z-index: 1; }
.site-footer a { color: rgba(255,255,255,.75); transition: .4s; }
.site-footer a:hover { color: #fff; }

/* Top row: complete 6-menu dl + right-side contact + qrcode */
.footer-top {
  display: flex;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-menu {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: var(--space-lg) var(--space-xl);
}
.footer-menu-col { margin: 0; }
.footer-menu-col dt {
  font-size: var(--fs-md);
  color: #fff;
  font-weight: var(--fw-normal);
  margin-bottom: var(--space-md);
  position: relative;
  padding-bottom: 10px;
}
.footer-menu-col dt::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 24px; height: 2px; background: var(--primary);
}
.footer-menu-col dt a { color: #fff; }
.footer-menu-col dd {
  margin: 0 0 10px 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.footer-menu-col dd a { color: rgba(255,255,255,.72); }
.footer-menu-col dd a:hover { color: #fff; }

.footer-contact {
  flex: 0 0 auto;
  text-align: right;
  font-size: var(--fs-sm);
  line-height: 1.9;
  color: rgba(255,255,255,.8);
}
.footer-contact .ft-line { margin-bottom: 4px; }
.footer-qrcode {
  display: inline-block;
  margin-top: var(--space-md);
  text-align: center;
}
.footer-qrcode img {
  width: 120px; height: 120px;
  background: #fff; padding: 4px;
  border-radius: var(--radius);
  display: block;
}
.footer-qrcode .ft-qrcode-label {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
}

/* Bottom row: copyright left, risk button right */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.6);
  line-height: 1.8;
}
.footer-bottom .ft-copyright { flex: 1 1 auto; }
.footer-bottom .ft-copyright a { color: rgba(255,255,255,.75); margin-left: 14px; }
.footer-bottom .ft-copyright a:hover { color: #fff; }
.footer-bottom .ft-police { margin-left: 14px; }
.footer-bottom .btn-risk {
  display: inline-block;
  background: var(--primary);
  color: #fff !important;
  padding: 8px 24px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  transition: background .2s;
}
.footer-bottom .btn-risk:hover { background: var(--primary-hover, #00449e); }

@media (max-width: 991.98px) {
  .footer-top { flex-direction: column; }
  .footer-contact { text-align: left; }
  .footer-menu { gap: var(--space-md) var(--space-lg); }
}
@media (max-width: 575.98px) {
  .footer-menu { flex-direction: column; gap: var(--space-md); }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* Risk modal（"重要提示"点击后打开） */
.risk-modal {
  position: fixed; inset: 0; z-index: 1050;
  display: none;
}
.risk-modal.is-open { display: block; }
.risk-modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.risk-modal-dialog {
  position: relative;
  max-width: 720px;
  max-height: 80vh;
  margin: 6vh auto;
  background: #fff;
  border-radius: var(--radius);
  padding: var(--space-xl);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.risk-modal-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: 0; font-size: 28px;
  color: #999; cursor: pointer; line-height: 1;
}
.risk-modal-close:hover { color: #333; }
.risk-modal-title {
  text-align: center;
  color: var(--primary);
  font-size: 22px;
  font-weight: var(--fw-normal);
  margin: 0 0 var(--space-md);
}
.risk-modal-body { color: #333; line-height: 1.8; font-size: var(--fs-md); }
.risk-modal-body p { margin: 0 0 10px; }

/* =====================================================================
 * Floating sidebar (right-edge) — kffund-aligned quick-contact panel.
 * Visible on all viewports; bottom offset adapts to iOS safe area.
 * =====================================================================*/
.floating-sidebar {
  position: fixed;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (min-width: 768px) {
  .floating-sidebar { right: 14px; bottom: 100px; }
}
.floating-sidebar .fs-item {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #fff;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
  text-decoration: none;
  box-shadow: var(--shadow-1);
}
.floating-sidebar .fs-item:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.floating-sidebar .fs-item .iconfont {
  font-size: 18px;
  line-height: 1;
}
.floating-sidebar .fs-item .fs-label {
  font-size: 11px;
  line-height: 1;
  letter-spacing: .02em;
  white-space: nowrap;
}
/* 4-character labels (e.g. "app下载", "在线客服") need a tighter face to fit 48px. */
.floating-sidebar .fs-item .fs-label-sm {
  font-size: 10px;
  letter-spacing: 0;
  transform: scale(.95);
  transform-origin: center;
}

/* ---- Popovers (phone / wechat) ---- */
.floating-sidebar .fs-popover {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 14px 18px;
  color: var(--text-1);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.floating-sidebar .fs-item:hover .fs-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(-4px);
}
.floating-sidebar .fs-popover::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-left-color: #fff;
}
.floating-sidebar .fs-popover-title {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: 4px;
}
.floating-sidebar .fs-popover-body {
  font-size: var(--fs-lg);
  color: var(--primary);
  font-weight: var(--fw-bold);
  line-height: 1.3;
  white-space: nowrap;
}
.floating-sidebar .fs-popover-sub {
  font-size: var(--fs-md);
  margin-top: 4px;
  color: var(--text-2);
  font-weight: var(--fw-normal);
}
.floating-sidebar .fs-popover-wechat {
  min-width: 160px;
  padding: 10px;
  text-align: center;
}
.floating-sidebar .fs-popover-wechat img {
  width: 140px;
  height: 140px;
  display: block;
  margin: 0 auto;
  background: #fff;
}
.floating-sidebar .fs-popover-tip {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ---- App download chooser (QR codes + download buttons) ---- */
.floating-sidebar .fs-popover-app {
  min-width: 224px;
  padding: 12px;
  text-align: center;
}
.floating-sidebar .fs-popover-app .fs-popover-title {
  margin-bottom: 10px;
}
.floating-sidebar .fs-app-qrs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.floating-sidebar .fs-app-qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.floating-sidebar .fs-app-qr {
  width: 88px;
  height: 88px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.floating-sidebar .fs-app-qr img {
  width: 100%;
  height: 100%;
  display: block;
}
.floating-sidebar .fs-app-qr-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.floating-sidebar .fs-app-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 6px;
  background: var(--bg-2, #f5f7fa);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.floating-sidebar .fs-app-link:first-of-type { margin-top: 0; }
.floating-sidebar .fs-app-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.floating-sidebar .fs-app-link .iconfont {
  font-size: 14px;
  line-height: 1;
}

/* Click-toggle: mobile lacks hover so app.js adds .is-open on tap.
   Same opened state on desktop when user clicks instead of hovering. */
.floating-sidebar .fs-item-app.is-open .fs-popover-app {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(-4px);
}
/* Narrow screens: center the chooser to avoid bumping into the
   left edge and to dodge any iOS hover-stickiness side-effects. */
@media (max-width: 480px) {
  .floating-sidebar .fs-item-app.is-open .fs-popover-app {
    position: fixed;
    left: 50%;
    right: auto;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .floating-sidebar .fs-item-app.is-open .fs-popover-app::after {
    display: none;
  }
}

/* ========== Cookie Notice ========== */
.cookie-notice {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 14px 16px;
  text-align: center;
  z-index: 10000;
  font-size: var(--fs-sm);
}
.cookie-notice button {
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 6px 20px;
  margin-left: var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: .4s;
}
.cookie-notice button:hover { background: var(--primary-hover); }
