/* 开杆官网 · 站点级样式（导航 / 页脚 / 联系弹窗）
 *
 * 三个页面（/、/help.html、/changelog.html）共用这一份，取代此前各自内联的导航副本。
 * 主域名由 nginx 以 published_static 为根直接命中本文件；API 域名（含 stage 的 api-test）
 * 靠 FastAPI 的 /site-assets 挂载。引用时带 ?v= 版本号——apex 对 .css 有 7 天缓存。
 *
 * 页面自己的排版仍留在各页内联，这里只放跨页构件。
 */

:root {
  --ink: #ffffff;
  --green: #1d6848;
  --green-lit: #1d6848;
  --gold: #587563;
  --cream: #17221b;
  --muted: #68736c;
  --dim: #8c968f;
  --line: #e5ebe7;
  /* 导航高度：页面里凡是要「贴在导航下面」的 sticky 元素都读它，别各自写死数字 */
  --nav-h: 68px;
}

/* ── 导航 ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: none;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
}
.nav__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.nav__logo { width: 30px; height: 30px; border-radius: 8px; display: block; }
.nav__word { font-size: 18px; font-weight: 800; letter-spacing: 1.5px; color: var(--cream); }

/* 菜单居中：绝对定位居中，左右品牌/留白不影响它 */
.nav__menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav__group { position: relative; }
.nav__trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 15px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.nav__trigger:hover,
.nav__group:hover > .nav__trigger,
.nav__group:focus-within > .nav__trigger { color: var(--cream); background: rgba(29, 104, 72, .06); }
.nav__trigger--current { color: var(--cream); }
/* 下拉指示箭头：纯 CSS，不引图标 */
.nav__caret {
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: .6;
}

.nav__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 168px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .97);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(27, 54, 40, .12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  /* 淡出的 180ms 里 visibility 还没切回 hidden，若不关掉 pointer-events，
     刚收起的面板会继续拦住底下的点击（含下面那条透明桥）。 */
  pointer-events: none;
  /* visibility 不可插值：关闭时延到淡出结束再切，打开时立刻切。
     写成 `visibility .18s` 会让面板在开启的前 180ms 仍然不可见。 */
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
/* 触发器与面板之间有视觉间隙，指针穿过时会离开 .nav__group，:hover 断掉、面板收起
   ——就是「移不进去、一进去就消失」。用一条透明的桥把间隙纳入面板自己的命中区；
   桥随面板一起隐藏，所以不会在收起状态下拦住底下的元素。 */
.nav__panel::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}
/* 无脚本时靠 hover/focus 也能展开，键盘可达 */
.nav__group:hover > .nav__panel,
.nav__group:focus-within > .nav__panel,
.nav__group.is-open > .nav__panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity .18s ease, transform .18s ease, visibility 0s;
}
/* 下拉项只有标题，不带副标题 */
.nav__panel-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--cream);
  white-space: nowrap;
  transition: background-color .18s, color .18s;
}
.nav__panel-link:hover { background: rgba(29, 104, 72, .06); }
.nav__panel-link[aria-current="page"] { color: var(--green-lit); }

@media (max-width: 720px) {
  :root { --nav-h: 58px; }
  .nav__inner { padding: 0 14px; }
  .nav__logo { width: 26px; height: 26px; }
  .nav__word { font-size: 16px; }
  /* 窄屏放不下「居中」，退回品牌右侧顺排，并压缩间距 */
  .nav__menu { position: static; left: auto; transform: none; margin-left: auto; gap: 0; }
  .nav__trigger { font-size: 13.5px; padding: 8px 9px; }
  .nav__panel { left: auto; right: 0; transform: translateY(-4px); min-width: 150px; }
  .nav__group:hover > .nav__panel,
  .nav__group:focus-within > .nav__panel,
  .nav__group.is-open > .nav__panel { transform: translateY(0); }
}

/* ── 联系弹窗（由 site.js 注入，三页共用） ── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(21, 34, 27, .22); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal__card {
  position: relative;
  width: 100%; max-width: 340px;
  border-radius: 20px;
  padding: 30px 26px 26px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(27, 54, 40, .18);
  text-align: center;
}
.modal__title { font-size: 16px; font-weight: 800; }
.modal__hint { margin-top: 8px; font-size: 12.5px; color: var(--dim); line-height: 1.7; }
.modal__mail {
  margin-top: 18px; padding: 12px 14px;
  background: #f4f8f5; border-radius: 10px;
  font-size: 15px; color: var(--green-lit);
  word-break: break-all;
}
.modal__qr { margin-top: 18px; width: 210px; height: 210px; border-radius: 12px; background: #fff; padding: 8px; }
.modal__x {
  position: absolute; top: 10px; right: 12px;
  width: 30px; height: 30px;
  border: none; background: none;
  color: var(--dim); font-size: 22px; line-height: 1;
  cursor: pointer; border-radius: 8px;
}
.modal__x:hover { color: var(--cream); background: rgba(29, 104, 72, .06); }
.modal__copy {
  margin-top: 14px;
  font-size: 13px; font-weight: 700;
  padding: 9px 18px; border-radius: 9px;
  border: none; background: none; color: var(--dim);
  cursor: pointer; font-family: inherit;
}
.modal__copy:hover { color: var(--green-lit); }

/* ── 联系图标（页脚与弹窗共用，一律不加框） ── */
.social { display: flex; gap: 8px; }
.social__btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: none; background: none;
  color: var(--dim);
  cursor: pointer;
  transition: color .2s, transform .2s;
}
.social__btn:hover { color: var(--green-lit); transform: translateY(-2px); }
.social__btn svg { width: 19px; height: 19px; display: block; }
.social--lg { justify-content: center; gap: 20px; margin-top: 22px; }
.social--lg .social__btn { width: 46px; height: 46px; color: var(--muted); }
.social--lg .social__btn svg { width: 26px; height: 26px; }

/* ── 小程序二维码浮窗（产品展示页） ── */
.product-qr {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 35;
  width: 148px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 18px 46px rgba(27, 54, 40, .16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .25s ease;
}
.product-qr.is-collapsed { right: 0; width: 34px; padding: 0; border-radius: 14px 0 0 14px; transform: none; }
.product-qr__toggle {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(29, 104, 72, .08);
  color: var(--dim);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.product-qr__toggle:hover { color: var(--green); background: rgba(29, 104, 72, .14); }
.product-qr.is-collapsed .product-qr__body { display: none; }
.product-qr.is-collapsed .product-qr__toggle { position: static; width: 34px; height: 64px; border-radius: 14px 0 0 14px; background: rgba(255, 255, 255, .96); font-size: 20px; }
.product-qr__body { text-align: center; }
.product-qr__body img { display: block; width: 124px; height: 124px; border-radius: 10px; margin: 0 auto; }
.product-qr__title { display: block; margin-top: 9px; color: var(--cream); font-size: 13px; font-weight: 800; }
.product-qr__hint { display: block; margin-top: 3px; color: var(--dim); font-size: 10px; }
@media (max-width: 760px) {
  .product-qr { right: 12px; bottom: 12px; width: 116px; padding: 8px; border-radius: 14px; }
  .product-qr__body img { width: 100px; height: 100px; border-radius: 8px; }
  .product-qr__title { margin-top: 6px; font-size: 11px; }
  .product-qr__hint { font-size: 9px; }
  .product-qr__toggle { top: 7px; left: 7px; width: 22px; height: 22px; font-size: 16px; }
  .product-qr.is-collapsed { right: 0; width: 30px; padding: 0; }
  .product-qr.is-collapsed .product-qr__toggle { width: 30px; height: 58px; border-radius: 12px 0 0 12px; }
}
