/*!
 * ============================================================
 *  B端工业垂直技术网站 —— 全局样式表
 *  项目：金属表面处理 & 工厂智造管理技术站
 *  目标受众：电镀工艺工程师、品质主管、工厂负责人
 *  配色：低饱和度蓝灰配色，简约工业风
 *
 *  目录：
 *  1. 全局变量与基础重置
 *  2. 顶部导航栏（含移动端汉堡菜单）
 *  3. 通用工具类（容器、标题、按钮）
 *  4. 首页组件（英雄区、创始人、服务、工具卡片、商城、表单、页脚）
 *  5. 工具计算器页面（卡片、输入行、结果区）
 *  6. 博客列表与详情页
 *  7. 模态框 / 弹窗
 *  8. 移动端适配（媒体查询）
 * ============================================================
 */

/* ============================================================
 * 1. 全局变量与基础重置
 * ============================================================ */
:root {
  --bg-primary: #f8f9fa;        /* 页面主背景（浅灰蓝） */
  --bg-secondary: #e9ecef;      /* 次要背景（用于交替区块） */
  --bg-card: #ffffff;           /* 卡片 / 面板背景 */
  --bg-muted: #f1f3f5;          /* 弱化背景（提示、标签） */
  --primary: #2c3e50;           /* 主色（深蓝灰） */
  --primary-light: #34495e;     /* 主色浅一档（悬停） */
  --accent: #5d6d7e;            /* 强调色（蓝灰） */
  --accent-hover: #4a5a6a;      /* 强调色悬停 */
  --success: #27ae60;           /* 成功色 */
  --warning: #f39c12;           /* 警告色 */
  --danger: #e74c3c;            /* 危险色 */
  --text-primary: #2c3e50;      /* 正文主色 */
  --text-secondary: #6c757d;    /* 次要文字 */
  --text-light: #8f9ca6;        /* 弱化文字 */
  --border: #dee2e6;            /* 边框颜色 */
  --radius: 4px;                /* 基础圆角 */
}

/* 基础重置：统一盒模型，去掉默认内外边距 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;      /* 锚点跳转平滑滚动 */
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', Tahoma, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  padding-top: 60px;            /* 给固定顶栏留出空间 */
}

/* ============================================================
 * 2. 顶部导航栏（桌面端 + 移动端汉堡菜单）
 * ============================================================ */
.header {
  position: fixed;              /* 固定吸顶 */
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--bg-card);
  z-index: 1000;               /* 保证覆盖其他元素 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

/* Logo 区域 */
.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  font-weight: bold;
}

/* 桌面端导航菜单（水平排列） */
.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-nav a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

/* 汉堡菜单按钮：桌面端隐藏，手机端显示 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--primary);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 汉堡按钮展开动画（三线变叉） */
.nav-toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ============================================================
 * 3. 通用工具类
 * ============================================================ */

/* 页面内容容器：最大宽度居中，两侧留白 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* 页面主标题 */
h1 {
  font-size: 26px;
  color: var(--primary);
  margin-bottom: 10px;
  line-height: 1.4;
}

/* 页面副标题（工具页 / 子页顶部说明） */
.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

/* 主按钮（计算器执行按钮） */
.btn-primary {
  width: 100%;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-primary:active {
  transform: scale(0.99);
}

/* ============================================================
 * 4. 首页组件
 * ============================================================ */

/* ---------- 4.1 英雄区 ---------- */
.hero {
  padding: 60px 20px 80px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  text-align: center;
}

.hero .container {
  max-width: 800px;
  padding-bottom: 40px;
}

.hero h1 {
  font-size: 32px;
  margin-bottom: 20px;
  color: var(--primary);
}

.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero .btn {
  display: inline-block;
  padding: 12px 30px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s ease;
}

.hero .btn:hover {
  background: var(--primary-light);
}

/* ---------- 4.2 板块通用 ---------- */
.section {
  padding: 60px 20px;
}

.section .container {
  max-width: 1000px;
  padding-bottom: 20px;
}

.section h2 {
  font-size: 24px;
  margin-bottom: 40px;
  color: var(--primary);
  text-align: center;
}

/* 标题下方蓝色短横线装饰 */
.section h2::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--accent);
  margin: 15px auto 0;
}

/* 区块内段落（付费资料区说明等） */
.section > .container > p {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ---------- 4.3 创始人介绍 ---------- */
.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.profile-card .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-secondary);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary);
  font-weight: bold;
}

.profile-card h3 {
  font-size: 18px;
  margin-bottom: 5px;
}

.profile-card .badge {
  display: inline-block;
  padding: 4px 8px;
  background: var(--bg-muted);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.profile-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

/* ---------- 4.4 核心服务卡片 ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.service-card {
  background: var(--bg-card);
  padding: 30px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.service-card .icon {
  width: 48px;
  height: 48px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 20px;
}

.service-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.service-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- 4.5 工具中心介绍区 ---------- */
.tools-intro {
  background: var(--bg-card);
  padding: 30px;
  border-radius: var(--radius);
  margin-bottom: 40px;
  border: 1px solid var(--border);
}

.tools-intro h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

.tools-intro p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 工具卡片网格 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.tool-card .tool-name {
  font-size: 17px;
  color: var(--primary);
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.tool-card .tool-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  flex: 1;                     /* 让描述区自动撑开，底部按钮对齐 */
}

.tool-card .tool-features {
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 12px 15px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.tool-card .tool-features span:first-child {
  color: var(--text-primary);
}

.tool-card .tool-features span:last-child {
  color: var(--accent);
  font-weight: 500;
}

/* 工具卡片跳转按钮 */
.tool-link {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  margin-top: 20px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease;
}

.tool-link:hover {
  background: var(--primary-light);
}

/* ---------- 4.6 付费资料商城 ---------- */
.mall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

/* 商城卡片：用 div 而非 <a>，避免整卡跳转干扰表单操作 */
.mall-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  color: var(--text-primary);
  transition: box-shadow 0.3s ease;
}

.mall-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.mall-card .badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  font-size: 12px;
  margin-bottom: 20px;
}

.mall-card h3 {
  font-size: 16px;
  margin-bottom: 15px;
}

.mall-card .price {
  font-size: 16px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 20px;
  display: block;
}

/* ---------- 4.7 表单通用样式 ---------- */

/* 咨询表单容器（卡片式背景，内容居中不超宽） */
.consultation-form {
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
}

/* 表单分组：每组标签 + 输入框 */
.form-group {
  margin-bottom: 20px;
}

/* 表单标签 */
.form-label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

/* 表单输入框（文本框、下拉、数字）通用 */
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(93, 109, 126, 0.15);
}

/* 多行文本域 */
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.3s ease;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(93, 109, 126, 0.15);
}

/* 提交按钮 */
.btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-submit:hover {
  background: var(--primary-light);
}

/* ---------- 4.8 页脚 ---------- */
.footer {
  background: var(--primary);
  color: #fff;
  padding: 40px 20px 20px;
  margin-top: 40px;
}

.footer .container {
  max-width: 1200px;
  padding-bottom: 0;
}

.footer h3 {
  font-size: 16px;
  margin-bottom: 20px;
  color: #fff;
}

.footer p,
.footer a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  margin-bottom: 8px;
  display: block;
}

.footer a:hover {
  color: #fff;
}

.footer .links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer .links ul {
  list-style: none;
}

.footer .links li {
  margin-bottom: 10px;
}

.footer .bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

/* ============================================================
 * 5. 工具计算器页面
 * ============================================================ */

/* 计算器分区卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 30px;
}

.card h2 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.card h3 {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 10px;
}

.card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* 计算输入区 */
.calc-section {
  margin-bottom: 20px;
}

/* 输入行：标签 + 输入框，桌面端并排，移动端自动换行 */
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-row label {
  font-size: 14px;
  color: var(--text-secondary);
  flex: 0 0 140px;             /* 固定标签宽度，保持对齐 */
}

.form-row input[type="number"],
.form-row input[type="text"],
.form-row select,
.calc-section input[type="number"],
.calc-section select {
  flex: 1;
  min-width: 160px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  transition: border-color 0.3s ease;
}

.form-row input:focus,
.form-row select:focus,
.calc-section input:focus,
.calc-section select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(93, 109, 126, 0.15);
}

/* 只读输入框（显示计算结果时） */
input[readonly] {
  background: var(--bg-muted);
  color: var(--primary);
  font-weight: 600;
  cursor: not-allowed;
}

/* 结果展示区（统一背景，计算结果高亮） */
.result-box {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: none;               /* 默认隐藏，计算后由 JS 显示 */
  line-height: 1.8;
}

.result-box.show {
  display: block;
}

.result-box .result-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

/* 计算说明 / 提示区 */
.note-box {
  margin-top: 20px;
  padding: 15px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  display: none;
}

.note-box.show {
  display: block;
}

/* 计算过程展开区（用于展示公式推导，便于人工核对） */
.formula-box {
  margin-top: 15px;
  padding: 15px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.9;
  border-left: 3px solid var(--accent);
}

.formula-box code {
  display: block;
  background: #fff;
  padding: 8px 10px;
  margin: 6px 0;
  border-radius: 3px;
  color: var(--primary);
  font-family: Consolas, monospace;
}

/* ============================================================
 * 6. 博客列表与详情页
 * ============================================================ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

/* 博客卡片整体作为链接，点击进入详情页 */
.blog-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text-primary);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.blog-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border-color: var(--accent);
}

.blog-card .badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--accent);
  background: var(--bg-muted);
  border-radius: 12px;
  margin-bottom: 12px;
}

.blog-card .title {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.blog-card .meta {
  color: var(--text-secondary);
  font-size: 13px;
}

/* 博客详情页 */
.blog-detail {
  max-width: 800px;
}

.blog-detail .meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.blog-detail .content {
  line-height: 1.8;
}

.blog-detail .content h1 {
  font-size: 28px;
  margin-bottom: 20px;
  color: var(--primary);
}

.blog-detail .content h2 {
  font-size: 20px;
  margin: 30px 0 15px;
  color: var(--primary);
}

.blog-detail .content p {
  margin-bottom: 16px;
}

.blog-detail .content ul,
.blog-detail .content ol {
  margin: 0 0 16px 24px;
}

.blog-detail .content pre {
  background: var(--bg-muted);
  padding: 12px;
  border-radius: var(--radius);
  margin: 12px 0;
  overflow-x: auto;            /* 公式过长时横向滚动 */
}

.blog-detail .content code {
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* ============================================================
 * 7. 模态框 / 弹窗
 * ============================================================ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius);
  width: 90%;
  max-width: 460px;
  position: relative;
  text-align: center;
  animation: popIn 0.3s ease forwards;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content h3 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 12px;
}

.modal-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* 右上角 × 关闭按钮 */
.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--danger);
}

/* 模态框确认按钮 */
.modal-btn {
  padding: 10px 40px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.modal-btn:hover {
  background: var(--primary-light);
}

/* ============================================================
 * 8. 移动端适配（媒体查询）
 * 屏幕宽度 ≤ 768px 时启用手机布局
 * ============================================================ */
@media (max-width: 768px) {
  /* 汉堡按钮显示 */
  .nav-toggle {
    display: block;
  }

  /* 桌面导航菜单收起为下拉面板 */
  .main-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: none;             /* 默认隐藏，点击汉堡后显示 */
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    border-bottom-color: var(--border);
    font-size: 15px;
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  /* 容器留白缩小 */
  .container {
    padding: 20px 15px 40px;
  }

  /* 标题字号缩小 */
  h1 {
    font-size: 22px;
  }

  .hero {
    padding: 40px 15px 50px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .section {
    padding: 40px 15px;
  }

  /* 卡片内边距缩小 */
  .card,
  .tool-card,
  .mall-card,
  .profile-card,
  .tools-intro {
    padding: 20px;
  }

  /* 输入行：标签独占一行，输入框占满，避免挤压错乱 */
  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .form-row label {
    flex: none;
    font-size: 13px;
  }

  .form-row input,
  .form-row select,
  .calc-section input,
  .calc-section select {
    min-width: 0;
  }

  /* 移动端网格一律单列 */
  .tools-grid,
  .mall-grid,
  .blog-grid,
  .services-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* 页脚单列堆叠 */
  .footer .links {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}