/* 基础重置与全局样式 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --nav-height: 4.9rem;
    --brand-deep: #1a237e;
    --brand-purple: #311b92;
    --accent: #bb86fc;
}

html {
    /* 锚点跳转时不会被吸顶导航挡住 */
    scroll-padding-top: var(--nav-height);
    scroll-behavior: smooth;
}

body {
    /* 字体只挂在这里，不再用通配符覆盖一切元素 */
    font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 表单控件跟随正文字体 */
button, input, select, textarea {
    font: inherit;
    color: inherit;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

/* 键盘聚焦时给一个清晰的描边（鼠标点击不显示） */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* 内联 SVG 图标：跟文字同色、同字号 */
.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.125em;
    flex: none;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand-purple) 100%);
    color: #fff;
    padding: 1rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-avatar {
    display: block;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    overflow: hidden;
    flex: none;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.logo-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-avatar:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-link {
    font-size: 1.1rem;
    padding: 0.5rem 0.3rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
    background-color: rgba(255, 255, 255, 0.05);
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto 3rem;
    padding: 0 2rem;
}

.page {
    display: none;
}

.page.active-page {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 首页欢迎语样式 */
.hero {
    text-align: center;
    padding: 5rem 2rem;
    background: linear-gradient(to right, #e3f2fd, #f3e5f5);
    border-radius: 20px;
    margin-bottom: 3rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.welcome-text {
    font-size: 3.5rem;
    color: var(--brand-deep);
    margin-bottom: 1rem;
    font-weight: 600;
}

.sub-text {
    font-size: 1.4rem;
    color: #555;
    max-width: 600px;
    margin: 0 auto;
}

/* 文章区域样式 */
.section-title {
    font-size: 2.5rem;
    color: var(--brand-purple);
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}

.article-card {
    background: #fff;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    /* 只过渡真正会变的属性，比 transition: all 更省 */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #eee;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border-color: #d1c4e9;
}

.article-header {
    margin-bottom: 1.2rem;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 1rem;
}

.article-title {
    font-size: 1.6rem;
    color: var(--brand-deep);
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.article-date {
    font-size: 0.9rem;
    /* 原来是 #777，对白底只有 4.48:1，刚好卡在 WCAG AA 门槛下面 */
    color: #6b6b6b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.article-content {
    color: #555;
    line-height: 1.7;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.read-more {
    color: #6200ea;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
    padding: 0.5rem 0;
    cursor: pointer;
}

.read-more:hover {
    color: #3700b3;
    gap: 0.8rem;
}

/* 轻提示，替代原来的 alert() */
.toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translate(-50%, 1.5rem);
    max-width: min(90vw, 30rem);
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    background: rgba(26, 35, 126, 0.95);
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 2000;
}

.toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* 页脚样式 */
.footer {
    background-color: #1a1a1a;
    color: #aaa;
    padding: 2.5rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.beian-info {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
}

.icp-link,
.gongan-link {
    color: #aaa;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.icp-link:hover,
.gongan-link:hover {
    color: #fff;
    text-decoration: underline;
}

.beian-icon {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
}

.sep {
    color: #666;
}

.copyright {
    font-size: 0.9rem;
    /* 原来是 #777，对 #1a1a1a 只有 3.8:1，太暗了 */
    color: #9a9a9a;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 导航栏在手机上会折成两行，吸顶高度随之变高 */
    :root {
        --nav-height: 8rem;
    }
    .nav-container {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0 1rem;
    }
    .logo {
        font-size: 1.4rem;
        gap: 0.6rem;
    }
    .logo-avatar {
        width: 2.4rem;
        height: 2.4rem;
    }
    .nav-menu {
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }
    .nav-link {
        font-size: 1rem;
    }
    .main-content {
        padding: 0 1rem;
        margin: 1.5rem auto 2rem;
    }
    .welcome-text {
        font-size: 2.5rem;
    }
    .sub-text {
        font-size: 1.1rem;
    }
    .hero {
        padding: 3rem 1rem;
    }
    .articles-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .beian-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    .sep {
        display: none;
    }
}

/* 尊重"减少动效"的系统设置 */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
