/*
 * contact.css — 「联系我们」多通道联系面板
 *
 * 解决的问题
 * ----------
 * 落地页原来的「联系我们」是裸 mailto: 链接，点击会唤起系统默认邮件客户端
 * （在 Windows 上就是 Outlook）。大量用户并没有 Outlook、或不想用它，
 * 于是「联系我们」这一步直接流失。
 *
 * 方案
 * ----
 * 统一弹层「联系面板」，站点上所有「联系我们」入口都打开它：
 *   ① 邮件 —— 一键复制地址为主（主按钮），mailto 为辅（次要文字链）
 *   ② 微信 —— 复用公众号二维码 + assets/js/wecom-qr.js 的放大灯箱
 *
 * ⚠ CSS 变量
 *   index.html **不加载** assets/css/tokens.css（它用自己内联的 :root），
 *   那套 :root 没有 --radius-* / --shadow-*。
 *   → 本文件凡用到这两个族，一律带 fallback。
 *
 * ⚠ z-index
 *   本面板 overlay = 900，微信放大灯箱 .wecom-lightbox = 9999。
 *   必须 900 < 9999，否则在面板里点开二维码时，灯箱会被压在面板下面。
 *
 * ⚠ 滚动锁
 *   本面板用 body.contact-lock，微信灯箱用 body.wecom-lock —— 两个不同的
 *   class，否则关掉灯箱会把面板的锁一起解掉。
 */

/* =============================================================
 * 1. 触发按钮
 * -------------------------------------------------------------
 * 「联系我们」入口从 <a> 换成了 <button>（打开对话框用 button 语义才正确）。
 * 这里只重置「锚点没有、按钮有」的那几项 UA 默认样式；
 * 绝不动 padding / display / font-size —— 那些由 .nav-link、
 * .mobile-menu-link、.btn-ghost-w 等原有类负责。
 * ============================================================= */

.contact-trigger {
  font-family: inherit;
  line-height: inherit;
  background: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.contact-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 移动端菜单项：<a> 是块级 flex 会撑满，<button> 不会 */
.mobile-menu-link.contact-trigger {
  width: 100%;
  text-align: left;
}

/* 页脚里的「联系我们」：外观与原来的 <a> 完全一致 */
.foot-col .contact-trigger,
.footer__col .contact-trigger {
  display: inline-block;
  padding: 0;
  text-align: left;
  font-size: 14px;
  color: var(--ink-3);
  transition: color 0.15s;
}

.foot-col .contact-trigger:hover,
.footer__col .contact-trigger:hover {
  color: var(--primary);
  text-decoration: none;
}

/* 404 页用的 .btn.btn-outline 改成 <button> 后补回字体继承 */
button.btn {
  font-family: inherit;
}

/* CTA 区块里的「联系我们」按钮
 * （它原来 href="#contact"，而它自己就在 id="contact" 的 section 里 —— 死按钮） */
.cta-band button.btn-ghost-w {
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

/* =============================================================
 * 2. 面板容器
 * ============================================================= */

.contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;                /* 必须 < 9999（.wecom-lightbox） */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 23, 30, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.contact-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.contact-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 26px 20px;
  background: var(--card, #fff);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  transform: scale(0.96);
  transition: transform 0.18s ease;
}

.contact-overlay.is-open .contact-card {
  transform: scale(1);
}

.contact-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: center;
}

.contact-title:focus {
  outline: none;
}

.contact-sub {
  margin: 6px 0 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  text-align: center;
}

.contact-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.contact-close:hover {
  background: rgba(20, 23, 30, 0.06);
  color: var(--ink);
}

.contact-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* =============================================================
 * 3. 通道
 * ============================================================= */

.contact-channel {
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 10px);
  background: var(--bg-soft, #f3f0e8);
}

.contact-channel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.contact-channel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* ---- 邮件通道 ---- */

.contact-email-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-email {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--card, #fff);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-mono, ui-monospace, 'SF Mono', Menlo, Consolas, monospace);
  font-size: 14px;
  color: var(--ink);
  word-break: break-all;
  /* 点一下就全选，方便手动复制 */
  user-select: all;
}

.contact-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.contact-copy:hover {
  background: var(--primary-hover, #1d3590);
}

.contact-copy:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.contact-copy.is-done {
  background: #15803d;
}

.contact-copy svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.contact-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-3);
}

.contact-mailto {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact-mailto:hover {
  color: var(--primary-hover, #1d3590);
}

/* ---- 分隔 ---- */

.contact-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--ink-4);
  font-size: 12px;
}

.contact-sep::before,
.contact-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---- 微信通道 ---- */

.contact-wechat {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.contact-wechat-text {
  flex: 1 1 auto;
  min-width: 0;
}

.contact-wechat-text p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

.contact-wechat-name {
  font-weight: 600;
  color: var(--ink);
}

.contact-copy--ghost {
  min-height: 32px;
  padding: 0 12px;
  background: var(--card, #fff);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
}

.contact-copy--ghost:hover {
  background: var(--card, #fff);
  border-color: var(--primary);
  color: var(--primary);
}

.contact-copy--ghost.is-done {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

/* =============================================================
 * 4. 状态播报（aria-live）
 * ============================================================= */

.contact-status {
  margin: 12px 0 0;
  min-height: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}

.contact-status.is-ok {
  color: #15803d;
}

.contact-status.is-warn {
  color: var(--warn, #b45309);
}

/* 弹层打开时锁住背景滚动（class 与微信灯箱的 wecom-lock 分开） */
body.contact-lock {
  overflow: hidden;
}

/* =============================================================
 * 5. 响应式
 * ============================================================= */

@media (max-width: 560px) {
  .contact-overlay {
    padding: 16px;
    align-items: flex-end;
  }

  .contact-card {
    padding: 22px 18px 18px;
    max-height: calc(100vh - 32px);
  }

  .contact-email-row {
    flex-direction: column;
    align-items: stretch;
  }

  /* 竖排后 flex-basis 会变成「高度」—— 必须显式收掉，
     否则邮箱框会被撑成 220px 高的大白块 */
  .contact-email {
    flex: 0 0 auto;
  }

  .contact-copy {
    width: 100%;
  }

  .contact-wechat {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* =============================================================
 * 6. 无障碍：尊重「减少动态效果」偏好
 * ============================================================= */

@media (prefers-reduced-motion: reduce) {
  .contact-overlay,
  .contact-card,
  .contact-copy,
  .contact-close {
    transition: none;
  }

  .contact-overlay.is-open .contact-card {
    transform: none;
  }
}
