/* ============================================================
 * popups.css — 文章页订阅弹窗样式 (v20260928a)
 *
 * 配套：layouts/_partials/popups/popup-engine.html
 *      layouts/_partials/popups/popups/subscribe_random.html
 *      static/js/popup-engine.js
 *
 * 设计原则：
 *   - 与现有 .mlwm-auth-modal / .mlwm-denied-modal 同根（浅色卡 + 圆角 + 软阴影）
 *   - 视觉重音：绿色主调 (#22c55e) + 礼物/新用户徽章 + 4 特性 + 大 CTA
 *   - 移动端：max-width 100%，features 改 2 列，关闭按钮加 hit area
 * ============================================================ */

/* === 容器 ====================================================== */
.mlwm-popup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.mlwm-popup[aria-hidden="false"] { display: flex; }

.mlwm-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: mlwm-popup-fade-in 0.18s ease-out;
}

.mlwm-popup__dialog {
  position: relative;
  width: 100%;
  max-width: 500px;             /* 880 × 0.6 — 缩窄 40% 让弹窗更紧凑 */
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 20px 60px -10px rgba(0, 0, 0, 0.25),
    0 8px 24px -8px rgba(34, 197, 94, 0.15);
  padding: 20px 28px 20px;      /* 等比缩 padding 跟宽度匹配 */
  animation: mlwm-popup-scale-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === 关闭按钮 ================================================== */
.mlwm-popup__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.mlwm-popup__close:hover,
.mlwm-popup__close:focus-visible {
  background: #f3f4f6;
  color: #4b5563;
  outline: none;
}

/* === 头部（横向：文左 + 插画右，缩窄后插画收到 160px 让出文字空间）=== */
.mlwm-popup__header {
  display: flex;
  flex-direction: row;          /* column → row：恢复横向布局 */
  align-items: flex-start;      /* center → flex-start：左对齐 */
  gap: 16px;                    /* 14 → 16：row 间距稍大 */
}
.mlwm-popup__header-text { flex: 1; min-width: 0; }
.mlwm-popup__illustration {
  flex: 0 0 auto;
  width: 160px;                 /* 140 → 160：row 布局插画稍大 */
}
.mlwm-popup__illustration svg {
  width: 100%;
  height: auto;
  display: block;
}

/* 礼物 + 徽章(列居中父里,row 自己也居中) */
.mlwm-popup__badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.mlwm-popup__gift {
  display: inline-flex;
  width: 32px;
  height: 32px;
}
.mlwm-popup__gift svg { width: 100%; height: 100%; }
.mlwm-popup__badge {
  display: inline-block;
  padding: 4px 12px;
  background: #dcfce7;
  color: #16a34a;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* 标题 + 副标题 */
.mlwm-popup__title {
  margin: 0 0 8px;
  font-size: 22px;              /* 26 → 22:缩窄后标题等比缩 */
  font-weight: 700;
  line-height: 1.35;
  color: #111827;
  letter-spacing: -0.01em;
}
.mlwm-popup__title-accent { color: #22c55e; }
.mlwm-popup__subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #6b7280;
}

/* === 分割线 ==================================================== */
.mlwm-popup__divider {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0 16px;
}

/* === 4 特性 grid(2 行 2 列,2x2 排布)============================= */
.mlwm-popup__features {
  list-style: none;
  margin: -5px 0 9px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 18px;               /* 行距 / 列距 分开,2 列更疏 */
}
.mlwm-popup__feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.mlwm-popup__check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
}
.mlwm-popup__check svg {
  width: 100%;
  height: 100%;
  display: block;
}
.mlwm-popup__feature-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mlwm-popup__feature-text strong {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}
.mlwm-popup__feature-text span {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.5;
}

/* === CTA(镜像 .trial-callout__cta in static/css/pricing.css) ============
 * 弹窗 "查看订阅" 与 pricing "立即注册" 视觉完全一致 —— 用户从弹窗跳到
 * /pricing/ 时按钮是同一个色/字号/圆角/hover,无认知切换。
 * 改两边任何一处都要同步另一边,这是 source-of-truth 双向约束。 */
.mlwm-popup__cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.mlwm-popup__cta,
.mlwm-popup__cta:visited,
.mlwm-popup__cta:hover,
.mlwm-popup__cta:focus,
.mlwm-popup__cta:active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #16a34a;
  color: #fff !important;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.mlwm-popup__cta:hover { background: #15803d; }
.mlwm-popup__cta:active { transform: translateY(1px); }
.mlwm-popup__cta svg { width: 14px; height: 14px; }

.mlwm-popup__subscribed-hint {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}
.mlwm-popup__subscribed-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #6b7280;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mlwm-popup__subscribed-link:hover { color: #4b5563; }

/* === 动画 ====================================================== */
@keyframes mlwm-popup-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mlwm-popup-scale-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* === 响应式 ==================================================== */
@media (max-width: 720px) {
  .mlwm-popup__dialog {
    padding: 20px 18px 18px;
    border-radius: 14px;
  }
  /* 移动端恢复列布局(528 dialog 在 ≤720 屏幕下,row 塞不下插画+文字) */
  .mlwm-popup__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }
  .mlwm-popup__header-text { width: 100%; }
  .mlwm-popup__badge-row { justify-content: center; }
  .mlwm-popup__illustration { width: 120px; align-self: center; }
  .mlwm-popup__title { font-size: 20px; }
  .mlwm-popup__features { gap: 12px; }
}
@media (max-width: 420px) {
  .mlwm-popup__features { grid-template-columns: 1fr; }
  .mlwm-popup__title { font-size: 18px; }
  .mlwm-popup__illustration { width: 100px; }
}

/* === 减少动画（无障碍） ======================================== */
@media (prefers-reduced-motion: reduce) {
  .mlwm-popup__backdrop,
  .mlwm-popup__dialog { animation: none; }
}
