/* 六智宝库 - 共享页脚样式（所有页面通过 <link> 引入）
   视觉基准：home/antacid.html
   核心符号：pH 三色渐变 #C73E2A → #C89F3D → #1E6B6E */

/* ============ 返回顶部按钮 ============ */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 200;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(199, 62, 42, .3);
  transition: opacity .3s, transform .3s, background .15s;
  font-size: 20px;
  opacity: 0; transform: translateY(16px) scale(.8);
  pointer-events: none;
}
.back-to-top.is-visible {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}
.back-to-top:hover {
  background: #a8301e; transform: translateY(-2px) scale(1.05);
}

/* ============ 页脚主体 ============ */
.site-footer {
  position: relative;
  padding: 1.9rem 1.5rem 1.35rem;
  background: var(--surface);
  animation: footerSlideUp .6s cubic-bezier(.22, .61, .36, 1) both;
  transform-origin: bottom center;
}
@keyframes footerSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 顶部 pH 三色渐变线 —— 呼应互动解读视觉符号 */
.site-footer::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(to right, #C73E2A 0%, #C89F3D 50%, #1E6B6E 100%);
  box-shadow: 0 1px 3px rgba(44, 31, 18, .07);
}

.site-footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; flex-direction: column; gap: .85rem;
  text-align: center;
}

/* ---------- 上排：品牌 + 友链 ---------- */
.site-footer-top {
  display: flex; flex-direction: column;
  gap: 1.5rem; align-items: center;
}
.site-footer-brand {
  display: flex; flex-direction: column;
  gap: .4rem; align-items: center;
}
.site-footer-logo {
  font-family: 'Fraunces', 'Songti SC','Source Han Serif SC','SimSun', serif;
  font-size: 1.4rem; font-weight: 700;
  letter-spacing: -.01em; line-height: 1.1;
  color: var(--fg);
}
.site-footer-tagline {
  font-size: .68rem; font-weight: 500;
  letter-spacing: .18em;
  color: var(--muted); opacity: .85;
}

/* 友链：胶囊标签 */
.site-footer-friends {
  display: flex; flex-wrap: wrap;
  gap: .5rem; align-items: center; justify-content: center;
}
.site-footer-friends-label {
  font-size: .68rem; letter-spacing: .14em;
  color: var(--muted); opacity: .55;
  margin-right: .2rem;
}
.site-footer-friends a {
  font-size: .76rem;
  color: var(--muted);
  text-decoration: none;
  padding: .3rem .72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  transition: color .18s, background .18s, border-color .18s, transform .18s;
}
.site-footer-friends a:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 38%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  transform: translateY(-1px);
}

/* ---------- 下排：版权 + 备案 ---------- */
.site-footer-bottom {
  position: relative;
  padding-top: .85rem;
  display: flex; flex-direction: column;
  gap: .55rem; align-items: center;
}
/* 两侧淡出的分隔线 */
.site-footer-bottom::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(to right, transparent, rgba(44, 31, 18, .14), transparent);
}

.site-footer-copy {
  font-size: 12.5px; color: var(--muted); letter-spacing: .01em;
}
.site-footer-legal {
  display: flex; flex-wrap: wrap;
  gap: .5rem .9rem; align-items: center; justify-content: center;
  font-size: 12.5px; color: var(--muted);
}
.site-footer-legal span { opacity: .85; }
.site-footer-legal a {
  color: var(--muted); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
.site-footer-legal a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* 移动端：友链标签独占一行，避免挤在首个胶囊左侧 */
@media (max-width: 767px) {
  .site-footer-friends-label {
    width: 100%; margin: 0 0 .1rem;
  }
  /* 页脚为居中单列，版权行几乎占满整行，按钮贴底会压住文字尾部，
     故在窄屏把它抬到版权行上方 */
  .back-to-top { bottom: 4.5rem; }
}

/* ============ 桌面端：两行左右分栏 ============ */
@media (min-width: 768px) {
  /* 返回顶部按钮 position:fixed 固定在右下角，滚到页底会压住右对齐的
     友链与备案链接，故容器右侧预留 3.5rem 安全距。
     实测上排（品牌 + 友链）单行仅需 469px，768px 档留白后仍不换行。 */
  .site-footer-inner { text-align: left; padding-right: 3.5rem; }

  .site-footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  /* 品牌名与标语并排一行，压缩纵向高度 */
  .site-footer-brand {
    flex-direction: row;
    align-items: baseline;
    gap: .75rem;
    flex-wrap: wrap;
  }
  .site-footer-logo { line-height: 1; }
  .site-footer-tagline { line-height: 1; }
  .site-footer-friends { justify-content: flex-end; }

  .site-footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  /* 固定定位的返回顶部按钮位于右下角，会压住右侧最后一列内容 */
  .site-footer-legal { justify-content: flex-end; }
}

/* ============ 内容不足一屏时，把页脚推到底部 ============ */
body.has-shared-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* 保持各区块原有的整行宽度，避免 margin:auto 把内容拉成居中 */
body.has-shared-layout > *:not(.back-to-top) { width: 100%; }
body.has-shared-layout .site-footer { margin-top: auto; }
