/**
 * ============================================================
 * 江苏志博电气 — CSS Reset & 基础样式 / 设计令牌
 * Zhibo Electric — CSS Reset & Base Styles / Design Tokens
 * ============================================================
 *
 * 本文件包含：
 * 1. CSS Reset — 统一浏览器默认样式
 * 2. 设计令牌 (Design Tokens) — 颜色、字体、间距、阴影等 CSS 变量
 * 3. 工具类 — 容器、网格、无障碍等通用样式
 */

/* ============================================================
   CSS RESET — 重置所有元素的默认样式
   ============================================================ */

/* 统一盒模型为 border-box，移除默认内外边距 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 防止移动端浏览器自动缩放文字 */
html {
  -webkit-text-size-adjust: 100%;
}

/* 平滑滚动（尊重用户的减少动画偏好） */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* 设置全局字体、字号、行高、文字颜色和背景色 */
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;      /* macOS/WebKit 字体平滑 */
  -moz-osx-font-smoothing: grayscale;       /* Firefox macOS 字体平滑 */
  overflow-x: hidden;                        /* 防止水平滚动条 */
}

/* ── 文字选中颜色 ── */
::selection {
  background: rgba(0,85,238,0.15);
  color: var(--color-primary);
}

/* ── 滚动条样式（WebKit 浏览器） ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: #CDD5E0; border-radius: 10px; border: 2px solid var(--color-bg); }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* 图片默认响应式：不超出容器，保持比例 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 链接去掉默认下划线和颜色 */
a {
  color: inherit;
  text-decoration: none;
}

/* 列表去掉默认项目符号 */
ul, ol {
  list-style: none;
}

/* 表单元素继承字体样式，去掉默认边框和背景 */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

/* 标题样式：紧凑行高、粗体、略微收紧字间距 */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 响应式标题字号（使用 clamp 实现流畅缩放） */
h1 { font-size: clamp(2.25rem, 5.5vw, 4rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 600; }

/* ============================================================
   设计令牌 (DESIGN TOKENS) — CSS 自定义属性
   所有颜色、字体、间距等设计参数集中定义在此
   方便全局统一管理和修改
   ============================================================ */
:root {
  /* ── 主色调（蓝色系）── */
  --color-primary: #0055EE;                          /* 主题蓝色 */
  --color-primary-hover: #0043C8;                    /* 悬停加深 */
  --color-primary-light: #EBF2FF;                    /* 浅蓝背景 */
  --color-primary-gradient: linear-gradient(135deg, #0055EE 0%, #0080FF 100%);  /* 蓝色渐变 */

  /* ── 辅助色（绿色系）── */
  --color-secondary: #00C896;                        /* 辅助绿色 */
  --color-secondary-hover: #00A67A;                  /* 悬停加深 */
  --color-secondary-light: #E6FAF4;                  /* 浅绿背景 */
  --color-secondary-gradient: linear-gradient(135deg, #00C896 0%, #00E0A8 100%);  /* 绿色渐变 */

  /* ── 深色系 ── */
  --color-dark: #080C14;                             /* 最深色（页脚背景等） */
  --color-dark-800: #0D1525;                         /* 深色变体 */
  --color-dark-700: #111C33;                         /* 深色变体 */
  --color-dark-light: #1A2D4A;                       /* 浅深色 */

  /* ── 背景与表面色 ── */
  --color-bg: #F8FAFC;                               /* 页面主背景 */
  --color-bg-alt: #F0F4F8;                           /* 交替背景（灰色区块） */
  --color-surface: #FFFFFF;                          /* 卡片/容器表面色 */

  /* ── 文字颜色 ── */
  --color-text: #0F172A;                             /* 主文字色 */
  --color-text-secondary: #475569;                   /* 次要文字色 */
  --color-text-muted: #94A3B8;                       /* 弱化/提示文字色 */

  /* ── 边框颜色 ── */
  --color-border: #E2E8F0;                           /* 默认边框 */
  --color-border-light: #F1F5F9;                     /* 浅色边框 */

  /* ── 功能色 ── */
  --color-accent: #F59E0B;                           /* 强调色（橙色） */
  --color-accent-light: #FFFBEB;                     /* 浅橙色背景 */
  --color-error: #EF4444;                            /* 错误/危险（红色） */
  --color-success: #10B981;                          /* 成功（绿色） */
  --color-whatsapp: #25D366;                         /* WhatsApp 品牌绿色 */

  /* ── 字体排版 ── */
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-en: 'Inter', sans-serif;                    /* 英文专用字体 */
  --font-zh: 'Noto Sans SC', sans-serif;             /* 中文专用字体 */
  --font-mono: 'Inter', 'SF Mono', 'Courier New', monospace;  /* 等宽字体（数字用） */

  /* 字重 */
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* 字间距 */
  --ls-tight: -0.02em;                              /* 紧凑（标题用） */
  --ls-wide: 0.02em;                                /* 宽松 */
  --ls-wider: 0.06em;                               /* 更宽松（标签用） */

  /* 行高 */
  --lh-heading: 1.15;                               /* 标题行高（紧凑） */
  --lh-body: 1.7;                                   /* 正文行高（舒适阅读） */

  /* ── 间距系统 ── */
  --section-padding: clamp(4rem, 10vw, 8rem);       /* 区块上下间距（响应式） */
  --content-max: 1200px;                            /* 内容最大宽度 */
  --content-narrow: 900px;                          /* 窄内容最大宽度（文章等） */
  --card-gap: 1.5rem;                               /* 卡片间距 */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* ── 圆角系统 ── */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;                            /* 胶囊/圆形 */
  --card-radius: var(--radius-md);                  /* 卡片默认圆角 */
  --btn-radius: var(--radius-sm);                   /* 按钮默认圆角 */
  --input-radius: var(--radius-sm);                 /* 输入框默认圆角 */

  /* ── 阴影系统（多层叠加实现真实深度感）── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.06), 0 16px 48px rgba(0,0,0,0.05);
  --shadow-xl: 0 6px 12px rgba(0,0,0,0.04), 0 12px 32px rgba(0,0,0,0.06), 0 24px 64px rgba(0,0,0,0.06), 0 40px 96px rgba(0,0,0,0.03);

  /* 发光阴影（主色/辅色光晕效果） */
  --shadow-glow-primary: 0 0 0 1px rgba(0,85,238,0.1), 0 0 20px rgba(0,85,238,0.12), 0 0 40px rgba(0,85,238,0.04);
  --shadow-glow-secondary: 0 0 0 1px rgba(0,200,150,0.1), 0 0 20px rgba(0,200,150,0.12), 0 0 40px rgba(0,200,150,0.04);

  /* 语义化阴影 */
  --shadow-card: var(--shadow-sm);                   /* 卡片默认阴影 */
  --shadow-card-hover: var(--shadow-lg);             /* 卡片悬停阴影 */
  --shadow-header: 0 1px 0 rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);  /* 页头阴影 */
  --shadow-modal: 0 8px 32px rgba(0,0,0,0.12), 0 24px 80px rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.06);  /* 弹窗阴影 */

  /* ── 玻璃态质感（Glass Morphism）── */
  --glass-bg: rgba(255,255,255,0.72);                /* 半透明背景 */
  --glass-bg-strong: rgba(255,255,255,0.90);         /* 更不透明的背景 */
  --glass-border: rgba(255,255,255,0.18);            /* 玻璃边框 */
  --glass-blur: blur(24px);                          /* 强模糊 */
  --glass-blur-light: blur(12px);                    /* 轻模糊 */

  /* ── 过渡动画缓动函数 ── */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);    /* 快速过渡 */
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);    /* 基础过渡 */
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);    /* 慢速过渡 */
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);   /* 弹性过渡 */
  --transition-out-expo: 600ms cubic-bezier(0.16, 1, 0.3, 1);     /* 指数衰减过渡 */

  /* ── Z-index 层级系统 ── */
  --z-header: 100;                                  /* 页头导航 */
  --z-overlay: 150;                                 /* 遮罩层 */
  --z-modal: 200;                                   /* 弹窗/模态框 */
}

/* ── 减少动画偏好适配 ── */
/* 当用户在操作系统中开启"减少动画"时，禁用所有动画效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  /* 完全隐藏依赖动画的交互元素 */
  .cursor-glow,
  .splash-screen,
  .tilt-card,
  [data-parallax] { display: none !important; }
}

/* ============================================================
   工具类 (UTILITY CLASSES)
   ============================================================ */

/* 内容容器：居中、限宽、带水平内边距 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 屏幕阅读器专用（视觉上隐藏，但辅助技术可读取） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* 通用区块：带响应式上下间距 */
.section {
  padding: var(--section-padding) 0;
}

/* 灰色背景区块（用于视觉分隔） */
.section-gray { background: var(--color-bg-alt); }

/* 区块标题区域（居中、底部留白） */
.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  color: var(--color-dark);
  margin-bottom: 0.75rem;
  position: relative;
  padding-top: 1.25rem;
}

/* 标题上方装饰线（蓝色渐变短横线） */
.section-header h2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  border-radius: 3px;
  background: var(--color-primary-gradient);
}

.section-header p {
  color: var(--color-text-secondary);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ── 网格辅助类 ── */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: var(--card-gap); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--card-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--card-gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--card-gap); }

/* ── 焦点可见样式（键盘导航无障碍）── */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,85,238,0.25);
}

/* ── 响应式网格断点 ── */
/* 平板：3列/4列 → 2列 */
@media (max-width: 1024px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
/* 手机：所有多列 → 1列 */
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section-header { margin-bottom: 2.5rem; }
}
