/* ==========================================================================
   充电车主福利 · 微信推文 H5
   设计稿宽度 750px（2x），页面在移动端全宽铺满，宽屏限制 750px 居中。
   二维码卡片原始宽度 480px，宽屏居中显示，避免放大导致模糊。
   ========================================================================== */

:root {
  --page-max: 750px;
  --page-bg: #f2f2f3;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --muted: #8a8f99;
  --focus: #c8102e;
  --radius: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------- 推文主体 ---------- */
.poster {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  background: var(--card-bg);
}

.poster__item {
  margin: 0;
  padding: 0;
  line-height: 0; /* 消除图片行内基线间隙，保证无缝堆叠 */
  position: relative;
}

.poster__item img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- 二维码入口卡片（原始 480px，宽屏居中） ---------- */
.poster__link {
  display: block;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  text-decoration: none;
  border: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.16s ease, filter 0.16s ease;
}

/* 仅当 JS 增强后禁用原生长按菜单；无 JS 时保留微信原生“识别二维码” */
.poster__link.is-enhanced {
  -webkit-touch-callout: none;
}

.poster__link img {
  display: block;
  width: 100%;
  height: auto;
}

.poster__link:active {
  transform: scale(0.996);
  filter: brightness(0.98);
}

.poster__link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

/* 卡片内操作提示：点击直达 · 长按看大图 */
.poster__hint {
  position: absolute;
  right: 8px;
  bottom: 7px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #c8102e;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- 图片加载失败兜底 ---------- */
.poster__item.is-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  background: #f6f7f9;
}

.poster__item.is-error img {
  display: none;
}

.poster__item.is-error::after {
  content: "图片加载失败 · 请刷新页面重试";
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------- 底部提示（默认隐藏，可通过 JS/配置开启） ---------- */
.poster__footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  text-align: center;
  background: var(--card-bg);
}

.poster__footer p {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------- 宽屏：卡片化居中 ---------- */
@media (min-width: 760px) {
  body {
    padding: 28px 0;
  }

  .poster {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(17, 17, 26, 0.1);
  }

  .poster__footer {
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

/* ---------- 二维码放大弹层 ---------- */
body.is-locked {
  overflow: hidden;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.qr-modal[hidden] {
  display: none;
}

.qr-modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 26, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: qr-fade 0.18s ease both;
}

.qr-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(86vw, 340px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 28px 24px 24px;
  overflow-y: auto;
  text-align: center;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(17, 17, 26, 0.24);
  animation: qr-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.qr-modal__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #8a8f99;
}

.qr-modal__title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
}

.qr-modal__desc {
  max-width: 240px;
  margin: 0 auto 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #5b6069;
}

.qr-modal__code {
  width: min(58vw, 220px);
  margin: 0 auto 18px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #eceded;
  border-radius: 12px;
}

/* 弹层内的二维码必须允许长按识别，切勿设置 touch-callout:none */
.qr-modal__code img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.qr-modal__btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  background: #c8102e;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.qr-modal__btn:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

.qr-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #5b6069;
  cursor: pointer;
}

.qr-modal__close:hover {
  background: #e9eaee;
}

@keyframes qr-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes qr-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .qr-modal__mask,
  .qr-modal__dialog {
    animation: none;
  }
  .poster__link {
    transition: none;
  }
}

/* ---------- 无障碍：仅供读屏的文本 ---------- */
.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;
}