/* ========================================================================
 * 首页「添加微信」入口 + 微信二维码弹窗
 * 入口位于左侧简介卡下方（与 Email 同组），点击弹出复古窗口样式的二维码。
 * 无 JS 时入口退化为直接打开二维码图片，弹窗本身保持 hidden。
 * ====================================================================== */

/* ---------- 左侧栏：联系方式（Email + 微信） ---------- */
.hero-contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.hero-contact .hero-email {
    margin-top: 0;
}

.hero-wechat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--retro-navy, #000080);
    border: 2px solid;
    border-color: var(--retro-highlight, #fff) var(--retro-dark, #202020) var(--retro-dark, #202020) var(--retro-highlight, #fff);
    background: #e4e4e4;
    box-shadow: 1px 1px 0 #000;
    font-family: var(--retro-ui, Tahoma, sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.hero-wechat:visited {
    color: var(--retro-navy, #000080);
}

.hero-wechat:hover {
    color: var(--retro-hover, #cc0000);
    background: #f4f4f4;
    border-color: var(--retro-shadow, #808080) var(--retro-highlight, #fff) var(--retro-highlight, #fff) var(--retro-shadow, #808080);
}

.hero-wechat:active {
    border-color: var(--retro-dark, #202020) var(--retro-highlight, #fff) var(--retro-highlight, #fff) var(--retro-dark, #202020);
    box-shadow: none;
    transform: translate(1px, 1px);
}

.hero-wechat-qr {
    flex: 0 0 auto;
    color: #07c160;
}

/* ---------- 二维码弹窗 ---------- */
.wechat-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

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

.wechat-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

.wechat-modal-window {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    background: var(--retro-desktop, #d4d0c8);
    border: 2px solid;
    border-color: var(--retro-highlight, #fff) var(--retro-dark, #202020) var(--retro-dark, #202020) var(--retro-highlight, #fff);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
}

.wechat-modal-titlebar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 4px 9px;
    background: var(--retro-navy, #000080);
    color: #fff;
    font-family: var(--retro-ui, Tahoma, sans-serif);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
}

.wechat-modal-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 22px;
    padding: 0;
    color: #111;
    border: 2px solid;
    border-color: var(--retro-highlight, #fff) var(--retro-dark, #202020) var(--retro-dark, #202020) var(--retro-highlight, #fff);
    background: var(--retro-panel, #c0c0c0);
    box-shadow: 1px 1px 0 #000;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
}

.wechat-modal-close:active {
    border-color: var(--retro-dark, #202020) var(--retro-highlight, #fff) var(--retro-highlight, #fff) var(--retro-dark, #202020);
    box-shadow: none;
}

.wechat-modal-body {
    padding: 14px 16px 16px;
    overflow: auto;
    background: var(--retro-paper, #fff);
    border-top: 2px solid var(--retro-dark, #202020);
    text-align: center;
}

.wechat-modal-qr {
    display: block;
    width: auto;
    height: auto;
    max-width: min(360px, 74vw);
    max-height: min(56vh, 520px);
    margin: 0 auto;
    background: #fff;
    border: 1px solid #d0d0d0;
}

.wechat-modal-hint {
    margin: 10px 0 0;
    color: var(--retro-muted, #404040);
    font-size: 0.78rem;
}

/* 弹窗打开时锁住页面滚动 */
html.wechat-modal-lock,
html.wechat-modal-lock body {
    overflow: hidden;
}

@media (max-width: 420px) {
    .wechat-modal {
        padding: 10px;
    }

    .wechat-modal-window {
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
    }

    .wechat-modal-body {
        padding: 12px;
    }

    .wechat-modal-qr {
        max-width: 78vw;
        max-height: 52vh;
    }
}
