/**
 * Allget 全站视觉规范 — 字体 / 字阶 / 颜色 / 间距
 *
 * 原则：仅呈现层（CSS 变量与选择器），不修改 HTML 语义结构、不影响 SEO meta/JSON-LD、
 * 不改变按钮/链接尺寸与布局导致的交互热区。
 *
 * 加载顺序：必须在 /assets/css/style.css 之后。
 */

/* -------------------------------------------------------------------------- */
/* 1. Design tokens                                                           */
/* -------------------------------------------------------------------------- */

:root,
[data-bs-theme='light'] {
  /* —— 字体 —— */
  --site-font-family-base: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --site-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
    'Courier New', monospace;

  /* —— 字阶（rem，根 16px）—— */
  --site-font-size-xs: 0.8125rem; /* 13px — 元信息、标签 */
  --site-font-size-sm: 0.875rem; /* 14px — 次要说明 */
  --site-font-size-base: 0.9375rem; /* 15px — 正文默认 */
  --site-font-size-md: 1rem; /* 16px — 强调正文 */
  --site-font-size-lg: 1.0625rem; /* 17px — 导语上限 */
  --site-font-size-xl: 1.125rem; /* 18px — 小标题 */
  --site-font-size-2xl: 1.25rem; /* 20px — 区块副标题 */
  --site-font-size-3xl: 1.5rem; /* 24px — 页面级标题 */

  /* —— 行高 —— */
  --site-line-height-tight: 1.35;
  --site-line-height-snug: 1.45;
  --site-line-height-base: 1.6;
  --site-line-height-relaxed: 1.75;

  /* —— 字重 —— */
  --site-font-weight-normal: 400;
  --site-font-weight-medium: 500;
  --site-font-weight-semibold: 600;
  --site-font-weight-bold: 700;

  /* —— 字间距 —— */
  --site-heading-letter-spacing: -0.015em;

  /* —— 品牌色 / 语义色 —— */
  --site-heading-color: #1a1d21;
  --site-nav-link-color: #404448;
  --site-header-bg: #d8e6f8;
  --site-border-subtle: rgba(var(--bs-body-color-rgb, 44, 48, 53), 0.12);

  /* —— 间距节奏 —— */
  --site-space-1: 0.25rem;
  --site-space-2: 0.5rem;
  --site-space-3: 0.75rem;
  --site-space-4: 1rem;
  --site-space-5: 1.25rem;
  --site-space-6: 1.5rem;
  --site-space-8: 2rem;
  --site-section-py: 3rem; /* 对齐 Bootstrap py-5 */
  --site-content-max-width: 42rem; /* 长文阅读宽度 */

  /* —— 响应式标题（首页区块等复用）—— */
  --site-section-heading-size: clamp(1.375rem, 1.05rem + 1.5vw, 1.875rem);
  --site-section-heading-weight: var(--site-font-weight-bold);
  --site-section-heading-line-height: 1.28;

  --site-lede-size: clamp(0.9375rem, 0.88rem + 0.35vw, 1.0625rem);
  --site-lede-line-height: var(--site-line-height-snug);

  --site-hero-title-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.85rem);
  --site-hero-lede-size: clamp(1rem, 0.94rem + 0.2vw, 1.125rem);
  --site-card-title-size: clamp(1.1875rem, 0.98rem + 0.9vw, 1.5rem);
  --site-feature-text-size: clamp(0.9375rem, 0.89rem + 0.22vw, 1.0625rem);
  --site-flow-lede-size: clamp(0.9375rem, 0.86rem + 0.4vw, 1.0625rem);
  --site-subsection-title-size: clamp(1rem, 0.94rem + 0.35vw, 1.125rem);

  --site-page-title-size: clamp(1.2rem, 2.4vw, 1.5rem);

  /* —— Bootstrap 语义映射（组件/工具类自动继承）—— */
  --bs-body-font-family: var(--site-font-family-base);
  --bs-body-font-size: var(--site-font-size-base);
  --bs-body-line-height: var(--site-line-height-base);

  --bs-body-color: #2c3035;
  --bs-body-color-rgb: 44, 48, 53;

  --bs-secondary-color: #5c6368;
  --bs-secondary-color-rgb: 92, 99, 104;

  --bs-tertiary-color: rgba(44, 48, 53, 0.62);
  --bs-tertiary-color-rgb: 44, 48, 53;

  --bs-emphasis-color: #141619;
  --bs-emphasis-color-rgb: 20, 22, 25;

  --bs-heading-color: var(--site-heading-color);

  --bs-link-color: var(--bs-primary);
  --bs-link-hover-color: #055aad;

  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.75rem;
}

[data-bs-theme='dark'] {
  --site-heading-color: #f1f3f5;
  --site-nav-link-color: #ced4da;
  --site-header-bg: #1a2332;
  --site-border-subtle: rgba(var(--bs-body-color-rgb, 233, 236, 239), 0.14);

  --bs-body-font-family: var(--site-font-family-base);

  --bs-body-color: #e9ecef;
  --bs-body-color-rgb: 233, 236, 239;

  --bs-secondary-color: #adb5bd;
  --bs-secondary-color-rgb: 173, 181, 189;

  --bs-tertiary-color: rgba(233, 236, 239, 0.52);
  --bs-tertiary-color-rgb: 233, 236, 239;

  --bs-emphasis-color: #f8f9fa;
  --bs-emphasis-color-rgb: 248, 249, 250;

  --bs-heading-color: var(--site-heading-color);

  --bs-link-hover-color: #4dabf7;
}

/* -------------------------------------------------------------------------- */
/* 2. 全站基础呈现（不改变语义标签，仅统一视觉）                                  */
/* -------------------------------------------------------------------------- */

.template-site {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: var(--bs-body-font-family);
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
}

/* 主内容区：继承正文色阶（banner 内 .text-white 不受影响） */
.template-site main {
  color: var(--bs-body-color);
}

/* 内容页标题：保留 h1/h2 语义，仅统一字色与行高（配合 Bootstrap .h4 等工具类） */
.template-site main .news-article-header h1,
.template-site main article > header h1 {
  color: var(--bs-heading-color);
  line-height: var(--site-line-height-tight);
  letter-spacing: var(--site-heading-letter-spacing);
}

/* 面包屑 / 元信息：与 secondary 色阶对齐 */
.template-site main .text-muted,
.template-site main .text-body-secondary {
  color: var(--bs-secondary-color);
}

/* 顶栏导航链接色（Eduhub 模板默认硬编码覆盖） */
.template-site header.site-header-public .navbar-nav .nav-link:not(.active):not(:hover):not(:focus) {
  color: var(--site-nav-link-color);
}

/* -------------------------------------------------------------------------- */
/* 3. CMS 富文本 & 帮助中心 — 统一字阶引用 token                                */
/* -------------------------------------------------------------------------- */

.cms-rich-text {
  font-size: var(--site-font-size-base);
  line-height: var(--site-line-height-relaxed);
  color: var(--bs-body-color);
}

.cms-rich-text--news {
  font-size: var(--site-font-size-base);
  line-height: var(--site-line-height-relaxed);
}

.cms-rich-text--news h1,
.cms-rich-text--news h2 {
  font-size: var(--site-font-size-2xl);
  font-weight: var(--site-font-weight-semibold);
  line-height: var(--site-line-height-tight);
  color: var(--bs-emphasis-color);
}

.cms-rich-text--news h3 {
  font-size: var(--site-font-size-xl);
  font-weight: var(--site-font-weight-semibold);
  line-height: var(--site-line-height-tight);
  color: var(--bs-emphasis-color);
}

.cms-rich-text--news h4,
.cms-rich-text--news h5,
.cms-rich-text--news h6 {
  font-size: var(--site-font-size-md);
  font-weight: var(--site-font-weight-semibold);
  line-height: var(--site-line-height-snug);
  color: var(--bs-emphasis-color);
}

.help-center-detail__title {
  font-size: var(--site-page-title-size);
  font-weight: var(--site-font-weight-semibold);
  line-height: var(--site-line-height-tight);
  letter-spacing: var(--site-heading-letter-spacing);
  color: var(--bs-emphasis-color);
}

.help-center-detail__lead {
  font-size: var(--site-font-size-sm);
  line-height: var(--site-line-height-snug);
  color: var(--bs-secondary-color);
}

.help-center-detail__time-chip {
  font-size: var(--site-font-size-xs);
  color: var(--bs-secondary-color);
}
