/* 工厂官网 前台公共样式：导航栏 / 页脚 / 返回顶部 + 响应式基础布局 */
/* 主题色统一由 theme.css 的 CSS 变量管理，本文件仅引用变量，不再硬编码色值 */
/*
 * 响应式断点统一约定（全站各页面内联 <style> 中的 @media 均按此两档书写，禁止再自行定义 760/860/960 等一次性断点）：
 *   - 平板 / 窄屏桌面: max-width: 768px
 *   - 手机: max-width: 480px
 * 触控热区约定：手机端可点击的按钮、输入框、导航项、语言切换项最小高度不低于 44px。
 */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
ul { list-style: none; margin: 0; padding: 0; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* -------------------- 顶部导航 -------------------- */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-primary);
  border-top: 3px solid var(--color-accent-gold);
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 19px;
  font-weight: bold;
  min-width: 0;
}
/* Logo 由后台「公司简介 - 网站 Logo」上传，任意尺寸图片都等比缩放，并限制最大宽度避免挤掉公司名称文字 */
.brand-logo { height: 36px; width: auto; max-width: 180px; object-fit: contain; border-radius: 4px; flex: 0 0 auto; }
.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

.main-nav ul {
  display: flex;
  gap: 6px;
}
.main-nav a {
  display: block;
  padding: 10px 16px;
  color: rgba(255,255,255,0.88);
  font-size: 15px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { background: rgba(255,255,255,0.16); color: #fff; }
.main-nav a.active { background: #fff; color: var(--color-primary); font-weight: bold; box-shadow: inset 0 -3px 0 var(--color-accent-gold); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------------------- 语言切换 -------------------- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  flex-shrink: 0;
}
.lang-switch a { color: rgba(255,255,255,0.75); padding: 3px 4px; border-radius: 3px; }
.lang-switch a:hover { color: #fff; }
.lang-switch a.active { color: #fff; font-weight: bold; text-decoration: underline; text-underline-offset: 3px; }
.lang-switch span { opacity: 0.5; }

/* -------------------- 主体 -------------------- */
.site-main { min-height: calc(100vh - 400px); }

/* -------------------- 页脚 -------------------- */
.site-footer {
  background: var(--color-primary-darker);
  color: #e3cdce;
  margin-top: 40px;
  border-top: 3px solid var(--color-accent-gold);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
.footer-col h3, .footer-col h4 { color: #fff; margin: 0 0 14px; font-size: 16px; position: relative; padding-left: 12px; }
.footer-col h3::before, .footer-col h4::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 4px;
  height: 14px;
  background: var(--color-accent-gold);
  border-radius: 2px;
}
.footer-col .slogan { font-size: 13px; line-height: 1.7; color: #d9b8b9; }
.footer-links li, .footer-contact li { font-size: 13px; line-height: 2; color: #e3cdce; word-break: break-word; }
.footer-links a:hover { color: var(--color-accent-gold); }
.footer-contact .empty-tip { color: #d9b8b9; opacity: 0.7; }
/* 页脚二维码（视频号 / 公众号）：白底卡片保证深红背景上扫码识别率 */
.footer-qrcodes { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.footer-qrcode { margin: 0; width: 112px; text-align: center; }
.footer-qrcode img {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: contain;
  background: #fff;
  padding: 6px;
  border-radius: 6px;
  box-sizing: border-box;
}
.footer-qrcode figcaption { margin-top: 8px; font-size: 13px; color: #e3cdce; line-height: 1.4; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 16px 20px;
  text-align: center;
  font-size: 12px;
  color: #cf9fa1;
}

/* -------------------- 返回顶部 -------------------- */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  transition: opacity 0.2s, background 0.2s;
}
.back-to-top:hover { background: var(--color-accent); }
.back-to-top.visible { display: flex; }

/* -------------------- 页头横幅 page-banner（全站统一，禁止各页面再内联重复定义） -------------------- */
/*
 * 该组件曾在 about / news / products / contact 四个页面各自的 <style> 中复制粘贴，
 * 导致「改一处漏三处」（如左右 padding 缺失、残留深蓝配色）。现统一收敛到本文件，
 * 配色一律取 theme.css 的 CSS 变量：背景红色主色、文字白色、底部深红分隔线。
 * 左右留白：桌面 20px / ≤768px 断点 16px；长文案（尤其英文）必须换行，不允许溢出色块。
 */
.page-banner {
  background: var(--color-primary);
  color: #fff;
  padding: 36px 20px;
  text-align: center;
  border-bottom: 3px solid var(--color-accent);
}
.page-banner h1,
.page-banner p {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}
.page-banner h1 { margin: 0 0 8px; font-size: 24px; color: #fff; }
.page-banner p { margin: 0; font-size: 13px; opacity: 0.85; color: #fff; }

/* -------------------- 通用区块 -------------------- */
.section-title {
  text-align: center;
  margin: 0 0 30px;
}
.section-title h2 {
  font-size: 26px;
  color: var(--color-primary);
  margin: 0 0 10px;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}
.section-title h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 46px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}
.section-title p { color: var(--color-text-muted); font-size: 14px; margin: 0; }
.empty-tip { color: var(--color-text-muted); text-align: center; padding: 60px 0; background: var(--color-bg-white); border-radius: 8px; }

/* -------------------- 手机端响应式（标准断点 768px） -------------------- */
@media (max-width: 768px) {
  .nav-toggle { display: flex; min-width: 44px; min-height: 44px; }

  /* 窄屏 Logo 收窄，给公司名称文字与右侧导航按钮留出空间，避免名称被省略号截断 */
  .brand-logo { height: 30px; max-width: 96px; }

  .main-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-primary);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .main-nav.open { max-height: 400px; overflow-y: auto; }
  .main-nav ul { flex-direction: column; padding: 8px 12px 16px; gap: 0; }
  .main-nav a { padding: 13px 10px; min-height: 44px; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.08); border-radius: 0; }
  .main-nav a.active { background: rgba(255,255,255,0.15); color: #fff; box-shadow: inset 3px 0 0 var(--color-accent-gold); }

  .lang-switch a { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }

  .footer-inner { grid-template-columns: 1fr; gap: 26px; padding: 32px 20px 20px; }
  .back-to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; font-size: 18px; }

  /* 页头横幅：手机端左右留白收窄到 16px，标题字号同步下调避免长标题被撑破 */
  .page-banner { padding: 28px 16px; }
  .page-banner h1 { font-size: 21px; }
}

/* -------------------- 手机端响应式（标准断点 480px） -------------------- */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .header-inner { padding: 0 14px; gap: 8px; }
  .brand { gap: 6px; }
  .brand-name { max-width: 48vw; font-size: 16px; }
  /* 手机端顶栏宽度有限（汉堡按钮 44 + 语言切换 107 已占去一半），
     已上传 Logo 时由 Logo 承担品牌标识、隐藏公司名称文字，
     避免出现「Shenzh…」这类被省略号截断、显示不全的效果；
     未上传 Logo 时（无 .brand-logo 兄弟元素）公司名称照常完整展示。 */
  .brand-logo { height: 30px; max-width: 150px; }
  .brand-logo + .brand-name { display: none; }

  .page-banner { padding: 26px 16px; }
  .page-banner h1 { font-size: 20px; }
}

/*
 * -------------------- 手机端「单列纵向流」排版基线 --------------------
 * 参考站 http://www.guanghuishiye.com/Index.asp 的移动端排版思路：
 *   1. 整站单列纵向流，每个区块独立占据完整高度，靠外边距分隔，不做横向并排；
 *   2. 任何元素都不允许脱离文档流叠到下一个区块上（绝对定位元素在窄屏一律回归普通流）；
 *   3. 卡片宽度 100%，文字自动换行不截断，卡片高度随内容自适应（禁止固定像素高度 + overflow:hidden）；
 *   4. 图片按比例自适应，用 aspect-ratio 占位保证「图片未加载完也不会高度塌陷」，避免后续内容叠上来。
 * 本段为全站基线，各页面 <style> 中的移动端规则只做页面特有补充，不再重复定义这些通用行为。
 */
@media (max-width: 768px) {
  /* 视口级溢出兜底：任何子元素都不允许把页面撑出横向滚动条 */
  html, body { max-width: 100%; overflow-x: hidden; }
  .site-main { width: 100%; max-width: 100%; overflow-x: hidden; }

  /* 长文本（中英文混排、产品型号、URL）统一换行策略，禁止溢出容器 */
  h1, h2, h3, h4, p, li, td, th, a, span, div {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  /* 图片、表格、iframe 等替换元素按比例自适应，不撑破容器 */
  img, video, iframe { max-width: 100%; }
  table { max-width: 100%; }

  /* 区块之间的统一纵向间距，保证「上一个区块结束后下一个区块才开始」 */
  .home-section + .home-section { border-top: 1px solid var(--color-border); }
}

@media (max-width: 480px) {
  /* 手机端所有多列栅格一律退化为单列纵向流（分类卡片保留双列，文案短不会截断） */
  .product-grid,
  .news-grid,
  .news-list {
    grid-template-columns: 1fr !important;
    display: grid;
    gap: 14px;
  }
  .category-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* 卡片高度随内容自适应：清除固定高度/单行省略，改为完整换行显示 */
  .product-card,
  .news-mini-card,
  .news-card,
  .category-card { width: 100%; height: auto; }
  .product-card .name,
  .news-mini-card .title,
  .news-card .title,
  .category-card .name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    height: auto;
    max-height: none;
    -webkit-line-clamp: initial;
    display: block;
    line-height: 1.5;
  }
  .product-card .summary,
  .news-card .summary {
    height: auto;
    max-height: none;
    overflow: visible;
    -webkit-line-clamp: initial;
    display: block;
  }
}

/*
 * -------------------- 右下角「在线沟通询价」悬浮窗 --------------------
 * 收起态：小胶囊按钮（红色主色 + 白色图标文字），固定在返回顶部按钮上方，滚动时始终跟随；
 * 展开态：向上展开紧凑面板（询价表单 + 联系方式快捷区），面板打开时隐藏胶囊按钮避免互相遮挡。
 * 手机端（≤768px / ≤480px）按钮与面板宽度按屏幕自适应，面板最大高度限制并内部滚动，
 * 保证不遮挡页面主要内容与页脚关键信息。样式统一收敛在本文件，各页面禁止再内联复制。
 */
.float-inquiry {
  position: fixed;
  right: 24px;
  /* 让开返回顶部按钮（bottom:24px，高 44px），避免两个悬浮元素重叠 */
  bottom: 80px;
  z-index: 160;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------------- 收起态胶囊按钮 ---------------- */
.float-inquiry .fi-launcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 22px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}
.float-inquiry .fi-launcher:hover { background: var(--color-accent); transform: translateY(-1px); }
.float-inquiry .fi-launcher-icon { display: inline-flex; align-items: center; }
.float-inquiry.is-open .fi-launcher { display: none; }

/* ---------------- 展开态面板 ---------------- */
.float-inquiry .fi-panel {
  display: none;
  width: 300px;
  /* 窄屏兜底：任何情况下都不允许把页面撑出横向滚动条 */
  max-width: calc(100vw - 32px);
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.float-inquiry.is-open .fi-panel { display: block; }

.float-inquiry .fi-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-primary);
  color: #fff;
}
.float-inquiry .fi-panel-title { font-size: 15px; font-weight: 600; }
.float-inquiry .fi-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  min-width: 28px;
  min-height: 28px;
}
.float-inquiry .fi-close:hover { color: var(--color-primary-light); }

.float-inquiry .fi-panel-body {
  padding: 12px 14px 14px;
  max-height: 68vh;
  overflow-y: auto;
}
.float-inquiry .fi-desc {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.float-inquiry .fi-alert {
  display: none;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 12px;
  word-break: break-word;
}
.float-inquiry .fi-alert.show { display: block; }
.float-inquiry .fi-alert.success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}
.float-inquiry .fi-alert.error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}
.float-inquiry .fi-alert ul { margin: 4px 0 0; padding-left: 16px; }

.float-inquiry .fi-row { margin-bottom: 9px; }
.float-inquiry .fi-row label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--color-text);
}
.float-inquiry .fi-required { color: var(--color-accent); }
.float-inquiry .fi-row input,
.float-inquiry .fi-row textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--color-bg-white);
  color: var(--color-text);
}
.float-inquiry .fi-row input:focus,
.float-inquiry .fi-row textarea:focus { border-color: var(--color-primary); }
.float-inquiry .fi-row textarea { resize: vertical; min-height: 62px; }
.float-inquiry .fi-row.has-error input,
.float-inquiry .fi-row.has-error textarea { border-color: var(--color-danger); }

.float-inquiry .fi-submit {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 5px;
  background: var(--color-accent);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 2px;
}
.float-inquiry .fi-submit:hover { background: var(--color-accent-dark); }
.float-inquiry .fi-submit:disabled { background: var(--color-text-muted); cursor: not-allowed; }

.float-inquiry .fi-contact {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.float-inquiry .fi-contact-title {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.float-inquiry .fi-contact-list { list-style: none; margin: 0; padding: 0; }
.float-inquiry .fi-contact-list li {
  display: flex;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
}
.float-inquiry .fi-contact-label { color: var(--color-text-muted); flex-shrink: 0; min-width: 34px; }
.float-inquiry .fi-contact-value { color: var(--color-primary); text-decoration: none; word-break: break-all; }
.float-inquiry .fi-contact-value:hover { text-decoration: underline; }

/* ---------------- 平板 / 窄屏（≤768px） ---------------- */
@media (max-width: 768px) {
  .float-inquiry { right: 16px; bottom: 70px; }
  .float-inquiry .fi-launcher { padding: 8px 14px; font-size: 13px; min-height: 38px; }
  .float-inquiry .fi-panel { width: 280px; max-width: calc(100vw - 32px); }
  .float-inquiry .fi-panel-body { max-height: 60vh; }
}

/* ---------------- 手机端（≤480px） ---------------- */
@media (max-width: 480px) {
  .float-inquiry { right: 12px; left: auto; bottom: 66px; }
  /* 手机端只保留图标 + 短文案，按钮进一步缩小，避免遮挡正文与页脚 */
  .float-inquiry .fi-launcher { padding: 8px 12px; font-size: 12px; border-radius: 20px; }
  .float-inquiry .fi-launcher-icon svg { width: 16px; height: 16px; }
  /* 面板展开时占据屏幕宽度的绝大部分但左右各留 12px，保证内容不被截断也不溢出视口 */
  .float-inquiry.is-open { left: 12px; right: 12px; }
  .float-inquiry .fi-panel { width: 100%; max-width: 100%; }
  .float-inquiry .fi-panel-body { max-height: 56vh; }
  /* iOS 上字号小于 16px 聚焦输入框会自动放大页面，这里统一提到 16px 并保证触控高度 */
  .float-inquiry .fi-row input { font-size: 16px; min-height: 40px; }
  .float-inquiry .fi-row textarea { font-size: 16px; min-height: 66px; }
  .float-inquiry .fi-submit { min-height: 42px; font-size: 15px; }
  .float-inquiry .fi-close { min-width: 32px; min-height: 32px; font-size: 24px; }
}

/* ==================================================================
 * 预留内容板块（content_blocks）——后台可管理、前台按 is_visible 渲染
 * 红白基调：白底卡片 + 红色标题；手机端单列纵向流，图片按比例自适应
 * ================================================================== */
.content-block-section {
  padding: 50px 0;
  background: var(--color-bg-white);
}
/* 相邻板块交替浅灰底，避免连续多个白底板块粘连在一起分不清层次 */
.content-block-section + .content-block-section {
  background: var(--color-bg);
}
.content-block-body {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}
.content-block-image {
  flex: 0 0 40%;
  max-width: 40%;
}
.content-block-image img {
  width: 100%;
  height: auto;
  /* 后台上传的图片比例不可控，超高图片按 cover 裁切封顶，避免把整个板块撑得过长 */
  max-height: 360px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}
.content-block-text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 1.9;
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (max-width: 768px) {
  .content-block-section { padding: 32px 0; }
  /* 手机端单列纵向流：图片在上、文字在下，宽度 100%，不再左右分栏 */
  .content-block-body { flex-direction: column; gap: 16px; }
  .content-block-image { flex: none; max-width: 100%; width: 100%; }
  .content-block-image img { max-height: 240px; }
  .content-block-text { font-size: 14px; line-height: 1.8; }
}
@media (max-width: 480px) {
  .content-block-section { padding: 26px 0; }
  .content-block-section .section-title { margin-bottom: 18px; }
}
