/*
 * footer.css — 统一页脚样式唯一真源；结构真源 = assets/js/footer.js。
 * 分发：node _tools/sync_footer.js（--check 只校验漂移）。禁止直接编辑副本。
 * 站点可能没有 --bg-2 / --border，故在 .footer 上定义 --f-* 并逐级 fallback。
 */

/* ---------- 容器 / 表面 ---------- */
.footer {
  --f-brand: var(--brand, #2B5CFF);
  --f-brand-deep: var(--brand-deep, #1E50E8);
  --f-brand-soft: var(--brand-soft, rgba(43, 92, 255, .12));
  --f-grad: var(--brand-grad, linear-gradient(135deg, #2B5CFF 0%, #00C2FF 100%));
  --f-bg: var(--bg-2, var(--bg-soft, #F0F2F7));
  --f-card: var(--card, #FFFFFF);
  --f-line: var(--border, var(--line, #E3E8F0));
  --f-ink: var(--ink, #0F172A);
  --f-ink-2: var(--ink-2, #334155);
  --f-muted: var(--muted, #64748B);
  --f-shadow: var(--shadow-lg);

  position: relative;
  margin-top: 72px;
  padding: 54px 0 26px;
  background: var(--f-bg);
  border-top: 1px solid var(--f-line);
  color: var(--f-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* 顶部品牌渐变细线 + 极淡光晕（纯装饰） */
.footer::before,
.footer::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.footer::before {
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--f-grad);
  opacity: .92;
}
.footer::after {
  left: 50%; top: 0;
  width: min(720px, 100%); height: 200px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--f-brand-soft) 0%, transparent 68%);
  opacity: .7;
}

/* ---------- 上区：品牌 + 五栏导航 ---------- */
.footer-top {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 40px;
  align-items: start;
}

.footer-brand .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--f-ink);
  text-decoration: none;
}
.footer-brand .brand svg {
  width: 34px; height: 34px;
  padding: 6px;
  border-radius: var(--r-md, 12px);
  background: var(--f-brand-soft);
  color: var(--f-brand);
}
.footer-brand p {
  margin: 14px 0 0;
  max-width: 300px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--f-muted);
}

/* 四栏 → 五栏（新增「开发者」）。品牌列更窄，给导航让出空间。 */
.footer-cols {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
}
/*
 * 栏目标题改为 <span class="footer-col-t">（原 h3 会污染每页的标题大纲，
 * 造成 1→3 / 2→4 跳级）。声明逐条保留原值，保证与改造前逐像素一致：
 * 原 h3 在 summary 内是 display:inline，span 默认也是 inline，故不再额外补 display。
 */
.footer-col .footer-col-t {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--f-ink-2);
}
/*
 * 栏目容器改为 <details class="footer-col" open><summary>…</summary>。
 * 桌面端必须与改造前逐像素一致 —— 所以在这里把 details 的痕迹全部抹掉：
 * · summary 的三角 marker（WebKit / 标准两种写法都要关）
 * · 手型光标（桌面不可折叠，显示手型会误导）
 * 折叠只在 ≤640px 生效（见下方媒体查询与 footer.js 的 syncFooterFold）。
 */
.footer-col > summary {
  list-style: none;
  cursor: default;
  display: block;
  /*
   * 宽屏下栏目标题不是控件，别让它可点。
   * 症状：视觉上它没有三角、cursor 是 default、看起来纯标题，但 <summary> 天生可点 ——
   * 桌面端点一下会把整栏链接折叠起来，且 syncFooterFold 只在 resize 时复位，
   * 于是"点了一下标题，页脚一半没了，且不会自己回来"。
   * 触控门禁把它算成一个 22px 的点击目标正是抓到了这个谎。
   * 窄屏（≤640）的折叠是真功能，在下面的媒体查询里恢复 pointer-events。
   */
  pointer-events: none;
}
.footer-col > summary::-webkit-details-marker { display: none; }
.footer-col > summary > .footer-col-t { display: inline; }
/*
 * display:block → flex。
 * 触控地板抬到 44px 之后（site.css 的 .footer-col a），文字必须垂直居中在
 * 44px 的盒子里；block 会让文字贴着 padding-top 停在盒子上沿，下面空出 10px。
 * 之所以不把 display:flex 写在 site.css 那条规则里：footer.css 排在 site.css 之后，
 * 同特异性下它的 display:block 会把 site.css 的写法压掉 —— 上一版就是这样，
 * site.css 里那条 display:inline-flex; align-items:center 一直是空转的
 * （实测：218×34 的盒子，宽度等于整栏宽，inline-flex 不可能这样）。
 */
.footer-col a {
  display: flex;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--f-muted);
  text-decoration: none;
  transition: color .16s ease, transform .16s ease;
}
.footer-col a:hover { color: var(--f-brand-deep); transform: translateX(3px); }
.footer-col a:focus-visible { outline: 2px solid var(--f-brand); outline-offset: 2px; border-radius: var(--r-sm, 8px); }

/* ---------- 站点生态区（子域一览） ---------- */
.footer-eco {
  position: relative;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--f-line);
}
.footer-eco-t {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--f-ink-2);
}
.footer-eco-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-eco-list li { display: block; }
.footer-eco-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  /*
   * 7px → 13px：这两个行内子项最高 13px×1.4=18.2，
   * 18.2 + 13×2 = 44.2 ≥ 44 触控地板。
   * 为什么用 padding 撑高度而不是 min-height：这条链接用 align-items:baseline
   * 把 13px 的主名和 12px 的域名按基线对齐（视觉上更对），一旦改成 min-height +
   * align-items:center，基线会错开约 1px。padding 方案不动对齐，只加高度。
   */
  padding: 13px 13px;
  border-radius: 999px;
  border: 1px solid var(--f-line);
  background: var(--f-card);
  text-decoration: none;
  transition: border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.footer-eco-list a b {
  font-size: 13px;
  font-weight: 600;
  color: var(--f-ink);
}
.footer-eco-list a span {
  font-size: 12px;
  color: var(--f-muted);
  font-variant-numeric: tabular-nums;
}
.footer-eco-list a:hover {
  border-color: var(--f-brand-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.footer-eco-list a:hover b { color: var(--f-brand-deep); }
.footer-eco-list a:focus-visible { outline: 2px solid var(--f-brand); outline-offset: 2px; }

.footer-eco-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--f-muted);
  max-width: 760px;
}

/* ---------- 社交行（后台「社交媒体管理」驱动） ---------- */
.footer-social {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--f-line);
}
.footer-social[hidden] { display: none; }
.footer-social-h {
  margin-right: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--f-ink-2);
}
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--r-md, 12px);
  color: var(--f-muted);
  background: var(--f-card);
  border: 1px solid var(--f-line);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.social-btn:hover {
  color: var(--f-brand-deep);
  border-color: var(--f-brand-deep);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.social-btn:focus-visible { outline: 2px solid var(--f-brand); outline-offset: 2px; }
.social-btn svg { width: 18px; height: 18px; display: block; }

/* ---------- 底部条 ---------- */
.footer-bottom {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 26px;
  padding: 18px 0 2px;
  border-top: 1px solid var(--f-line);
  font-size: 13px;
  color: var(--f-muted);
}
.footer-bottom a {
  color: var(--f-muted);
  text-decoration: none;
  transition: color .15s ease;
}
.footer-bottom a:hover { color: var(--f-brand-deep); }
.qf-bottom-links { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qf-bottom-links a { white-space: nowrap; }
.qf-dot { opacity: .45; }

/* ---------- 二维码弹窗 ---------- */
.qf-qr-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.qf-qr-card {
  position: relative;
  width: 100%; max-width: 320px;
  padding: 22px;
  border-radius: var(--r-lg, 16px);
  background: var(--f-card);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.qf-qr-title { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: var(--f-ink); }
.qf-qr-img { width: 200px; height: 200px; max-width: 100%; border-radius: var(--r-md, 12px); }
.qf-qr-x { position: absolute; top: 10px; right: 10px; }

/* ---------- 深色主题 ---------- */
[data-theme="dark"] .footer {
  --f-bg: var(--bg-2, #0E1725);
  --f-card: var(--card, #141D2A);
  --f-line: var(--border, #263042);
  --f-ink: var(--ink, #E6EDF6);
  --f-ink-2: #9AA6B8;
  --f-muted: #8B97A8;
  --f-brand: var(--brand, #6C8FFF);
  --f-brand-deep: var(--brand-deep, #9FB5FF);
  --f-brand-soft: rgba(108, 143, 255, .18);
}
[data-theme="dark"] .footer::before { opacity: .8; }
[data-theme="dark"] .footer::after { opacity: .55; }
[data-theme="dark"] .footer-col .footer-col-t,
[data-theme="dark"] .footer-eco-t,
[data-theme="dark"] .footer-social-h { color: #9AA6B8; }
[data-theme="dark"] .social-btn:hover { box-shadow: var(--shadow-md); }

/* ---------- 响应式 ---------- */
@media (max-width: 1279px) {
  /* 五栏在窄屏会挤到每栏不足 90px，先降到三栏 */
  .footer-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 24px; }
}
@media (max-width: 1023px) {
  .footer-top { grid-template-columns: 1fr; gap: 28px; }
  .footer-brand p { max-width: 560px; }
}
@media (max-width: 639px) {
  .footer { padding: 40px 0 22px; margin-top: 56px; }
  .footer-cols { grid-template-columns: 1fr 1fr; gap: 18px 20px; }
  .footer-col .footer-col-t { margin-bottom: 8px; }
  /*
   * min-height:44px / display:flex / align-items:center / padding:0 这几条已上移到
   * 基档（基档现在就是 flex + 44px + 居中），这里再写一遍属于纯重复，已删。
   */
  /*
   * 折叠态：标题整行可点，右侧 ± 号提示可展开/收起（原生 details，无 JS 也能用）。
   * 收起时给一条下边线，视觉上把每个栏目隔成一行 —— 这是移动端页脚的通用形态。
   */
  .footer-col > summary {
    pointer-events: auto;   /* 基档为 none（宽屏标题不是控件），窄屏这里才是真功能 */
    min-height: 44px;       /* 折叠后的标题就是这一栏唯一的点击目标，必须 44 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--f-line);
  }
  .footer-col > summary > .footer-col-t { margin: 0; }
  .footer-col > summary::after {
    content: '+';
    flex: none;
    width: 20px;
    text-align: center;
    font-size: 16px;
    line-height: 1;
    color: var(--f-muted);
  }
  .footer-col[open] > summary::after { content: '\2212'; }
  .footer-col:not([open]) > summary { border-bottom-color: transparent; }
  .footer-eco { margin-top: 26px; padding-top: 18px; }
  /*
   * 原 .footer-eco-list a { padding:9px 13px; min-height:40px } 删除：
   * 基档已用 padding:13px 撑到 44，这一档把 min-height 压到 40 等于"越窄越难点"，
   * 是触控欠账里最反直觉的一条。
   */
  .footer-social { gap: 10px; }
  .social-btn { width: 40px; height: 40px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}
/*
 * 极窄屏不再降成单列。
 * 实测 390px 单列时 5 个栏位依次堆叠，页脚高达 1700px ——
 * （API 站实测：footer-top 1700px，其中 footer-cols 1568px），
 * 用户要滑过整整两屏才到底部信息，是「页脚吃掉整页」的典型。
 * 改回两列：每列约 170px，链接文案短（四字为主）仍可读，高度约减半。
 */
@media (max-width: 479px) {
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
  /*
   * 原来这里有一条 min-height:40px，把 44 的触控地板在最窄的一档
   * 降到 40（叠上 13px 字号实际只渲染 32px）—— 移动端最需要好点的地方反而最难点的。
   * 已删除，只保留字号缩小。
   */
  .footer-col a { font-size: 13px; }
  /* 极窄屏下生态区改为整宽堆叠，避免 host 域名被压到换行 */
  .footer-eco-list a { width: 100%; justify-content: space-between; }
}
@media print {
  .footer-social, .footer::after { display: none !important; }
}
