/* =========================================================
   中汇能源化工集团 · 官网（证书查询平台首页）
   目录：
   1. 基础重置 / 变量
   2. 顶部页头（Logo、语言、二维码）
   3. 主导航（红色导航条）
   4. 首屏主视觉（缎带 + 查询表单 + 工厂插画）
   5. 查询结果弹层
   6. 页脚
   7. 响应式（平板 / 手机）
   ========================================================= */

/* ---------- 1. 基础 ---------- */
:root {
  --red: #c8102e;
  --red-deep: #a50d24;
  --red-soft: #e04048;
  /* 导航红：取自原站实测色值 rgb(204,0,4) */
  --nav-red: #cc0000;
  --ink: #222222;
  --ink-2: #555555;
  --ink-3: #8c8c8c;
  --line: #cfcfcf;
  /* 页面内容宽 1000px（原站实测红条 1004px），内外各留 20px 内边距 */
  --page-max: 1040px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", Arial, sans-serif;
  color: var(--ink);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

img { border: 0; }

a { color: inherit; }

.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 2. 页头 ---------- */
.site-header { background: #ffffff; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  /* 原站页头实测 99px：二维码 75px + 上下各 12px，logo 在 75px 行内垂直居中 */
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: block;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand-img {
  display: block;
  width: 215px;
  height: 60px;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 36px;
}

/* 语言切换 */
.lang-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: #4a4a4a;
}

.lang-list li { display: flex; align-items: center; }

.lang-list a {
  text-decoration: none;
  color: #4a4a4a;
  transition: color .18s;
}

.lang-list a:hover { color: var(--red); }

.lang-globe {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  flex: 0 0 auto;
}

/* 二维码 */
.qr-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.social-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #c8102e;
  white-space: nowrap;
  line-height: 1;
}

.social-ico {
  width: 19px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 19px;
}

.social-ico img {
  display: block;
  max-width: 19px;
  height: auto;
}

.qr-code {
  width: 75px;
  height: 75px;
  display: block;
  border: 1px solid #e6e6e6;
}

/* ---------- 3. 主导航 ---------- */
/* 白底页面，只有菜单这一块是红底，宽度与页头内容区对齐 */
.main-nav {
  background: #ffffff;
  position: relative;
  z-index: 30;
}

.nav-inner {
  display: flex;
  align-items: stretch;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: stretch;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--nav-red);
}

/* 菜单项按内容宽度排布（与原站一致），红条右侧留少量纯红余量 */
.nav-list > li {
  flex: 0 0 auto;
}

.nav-list a {
  display: block;
  padding: 0 14px;
  line-height: 28px;
  font-size: 14px;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
  transition: background-color .16s, color .16s;
}

.nav-list a:hover,
.nav-list a.is-active {
  background: #ffffff;
  color: var(--nav-red);
}

/* 导航下方的整页红色横条（原站实测：距导航 20px，高 9px，通栏） */
.red-rule {
  height: 9px;
  margin-top: 20px;
  background: var(--nav-red);
  flex: 0 0 auto;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  margin-left: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #ffffff;
  margin: 4px auto;
  transition: transform .2s, opacity .2s;
}

.nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- 4. 首屏 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 46px 0 185px;
  background: linear-gradient(180deg, #e5f1f7 0%, #edf7fa 36%, #f6fbfc 66%, #ffffff 100%);
}

.hero::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  /* 铺满整个主视觉区：cover 保证上方不留空白带 */
  background: url("../img/factory.png") center bottom / cover no-repeat;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

/* 红色缎带 —— 现在是 530×70 的图片（assets/img/ribbon-title.png） */
.ribbon {
  display: flex;
  justify-content: center;
  margin-bottom: 56px;
}

.ribbon-img {
  display: block;
  width: 530px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 530 / 70;   /* 图还没加载完也不跳版 */
}

/* 查询表单 */
.verify-form {
  max-width: 430px;
  margin: 0 auto;
}

.field {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.field-label {
  flex: 0 0 100px;
  width: 100px;
  text-align: right;
  padding-right: 10px;
  font-size: 15px;
  color: #333333;
  line-height: 1.4;
}

.field-label .req {
  color: #d8262c;
  margin-right: 1px;
}

.control {
  width: 330px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #ffffff;
  padding: 0 10px;
  font-size: 14px;
  color: #333333;
  font-family: inherit;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.text-input::placeholder { color: #a9a9a9; }

.text-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, .1);
}

.text-input.has-error {
  border-color: #d8262c;
  background: #fff8f8;
}

/* 验证码行 */
.field-captcha .control .text-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.captcha-img {
  width: 96px;
  height: 36px;
  flex: 0 0 96px;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  display: block;
  background: #ffffff;
}

.captcha-refresh {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 11px;
  color: #555555;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  text-align: center;
  width: 48px;
  white-space: nowrap;
}

.captcha-refresh:hover { color: var(--red); }

.btn-submit {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 15px;
  border: 0;
  border-radius: 2px;
  background: var(--red);
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background-color .18s;
}

.btn-submit:hover { background: var(--red-deep); }
.btn-submit:active { transform: translateY(1px); }

/* 查询请求进行中：变淡、不可重复点 */
.btn-submit.is-busy,
.btn-submit[disabled] {
  background: #e08a94;
  cursor: default;
  transform: none;
}

/* 表单提示 */
.form-msg {
  max-width: 420px;
  margin: 0 auto;
  min-height: 20px;
  padding-left: 100px;
  font-size: 13px;
  color: #d8262c;
  text-align: left;
}

.form-msg.is-ok { color: #1f8a4c; }

/* ---------- 5. 查询结果弹层 ---------- */
/* 无遮罩、无阴影，白底红框浮动窗口，位置对齐查询表单区域（与原站一致）。
   这里用 absolute 走「文档坐标」而不是 fixed：
   fixed 的基准是布局视口，手机端视口被锁成 1040 宽后高达 2250px，
   真机一缩放/平移就错位；absolute 相对文档，缩放平移都不影响。 */
.cert-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* 卡片比可视区高时（小屏横屏、系统字体放大）可滚动，不至于被裁掉 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cert-modal.is-open { display: flex; }

.cert-card {
  position: relative;
  width: 100%;
  max-width: 620px;
  /* flex 容器里内容超高时，margin:auto 比 align-items:center 更安全，
     否则溢出部分顶部会被裁掉且滚不上去 */
  margin: auto;
  flex: 0 0 auto;
  background: #ffffff;
  border: 4px solid var(--nav-red);
  border-radius: 3px;
  padding: 26px 0 30px;
  animation: certIn .18s ease-out;
}

@keyframes certIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cert-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid var(--nav-red);
  border-radius: 50%;
  background: #ffffff;
  color: var(--nav-red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .16s;
}

.cert-close svg { width: 18px; height: 18px; display: block; }
.cert-close:hover { background: #fdecec; }

.cert-title {
  margin: 0 0 24px;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 1px;
  text-align: center;
  color: var(--nav-red);
}

.cert-body {
  display: grid;
  grid-template-columns: 1fr 88px;
  column-gap: 26px;
  padding: 0 42px;
}

.cert-main { grid-column: 1; grid-row: 1; }

.cert-photo { grid-column: 2; grid-row: 1; }

.cert-photo img {
  display: block;
  width: 88px;
  height: 120px;
  object-fit: cover;
  background: #dfe9f2;
}

.cert-extra {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 26px;
}

.cert-row {
  margin: 0;
  line-height: 47px;
  font-size: 18px;
  color: #333333;
  white-space: nowrap;
}

.cert-row .ck { color: #333333; }
.cert-row .cv { color: #222222; }

/* 未查询到数据 */
.cert-card--alert {
  max-width: 520px;
  padding: 40px 34px 56px;
  text-align: center;
}

.nf-title {
  margin: 0 0 18px;
  font-size: 18px;
  color: #444444;
}

.nf-text p {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.65;
  color: #444444;
  /* 换行时把两行长度拉平，避免最后一行只剩一两个字 */
  text-wrap: balance;
}

.nf-btn {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  min-width: 150px;
  height: 44px;
  padding: 0 26px;
  border: 0;
  background: var(--nav-red);
  color: #ffffff;
  font-size: 17px;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background-color .16s;
}

.nf-btn:hover { background: #b30000; }

/* 手机端：弹窗收窄、字段改单列，避免文字挤在一起 */
@media (max-width: 640px) {
  .cert-card { padding: 22px 0 24px; }
  .cert-title { font-size: 17px; margin-bottom: 16px; letter-spacing: 0; }
  .cert-close { top: 6px; right: 6px; width: 28px; height: 28px; }
  .cert-close svg { width: 15px; height: 15px; }

  .cert-body {
    grid-template-columns: 1fr 74px;
    column-gap: 14px;
    padding: 0 16px;
  }

  .cert-photo img { width: 74px; height: 100px; }
  .cert-row { font-size: 15px; line-height: 38px; }
  .cert-extra { grid-template-columns: 1fr; }

  .cert-card--alert { padding: 30px 20px 46px; }
  .nf-title { font-size: 16px; margin-bottom: 12px; }
  .nf-text p { font-size: 14px; }
  .nf-btn { min-width: 120px; height: 40px; font-size: 15px; bottom: -20px; }
}

/* ---------- 6. 页脚 ---------- */
.site-footer {
  background: #fbfbfb;
  border-top: 1px solid #ededed;
  padding: 22px 20px 26px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 2;
}

.site-footer p { margin: 0; }

.site-footer a { text-decoration: none; color: var(--ink-3); }
.site-footer a:hover { color: var(--red); }

.foot-sep { margin: 0 6px; color: #d0d0d0; }

/* ---------- 7. 响应式 ---------- */
@media (max-width: 1039px) {
  /* 内容变窄时收紧项间距，保证 11 项仍在一行内不溢出
     上限取 1039 而不是 1060：手机端视口锁定 1040 做等比缩放，
     1040 必须保持完整的桌面导航间距，否则缩放后与桌面版不一致 */
  .nav-list a { padding: 0 11px; font-size: 13.5px; }
  .header-side { gap: 24px; }
}

@media (max-width: 980px) {
  /* 导航折叠：红条与 logo 左边缘对齐，宽度含汉堡按钮 */
  .nav-inner {
    position: relative;
    background: var(--nav-red);
    margin-left: 20px;
    margin-right: 20px;
    padding-left: 0;
    padding-right: 0;
    min-height: 44px;
    align-items: center;
  }

  .nav-toggle {
    display: block;
    height: 44px;
    margin-left: 12px;
  }

  .nav-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    flex: none;
    flex-direction: column;
    background: var(--nav-red);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .18);
    max-height: 70vh;
    overflow-y: auto;
  }

  .nav-list.is-open { display: flex; }

  .nav-list > li { flex: none; }

  .nav-list a {
    text-align: left;
    line-height: 46px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    font-size: 15px;
  }

  .red-rule { margin-top: 16px; height: 8px; }

  /* 页头：隐藏二维码，保留语言 */
  .qr-box { display: none; }
  .header-inner { padding-top: 12px; padding-bottom: 12px; }
  .brand-img { width: 190px; height: 53px; }
  .lang-list { gap: 10px; font-size: 12px; }

  .hero { padding: 34px 0 140px; }
  .hero::before { background-size: cover; background-position: 76% bottom; }
  .ribbon { margin-bottom: 40px; }
}

@media (max-width: 720px) {
  /* 只改左右内边距，避免简写把页头上下的 padding 清零 */
  .container { padding-left: 16px; padding-right: 16px; }
  .nav-inner { margin-left: 16px; margin-right: 16px; }
  .nav-toggle { margin-left: 10px; }
  .red-rule { margin-top: 12px; height: 7px; }

  .header-inner { gap: 12px; }
  .brand-img { width: 165px; height: 46px; }
  .lang-list { gap: 8px; font-size: 11px; }
  .lang-globe { display: none; }

  /* 表单：标签上移，控件满宽 */
  .verify-form { max-width: 100%; padding: 0 4px; }

  .field {
    display: block;
    margin-bottom: 16px;
  }

  .field-label {
    display: block;
    width: auto;
    flex: none;
    text-align: left;
    padding: 0 0 6px;
    font-size: 14px;
  }

  .control { width: 100%; }

  .text-input { height: 40px; font-size: 15px; }

  .captcha-img { height: 40px; width: 104px; flex: 0 0 104px; }
  .btn-submit { height: 40px; padding: 0 16px; }

  .form-msg { padding-left: 0; text-align: left; }

  .ribbon-img { max-width: calc(100vw - 32px); }

  .hero { padding: 28px 0 135px; justify-content: flex-start; flex: 0 0 auto; }
  .hero::before { background-size: cover; background-position: 84% bottom; }

  .site-footer { font-size: 12px; line-height: 1.9; padding: 18px 16px 22px; }
  .foot-sep { display: none; }
  .foot-line { display: inline-block; white-space: nowrap; margin: 0 7px; }
}

@media (max-width: 420px) {
  .lang-list { display: none; }
  .brand-img { width: 150px; height: 42px; }
}

/* ---------- 手机端等比缩放模式（html.is-scaled-mobile）----------
   viewport 锁成 1040 后，视口高度被反向折算成 2000+ CSS px，
   body 的 100vh 会把首屏拉成几乎整屏，缎带和表单悬在正中（与参考站不符）。
   这里让首屏回到「按内容自然高度」，页脚紧随表单下方。 */
html.is-scaled-mobile body { min-height: 0; }

html.is-scaled-mobile .hero {
  flex: 0 0 auto;
  justify-content: flex-start;
  padding: 40px 0 96px;
}
