/* ============================================================
 * base.css — 设计变量、重置、排版与页面骨架布局
 * 风格：干净的蓝白教育工具风
 * 响应式（PRD W06 / spec §1.2）：移动优先
 *   基准：≥375px 手机（流式，不出现整页横向溢出）
 *   断点：768px（平板）/ 1024px（桌面）
 * ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  /* 主色板：蓝白教育风 */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-accent: #0ea5e9;

  /* 语义色 */
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;

  /* 中性色 */
  --color-text: #1f2937;
  --color-text-secondary: #4b5563;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;

  /* 口径条 */
  --topbar-bg: #eff6ff;
  --topbar-border: #bfdbfe;
  --topbar-text: #1e40af;

  /* 尺寸 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.08);
  --header-height: 56px;
  --topbar-height: 40px;
  --container-width: 1200px;
  --gutter: 16px;           /* 移动端左右安全边距 */

  /* 字体 */
  --font-base: "PingFang SC", "Microsoft YaHei", "Segoe UI", "Helvetica Neue",
    Arial, sans-serif;
}

/* ---------- 重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  /* 锚点定位时为吸顶头栏预留高度 */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  /* PRD 要求响应式：不得再设全局 min-width:1024px（旧 PC-only 口径已废止，spec §1.2） */
  overflow-x: hidden; /* 兜底：任何素材超宽都不允许撑出整页横向滚动 */
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* 媒体不超出容器，防止图片撑破移动端布局 */
img,
video,
canvas,
svg {
  max-width: 100%;
}

/* 长串文本（英文/链接）在窄屏可换行 */
p, li, td, th {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- 排版（移动优先，标题随断点增大） ---------- */
h1 { font-size: clamp(22px, 6vw, 40px); line-height: 1.3; }
h2 { font-size: clamp(19px, 4.5vw, 28px); line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.4; }

@media (min-width: 768px) {
  body { font-size: 15px; }
  h3 { font-size: 17px; }
}

.text-muted {
  color: var(--color-text-muted);
}

/* ---------- 页面骨架 ---------- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 流式容器：移动端 16px 安全边距，随断点加宽，桌面端上限 1200px */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

@media (min-width: 768px) {
  :root { --gutter: 24px; }
}

@media (min-width: 1024px) {
  :root { --gutter: 32px; }
  .container { max-width: var(--container-width); }
}

/* 顶部站点头栏：移动端两行（Logo + 可横滑导航），桌面端一行吸顶 */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.site-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.site-logo:hover {
  text-decoration: none;
}

/* 导航在窄屏横向滑动，不换行撑宽页面；滑动条视觉隐藏 */
.site-nav {
  display: flex;
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
  /* 触屏主行动元素满足 ≥44px 命中区（W06） */
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.site-nav a:hover {
  background: var(--color-primary-light);
  text-decoration: none;
}

.site-nav a.is-active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

@media (min-width: 768px) {
  .site-header .container {
    flex-wrap: nowrap;
    gap: 32px;
    padding-top: 0;
    padding-bottom: 0;
    height: var(--header-height);
  }
  .site-logo { font-size: 18px; }
  .site-nav {
    width: auto;
    overflow: visible;
  }
}

/* 主内容区 */
.site-main {
  flex: 1;
  padding: 20px 0 40px;
}

@media (min-width: 768px) {
  .site-main { padding: 32px 0 64px; }
}

/* 页脚（含强制合规文案，spec §8） */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 20px 0;
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
}

.site-footer .compliance {
  color: var(--color-text-secondary);
}

/* ---------- 通用：宽表局部滚动容器（W06：宽表不整页横向溢出） ----------
 * 用法：<div class="table-scroll"><table>…</table></div>
 * T1-C 工具页的结果宽表统一放入该容器。
 */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 640px; /* 窄屏时由容器内部横向滚动，而不是撑破 body */
}
