/* =========================================================
   user.css — 用户端：质保防伪查询（响应式，移动优先）
   ========================================================= */

body.user-page {
  background:
    radial-gradient(1100px 520px at 82% -200px, #f3ecec 0%, transparent 60%),
    var(--bg);
}

/* ------------------------------ 顶栏 ------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(230, 234, 241, 0.9);
  backdrop-filter: saturate(160%) blur(14px);
}

.site-header .bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  height: 20px;
  width: auto;
}

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.lang-switch button {
  min-width: 40px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--graphite);
  color: #fff;
}

/* ------------------------------ Hero ------------------------------ */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 0;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: linear-gradient(140deg, #070708 0%, #141417 52%, #24262a 100%);
  box-shadow: var(--sh-3);
  padding: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  gap: 40px;
  align-items: center;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 0, 18, 0.20) 0%, transparent 62%);
  pointer-events: none;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 22% 30%, #000 0%, transparent 72%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  color: #fff;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(229, 0, 18, 0.38);
  border-radius: 999px;
  background: rgba(229, 0, 18, 0.14);
  color: #ffc9c4;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(229, 0, 18, 0.26);
}

.hero-copy h1 {
  margin-top: 18px;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* 英文字数多，略降字号以免出现单词孤行 */
html[lang="en"] .hero-copy h1 {
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: -0.02em;
}

.hero-copy h1 .hl {
  color: var(--brand-light);
}

.hero-copy p {
  margin-top: 14px;
  max-width: 46ch;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14.5px;
  line-height: 1.72;
}

.hero-points {
  margin-top: 26px;
  display: grid;
  gap: 12px;
}

.hero-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.86);
}

.hero-points .tick {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(229, 0, 18, 0.22);
  color: var(--brand-light);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

/* ------------------------------ 查询卡 ------------------------------ */
.search-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.55);
}

.search-card h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.search-card .sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.search-form {
  display: grid;
  gap: 12px;
}

.search-form .input {
  min-height: 50px;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.search-form .btn {
  min-height: 50px;
  font-size: 15px;
}

.search-hint {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 13px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.search-hint svg {
  flex: none;
  margin-top: 2px;
}

.form-msg {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

/* ------------------------------ 说明步骤 ------------------------------ */
.steps {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 20px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.step {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

.step .num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--brand-50);
  color: #b0000c;
  font-size: 12.5px;
  font-weight: 800;
}

.step h3 {
  margin-top: 12px;
  font-size: 14.5px;
  font-weight: 700;
}

.step p {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
}

/* ------------------------------ 查询结果 ------------------------------ */
.result-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 38px 20px 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.section-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.section-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 电子质保证书 */
.cert {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, #ffffff 0%, #fcfcfd 100%);
  border: 1px solid #e4e4e7;
  border-radius: 20px;
  box-shadow: 0 30px 70px -34px rgba(11, 18, 32, 0.4);
  color: #111114;
}

/* 证书顶边：品牌红 + 墨黑双色条，呼应 LOGO */
.cert::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 55%, #b0000c 100%);
  z-index: 3;
}

.cert-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  width: 172px;
  height: 172px;
  pointer-events: none;
  opacity: 0.95;
  z-index: 0;
}

.cert-inner {
  position: relative;
  z-index: 1;
  padding: 34px 38px 30px;
}

.cert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #ececef;
}

.cert-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.cert-logo {
  height: 22px;
  width: auto;
}

.cert-brand-sub {
  display: block;
  font-size: 10px;
  color: #8e8e96;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
}

.cert-no {
  text-align: right;
  font-size: 11.5px;
  color: #7c7c86;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e9e9ec;
  backdrop-filter: blur(4px);
}

.cert-no b {
  display: block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px;
  color: #111114;
  letter-spacing: 0.02em;
}

.cert-title {
  text-align: center;
  padding: 26px 0 8px;
}

.cert-title h3 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: #101114;
}

.cert-title .en {
  display: block;
  margin-top: 8px;
  font-size: 10.5px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #9a9aa4;
}

/* 英文标题字距收紧，避免长词溢出窄屏 */
.cert.is-en .cert-title h3 {
  font-size: clamp(20px, 3.2vw, 30px);
  letter-spacing: 0.01em;
  text-indent: 0;
  font-family: var(--font-sans);
  font-weight: 700;
}

.cert.is-en .cert-title .en {
  letter-spacing: 0.22em;
}

.cert-title .rule {
  width: 62px;
  height: 2px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
}

.cert-intro {
  margin: 10px 0 24px;
  text-align: center;
  font-size: 12.5px;
  color: #6b7280;
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #ececef;
  border-left: 1px solid #ececef;
  border-radius: 10px;
  overflow: hidden;
}

.cert-cell {
  padding: 13px 16px;
  border-right: 1px solid #ececef;
  border-bottom: 1px solid #ececef;
  background: rgba(255, 255, 255, 0.6);
}

.cert-cell dt {
  font-size: 11px;
  color: #8e8e96;
  letter-spacing: 0.06em;
}

.cert-cell dd {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #111114;
  word-break: break-word;
  line-height: 1.45;
}

.cert-cell.is-wide {
  grid-column: span 2;
}

.cert-cell.is-highlight dd {
  color: #b0000c;
}

.cert-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-top: 26px;
}

.cert-verify {
  display: flex;
  align-items: center;
  gap: 14px;
}

.qr {
  width: 78px;
  height: 78px;
  padding: 5px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e4e4e7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cert-verify p {
  font-size: 11px;
  line-height: 1.65;
  color: #7c7c86;
  max-width: 30ch;
}

.cert-stamp {
  text-align: center;
  flex: none;
}

.stamp {
  width: 102px;
  height: 102px;
  border-radius: 50%;
  border: 2px solid rgba(229, 0, 18, 0.45);
  color: rgba(229, 0, 18, 0.78);
  display: grid;
  place-items: center;
  transform: rotate(-12deg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-align: center;
}

.cert-stamp span {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #7c7c86;
  letter-spacing: 0.04em;
}

.cert-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px dashed #e4e4e7;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  font-size: 11px;
  color: #8e8e96;
}

/* 状态条 */
.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 13px 18px;
  margin-bottom: 16px;
  border-radius: var(--r);
  background: var(--ok-bg);
  color: #0b6b49;
  font-size: 13px;
  font-weight: 600;
}

.status-bar.is-expired {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-bar .meta {
  margin-left: auto;
  font-weight: 500;
  font-size: 12.5px;
  opacity: 0.86;
}

/* ------------------------------ 页脚 ------------------------------ */
.site-footer {
  max-width: 1180px;
  margin: 60px auto 0;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--graphite);
}

.site-footer .footer-beian {
  margin-left: 14px;
  white-space: nowrap;
  color: var(--muted);
}

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1020px) {
  .hero-panel {
    grid-template-columns: minmax(0, 1fr);
    padding: 32px;
    gap: 28px;
  }
  .hero-copy p {
    max-width: none;
  }
  .hero-points {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
  }
  .search-card {
    max-width: 520px;
  }
}

@media (max-width: 860px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cert-inner {
    padding: 26px 22px 24px;
  }
}

@media (max-width: 640px) {
  body.user-page {
    font-size: 14.5px;
  }
  .site-header .bar {
    padding: 10px 16px;
  }
  .brand-logo {
    height: 17px;
  }
  .hero {
    padding: 16px 14px 0;
  }
  .hero-panel {
    padding: 24px 18px;
    border-radius: 18px;
    gap: 22px;
  }
  .hero-copy h1 {
    margin-top: 14px;
  }
  .hero-points {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 18px;
  }
  .search-card {
    padding: 18px;
    border-radius: 14px;
  }
  /* 页脚改为纵向排列：版权、备案号、客服各占一行，左对齐，避免备案号缩在中间 */
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 40px;
    padding: 20px 16px 32px;
  }
  .site-footer .footer-beian {
    margin-left: 0;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
    padding: 22px 14px 0;
  }
  .result-section {
    padding: 26px 14px 0;
  }
  .cert-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cert-cell.is-wide {
    grid-column: span 1;
  }
  .cert-title {
    padding: 20px 0 6px;
  }
  .cert-title h3 {
    letter-spacing: 0.18em;
    text-indent: 0.18em;
  }
  .cert-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .cert-stamp {
    align-self: flex-end;
  }
  .cert-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .cert-ribbon {
    width: 118px;
    height: 118px;
  }
  .cert-logo {
    height: 18px;
  }
  .cert-no {
    text-align: left;
  }
  .status-bar .meta {
    margin-left: 0;
    width: 100%;
  }
  .section-actions {
    width: 100%;
  }
  .section-actions .btn {
    flex: 1;
  }
}

/* ------------------------------ 打印：只输出质保证书，且强制单页 A4 ------------------------------ */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  html,
  body.user-page {
    height: auto !important;
    min-height: 0 !important;
    background: #fff;
  }

  .site-header,
  .hero,
  .steps,
  .site-footer,
  .section-head,
  .status-bar,
  .toast-stack,
  .no-print {
    display: none !important;
  }

  .result-section {
    padding: 0;
    max-width: none;
    margin: 0;
  }

  /* 整张证书是一个不可分割的整体：宁可整体缩放，也不允许从中间断页 */
  .cert {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #dcdcde;
    box-shadow: none;
    border-radius: 0;
    background: #fff;
  }

  .cert::before {
    height: 2.5px;
  }

  .cert-ribbon {
    width: 118px;
    height: 118px;
  }

  /* 内边距由 18mm 收到 9mm/10mm，把省下的高度让给正文 */
  .cert-inner {
    padding: 11mm 12mm 10mm;
  }

  .cert-top {
    padding-bottom: 14px;
  }
  .cert-logo {
    height: 20px;
  }
  .cert-brand-sub {
    font-size: 9.5px;
    letter-spacing: 0.1em;
  }
  .cert-no {
    padding: 7px 11px;
    font-size: 10.5px;
  }
  .cert-no b {
    font-size: 11.5px;
  }

  .cert-title {
    padding: 20px 0 4px;
  }
  .cert-title h3 {
    font-size: 29px;
    letter-spacing: 0.24em;
    text-indent: 0.24em;
  }
  .cert-title .en {
    margin-top: 6px;
    font-size: 9.5px;
    letter-spacing: 0.28em;
  }
  .cert.is-en .cert-title h3 {
    font-size: 25px;
  }
  .cert-title .rule {
    width: 58px;
    margin-top: 11px;
  }

  .cert-intro {
    margin: 9px 0 16px;
    font-size: 11.5px;
    line-height: 1.55;
  }

  /* 打印视口宽度约 190mm，此宽度下双列信息最省高度 */
  .cert-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .cert-cell {
    padding: 9px 12px;
  }
  .cert-cell.is-wide {
    grid-column: span 2 !important;
  }
  .cert-cell dt {
    font-size: 10px;
  }
  .cert-cell dd {
    margin-top: 3px;
    font-size: 12.5px;
    line-height: 1.4;
  }

  .cert-bottom {
    margin-top: 20px;
    gap: 16px;
  }
  .qr {
    width: 70px;
    height: 70px;
    padding: 4px;
  }
  .cert-verify {
    gap: 10px;
  }
  .cert-verify p {
    max-width: 34ch;
    font-size: 10.5px;
    line-height: 1.55;
  }
  .stamp {
    width: 92px;
    height: 92px;
    font-size: 10px;
  }
  .cert-stamp span {
    margin-top: 4px;
    font-size: 10px;
  }

  .cert-foot {
    margin-top: 16px;
    padding-top: 11px;
    gap: 4px 14px;
    font-size: 10px;
  }

  .cert::before,
  .qr i.on,
  .stamp,
  .badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
