/**
 * =============================================================================
 * 校园法律AI辅导员 — 全局样式表 (style.css)
 * =============================================================================
 *
 * 【文件作用】
 *   定义首页的视觉层次：背景、导航、首屏 Hero、三大板块卡片、页脚。
 *
 * 【设计思路（便于您改主题）】
 *   1. 用 CSS 变量 :root 集中管理颜色、圆角、阴影，改一处即可全局换肤。
 *   2. 首屏用「深色渐变 + 可选背景图 + 半透明遮罩」，显得稳重、偏「法律/专业」气质。
 *   3. 三大板块用三张卡片，每张有轻微不同的强调色，便于用户区分记忆。
 *
 * 【如何换背景图】
 *   将图片放入 assets/images/（默认名 bg001.png），或改 :root 里 --hero-bg-photo 的 url()。
 *   图片建议：横图、偏暗或中性色调，避免文字看不清（遮罩会再压一层）。
 */

/* ---------------------------------------------------------------------------
   一、CSS 变量（设计令牌 / Design Tokens）
   所有「会重复用到的值」放在这里，后续改版只改这里即可。
--------------------------------------------------------------------------- */
:root {
  /* ---------- 浅色主背景（与校徽、校园场景协调） ---------- */
  --color-bg-deep: #ffffff;
  --color-bg-mid: #f4f6fa;
  --color-surface: rgba(255, 255, 255, 0.94);
  --color-surface-solid: #f8f9fc;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-text: #1a1f2e;
  /** 蒙版/浅色底上的主标题与简介：近黑，提高对比 */
  --color-text-ink: #0a0a0d;
  /** 深色摄影/插画底图上的首屏主文案（与黑字区分） */
  --hero-text-title: #ffffff;
  --hero-text-sub: rgba(236, 245, 255, 0.94);
  --hero-text-eyebrow: rgba(180, 235, 255, 0.95);
  --color-text-muted: rgba(26, 31, 46, 0.62);
  --color-accent: #b8922e;
  --color-accent-soft: rgba(184, 146, 46, 0.12);
  --header-bg: rgba(255, 255, 255, 0.94);

  /* 三大板块各自的强调色（仅用于边框、光晕、小标签） */
  --color-consult: #5b8cff;
  --color-tools: #3ecf9a;
  --color-camp: #e07c5c;

  /* ---------- 排版 ---------- */
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* ---------- 布局与圆角 ---------- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --header-h: 72px;
  /** 主内容区最大宽度：居中窄栏（导航、三大板块、子模块轨道等共用） */
  --max-content: 1120px;
  /** 页面左右内边距（窄屏下与 max-content 一起留白） */
  --page-gutter: clamp(16px, 4vw, 48px);

  /* ---------- 动效时长 ---------- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /**
   * 【首屏背景图】图片放在 assets/images/，当前默认 bg001.png（可改文件名并同步 url）
   * --hero-bg-fallback：无图或加载失败时底层渐变仍可见。
   */
  --hero-bg-photo: url("../assets/images/bg001.png");
  --hero-bg-fallback: linear-gradient(165deg, #f0f4fa 0%, #e8eef6 45%, #f6f8fc 100%);
  /**
   * 第二屏（核心板块）背景：默认与首屏同图（bg001.png）；若要另一张图，改 --hub-bg-photo。
   */
  --hub-bg-photo: url("../assets/images/bg001.png");
  --hub-bg-fallback: linear-gradient(175deg, #eef3f9 0%, #e4ecf4 40%, #f2f6fb 100%);
}

/* ---------------------------------------------------------------------------
   二、基础重置与页面级样式
   统一盒模型、去掉默认边距，避免各浏览器差异。
--------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* 平滑滚动：锚点跳转时有过渡，体验更顺 */
  scroll-behavior: smooth;
  width: 100%;
  min-height: 100%;
  /* 根字号约 20px（相对浏览器默认 16px），全站 rem 统一放大一档 */
  font-size: 125%;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg-deep);
  /* 防止横向滚动条因某元素溢出而出现 */
  overflow-x: hidden;
}

/* 首页：整页翻屏，禁止整页纵向滚动（由脚本 + 第二屏内部滚动承担） */
body.home-page {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* 链接默认去掉下划线，在组件里单独控制 */
a {
  color: inherit;
  text-decoration: none;
}

/* 图片最大宽度限制，防止撑破布局（后续子页用图时有用） */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------------------------------------------------------------------------
   三、全页装饰背景层 (.page-bg)
   仅铺页面底色，不叠加渐变蒙版（蒙版已全局关闭）。
--------------------------------------------------------------------------- */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--color-bg-deep);
}

/* ---------------------------------------------------------------------------
   四、顶部导航 (.site-header)
   position: sticky 吸顶，用户向下滚动时导航始终可见，方便跳板块。
--------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  /* 毛玻璃效果：backdrop-filter 在旧浏览器可能弱一些，仍可读 */
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.header-inner {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* 品牌区：左侧 logo 方块 + 文字 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: 0.06em;
}

/* 校徽：将 bupt_logo.png / bupt_logo.jpg 置于 assets/images/（无边框，贴合 Logo） */
.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 右上：胶囊按钮组 — 默认弱态，悬停与 .is-active 高亮底 */
.nav-main--pills {
  padding: 6px;
  gap: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(244, 246, 250, 0.98) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  background: transparent;
  transition:
    color 0.22s var(--ease-out),
    background 0.22s var(--ease-out),
    box-shadow 0.22s var(--ease-out),
    border-color 0.22s var(--ease-out),
    transform 0.18s var(--ease-out);
}

/* 悬停 / 键盘聚焦：中性浅灰底，与各板块主题色解耦，避免与背景或滚动高亮错位时「颜色不对」 */
.nav-pill:hover:not(.is-active),
.nav-pill:focus-visible:not(.is-active) {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.06);
}

.nav-pill:active:not(.is-active) {
  background: rgba(0, 0, 0, 0.1);
}

/* 按下：常规按钮反馈（略缩小），不叠加彩色 */
.nav-pill:active {
  transform: scale(0.98);
}

/* 当前锚点板块：统一中性选中态 */
.nav-pill.is-active {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.nav-pill.is-active:hover,
.nav-pill.is-active:focus-visible {
  background: rgba(0, 0, 0, 0.1);
  color: var(--color-text);
}

.nav-pill.is-active:active {
  transform: scale(0.98);
  background: rgba(0, 0, 0, 0.12);
}

.nav-pill:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.22);
  outline-offset: 2px;
}

/* 小屏：导航换行或缩小字号 */
@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 12px var(--page-gutter);
    height: auto;
  }

  .site-header {
    height: auto;
  }

  .nav-main {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .nav-main--pills {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    padding: 6px;
  }

  .nav-pill {
    padding: 8px 12px;
    font-size: 0.8125rem;
  }
}

/* ---------------------------------------------------------------------------
   首页全屏翻页：两屏轨道，transform 切换（脚本设置 --home-slide-index）
--------------------------------------------------------------------------- */
.home-viewport {
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
  position: relative;
}

.home-slides-track {
  --home-slide-index: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(var(--home-slide-index) * -50%));
  transition: transform 0.68s cubic-bezier(0.22, 1, 0.32, 1);
  will-change: transform;
}

.home-slide {
  flex: 0 0 auto;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  position: relative;
  display: flex;
  flex-direction: column;
}

.home-slide--stack {
  overflow: hidden;
}

.home-slide-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  overflow-anchor: none;
}

/* 锚点 #hub：零高度顶对齐，避免浏览器对整块导览+页脚做 scrollIntoView */
.home-hub-anchor {
  height: 0;
  overflow: hidden;
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  body.home-page {
    overflow: auto;
    height: auto;
  }

  .home-viewport {
    height: auto;
    overflow: visible;
  }

  .home-slides-track {
    transform: none !important;
  }

  .home-slide {
    height: auto;
    min-height: 0;
  }

  .home-slide-scroll {
    overflow: visible;
  }
}

/* ---------------------------------------------------------------------------
   五、首屏 Hero (.hero)
   min-height: 100vh 减去导航高度，让首屏几乎占满一屏，大气。
--------------------------------------------------------------------------- */
.hero {
  position: relative;
  /* 先写 vh 兼容旧浏览器，再写 dvh：新浏览器用动态视口，首屏更贴满屏幕 */
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px var(--page-gutter) 80px;
  text-align: center;
}

.home-slide--hero .hero {
  flex: 1;
  width: 100%;
  min-height: 0;
}

/**
 * .hero-media：背景层（照片 + 无图兜底）；不叠全屏蒙版。
 */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--hero-bg-photo), var(--hero-bg-fallback);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: clamp(12px, 2.5vmin, 28px) clamp(16px, 3vw, 32px);
  border-radius: var(--radius-lg);
}

/*
 * 首页正中：深色磨砂玻璃（与参考图一致）— 蓝灰半透明底 + blur，白字层次，底图隐约透出。
 */
body.home-page .hero-content {
  max-width: min(720px, 100%);
  padding: clamp(28px, 4.5vmin, 44px) clamp(22px, 4vw, 40px);
  background: rgba(18, 32, 52, 0.34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow:
    0 18px 42px rgba(0, 8, 24, 0.24),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.home-page .hero-content .hero-eyebrow {
  font-family: var(--font-sans);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.32em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

body.home-page .hero-content .hero-title {
  color: #ffffff;
  text-shadow:
    0 2px 14px rgba(0, 0, 0, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.65);
}

body.home-page .hero-content .hero-subtitle {
  color: rgba(245, 248, 255, 0.94);
  font-weight: 400;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* 眉题：与深色科技风底图协调的浅青字 */
.hero-eyebrow {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--hero-text-eyebrow);
  font-weight: 600;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.85);
}

.hero-title {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.12em;
  color: var(--hero-text-title);
  text-shadow:
    0 0 48px rgba(0, 0, 0, 0.88),
    0 2px 6px rgba(0, 0, 0, 0.9),
    0 4px 28px rgba(0, 0, 0, 0.65),
    0 0 2px rgba(0, 0, 0, 0.95);
}

.hero-subtitle {
  margin: 0 0 36px;
  font-size: 1.0625rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--hero-text-sub);
  line-height: 1.75;
  text-shadow:
    0 0 22px rgba(0, 0, 0, 0.72),
    0 1px 4px rgba(0, 0, 0, 0.88);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* 按钮基类 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s;
}

.btn-primary {
  background: linear-gradient(145deg, var(--color-accent) 0%, #9a7824 100%);
  color: #fff;
  box-shadow: 0 8px 28px rgba(184, 146, 46, 0.28);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(184, 146, 46, 0.35);
}

.btn-ghost {
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.7);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}

/* 首屏底部「向下滚动」提示动画 */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 28px;
  height: 44px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  transition: border-color 0.25s;
}

.scroll-hint:hover {
  border-color: rgba(201, 169, 98, 0.5);
}

.scroll-hint-line {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--color-accent);
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.4;
    transform: translateY(10px);
  }
}

/*
 * 首页专用：顶栏不再占位（原「白条」来自 sticky+白底），改为 fixed 叠在整屏背景上；
 * 主内容区与每屏高度改为 100vh，首屏/导览的 hero-media、hub-media 铺满含顶栏区域。
 * 可选：body 再加 home-page--no-top-nav 可完全隐藏顶栏。
 */
body.home-page .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

body.home-page.home-page--no-top-nav .site-header {
  display: none !important;
}

/*
 * 左上角品牌：仅校徽下白圆形底；「智邮法界」小标题浅色 + 阴影，压在背景上不抢眼。
 */
body.home-page .site-header .brand,
body.home-page .hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  text-decoration: none;
  border-radius: 0;
  transition: opacity 0.2s var(--ease-out);
}

body.home-page .site-header .brand:hover,
body.home-page .hero-brand:hover {
  opacity: 0.95;
}

body.home-page .site-header .brand:focus-visible,
body.home-page .hero-brand:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 4px;
  border-radius: 4px;
}

body.home-page .site-header .brand-text,
body.home-page .hero-brand .brand-text {
  color: rgba(236, 242, 252, 0.96);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 18px rgba(0, 0, 0, 0.55),
    0 2px 10px rgba(0, 0, 0, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.9);
}

body.home-page .site-header .brand-logo,
body.home-page .hero-brand .brand-logo {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  padding: 6px;
  box-sizing: content-box;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.45);
  filter: none;
}

body.home-page .hero-brand {
  display: none;
}

body.home-page.home-page--no-top-nav .hero-brand {
  display: inline-flex;
  position: absolute;
  top: clamp(18px, 4.5vmin, 32px);
  left: var(--page-gutter);
  z-index: 2;
}

body.home-page .nav-main--pills {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

body.home-page .nav-pill {
  color: rgba(232, 238, 248, 0.9);
}

body.home-page .nav-pill:hover:not(.is-active),
body.home-page .nav-pill:focus-visible:not(.is-active) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

body.home-page .nav-pill:active:not(.is-active) {
  background: rgba(255, 255, 255, 0.22);
}

body.home-page .nav-pill.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.home-page .nav-pill.is-active:hover,
body.home-page .nav-pill.is-active:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

body.home-page .nav-pill:focus-visible {
  outline-color: rgba(255, 255, 255, 0.45);
}

body.home-page .home-viewport {
  height: 100vh;
  height: 100dvh;
}

body.home-page .home-slide {
  height: 100vh;
  min-height: 100dvh;
}

body.home-page .hero {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--header-h);
  box-sizing: border-box;
}

body.home-page.home-page--no-top-nav .hero {
  padding-top: 36px;
}

body.home-page .btn-ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: #f4f7fb;
  background: rgba(6, 10, 18, 0.35);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

body.home-page .btn-ghost:hover {
  background: rgba(6, 10, 18, 0.5);
  border-color: rgba(255, 255, 255, 0.45);
}

/* 深色磨砂卡片上的次按钮：浅灰实心胶囊 + 深字（参考图右侧按钮） */
body.home-page .hero-content .btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #1a2332;
  background: linear-gradient(180deg, rgba(236, 240, 246, 0.98) 0%, rgba(218, 224, 234, 0.96) 100%);
  text-shadow: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

body.home-page .hero-content .btn-ghost:hover {
  background: linear-gradient(180deg, #f0f4f8 0%, #e2e8f0 100%);
  border-color: rgba(255, 255, 255, 0.5);
  color: #0f1728;
}

body.home-page .scroll-hint {
  border-color: rgba(255, 255, 255, 0.32);
}

body.home-page .scroll-hint:hover {
  border-color: rgba(201, 169, 98, 0.65);
}

body.home-page.home-page--no-top-nav .hub {
  padding-top: clamp(16px, 3vmin, 28px);
}

/* ---------------------------------------------------------------------------
   六、三大板块区域 (.hub) — 第二屏：独立背景 + 近一屏高度，与首屏形成「两页」
--------------------------------------------------------------------------- */
.hub {
  position: relative;
  padding: 80px var(--page-gutter) 100px;
  overflow: hidden;
}

/* 首页第二屏：整屏高（顶栏 fixed 叠在 hub-media 上）；上内边距避免卡片被顶栏遮挡 */
.home-page .hub {
  flex: 1 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  padding: calc(var(--header-h) + clamp(12px, 2.5vmin, 20px)) var(--page-gutter) clamp(20px, 3vmin, 32px);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
}

.home-page .hub-inner {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

/*
 * 宽屏导览：外框高度固定；gap 不变；分界线上移 = 上排变矮（吃掉按钮下留白）、下排工具坊变高。
 */
.home-page .hub-layout {
  flex: 0 1 auto;
  width: 100%;
  max-width: min(1100px, 100%);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 外框高度：尽量一屏内露出全部子按钮；按钮尺寸见 .home-page .hub-subbtn */
  --hub-panel-fixed-h: min(820px, max(512px, 64vh));
  height: var(--hub-panel-fixed-h);
  min-height: var(--hub-panel-fixed-h);
  max-height: var(--hub-panel-fixed-h);
  gap: clamp(14px, 2vmin, 20px);
  /* 上排足够高；下排法律工具坊略多占一行，避免最下按钮被裁切 */
  grid-template-rows: minmax(0, 1.18fr) minmax(0, 1.14fr);
  align-items: stretch;
  justify-items: stretch;
  padding: clamp(16px, 2.5vmin, 26px);
  box-sizing: border-box;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 16px 48px rgba(18, 42, 72, 0.08);
  overflow: hidden;
}

.home-page .hub-row--top {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vmin, 20px);
  align-items: stretch;
  justify-items: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.home-page .hub-card--wide {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* 标题与暖心话之间略收紧；副标题与按钮区仍保留间距 */
  gap: 4px;
  overflow: hidden;
  justify-self: stretch;
}

.home-page .hub-card {
  /* 略收紧内边距，配合略大的标题/按钮，不撑大外层 .hub-layout 面板 */
  padding: clamp(9px, 1.25vmin, 14px) clamp(12px, 1.55vmin, 16px) clamp(9px, 1.15vmin, 13px);
  border-radius: 14px;
}

.home-page .hub-card::before {
  border-radius: 14px 14px 0 0;
}

.home-page .hub-card--tile {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: unset;
  overflow: hidden;
  justify-self: stretch;
  padding: clamp(9px, 1.25vmin, 14px) clamp(12px, 1.55vmin, 16px) clamp(4px, 0.65vmin, 6px);
}

.home-page .hub-card--tile .hub-subtrack {
  flex: 1 1 auto;
  min-height: 0;
  padding: 2px 2px 3px;
}

.home-page .hub-card--tile .hub-subgrid {
  padding: 4px 3px 3px;
}

.home-page .hub-card-head--wide {
  gap: 7px;
  margin-bottom: 0;
  flex: 0 0 auto;
  align-items: center;
}

/**
 * .hub-media：第二屏全宽背景；不叠全屏蒙版。
 */
.hub-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--hub-bg-photo), var(--hub-bg-fallback);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.hub-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-content);
  margin: 0 auto;
}

.hub-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-title {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.section-desc {
  margin: 0 auto;
  max-width: 560px;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* 第二屏：上排两列 + 下排通栏；子模块为竖条按钮 */
.hub-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hub-row--top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 960px) {
  .hub-row--top {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .home-page .hub-inner {
    justify-content: flex-start;
  }

  .home-page .hub-layout {
    display: flex;
    flex-direction: column;
    grid-template-rows: none;
    gap: clamp(8px, 1.4vmin, 12px);
    flex: 0 1 auto;
    width: 100%;
    max-width: 500px;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .home-page .hub-row--top {
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: 1fr;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    flex: 0 0 auto;
    height: auto;
  }

  .home-page .hub-card--wide {
    grid-column: auto;
    grid-row: auto;
    flex: 0 0 auto;
    min-height: clamp(152px, 19.5vh, 232px);
    height: auto;
  }

  .home-page .hub-card--tile,
  .home-page .hub-card--wide {
    width: 100%;
    max-width: 100%;
  }

  /* 窄屏：不用固定外框，恢复比例与内边距 */
  .home-page .hub-card--tile {
    height: auto;
    aspect-ratio: 4 / 3;
    padding: clamp(9px, 1.25vmin, 14px) clamp(12px, 1.55vmin, 16px) clamp(9px, 1.15vmin, 13px);
  }

  .home-page .hub-card--tile .hub-subtrack {
    padding: 2px 2px 6px;
  }

  .home-page .hub-card--tile .hub-subgrid {
    padding: 4px 3px 6px;
  }

  /* 窄屏三列纵向堆叠时，允许整块略超出时在 #hub 内滚动，避免裁切 */
  .home-page .hub {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.hub-card--tile {
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.hub-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.hub-card-head .hub-card-icon {
  margin-bottom: 0;
  flex-shrink: 0;
}

.hub-card-head .hub-card-title {
  margin: 0;
}

.hub-card-desc--short {
  margin: 0 0 16px;
  flex-shrink: 0;
}

.home-page .hub-card-desc--short {
  margin: 0 0 4px;
  font-size: 0.75rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-page .hub-card-desc--inline {
  font-size: 0.75rem;
  line-height: 1.35;
  margin-top: 1px;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 法律工具坊通栏：副标题与上排卡片一致顶格（在 head 外全宽），允许多行 */
.home-page .hub-card-desc--wide-lead {
  margin: 0 0 4px;
  font-size: 0.75rem;
  line-height: 1.45;
}

.home-page .hub-card-head {
  gap: 7px;
  margin-bottom: 2px;
}

.home-page .hub-card-head .hub-card-icon svg {
  width: 30px;
  height: 30px;
}

.home-page .hub-card-head--wide .hub-card-icon svg {
  width: 32px;
  height: 32px;
}

.home-page .hub-card-title {
  font-size: clamp(1rem, 1.75vmin, 1.125rem);
  font-weight: 700;
  color: var(--color-text-ink);
}

.home-page .hub-card-desc--short,
.home-page .hub-card-desc--inline,
.home-page .hub-card-desc--wide-lead {
  color: var(--color-text-ink);
  font-weight: 400;
}

.home-page .hub-card--wide .hub-subtrack {
  flex: 1 1 auto;
  min-height: 0;
}

.hub-card--wide {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hub-card-head--wide {
  margin-bottom: 2px;
  align-items: center;
}

.hub-card-desc--inline {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

/* 子模块轨道（非首页若复用）：默认横向；首页由下方 .home-page 覆盖为两列 + 纵向滚动 */
.hub-subtrack {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 2px 8px;
  margin: 0 -2px;
  outline: none;
}

.hub-subtrack:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.hub-subtrack::-webkit-scrollbar {
  height: 4px;
}

.hub-subtrack::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.hub-subgrid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: clamp(8px, 1.5vmin, 12px);
  width: max-content;
  min-width: max(100%, max-content);
  min-height: 0;
  padding: 6px 8px 4px;
  box-sizing: border-box;
}

.hub-subgrid--wide {
  min-height: 0;
  padding-bottom: 6px;
}

/*
 * 首页：三大板块卡片外框尺寸不变；仅内部为两列「等扁条」按钮（同高同宽铺满格）；
 * 条目过多时仅在 .hub-subtrack 内纵向滚动。
 */
.home-page .hub-subtrack {
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex: 1 1 auto;
  min-height: 0;
  padding: 2px 2px 6px;
  margin: 0 -2px;
  outline: none;
}

.home-page .hub-subtrack:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.home-page .hub-subtrack::-webkit-scrollbar {
  width: 5px;
  height: 0;
}

.home-page .hub-subtrack::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.14);
  border-radius: 4px;
}

.home-page .hub-subgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.4vmin, 11px);
  width: 100%;
  min-width: 0;
  align-content: start;
  padding: 4px 3px 6px;
  box-sizing: border-box;
}

.home-page .hub-subgrid--wide {
  padding-bottom: 6px;
  align-content: start;
}

.home-page .hub-card--tile .hub-subgrid {
  min-height: 0;
}

.home-page .hub-subgrid--wide .hub-subbtn {
  min-width: 0;
  max-width: none;
}

/* 三板块内子按钮：加高以撑满栅格、配合固定外框 */
.home-page .hub-subbtn {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: clamp(2.75rem, 5vmin, 3.1rem);
  min-height: clamp(2.75rem, 5vmin, 3.1rem);
  max-height: clamp(2.75rem, 5vmin, 3.1rem);
  padding: 0 12px 0 15px;
  font-size: clamp(0.8rem, 1.45vmin, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  text-overflow: ellipsis;
  border-radius: 12px;
  scroll-snap-align: unset;
}

.home-page .hub .hub-subtrack {
  padding: 2px 2px 6px;
  margin: 0 -2px;
}

.hub-subbtn {
  flex: 0 0 auto;
  position: relative;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  text-decoration: none;
  color: var(--color-text);
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out), border-color 0.22s,
    background 0.22s;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 2px 10px rgba(15, 35, 65, 0.06);
  overflow: hidden;
}

.hub-subbtn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  opacity: 0.85;
}

.hub-subbtn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 8px 22px rgba(0, 0, 0, 0.09);
}

.hub-subbtn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.hub-subbtn--consult::before {
  background: linear-gradient(180deg, #6b9cff, #5b8cff);
}

.hub-subbtn--consult {
  color: #243d6e;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(236, 243, 255, 0.97) 100%);
  border-color: rgba(91, 140, 255, 0.22);
}

.hub-subbtn--consult:hover {
  border-color: rgba(91, 140, 255, 0.42);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 8px 22px rgba(91, 140, 255, 0.2);
}

.hub-subbtn--tools::before {
  background: linear-gradient(180deg, #5ed4a8, #3ecf9a);
}

.hub-subbtn--tools {
  color: #155a45;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(232, 250, 243, 0.96) 100%);
  border-color: rgba(62, 207, 154, 0.24);
}

.hub-subbtn--tools:hover {
  border-color: rgba(62, 207, 154, 0.42);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 8px 22px rgba(62, 207, 154, 0.18);
}

.hub-subbtn--camp::before {
  background: linear-gradient(180deg, #e89578, #e07c5c);
}

.hub-subbtn--camp {
  color: #7a3f30;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 244, 240, 0.96) 100%);
  border-color: rgba(224, 124, 92, 0.24);
}

.hub-subbtn--camp:hover {
  border-color: rgba(224, 124, 92, 0.42);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 8px 22px rgba(224, 124, 92, 0.16);
}

/**
 * 单张卡片：玻璃拟态 + 顶部色条区分板块
 * hover 时轻微上浮 + 边框变亮，提示可点击
 */
.hub-card {
  position: relative;
  padding: 32px 28px 28px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.35s;
  overflow: hidden;
}

.hub-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.hub-card--consult::before {
  background: linear-gradient(90deg, var(--color-consult), transparent);
  box-shadow: 0 0 24px rgba(91, 140, 255, 0.35);
}

.hub-card--tools::before {
  background: linear-gradient(90deg, var(--color-tools), transparent);
  box-shadow: 0 0 24px rgba(62, 207, 154, 0.3);
}

.hub-card--camp::before {
  background: linear-gradient(90deg, var(--color-camp), transparent);
  box-shadow: 0 0 24px rgba(224, 124, 92, 0.3);
}

.hub-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.12);
}

.hub-card-icon {
  margin-bottom: 18px;
  color: var(--color-text-muted);
}

.hub-card--consult .hub-card-icon {
  color: var(--color-consult);
}

.hub-card--tools .hub-card-icon {
  color: var(--color-tools);
}

.hub-card--camp .hub-card-icon {
  color: var(--color-camp);
}

.hub-card-title {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.hub-card-desc {
  margin: 0 0 20px;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* 标签：表示未来可扩展的子功能方向 */
.hub-card-tags {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hub-card-tags li {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.hub-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-accent);
  transition: gap 0.25s var(--ease-out), color 0.25s;
}

.hub-card:hover .hub-card-cta {
  gap: 12px;
  color: #8a6d1c;
}

.hub-card-arrow {
  transition: transform 0.25s var(--ease-out);
}

.hub-card:hover .hub-card-arrow {
  transform: translateX(4px);
}

/* ---------------------------------------------------------------------------
   七、页脚 (.site-footer)
--------------------------------------------------------------------------- */
.site-footer {
  padding: 40px var(--page-gutter) 48px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-mid);
}

.footer-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.footer-note {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

.footer-note code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 0.95em;
}

.footer-copy {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(26, 31, 46, 0.45);
}

/* 减少动画：用户系统设置「减少动态效果」时，关闭强动画（可访问性） */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  .scroll-hint-line {
    animation: none;
  }

  .hub-card:hover {
    transform: none;
  }

  .hub-subbtn:hover {
    transform: none;
  }

  .nav-pill:hover,
  .nav-pill:active {
    transform: none;
  }
}

/* 占位页 / 仅返回：无通栏顶栏，与咨询子页同款磨砂返回胶囊 */
.feature-hub-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  box-sizing: border-box;
}

.feature-hub-bar__inner {
  width: 100%;
  max-width: var(--max-content, 1120px);
  margin: 0 auto;
  padding: clamp(14px, 3vmin, 22px) var(--page-gutter, 24px);
  min-height: 0;
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
}

.feature-hub-bar .sub-back {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.96) !important;
  text-decoration: none;
  background: rgba(18, 32, 52, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.feature-hub-bar .sub-back:hover {
  color: #ffffff !important;
  background: rgba(18, 32, 52, 0.55);
  transform: translateY(-1px);
}

.feature-hub-bar .sub-back:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 3px;
}

/* 未使用 .sub-page 壳时，主内容区预留固定顶区高度 */
header.feature-hub-bar + main,
header.feature-hub-bar + .admin-wrap {
  padding-top: clamp(76px, 12vh, 108px);
}
