/* partials.css通用组件样式
页头页脚,loader.js的文章卡片,通用组件等*/
:root {
    --footer-main-color: #540a5e;/*页脚标题颜色*/
}
/*页头导航*/
.site-header {
    width: 100%;
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    background: #ffffff;
    color: #1a1a1a;
    transition: height 220ms ease, background 220ms ease, box-shadow 220ms ease; /* 加入阴影过渡 */
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);/* 用内阴影模拟底边*/
}

/* 头部容器：左右分布布局 */
.header-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: transparent;
    position: relative;
}

/* 品牌Logo区域 */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
}

.brand-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}

.brand-name-cn {
    font-size: 20px;
    font-weight: 600;
    color: #000000; /* 黑色文字 */
    white-space: nowrap;
}

.brand-name-en {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.75); /* 深灰色文字 */
    white-space: nowrap;
}

.main-nav {
    flex: 0 0 auto;
    top: 0;
    height: 100%;
    z-index: 1200;
    background: transparent;
    display: flex;
    align-items: center;
    transition: height 220ms ease;
}

.main-nav .nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 12px;
}

/* 可滚动容器 */
.nav-scroll {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 64px;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 56px;
    height: 100%;
}

/* 窄屏进一步压缩内边距以确保首尾项可见并更易滑动 */
@media (max-width: 420px) {
    .nav-list {
        padding: 0 16px;
        gap: 20px;
    }
}

.nav-item {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    font-size: 18px;
    color: #000000; /* 黑色字体 */
    border-radius: 0;
    line-height: 1;
    padding: 20px 18px 20px;
}

.nav-link:hover,
.nav-link:focus {
    font-weight: 800; /* 悬停时加粗 */
    outline: none;
}

.nav-link:focus {box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);}

.nav-link.active {
    font-weight: 800; /* 选中时加粗 */
}

/* 桌面端：关闭横向滚动，全部项平铺靠右 */
@media (min-width: 768px) {
    .nav-scroll {overflow: visible;}

    .nav-list {
        justify-content: flex-end;
        gap: 32px;
        padding: 0;
    }
}

/* ===== Footer ===== */
/*页脚*/
.main-footer {
    background-color:#f0f0f0;
    color:#333;
    padding: 32px 0;
}

/* 页脚内容容器 */
.main-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.footer-nav-grid {
    display:grid;
    grid-template-columns: repeat(4,1fr);
    gap:30px;
    margin-bottom:40px;
}

.footer-nav-column h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.footer-nav-column p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.footer-nav-column h4 {
    font-size:16px;
    font-weight:600;
    margin-bottom:18px;
    color:var(--footer-main-color);
}
.footer-nav-column ul {
    display:flex;
    flex-direction:column;
    gap:10px;
}
/* 链接统一样式（合并冗余覆盖写法） */
.footer-nav-column ul li a {
    font-size:14px;
    color:#555;
    transition:color .2s ease;
}
.footer-nav-column ul li a:hover {
    color:var(--footer-main-color);
    text-decoration:underline;
}

/* 待开放栏目链接样式 */
.footer-nav-column ul li a.coming-soon {
    cursor: pointer;
    text-decoration: none;
}
/* 页脚分隔线 */
.footer-divider {
    height:1px;
    background-color:#444;
    margin-bottom:12px;
}
/* ===== 响应式 ===== */
@media (max-width:768px) {
    .footer-address {
        flex-direction:column; gap:6px;
    }

    .footer-copyright {
        flex-direction:column; align-items:flex-start;
    }

    .copyright-links {
        flex-wrap:wrap;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .footer-nav-grid {
        grid-template-columns: 1fr;
    }
}
/* ===== 全站通用链接样式 =====
适用于：index.html的.page-link和article/about.html的正文链接
特点：蓝色下划线，悬停时变为紫色波浪线并轻微上浮 */
.page-link,
.nav-page .content-area a {
    color: #0044cc;
    text-decoration: underline;
    text-decoration-color: #0044cc;
    text-underline-offset: 2px;
    transition: color 160ms ease, transform 120ms ease, text-decoration-color 160ms ease;
}

:where(.page-link, .nav-page .content-area a):is(:hover, :focus) {
    color: #6a0dad; /* 紫色 */
    text-decoration-style: wavy; /* 波浪线 */
    text-decoration-color: #6a0dad;
    transform: translateY(-3px); /* 上浮效果 */
}

/* === Loader.js模板 ===== */
.card-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.3;
    text-align: center;
    /* 标题底部装饰线*/
    border-bottom: 4px solid var(--theme-color, #0073da);
    padding-bottom: 8px;
}

.card-meta {
    font-size: 14px;
    color: #666666;
    text-align: center;
}

.card-body {
    font-size: 16px;
    color: #333333;
    line-height: 1.8;
    font-family: "KaiTi", "STKaiti", sans-serif;/* 文章正文字体*/
}

/* 段落首行缩进两格汉字 */
.card-body p {
    text-indent: 2em;
}
.card-body p.project-link {
    text-indent: 0;
}

/* 空内容卡片保持最小高度，布局与有内容卡片一致 */
.card-body:empty {min-height: 40px;}

/* ===== 「关于我」大头像 + 介绍布局（profile 模板） ===== */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
    padding: 16px 0 8px;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ffffff;
    box-shadow: 0 6px 20px #0000001f;
}

.profile-avatar-placeholder {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--theme-color, #0073da);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
}

.profile-info {
    max-width: 560px;
}

.profile-name {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px;
}

.profile-handle {
    font-size: 15px;
    color: #888888;
    margin-bottom: 14px;
}

.profile-bio {
    font-size: 16px;
    line-height: 1.85;
    color: #333333;
    text-align: left;
}

.profile-bio p {
    margin-bottom: 14px;
    text-indent: 2em;
}

.profile-bio address {
    font-style: normal;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e0e0e0;
    text-align: left;
}

/* 移动端：头像略缩小，介绍仍居中 */
@media (max-width: 480px) {
    .profile-avatar-img,
    .profile-avatar-placeholder {
        width: 120px;
        height: 120px;
    }

    .profile-bio {
        font-size: 15px;
    }
}

/* ===== 「维护的项目」卡片（project 模板） ===== */
.card-meta .meta-stack {
    color: #888888;
    font-size: 13px;
}

.project-link {
    margin-top: 16px;
    font-size: 15px;
}

.project-link a {
    color: var(--theme-color, #0073da);
    text-decoration: none;
}

.project-link a:hover {
    text-decoration: underline;
}

/* ===== 通用页面布局 =====
适用于：note.html, article.html, about.html布局：左侧导航菜单 + 右侧内容区域 */
/* 右侧内容区域 */
.content-area {
    width: 900px; /* 固定宽度 */
    flex-shrink: 0; /* 防止内容区域收缩 */
    min-width: 900px; /* 最小宽度确保不会变窄 */
    min-height: calc(100vh - var(--header-height)); /* 减去Header高度，防止顶部显示页脚 */
    padding: 30px 40px 120px; /* 底部增加120px内边距，避免页脚出现 */
    background: #FFFCF7; /* 作业本纸的温暖米黄色 */
    border: 1px solid #e0e0e0;
    border-left: none;
    position: relative;
}

/* 内容区域中的article标签样式（loader.js注入的内容） */
.content-section article {
    font-size: 18px; /* 正文字号 */
    color: #333;
    line-height: 1.8;
}

.content-section article p {
    margin-bottom: 16px;
    text-indent: 2em;
    line-height: 1.8;
}

/* 标题样式（h1, h2, h3等） */
.content-section article :is(h1, h2, h3){
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 32px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--theme-color);
}

.content-section article h1 {
    font-size: 32px;
}

.content-section article h2 {
    font-size: 28px;
}

.content-section article h3 {
    font-size: 24px;
    border-bottom-width: 2px;
}

/* 地址样式 */
.content-section article address {
    font-style: normal;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

/* 内容区域链接样式 */
.content-section article a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
}

.content-section article a:hover {
    color: var(--theme-color);
    text-decoration: underline;
}

/* 显示当前激活的章节（由JS控制 .is-active类） */
.content-section.is-active {
    display: block;
    animation: fadeInUp 0.4s ease forwards;
}

/* 为每个章节设置锚点偏移量，防止被Header遮挡或跳动 */
.content-section {
    scroll-margin-top: 80px; /* Header(64px) + 16px缓冲，精准对齐减少跳动 */
    display: none;/* 内容章节默认隐藏 */
}

/* 初始化状态：页面加载时默认隐藏所有内容，等待JS激活，防止闪烁 */
body:not(.js-loaded) .content-section {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .server-nav {
        width: 100%;
        border: 1px solid #e0e0e0;
        border-bottom: none;
        padding: 10px 0;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .content-area {
        width: 100%;
        min-width: 0;
        min-height: auto;
        flex: 1 0 0;
        overflow: visible;
        padding: 20px;
        border: 1px solid #e0e0e0;
    }

    /* 防止内容区内部元素撑出容器导致水平滚动 */
    .content-area article,
    .content-area section {
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* 图片自适应 */
    .content-area img {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 16px;
    }

    .content-section article {
        font-size: 15px;
    }
}

/* ===== 父子导航导航页面布局样式 ===== */
/* 页面整体布局：父导航在顶部，下方是子导航+内容 */
.nav-page {
    display: flex;
    gap: 0;
    flex-direction: column;
    padding: 0;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    position: relative;
}

/* ---父导航：始终使用横向滚动移动端样式 --- */
.parent-nav {
    width: 100%;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    padding: 8px 0;
    flex-shrink: 0;
    position: sticky;
    top: var(--header-height);
    z-index: 1100;
}

.parent-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 12px;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;/* Firefox */
    -ms-overflow-style: none;/* IE/Edge */
    gap: 4px;
}

.parent-nav-list::-webkit-scrollbar {
    display: none;/* Chrome/Safari */
}

.parent-nav-item {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.parent-nav-link {
    display: block;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.parent-nav-link:hover {
    background: #ebebeb;
    color: var(--theme-color);
}

.parent-nav-link.active {
    color: var(--theme-color);
    font-weight: 600;
    border-bottom-color: var(--theme-color);
    box-shadow: inset 7px -4px 0 0 var(--theme-color);
}

/* --- 子导航+内容 容器 --- */
.content-body {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* --- 子导航 ---*/
.child-nav {
    width: 220px;
    flex-shrink: 0;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-right: none;
    padding: 16px 0;
    position: sticky;
    top: calc(var(--header-height) + 56px); /* 父导航高度 */
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - 56px);
    overflow-y: auto;
}

.child-nav .child-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.child-nav .child-nav-item {
    margin: 0;
    padding: 0;
}

.child-nav .child-nav-link {
    display: block;
    padding: 14px 24px;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.child-nav .child-nav-link:hover {
    background: #ebebeb;
    color: var(--theme-color);
    padding-left: 28px;
}

.child-nav .child-nav-link.active {
    background: #ffffff;
    color: var(--theme-color);
    font-weight: 600;
    border-left-color: var(--theme-color);
    box-shadow: inset 10px 0 0 var(--theme-color);
}

/* nav-page的content-area  */
.nav-page .content-area {
    flex: 1;
    min-width: 0;
    width: auto;
    padding: 30px 40px 120px;
    background: #FFFCF7;
    border: 1px solid #e0e0e0;
    border-left: none;
    min-height: 0;
}

/* ---- 移动端 ----*/
@media (max-width: 768px) {
    .nav-page {
        flex-direction: column;
        width: 100%;
        padding: 0;
    }

    .parent-nav {
        position: static;
        padding: 6px 0;
    }

    .parent-nav-link {
        padding: 10px 16px;
        font-size: 15px;
    }

    .content-body {
        flex-direction: column;
    }

    /* 子导航变为横向滚动 */
    .child-nav {
        width: 100%;
        border: 1px solid #e0e0e0;
        border-bottom: none;
        padding: 8px 0;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .child-nav .child-nav-list {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .child-nav .child-nav-list::-webkit-scrollbar {
        display: none;
    }

    .child-nav .child-nav-item {
        flex-shrink: 0;
    }

    .child-nav .child-nav-link {
        padding: 10px 14px;
        font-size: 14px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }

    .child-nav .child-nav-link:hover {
        padding-left: 14px;
    }

    .child-nav .child-nav-link.active {
        border-left: none;
        border-bottom-color: var(--theme-color);
        box-shadow: inset 7px -4px 0 0 var(--theme-color);
    }

    .nav-page .content-area {
        width: 100%;
        padding: 20px;
        border: 1px solid #e0e0e0;
    }
}

@media (max-width: 480px) {
    .parent-nav-link {
        padding: 8px 12px;
        font-size: 14px;
    }

    .child-nav .child-nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    .nav-page .content-area {
        padding: 16px;
    }
}

/* === 汉堡菜单样式=== */
/* 汉堡按钮,默认隐藏，仅在移动端显示 */
.nav-toggle {
    display: none; /* 桌面端隐藏 */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 52px;
    height: 52px;
    z-index: 1200;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

/* 图标容器：相对定位，作为线条参考系 */
.nav-toggle-icon {
    position: relative;
    display: block;
    width: 28px;
    height: 20px;
    pointer-events: none;
}

/* 通用横线样式 */
.nav-toggle-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #000000;
    border-radius: 3px;
    will-change: transform, opacity;
    transform-origin: center center;
    /* 只过渡transform和opacity，避免Layout触发 */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 三条线统一用top: 50% 定位，靠translateY拉开距离 */
.nav-toggle-line:nth-child(1) {
    top: 50%;
    transform: translateY(-8px);
}
.nav-toggle-line:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
    opacity: 1;
}
.nav-toggle-line:nth-child(3) {
    top: 50%;
    transform: translateY(6px);
}

/* 激活态：中间线消失，上下线旋转成X */
.nav-toggle.active .nav-toggle-line:nth-child(1) {
    transform: translateY(-50%) rotate(45deg);
}
.nav-toggle.active .nav-toggle-line:nth-child(2) {
    transform: translateY(-50%) scaleX(0.8);
    opacity: 0;
}
.nav-toggle.active .nav-toggle-line:nth-child(3) {
    transform: translateY(-50%) rotate(-45deg);
}

/* 移动端导航面板 */
.mobile-nav-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 1199;
    overflow-y: auto;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.6s ease, opacity 0.6s ease, visibility 0.6s ease;
}

.mobile-nav-panel.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* 关闭时的特殊样式 - 向上收起 */
.mobile-nav-panel.closing {
    animation: slideUpClose 0.6s ease forwards !important;
}

@keyframes slideUpClose {
    0% {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    100% {
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
    }
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    position: relative;
}

/* 菜单项之间的分割线 */
.mobile-nav-item:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.mobile-nav-item a {
    display: block;
    padding: 18px 24px;
    font-size: 18px;
    color: #000000;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.mobile-nav-item a:hover,
.mobile-nav-item a.active {
    background: #f5f5f5;
    color: var(--theme-color);
}

/* 遮罩层 */
.mobile-nav-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: #00000080;
    z-index: 1198;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 移动端显示汉堡按钮，隐藏导航链接 */
@media (max-width: 768px) {
    /* 使用更强的选择器确保按钮显示 */
    .header-container .main-nav .nav-inner .nav-toggle,
    .nav-toggle {
        display: block !important; /* 移动端显示，使用!important防止被覆盖 */
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* 确保nav-inner使用flex布局，让按钮和导航并排 */
    .header-container .main-nav .nav-inner,
    .nav-inner {
        display: flex !important;
        align-items: center;
        gap: 8px;
    }

    /* 移动端隐藏原始导航链接和渐变遮罩，只保留汉堡按钮 */
    .main-nav .nav-scroll {
        display: none !important;
    }

    /* 隐藏后导航栏高度回缩 */
    .main-nav {
        height: auto !important;
    }
}

/* ===== 数据展示面板样式（迁至part.css，供about的「数据统计」复用） ===== */
/* 网格表：auto-fit自适应列数——方块最小宽 200px，容器变窄时方块先压缩变挤、
   放不下 200px下限就自动换行减列（绝不溢出截断）。
   宽屏用min-width媒体查询把列数上限锁为 4 列（避免排到 5 列）；
   移动端（视窗 <768px）固定为 2 列 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
/* 宽屏：视窗 ≥1100px时容器够宽会排 5 列，强制锁为最多 4 列 */
@media (min-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(4, minmax(200px, 1fr));
    }
}
/* 移动端：浏览器视窗 <768px（与汉堡菜单断点一致）固定 2 列 */
@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
/* 移动端小屏字号微调（不再堆叠为单列，卡片保持网格两列） */
@media (max-width: 768px) {
    .stat-number {
        font-size: 28px;
    }
}