/* ==========================================================================
   河北瑞鑫信息技术有限公司 · 档案风格设计系统
   tokens.css — 设计令牌 / 基础排版 / 栅格
   命名规则：原始色板 → 语义令牌 → 组件令牌（组件层不直接引用原始色板）
   ========================================================================== */

:root {
  /* ---------- 01 色板：纸 ---------- */
  --paper-50: #fbf8f1;   /* 纸白：卡片、浮层 */
  --paper-100: #f4efe4;  /* 牛皮纸：页面底色 */
  --paper-200: #e9e1d0;  /* 档案袋：次级表面 */
  --paper-300: #d9cdb6;  /* 分隔线、卷宗边 */
  --paper-400: #c4b79b;  /* 装饰线、装订孔 */

  /* ---------- 02 色板：墨 ---------- */
  --ink-900: #1b1a17;    /* 正文墨色 */
  --ink-700: #3a362e;    /* 次级标题 */
  --ink-500: #6b6459;    /* 辅助文字（5.1:1 on paper-100） */
  --ink-300: #9a9284;    /* 仅装饰 / 大字（低于正文阈值，禁止承载信息） */

  /* ---------- 03 色板：瑞鑫蓝（品牌主色，取自企业标识） ---------- */
  --blue-700: #0b4e8a;
  --blue-600: #0f66b3;
  --blue-500: #2e86c8;
  --blue-100: #dce8f4;

  /* ---------- 04 色板：印章红（强调，仅用于归档语义） ---------- */
  --seal-600: #a8322a;
  --seal-500: #c04a3f;
  --seal-100: #f0dcd7;

  /* ---------- 05 语义令牌（亮色 / 公文纸） ---------- */
  --bg: var(--paper-100);
  --bg-pattern: rgba(107, 100, 89, 0.06);
  --surface: var(--paper-50);
  --surface-2: var(--paper-200);
  --surface-inverse: var(--ink-900);
  --text: var(--ink-900);
  --text-secondary: var(--ink-700);
  --text-muted: var(--ink-500);
  --text-inverse: var(--paper-100);
  --line: var(--paper-300);
  --line-strong: var(--ink-900);
  --brand: var(--blue-600);
  --brand-hover: var(--blue-700);
  --brand-soft: var(--blue-100);
  --on-brand: #ffffff;
  --seal: var(--seal-600);
  --seal-soft: var(--seal-100);
  --focus: var(--blue-700);

  /* ---------- 06 字体族 ---------- */
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Noto Sans SC", monospace;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  /* ---------- 07 字号阶梯（1.25 比例，正文 16px） ---------- */
  --fs-display: clamp(2.75rem, 1.6rem + 3.6vw, 4.25rem); /* 68px */
  --fs-h1: clamp(2.125rem, 1.5rem + 2.1vw, 3rem);        /* 48px */
  --fs-h2: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);      /* 36px */
  --fs-h3: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);    /* 26px */
  --fs-h4: 1.25rem;   /* 20px */
  --fs-lg: 1.125rem;  /* 18px */
  --fs-body: 1rem;    /* 16px */
  --fs-sm: 0.875rem;  /* 14px */
  --fs-xs: 0.75rem;   /* 12px */

  --lh-tight: 1.2;
  --lh-heading: 1.35;
  --lh-body: 1.75;
  --ls-cjk: 0.01em;
  --ls-label: 0.1em;

  /* ---------- 08 间距（4/8 节奏） ---------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 40px;
  --s-8: 48px;
  --s-9: 64px;
  --s-10: 80px;
  --s-11: 96px;
  --s-12: 120px;

  /* 区块垂直节奏 */
  --section-y: clamp(56px, 7vw, 104px);

  /* ---------- 09 形状与阴影（档案＝锐角） ---------- */
  --r-xs: 2px;
  --r-sm: 3px;
  --r-md: 4px;
  --r-pill: 999px;
  --shadow-paper: 0 1px 0 rgba(27, 26, 23, 0.05), 0 18px 32px -24px rgba(27, 26, 23, 0.55);
  --shadow-lift: 0 2px 0 rgba(27, 26, 23, 0.06), 0 26px 44px -28px rgba(27, 26, 23, 0.6);

  /* ---------- 10 动效 ---------- */
  --dur-fast: 120ms;
  --dur: 220ms;
  --dur-slow: 420ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  /* ---------- 11 层级 ---------- */
  --z-base: 1;
  --z-sticky: 50;
  --z-nav: 100;
  --z-toast: 200;

  /* ---------- 12 容器 ---------- */
  --container: 1240px;
  --gutter: clamp(20px, 5vw, 48px);
}

/* ==========================================================================
   暗色主题：夜间调阅（墨色纸）
   ========================================================================== */
[data-theme="dark"] {
  --bg: #17150f;
  --bg-pattern: rgba(233, 225, 208, 0.05);
  --surface: #211e16;
  --surface-2: #2b271d;
  --surface-inverse: #efe7d7;
  --text: #efe7d7;
  --text-secondary: #d8cebb;
  --text-muted: #b3a894;
  --text-inverse: #1b1a17;
  --line: #3d3729;
  --line-strong: #efe7d7;
  --brand: #7fb4e3;
  --brand-hover: #a6ccee;
  --brand-soft: #22384d;
  --on-brand: #10202e;
  --seal: #e08d7f;
  --seal-soft: #3d241f;
  --focus: #a6ccee;

  --shadow-paper: 0 1px 0 rgba(0, 0, 0, 0.4), 0 18px 32px -24px rgba(0, 0, 0, 0.9);
  --shadow-lift: 0 2px 0 rgba(0, 0, 0, 0.45), 0 26px 44px -28px rgba(0, 0, 0, 1);
}

/* ==========================================================================
   基础重置
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-cjk);
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 纸张颗粒：极低透明度的固定叠层，不影响可读性 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-toast);
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
svg {
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: 0.01em;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

a:hover {
  color: var(--brand-hover);
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--brand-soft);
  color: var(--text);
}

/* ==========================================================================
   排版工具类
   ========================================================================== */
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  font-weight: 500;
}

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.lead {
  font-size: var(--fs-lg);
  line-height: 1.85;
  color: var(--text-secondary);
  max-width: 62ch;
}

.text-muted {
  color: var(--text-muted);
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   布局
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-5);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 999;
  padding: 12px 18px;
  background: var(--ink-900);
  color: var(--paper-50);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-label);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--paper-50);
}

/* ==========================================================================
   降低动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
