/*
  导航壳：顶栏 + 内容区 + 四 tab 底栏。

  四个 tab 是全站唯一的一级导航（锦鹊AI / 健康课堂 / 商城好物 / 我的）。
  底栏在每一页都是同一份结构，只有 aria-current 的位置不同 ——
  各页自己写一套的表现是改一个字要动四个文件，且总有一页漏改。
*/

/*
  ---------- 没有顶栏 ----------

  全站不做自绘顶栏。载体是微信内置浏览器，它自带一条带标题与返回的导航栏，
  页面里再画一条的表现是屏幕顶部两条栏叠在一起、各写一个标题，
  而下面那条还占掉 40px 首屏高度。返回也交给微信，不自绘返回键。

  页面标题由 <title> 提供 —— 微信导航栏读的就是它，
  所以每页的 title 要写成用户该看到的那句，不是内部页面名。
*/

/* 品牌字标。原先在顶栏里，现在只用于页内头部（锦鹊AI 的墨底头）。 */
.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--ff-serif); font-size: var(--fs-sm); font-weight: 600;
  letter-spacing: 0.08em;
}
.brand-mark {
  width: 1.25rem; height: 1.25rem; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-cinnabar); color: #fff;
  font-family: var(--ff-serif); font-size: var(--fs-cap); font-weight: 600;
  border-radius: var(--r-sm);
}

/* ---------- 内容区 ---------- */

/*
  底栏会盖住内容，留出栏高 + 安全区。不留的表现是最后一张卡片
  永远被底栏压着一半，用户以为列表到底了。
*/
/*
  顶栏取消后，内容区自己给顶部间距。不给的表现是第一行字紧贴微信导航栏下沿，
  看着像被那条栏压住。
*/
.main {
  padding: var(--sp-4) var(--page-x)
           calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--sp-6));
}

/*
  墨底头部要顶到屏幕边（锦鹊AI 与「我的」），所以这两页的 .main 不给上边距，
  由头部自己带内边距 —— 留着上边距的表现是墨底上方露出一条纸色，
  像墨底没铺满。
*/
.main-flush { padding-top: 0; }

/* ---------- 底栏 ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  margin: 0 auto; max-width: var(--shell-max);
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: saturate(1.8) blur(14px);
  -webkit-backdrop-filter: saturate(1.8) blur(14px);
  border-top: 1px solid var(--c-line-soft);
  box-shadow: var(--sh-up);
}

.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  font-size: var(--fs-cap); line-height: 1;
  color: var(--c-ink-faint);
  position: relative;
  transition: color var(--t-fast) var(--ease);
}
.tab .tab-ico { width: 22px; height: 22px; flex: none; }
.tab .tab-t { letter-spacing: 0.02em; font-size: var(--fs-xs); }

/*
  选中态用三重表达：颜色 + 图标填充 + 顶部朱砂短线。
  只靠颜色的表现是色觉障碍用户完全看不出自己在哪个 tab，
  而这是全站唯一的位置指示。
*/
.tab[aria-current='page'] {
  color: var(--c-brand-dark);
  font-weight: 600;
}
.tab[aria-current='page']::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 18px; height: 2px;
  background: var(--c-cinnabar);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}
.tab:active { color: var(--c-brand); }

/* AI tab 单独给一个朱砂点，暗示这里是主功能入口。 */
.tab-dot::after {
  content: '';
  position: absolute; top: 8px; right: calc(50% - 15px);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--c-cinnabar);
  border: 1.5px solid var(--c-surface);
}

/* ---------- 底部固定操作条（二级页用） ---------- */

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  margin: 0 auto; max-width: var(--shell-max);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--page-x);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: var(--c-surface);
  border-top: 1px solid var(--c-line-soft);
  box-shadow: var(--sh-up);
}
.actionbar .grow { flex: 1; min-width: 0; }
