/* ============================================================
   Quntii Design System v1 — 色彩 / 排版 / 栅格 / 间距
   依据：docs/design/Quntii网站视觉设计文档_v1.md
   ============================================================ */

:root {
  /* ---------- 色彩 Token ---------- */
  /* 品牌色 */
  --brand: #1E3A5F;
  --brand-light: #3A5A7C;
  --brand-lighter: #5A7FA5;
  --brand-soft: #D4DEE8;

  /* 文字色 */
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-muted: #8A8A8A;

  /* 背景与表面 */
  --surface: #FFFFFF;
  --surface-subtle: #F7F7F6;
  --surface-alt: #F0EFED;

  /* 边框 */
  --border: #E5E5E3;
  --border-subtle: #F0F0EF;

  /* 语义色 */
  --success: #2D6A4F;
  --warning: #9A6B00;
  --danger: #8B2635;
  --pending: #9A6B00;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 26, 26, 0.06);
  --shadow-lg: 0 8px 24px rgba(26, 26, 26, 0.08);

  /* ---------- 字体 ---------- */
  --font-zh: "PingFang SC", "Source Han Sans SC", "Noto Sans SC",
             "Microsoft YaHei", -apple-system, BlinkMacSystemFont,
             sans-serif;
  --font-en: "Inter", -apple-system, BlinkMacSystemFont,
             "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* ---------- 字号 ---------- */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 28px;
  --text-3xl: 32px;
  --text-4xl: 36px;

  /* ---------- 字重 ---------- */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* ---------- 行高 ---------- */
  --leading-tight: 1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* ---------- 间距（8px 模数） ---------- */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
  --space-12: 96px;
  --space-16: 128px;

  /* ---------- 栅格 ---------- */
  --container-max: 1200px;
  --gutter: 24px;
  --gutter-mobile: 16px;

  /* ---------- 动效 ---------- */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ---------- 圆角 ---------- */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* ---------- 焦点环 ---------- */
  --focus-ring: 2px solid var(--brand);
  --focus-offset: 2px;
}

/* ============================================================
   重置与基础
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-zh);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
  background: var(--surface);
  min-height: 100vh;
}

/* 尊重用户动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   排版层级
   ============================================================ */

h1, h2, h3, h4 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 {
  font-size: clamp(26px, 3vw + 18px, 36px);
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(20px, 2vw + 14px, 28px);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  letter-spacing: -0.005em;
}

h3 {
  font-size: clamp(18px, 1.5vw + 12px, 24px);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

h4 {
  font-size: var(--text-lg);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

p:last-child {
  margin-bottom: 0;
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* 中文排版：数字/英文/URL 前后加空格 —— 交由内容编辑处理，此处提供工具类 */
.num-space { font-feature-settings: "tnum"; }

/* ============================================================
   链接
   ============================================================ */

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--brand-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* ============================================================
   容器与栅格
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-2);
  }
}

.grid {
  display: grid;
  gap: var(--gutter);
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ============================================================
   区块间距
   ============================================================ */

.section {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

.section-sm {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

@media (max-width: 640px) {
  .section {
    padding-top: var(--space-6);
    padding-bottom: var(--space-6);
  }
}

/* ============================================================
   焦点环（全局可见）
   ============================================================ */

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* ============================================================
   工具类
   ============================================================ */

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-brand { color: var(--brand); }
.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
