/* ============================================
   公共样式
   包含：CSS 变量、容器布局、导航栏、Footer
   ============================================ */

/* ---- 字体定义 ---- */
@font-face {
  font-family: 'DINPro';
  src: url('../font/DINPro-Medium.eot');
  src: url('../font/DINPro-Medium.eot?#iefix') format('embedded-opentype'),
       url('../font/DINPro-Medium.woff') format('woff'),
       url('../font/DINPro-Medium.ttf') format('truetype'),
       url('../font/DINPro-Medium.svg') format('svg');
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: 'iconfont';
  src: url('../font/icon/iconfont.eot');
  src: url('../font/icon/iconfont.eot?#iefix') format('embedded-opentype'),
       url('../font/icon/iconfont.woff2') format('woff2'),
       url('../font/icon/iconfont.woff') format('woff'),
       url('../font/icon/iconfont.ttf') format('truetype'),
       url('../font/icon/iconfont.svg#iconfont') format('svg');
  font-weight: normal;
  font-style: normal;
}

.iconfont {
  font-family: 'iconfont' !important;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- CSS 变量定义 ---- */
:root {
  /* 主色 */
  --primary-color: #ff0f23;
  --primary-color-dark: #d40d1e;
  --primary-color-light: #ff3a4b;

  /* 辅助色 */
  --text-color: #333333;
  --text-color-secondary: #666666;
  --text-color-light: #999999;
  --bg-color: #ffffff;
  --bg-color-gray: #f5f5f5;
  --border-color: #e0e0e0;

  /* 导航栏 */
  --navbar-height: 68px;
  --navbar-bg: #ffffff;
  --navbar-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);

  /* Footer */
  --footer-bg: #1a1a1a;
  --footer-text-color: #cccccc;
  --footer-text-color-light: #888888;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;

  /* 间距 */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;

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

  /* 过渡 */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  /* 容器最大宽度 */
  --container-max-width: 1200px;
}

/* ---- 容器布局 ---- */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* 屏幕阅读器可见但视觉隐藏（SEO/无障碍） */
.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;
}

/* ============================================
   导航栏
   默认透明覆盖在轮播图上方，滚动后固定白底
   移动端折叠为汉堡菜单
   ============================================ */
.header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--navbar-height);
  background-color: transparent;
  box-shadow: none;
  z-index: 1000;
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal);
}

/* 滚动后：固定定位、白色背景、深色文字、阴影 */
.header.scrolled {
  position: fixed;
  background-color: var(--navbar-bg);
  box-shadow: var(--navbar-shadow);
}

/* 非首页（services/about）固定白底样式，不受滚动逻辑影响 */
.header.header-solid {
  position: fixed;
  background-color: var(--navbar-bg);
  box-shadow: var(--navbar-shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
}

/* Logo 区域 */
.logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-color);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition-normal);
  display: flex;
  align-items: center;
}

.logo-img {
  width: 170px;
  height: auto;
  display: block;
}

.header.scrolled .logo,
.header.header-solid .logo {
  color: var(--primary-color);
}

/* 导航区域 - 与 Logo 间距 40px */
.nav {
  margin-left: 40px;
}

/* 导航列表 */
.nav-list {
  display: flex;
  align-items: center;
  height: 68px;
  gap: 0;
}

/* 导航项 - 高度68px垂直居中 */
.nav-item {
  height: 68px;
  display: flex;
  align-items: center;
}

/* 导航链接 */
.nav-link {
  font-size: 16px;
  color: #141414;
  transition: color var(--transition-normal);
  position: relative;
  padding: 0 16px;
  height: 68px;
  display: flex;
  align-items: center;
}

.nav-link:hover {
  color: var(--primary-color);
}

/* 导航图标 - 桌面端隐藏 */
.nav-icon {
  display: none;
  margin-right: 8px;
  font-size: 18px;
}

/* 当前页导航项高亮 */
.nav-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* 当前页导航项顶部指示线 */
.nav-link.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--primary-color);
}

/* 右侧电话区域 */
.header-phone {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 24px;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  transition: color var(--transition-normal);
}

.phone-icon {
  font-size: 22px;
}

.phone-number {
  color: inherit;
  font-family: 'DINPro', Arial, sans-serif;
  transition: color var(--transition-normal);
}

/* 汉堡菜单按钮（默认隐藏） */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text-color);
  border-radius: 1px;
  transition: all var(--transition-normal);
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-icon::before {
  top: -7px;
}

.menu-icon::after {
  top: 7px;
}

/* 汉堡菜单展开动画 */
.menu-toggle.active .menu-icon {
  background-color: transparent;
}

.menu-toggle.active .menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle.active .menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* 页面主体 - 首页不需要 padding-top（导航透明覆盖在轮播图上） */
/* 非首页由 .header-solid 配合下方规则添加 padding-top */
.main-content {
  padding-top: 0;
}

/* 非首页（services/about）需要 padding-top 避免被固定导航遮挡 */
.header-solid ~ .main-content {
  padding-top: var(--navbar-height);
}

/* ============================================
   Footer
   深色背景，联系信息 + 快速链接 + 微信公众号
   ============================================ */
.footer {
  background-color: var(--footer-bg);
  color: var(--footer-text-color);
  padding: var(--spacing-xxl) 0 var(--spacing-lg);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--spacing-xl);
}

/* Footer 信息列 */
.footer-section {
  display: flex;
  flex-direction: column;
}

.footer-title {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: var(--spacing-md);
}

.footer-contact p,
.footer-wechat p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--footer-text-color);
}

.footer-contact .footer-phone {
  font-family: 'DINPro', Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ffffff;
  margin-top: var(--spacing-sm);
}

/* Footer 链接列表 */
.footer-link-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer-link-list a {
  font-size: 14px;
  color: var(--footer-text-color);
  transition: color var(--transition-fast);
}

.footer-link-list a:hover {
  color: #ffffff;
}

/* 微信二维码区域 */
.footer-wechat {
  text-align: right;
}

.wechat-qrcode {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.qrcode-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: var(--radius-sm, 4px);
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.wechat-qrcode p {
  font-size: 12px;
  color: var(--footer-text-color-light);
}

/* Footer 底部分割线与版权 */
.footer-bottom {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid #333;
}

.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.copyright,
.icp {
  font-size: 13px;
  color: var(--footer-text-color-light);
}

.icp a {
  color: inherit;
  text-decoration: none;
}

.icp a:hover {
  text-decoration: underline;
}

/* ============================================
   响应式 - 平板端（768px 以下）
   ============================================ */
@media screen and (max-width: 768px) {
  :root {
    --navbar-height: 60px;
  }

  /* 显示汉堡菜单按钮 */
  .menu-toggle {
    display: flex;
  }

  /* 移动端导航 - 始终白底，确保下拉菜单可读 */
  .nav {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    margin-left: 0;
    background-color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
  }

  .nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: var(--spacing-md) var(--spacing-lg);
    gap: 0;
  }

  /* 移动端导航项 - 自动高度、满宽增大点击区域 */
  .nav-item {
    height: auto;
    width: 100%;
  }

  /* 移动端导航图标 - 显示 */
  .nav-icon {
    display: inline;
    color: #999999;
  }

  /* 移动端导航链接 - 块级显示增大点击区域 */
  .nav-link {
    display: block;
    width: 100%;
    padding: var(--spacing-md) 0;
    font-size: 16px;
    border-bottom: 1px solid var(--bg-color-gray);
    color: var(--text-color);
  }

  .nav-link.active {
    color: var(--primary-color);
  }

  .nav-link.active .nav-icon {
    color: var(--primary-color);
  }

  /* 移动端顶部线改为左侧指示 */
  .nav-link.active::before {
    top: 50%;
    transform: translateY(-50%);
    left: calc(-1 * var(--spacing-md));
    width: 3px;
    height: 20px;
  }

  /* 隐藏桌面端电话 */
  .header-phone {
    display: none;
  }

  /* Footer 单列排布 */
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================
   响应式 - 手机端（480px 以下）
   ============================================ */
@media screen and (max-width: 480px) {
  :root {
    --navbar-height: 56px;
  }

  .logo {
    font-size: 20px;
  }

  .logo-img {
    width: 120px;
  }

  .container {
    padding: 0 var(--spacing-md);
  }

  .qrcode-img {
    width: 100px;
    height: 100px;
  }
}
