/*
 * style.css — 主样式表
 * ======================
 * 通过 CSS 变量（--accent / --text / --hero-overlay 等）实现
 * 亮色 ↔ 暗黑模式（.dark-mode）的无缝切换。
 * 包含主页 Hero、Grid 交互、侧边栏、Cookie 横幅、
 * 内容页面（白底/暗色）、进度条、页面转场动画等模块。
 * ======================
 */

/* ---- CSS 变量：亮色模式默认值 ---- */
:root {
    --accent: #66CCFF;                         /* 强调色（悬停、链接 hover） */
    --text: #ffffff;                           /* 默认文字色 */
    --side-bg: #FFFFFF;                        /* 侧边栏背景 */
    --side-text: #000000;                      /* 侧边栏文字 */
    --side-border: rgba(0,0,0,0.1);            /* 侧边栏分割线 */
    --hero-overlay: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.7));
    /* ↑ 主页 Hero 背景上的渐变蒙版：
       上半部浅（看清背景图），下半部深（白色文字突出） */
}

/* ---- CSS 变量覆写：暗黑模式 ---- */
body.dark-mode {
    --side-bg: #121212;
    --side-text: #E0E0E0;
    --side-border: rgba(255,255,255,0.15);
    --hero-overlay: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.9));
    --text: #f0f0f0;
}

/* ---- 全局重置 ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 基础字体栈：Noto Sans SC 优先，系统字体兜底 */
body { background: #000; font-family: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; min-height: 100vh; }

/* 全局链接：去掉下划线，使用强调色 */
a { color: #66CCFF; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #88DDFF; }

/* ===== 主页元素 ===== */

/*
 * Hero 背景层
 * 固定全屏，叠加渐变蒙版让文字始终可见。
 * 使用 Unsplash 远程背景图（已替换为用户图片）。
 * will-change + translateZ(0) 开启 GPU 合成层，减少侧边栏打开时的抖动。
 */
.hero-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--hero-overlay),
                url('https://img-cfr2.chatongxue.top/202504272356918.webp') center/cover no-repeat;
    z-index: 1;
    filter: blur(0px);
    transition: filter 0.5s ease;
    background-color: #1a1a2e; /* 图片加载前显示深色背景 */
    will-change: filter;
    transform: translateZ(0);
}

/* 页面容器：z-index 高于背景，居中，flex 纵向布局 */
.page-container {
    position: relative; z-index: 2; height: 100dvh; padding: 2rem 4rem;
    display: flex; flex-direction: column; justify-content: space-between;
    color: var(--text);
    max-width: 1400px; margin: 0 auto;
}

/* 顶部栏：logo + 菜单按钮 */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.logo {
    font-weight: 900; font-size: 1.4rem; color: #fff; cursor: pointer;
}
.menu-btn { font-weight: 700; cursor: pointer; opacity: 0.7; transition: 0.2s; font-size: 0.95rem; letter-spacing: 1px; }
.menu-btn:hover { opacity: 1; }

/* Hero 区块：居中展示一言文字和社交图标 */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

/* 社交图标容器：Hero 下方的社交链接 */
.hero-social {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    margin-top: 1.5rem;
}

@media (max-width: 600px) {
    .hero-social {
        gap: 0.8rem;
        max-width: 360px;
    }
}

@media (max-width: 380px) {
    .hero-social {
        gap: 0.6rem;
        max-width: 300px;
    }
}

/* 社交图标：圆形按钮，半透明底板，hover 上浮 */
.hero-social .social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--text-primary);
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    background: rgba(255,255,255,0.05);
}

.hero-social .social-icon:hover {
    border-color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.15);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/*
 * Hero 主文字：居中展示一言或悬停替换文字。
 * 通过 fade-out / fade-in 类实现由上而下的渐入渐出动画。
 * text-shadow 确保在背景图上始终清晰可见。
 */
#mainHeroText {
    max-width: 70%;
    min-height: 2.4em;
    margin: 0 auto;
    word-break: break-word;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: top center;
}

#mainHeroText.fade-out {
    opacity: 0;
    transform: translateY(-20px); /* 淡出时向上移动 */
}

#mainHeroText.fade-in {
    opacity: 1;
    transform: translateY(0);    /* 淡入时归位 */
}

/* 作者署名行：半透明小字 */
#mainHeroText .author {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.6em;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.1em;
}

/* ===== 底部 Grid 导航（关于 / 项目 / 联系）===== */

.bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1000px;
    width: 100%;
    flex-shrink: 0;
    padding: 1.5rem 0 1rem;
    margin: 0 auto;
    justify-items: center;
}

/*
 * Grid 项样式：
 * - 左侧白色半透明竖线 → hover 变强调色
 * - 文字 hover 变色（不再使用反光效果）
 * - !important 防止外部库干扰
 */
.grid-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-left: 2px solid rgba(255, 255, 255, 0.25);
    padding-left: 1.2rem;
    align-items: flex-start;
    text-decoration: none;
    transform: none !important;
    margin: 0 !important;
}

.grid-item:hover {
    border-left-color: var(--accent);
}

.grid-item:hover .main {
    color: var(--accent);
}

.grid-item:hover .sub {
    color: var(--accent);
    opacity: 1;
}

.grid-item .main {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 900;
    display: flex; align-items: center; gap: 8px;
    color: #fff;
    transition: color 0.3s ease;
}
.grid-item .sub {
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    opacity: 0.7;
    margin-top: 4px;
    color: #fff;
    transition: color 0.3s ease, opacity 0.3s ease;
}
.arrow { font-size: 1.2rem; opacity: 0.8; }

/* ===== 侧边栏 ===== */

/*
 * 从右侧滑入的侧边栏
 * right: -100% → 隐藏；body.sidebar-open → right: 0 → 显示
 * contain + will-change 优化渲染性能
 */
aside {
    position: fixed; top: 0; right: -100%; width: 450px; max-width: 85vw; height: 100%;
    background: var(--side-bg); color: var(--side-text); padding: 3rem 2.5rem;
    z-index: 1000; display: flex; flex-direction: column;
    transition: right 0.55s cubic-bezier(0.8, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0,0,0,0.6);
    isolation: isolate;
    will-change: right;
    contain: layout style;
}
body.sidebar-open aside { right: 0; }

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem;
}
.mode-toggle {
    font-size: 0.8rem; font-weight: 700; cursor: pointer;
    border: 1px solid var(--side-text); padding: 4px 14px;
    border-radius: 20px; opacity: 0.6;
}
.close-btn {
    font-weight: 900; cursor: pointer; font-size: 1.8rem; line-height: 1;
}

/* 侧边栏导航链接：继承 li 颜色，去除下划线，撑满整行 */
.side-nav { list-style: none; margin: 2.5rem 0; flex: 1; }
.side-nav li { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.5rem; cursor: pointer; transition: 0.2s; }
.side-nav li a { color: inherit; text-decoration: none; display: block; }
.side-nav li:hover { color: var(--accent); transform: translateX(-4px); }

.sidebar-footer {
    border-top: 1px solid var(--side-border); padding-top: 1rem; font-size: 0.8rem; opacity: 0.6;
}

/* 背景遮罩：侧边栏打开时显示半透明黑色遮罩 */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none; z-index: 900;
    transition: opacity 0.4s ease;
}
body.sidebar-open .overlay { opacity: 1; pointer-events: auto; }

/* 侧边栏打开时背景模糊 */
body.sidebar-open .hero-bg {
    filter: blur(6px);
}
body.dark-mode.content-page-mode.sidebar-open .hero-bg {
    filter: blur(6px);
}

/* ===== 页脚 ===== */

.site-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    opacity: 0.35;
    letter-spacing: 1px;
    padding-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    line-height: 1.4;
}

/* 页脚与侧边栏底部的 ICP 链接 */
.footer-left .icp,
.sidebar-footer .icp {
    color: #66CCFF;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-left .icp:hover,
.sidebar-footer .icp:hover {
    color: #88DDFF;
}

/* ===== 移动端 Grid 适配 ===== */
@media (max-width: 600px) {
    .page-container { padding: 1.5rem; min-height: 100vh; }
    .bottom-grid { grid-template-columns: 1fr; gap: 0.6rem; padding: 1rem 0; }
    .grid-item {
        border-left: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 0.6rem 0;
        align-items: center;
        text-align: center;
    }
    .grid-item:hover { border-left-color: rgba(255, 255, 255, 0.25); border-bottom-color: rgba(255, 255, 255, 0.1); box-shadow: none; }
}

/* ===== Cookie 同意横幅 ===== */

/*
 * 底部固定的 Cookie 横幅
 * 由下向上滑入显示，点击同意后 hidden 隐藏。
 * z-index: 2000 确保始终在最上层。
 */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(15px);   /* 毛玻璃效果 */
    padding: 1.2rem 2rem;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease-out;
    min-height: 60px;
}

/* 横幅滑入动画：从底部（translateY: 100%）滑入 */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-banner.hidden {
    display: none;
}

.cookie-content {
    flex: 1;
    min-width: 0;   /* 防止文字溢出撑开 */
}

.cookie-content p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    white-space: normal;
    word-wrap: break-word;
}

.cookie-content a {
    color: #66CCFF;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cookie-content a:hover {
    color: #88DDFF;
    text-decoration: underline;
}

/* 按钮容器 */
.cookie-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* 按钮通用样式 */
.cookie-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* "允许全部"按钮：强调色背景 */
.cookie-btn-primary {
    background: var(--accent);
    color: #000;
}

.cookie-btn-primary:hover {
    background: #88DDFF;
    transform: translateY(-1px);
}

/* "仅必要"按钮：半透明边框 */
.cookie-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Cookie 横幅响应式：移动端垂直布局 */
@media (max-width: 768px) {
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1rem;
    }

    .cookie-content p {
        font-size: 0.8rem;
    }

    .cookie-actions {
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
    }

    .cookie-btn {
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .cookie-actions {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        padding: 0.7rem;
    }
}

/* ===== 内容页面（about / contact / projects 等） ===== */

/*
 * 内容页面使用全局背景图（与主页相同），文字为白色。
 * body.content-page-mode 表示当前是内容页面。
 * 淡入动画直接绑定在 body 上，页面加载时自动触发。
 */
body.content-page-mode {
    background-color: #111;       /* 图片加载前显示深灰 */
    color: #ffffff;
    animation: pageFadeIn 0.6s ease-out forwards;
}

/* 内容页显示 Hero 背景（与主页使用同一图片），加微量模糊降低干扰 */
body.content-page-mode .hero-bg {
    display: block;
    filter: blur(1px);
}

/* 内容页的 page-container：透明无背景 */
body.content-page-mode .page-container.content-page {
    background: transparent;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 4rem;
}

.page-container.content-page .top-bar .logo,
.page-container.content-page .top-bar .menu-btn {
    color: #ffffff;
    text-shadow: 0 1px 8px rgba(0,0,0,0.4); /* 在背景图上确保可见 */
}

/* 面包屑导航：半透明白色 */
.breadcrumb {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 8px;
}
.breadcrumb a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover {
    color: var(--accent);
}
.breadcrumb .current {
    font-weight: bold;
    color: #fff;
}

/* 内容页大标题 */
.content-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.contact-intro {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.55);
    margin-bottom: 2rem;
}

.contact-sub-intro {
    font-size: 1rem;
    color: rgba(255,255,255,0.5);
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

main.content-main {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.contact-cards.contact-cards--single {
    justify-content: flex-start;
}

.contact-cards.contact-cards--single .contact-card {
    flex: 0 1 auto;
    min-width: 240px;
    max-width: 400px;
}

.contact-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    max-width: 1000px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.contact-cards .contact-card {
    flex: 1 1 calc(50% - 0.5rem);
    box-sizing: border-box;
    min-width: 0;
}

@media (min-width: 900px) {
    .contact-cards .contact-card {
        flex: 1 1 calc(33.3333% - 0.6666rem);
    }
}

@media (min-width: 1200px) {
    .contact-cards .contact-card {
        flex: 1 1 calc(25% - 0.75rem);
    }
    .contact-cards {
        max-width: 1100px;
    }
}

@media (max-width: 480px) {
    .contact-card {
        padding: 1.4rem 0.8rem 1rem;
        box-sizing: border-box;
    }

    .contact-card-icon {
        font-size: 1.6rem;
    }

    .contact-card-name {
        font-size: 0.85rem;
    }

    .contact-card-handle {
        font-size: 0.7rem;
    }
}

.contact-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 2rem 1.5rem 1.6rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(6px);
    box-sizing: border-box;
    margin: 0;
}

.contact-card:hover {
    border-color: rgba(102,204,255,0.4);
    background: rgba(255,255,255,0.08);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.contact-card-icon {
    font-size: 2.2rem;
    color: #66CCFF;
    margin-bottom: 0.8rem;
    transition: transform 0.3s ease;
}

.contact-card:hover .contact-card-icon {
    transform: scale(1.1);
}

.contact-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.3rem;
}

.contact-card-handle {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

/* 正文段落：限制最大宽度，增加行高便于阅读 */
.content-body {
    font-size: 1.1rem;
    line-height: 1.9;
    color: rgba(255,255,255,0.8);
    max-width: 800px;
}

/* 正文内边距与列表样式 */
.content-body p,
.content-body ul,
.content-body ol {
    margin-bottom: 1.2rem;
}

.content-body li {
    margin-bottom: 0.4rem;
}

/* 正文 H2 / H3 标题 */
.content-body h2 {
    margin-top: 2.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    scroll-margin-top: 5rem;      /* 锚点跳转时留出顶部空间 */
}

.content-body h3 {
    margin-top: 1.8rem;
    margin-bottom: 0.6rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

/* 内容布局：正文 + 侧边目录 */
.content-layout {
    display: flex;
    gap: 3rem;
}

.content-layout .content-body {
    flex: 1;
    min-width: 0;                 /* 防止 flex 子元素溢出 */
}

/* ===== 侧边目录（TOC: Table of Contents） ===== */

/*
 * 粘性定位的目录导航
 * 随页面滚动高亮当前阅读位置（通过 IntersectionObserver + .toc-active）
 */
.toc {
    position: sticky;
    top: 6rem;
    width: 200px;
    flex-shrink: 0;
    align-self: flex-start;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

.toc-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0.3rem;
}

.toc a {
    display: block;
    padding: 0.3rem 0.6rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.toc a:hover {
    color: rgba(255,255,255,0.8);
    border-left-color: rgba(255,255,255,0.3);
}

/* 当前激活的 TOC 项：强调色高亮 */
.toc a.toc-active {
    color: #66CCFF;
    border-left-color: #66CCFF;
}

/* 内容页 Footer：增加底部留白 */
.page-container.content-page .site-info {
    color: rgba(255,255,255,0.5);
    padding-bottom: 3rem;
}
.page-container.content-page .site-info .icp {
    color: #66CCFF;
    transition: color 0.2s ease;
}
.page-container.content-page .site-info .icp:hover {
    color: #88DDFF;
}

/* ===== 暗黑模式下内容页适配 ===== */

body.dark-mode.content-page-mode {
    background-color: #000;
    color: #f0f0f0;
}

/* 暗黑模式下内容页背景模糊更深，降低干扰 */
body.dark-mode.content-page-mode .hero-bg {
    filter: blur(2px);
}

/* ===== 响应式适配 ===== */

@media (max-width: 768px) {
    body.content-page-mode .page-container.content-page {
        padding: 1.5rem;
    }

    .content-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    /* 移动端隐藏 TOC，正文占满宽度 */
    .toc {
        display: none;
    }

    .content-layout {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body.content-page-mode .page-container.content-page {
        padding: 1rem;
    }
}

/* ===== 顶部进度条 ===== */

/*
 * 页面切换时顶部 3px 细进度条
 * 从 0% → 30%（快） → 70%（慢） → 100% → 消失
 */
#page-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent, #66CCFF);
    width: 0%;
    z-index: 9999;
    transition: width 0.2s ease;
    pointer-events: none;          /* 不阻挡点击 */
}

/* ===== iconfont（阿里巴巴图标库） ===== */

/*
 * 用于补充 Font Awesome Free 不覆盖的中文平台图标
 * 例如：今日头条、百家号、小红书、知乎、CSDN 等
 *
 * 接入步骤：
 *   1. 打开 iconfont.cn，创建项目，搜索并添加所需图标
 *   2. 选择「Font Class」方式，生成 CDN 链接
 *   3. 将链接替换到 index.html / links.html 的 iconfont <link> 中
 *   4. 使用 <i class="iconfont icon-toutiao"></i> 调用
 *
 * 各图标对应的 CSS class 在 iconfont 项目中自定义，
 * 建议统一命名为 icon-{平台英文名}，如 icon-toutiao, icon-xiaohongshu
 */

/*
 * iconfont 基础字体声明
 * iconfont.cn 生成的 CSS 内已包含 @font-face 声明
 * 此处仅补充浏览器兼容样式
 */
.iconfont {
    font-family: "iconfont" !important;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/*
 * 在 .social-icon（Hero 圆形图标）中嵌入 iconfont
 * 字体大小自适应父容器 font-size: 1.2rem
 */
.hero-social .social-icon .iconfont {
    font-size: inherit;
}

/*
 * 在 .contact-card-icon（链接页矩形卡片图标）中嵌入 iconfont
 * 继承父容器的 color 和 transition
 */
.contact-card-icon .iconfont {
    font-size: inherit;
    color: inherit;
}

.contact-card-icon .svg-icon {
    width: 1em;
    height: 1em;
    display: block;
    color: inherit;
}

.contact-card:hover .contact-card-icon .iconfont {
    color: inherit;
}

.contact-card:hover .contact-card-icon .svg-icon {
    color: inherit;
}

/* ===== 页面转场动画 ===== */

/*
 * 新页面淡入动画（0.6s）
 * 不再使用 sessionStorage 跨页面传递状态，
 * 避免生产环境因 CDN / 重定向等导致的时序断裂。
 * 内容页面通过 body.content-page-mode 自动触发。
 */
@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== 微信二维码弹窗 ===== */

/*
 * 触发元素（首页 hero 社交图标 或 links 页卡片）
 * 通过 .wechat-trigger 类标记，与 main.js 配合实现弹窗。
 *
 * 交互策略（由 main.js 控制）：
 *   - 默认（index.html）：桌面端 hover 弹出，移动端 click toggle
 *   - data-wechat-trigger="click"（links.html）：全设备 click toggle
 *
 * HTML 结构：
 *   .wechat-trigger → 触发元素
 *   #wechatQROverlay  → 半透明遮罩（点击关闭）
 *   #wechatQRPopup    → 居中弹窗，包含两个二维码卡片
 *     .wechat-qr-close → 关闭按钮
 *     .wechat-qr-cards → 卡片容器
 *       .wechat-qr-card → 单个卡片（公众号 / 视频号）
 *         img  → 二维码图片（width 固定，max-height 限制纵向拉长）
 *         span → 标签文字
 *
 * 注意事项：
 *   - 弹窗默认 opacity:0 + pointer-events:none，通过 .active 类激活
 *   - 微信二维码通常为纵向矩形（含头像/名称），故用 max-height 而非固定高度
 *   - 弹窗 z-index:9999，遮罩 z-index:9998，确保在 cookie banner 之上
 */

.wechat-trigger {
    cursor: pointer;
}

/*
 * 半透明遮罩
 * 覆盖全屏，点击调用 hideWechatQR() 关闭弹窗
 */
.wechat-qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.wechat-qr-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/*
 * 弹窗主体
 * 居中定位，从 scale(0.9) 弹入 + opacity 渐现，玻璃质感
 */
.wechat-qr-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);  /* 初始微缩，激活后 scale(1) */
    z-index: 9999;
    background: rgba(20,20,30,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 2.5rem 2rem 2rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wechat-qr-popup.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* 关闭按钮：右上角 ×，hover 变白 */
.wechat-qr-close {
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 1.5rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.wechat-qr-close:hover {
    color: #fff;
}

/* 二维码卡片容器：水平排列，居中 */
.wechat-qr-cards {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: flex-start;
}

/* 单个二维码卡片：图片在上，标签在下 */
.wechat-qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

/*
 * 二维码图片
 * - width 固定 180px，保证清晰度
 * - max-height 240px 限制纵向拉长，微信二维码通常为纵向矩形
 * - object-fit: contain 保持原比例不裁剪
 * - 白色背景 + 6px padding 模拟白边卡片效果
 */
.wechat-qr-img {
    width: 180px;
    max-height: 240px;
    border-radius: 10px;
    background: #fff;
    padding: 6px;
    object-fit: contain;
}

.wechat-qr-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

/* 小屏手机：缩小弹窗内边距、卡片间距和图片尺寸 */
@media (max-width: 480px) {
    .wechat-qr-popup {
        padding: 1.8rem 1.2rem 1.6rem;
    }

    .wechat-qr-cards {
        gap: 1rem;
    }

    .wechat-qr-img {
        width: 140px;
        max-height: 200px;
    }
}

/* ===== 外站跳转确认弹窗 ===== */

.ext-link-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9996;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ext-link-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ext-link-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 9997;
    background: rgba(20,20,30,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 2.5rem 2rem 2rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.ext-link-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.ext-link-close {
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 1.5rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.ext-link-close:hover {
    color: #fff;
}

.ext-link-icon {
    font-size: 2.5rem;
    color: #66CCFF;
    margin-bottom: 1rem;
}

.ext-link-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    color: #66CCFF;
}

.ext-link-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.6rem;
}

.ext-link-desc {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.ext-link-url {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    word-break: break-all;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 1.5rem;
}

.ext-link-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.ext-link-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.ext-link-btn-cancel {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

.ext-link-btn-cancel:hover {
    background: rgba(255,255,255,0.2);
}

.ext-link-btn-confirm {
    background: #66CCFF;
    color: #000;
}

.ext-link-btn-confirm:hover {
    background: #3399CC;
    color: #fff;
}

@media (max-width: 480px) {
    .ext-link-modal {
        padding: 1.8rem 1.2rem 1.6rem;
    }

    .ext-link-icon {
        font-size: 2rem;
    }

    .ext-link-title {
        font-size: 1.05rem;
    }
}
