/* ==========================================================================
   官网全站共用：顶栏导航 / 页脚 / 按钮基元
   使用页：首页 · /download/ · /changelog/ · /help/ · /privacy/ · /terms/

   为什么单独一个文件：这六页各有各的骨架（首页是内联 <style>，文档页是 doc.css），
   但顶栏与页脚必须是同一套，否则用户在页面之间跳会看到导航"变脸"。
   这里不定义任何颜色令牌——首页内联块与 doc.css 各有一份同值定义，本文件只消费，
   并且每个 var() 都带兜底值，任一页缺令牌也不会塌成白板。

   命名全部前缀 site-（.site-nav / .site-footer），刻意避开各页已有的
   .nav-header / .nav-links / .nav-link / .footer ——那些是旧头尾的样式，
   不复用就不会互相打架。

   CSP：helmet 默认 script-src 'self' + script-src-attr 'none'，
   这里没有任何内联 on*，交互一律在 js/site-nav.js 里 addEventListener。

   缓存：根路径 /css/*.css 与 /js/*.js 走 nginx 的 location /（Express 静态，
   max-age=0 协商缓存），改了刷新即生效，不依赖 ?v=（仍按仓库惯例带上，便于排查）。
   ========================================================================== */

/* ---------- 顶栏 ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  /* 不支持 color-mix 的老 WebView（含安卓壳）拿不透明底色，绝不会出现"字压在正文上" */
  background: var(--canvas, #faf9f5);
  transition:
    border-color 0.25s ease,
    background 0.25s ease;
  border-bottom: 1px solid transparent;
}
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .site-nav {
    background: color-mix(in srgb, var(--canvas, #faf9f5) 82%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
  }
}
/* 只有滚起来才画分隔线：首屏顶部保持"无边框"的静谧感 */
.site-nav.is-stuck {
  border-bottom-color: var(--hairline, rgba(20, 20, 19, 0.1));
}

.site-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink, #141413);
  flex-shrink: 0;
}
.brand-logo img {
  display: block;
  object-fit: contain;
}
.brand-name {
  font-family: var(--font-display, 'Noto Serif SC', serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink, #141413);
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.site-nav-link {
  color: var(--body, #4a4a46);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s;
}
.site-nav-link:hover {
  color: var(--primary, #cc785c);
}
/* 当前页：JS 打 aria-current，无 JS 时只是少了高亮，不会误导 */
.site-nav-link[aria-current='page'] {
  color: var(--primary, #cc785c);
}

.site-nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border-radius: var(--radius-sm, 6px);
  background: var(--primary, #cc785c);
  color: var(--on-primary, #fff);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}
.site-nav-cta:hover {
  background: var(--primary-hover, #a9583e);
}

.site-nav-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 昼夜切换钮（原在首页内联样式里，这里收成全站唯一一份） */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--hairline, rgba(20, 20, 19, 0.1));
  color: var(--ink, #141413);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}
.theme-toggle-btn:hover {
  background: var(--surface-soft, rgba(245, 240, 232, 0.6));
  border-color: var(--muted, #6e6b65);
}

/* 汉堡钮：默认不显示。只有 JS 接管后（<html class="has-js">）窄屏才折进菜单，
   否则窄屏是"链接换行摊开"——没有 JS 也点得到下载/帮助。
   has-js 由 <head> 里的 doc-theme.js 打上（外链脚本，CSP 允许），
   在 body 解析前就位，所以不会先摊开再"啪"地收起来。 */
.site-nav-burger {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--hairline, rgba(20, 20, 19, 0.1));
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.site-nav-burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink, #141413);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}
.site-nav.is-open .site-nav-burger span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
.site-nav.is-open .site-nav-burger span:nth-child(2) {
  opacity: 0;
}
.site-nav.is-open .site-nav-burger span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

@media (max-width: 820px) {
  /* 无 JS 兜底：链接换行摊在品牌下面，仍然可达 */
  .site-nav-links {
    flex-wrap: wrap;
    gap: 14px 20px;
    justify-content: flex-end;
  }
  .site-nav-inner {
    flex-wrap: wrap;
    padding: 12px 20px;
  }
}

@media (max-width: 820px) {
  html.has-js .site-nav .site-nav-burger {
    display: flex;
  }
  html.has-js .site-nav .site-nav-inner {
    flex-wrap: nowrap;
  }
  /* 折叠态：抽屉挂在顶栏下方，整宽、实底（不能用半透明，会透出正文） */
  html.has-js .site-nav .site-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 20px 16px;
    background: var(--canvas, #faf9f5);
    border-bottom: 1px solid var(--hairline, rgba(20, 20, 19, 0.1));
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  }
  html.has-js .site-nav.is-open .site-nav-links {
    display: flex;
  }
  html.has-js .site-nav .site-nav-link {
    padding: 12px 0;
    border-bottom: 1px solid var(--hairline, rgba(20, 20, 19, 0.1));
    font-size: 15px;
  }
  html.has-js .site-nav .site-nav-link:last-of-type {
    border-bottom: none;
  }
  html.has-js .site-nav .site-nav-cta {
    margin-top: 12px;
    justify-content: center;
    padding: 12px 18px;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 17px;
  }
  .site-nav-inner {
    padding: 12px 16px;
  }
}

/* ---------- 按钮基元（原在首页内联样式，收成全站共用） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm, 6px);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--primary, #cc785c);
  color: var(--on-primary, #fff);
}
.btn-primary:hover {
  background: var(--primary-hover, #a9583e);
}
.btn-outline {
  background: transparent;
  color: var(--ink, #141413);
  border-color: var(--hairline, rgba(20, 20, 19, 0.1));
}
.btn-outline:hover {
  background: var(--surface-soft, rgba(245, 240, 232, 0.6));
  border-color: var(--muted, #6e6b65);
}
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--hairline, rgba(20, 20, 19, 0.1));
  margin-top: 96px;
  padding: 56px 0 40px;
  font-size: 13px;
}
.site-footer-grid {
  display: grid;
  /* 五列：品牌 + 开始 + 了解 + 条款与数据 + 社群（2026-09-22 加社群组） */
  grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
  gap: 40px 32px;
}
.site-footer-brand {
  font-family: var(--font-display, 'Noto Serif SC', serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink, #141413);
  margin-bottom: 12px;
}
.site-footer-blurb {
  color: var(--muted, #6e6b65);
  line-height: 1.75;
  max-width: 300px;
}
.site-footer-title {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted, #6e6b65);
  margin-bottom: 14px;
}
.site-footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-footer-links a {
  color: var(--body, #4a4a46);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer-links a:hover {
  color: var(--primary, #cc785c);
}
/* 当前页在页脚里（隐私政策 / 用户协议这类顶栏没有对应项的页面）：
   由 js/site-nav.js 打 aria-current，这里给同款高亮 */
.site-footer-links a[aria-current='page'] {
  color: var(--primary, #cc785c);
}
/* 社群号（抖音群/微信号）：不是链接——没有可跳的 URL，是「抄去 App 里搜」的号码。
   渐进增强：无 JS 时就是一段可选中的纯文本（user-select:all 一点全选）；
   js/site-nav.js 在场且剪贴板可用时打 .is-copyable，才升级成点按复制。 */
.site-footer-im {
  color: var(--body, #4a4a46);
  user-select: all;
  -webkit-user-select: all;
}
.site-footer-im.is-copyable {
  cursor: pointer;
}
.site-footer-im.is-copyable:hover {
  color: var(--primary, #cc785c);
}
.site-footer-im.is-copyable:focus-visible {
  outline: 2px solid var(--primary, #cc785c);
  outline-offset: 2px;
  border-radius: 3px;
}
.site-footer-im.is-copied {
  color: var(--accent-teal, #5db8a6);
}
.site-footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline, rgba(20, 20, 19, 0.1));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted, #6e6b65);
  font-size: 12.5px;
}
.site-footer-note {
  color: var(--muted, #6e6b65);
}

@media (max-width: 820px) {
  .site-footer {
    margin-top: 72px;
    padding: 44px 0 32px;
  }
  .site-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
  }
  .site-footer-brand-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .site-footer-grid {
    grid-template-columns: 1fr;
  }
  .site-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
