/* ============================================
   项目详情页共享样式 (project-*.html)
   最后更新：2026-07-24
   说明：所有 project-*.html 的顶部导航、三栏布局、基础样式均从此文件加载
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Ma+Shan+Zheng&display=swap');

:root {
    --primary: #c4a77d;
    --secondary: #e8dcc4;
    --accent: #d4a574;
    --warm-bg: #fdfbf7;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #5c4a3a;
    --text-secondary: #8b7355;
    --text-muted: #a89b7d;
    --border-color: rgba(196, 167, 125, 0.3);
    --shadow-soft: 0 8px 32px rgba(196, 167, 125, 0.15);
    --shadow-hover: 0 16px 48px rgba(196, 167, 125, 0.25);
    --gradient-main: linear-gradient(135deg, #c4a77d 0%, #e8dcc4 50%, #d4a574 100%);
    --gradient-text: linear-gradient(135deg, #5c4a3a 0%, #8b7355 50%, #c4a77d 100%);
    --nav-height: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--warm-bg);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ============================================
   顶部导航 (PC端 + 移动端)
   ============================================ */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    height: var(--nav-height);
}

.nav-inner {
    max-width: 100%;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    gap: 1rem;
}

.nav-logo {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    height: 100%;
}

.nav-logo i {
    color: var(--primary);
}

/* 项目导航链接组 */
.nav-projects {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.nav-project-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-radius: 14px;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.nav-project-link:hover {
    color: var(--primary);
    background: rgba(196, 167, 125, 0.08);
}

.nav-project-link.active {
    color: var(--primary);
    background: rgba(196, 167, 125, 0.12);
    border-color: var(--border-color);
    font-weight: 600;
}

/* 右侧操作区 */
.nav-actions {
    display: flex;
    align-items: center;   /* 关键：让返回首页按钮上下居中 */
    gap: 0.4rem;
    flex-shrink: 0;
    height: 100%;
}

.nav-divider {
    width: 1px;
    height: 18px;
    background: var(--border-color);
    margin: 0 0.25rem;
    align-self: center;
}

/* 返回首页按钮 —— 关键修复点 */
.nav-home-link {
    display: inline-flex;
    align-items: center;     /* 按钮内部垂直居中 */
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    line-height: 1;
    color: var(--text-secondary);
    border-radius: 14px;
    transition: all 0.25s ease;
    background: rgba(196, 167, 125, 0.06);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    height: auto;
}

.nav-home-link:hover {
    color: var(--primary);
    background: rgba(196, 167, 125, 0.12);
}

.nav-home-link i {
    font-size: 0.85rem;
    line-height: 1;
}

.nav-home-link span {
    line-height: 1;
    display: inline-block;
    transform: translateY(1px);   /* 微调视觉对齐 */
}

/* 移动端菜单按钮（PC端默认隐藏） */
.nav-menu-btn {
    display: none;
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 767px) {
    nav {
        height: auto;
    }

    .nav-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
        justify-content: space-between;
        min-height: 56px;
        height: auto;
    }

    .nav-logo {
        font-size: 1rem;
        height: auto;
    }

    .nav-actions {
        display: flex;
        align-items: center;
        gap: 0;
        margin-left: auto;
        height: auto;
    }

    /* 移动端隐藏项目切换菜单和汉堡按钮 */
    .nav-projects,
    .nav-menu-btn {
        display: none !important;
    }

    .nav-divider {
        display: none;
    }

    .nav-home-link {
        font-size: 0.72rem;
        padding: 0.4rem 0.65rem;
    }

    .nav-home-link span {
        display: none;
    }
}

/* ============================================
   三栏布局
   ============================================ */
.project-layout {
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 0;
    max-width: 100%;
    height: calc(100vh - var(--nav-height));
}

/* 左栏：交互原型 */
.prototype-col {
    border-right: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prototype-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.prototype-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* 中间：文章区 */
.article-col {
    padding: 2.5rem 3rem;
    overflow-y: auto;
    max-width: 100%;
}

.article-col::-webkit-scrollbar {
    width: 6px;
}

.article-col::-webkit-scrollbar-track {
    background: transparent;
}

.article-col::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-color);
}

.article-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(196, 167, 125, 0.12);
    color: var(--primary);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.article-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.article-meta i {
    color: var(--primary);
}

.article-section {
    margin-bottom: 2rem;
}

.article-h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-left: 0.8rem;
    border-left: 4px solid var(--primary);
    scroll-margin-top: 80px;
}

.article-h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.6rem;
    scroll-margin-top: 80px;
}

.article-p {
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    line-height: 1.85;
}

.article-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.article-table th,
.article-table td {
    border: 1px solid var(--border-color);
    padding: 0.7rem 1rem;
    text-align: left;
}

.article-table th {
    background: rgba(196, 167, 125, 0.1);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.article-table tr:nth-child(even) td {
    background: rgba(196, 167, 125, 0.04);
}

.article-code {
    background: #2d2d2d;
    color: #e8dcc4;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    overflow-x: auto;
    margin: 1rem 0;
    white-space: pre;
}

.article-highlight {
    background: rgba(196, 167, 125, 0.1);
    border-left: 3px solid var(--primary);
    padding: 0.8rem 1.2rem;
    border-radius: 0 10px 10px 0;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.article-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* 右栏：目录 */
.toc-col {
    border-left: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.3);
    padding: 1.5rem 1.25rem;
    overflow-y: auto;
}

.toc-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: all 0.25s;
    line-height: 1.5;
    border-left: 2px solid transparent;
}

.toc-list a:hover {
    color: var(--primary);
    background: rgba(196, 167, 125, 0.08);
    border-left-color: var(--primary);
}

.toc-list a.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(196, 167, 125, 0.12);
    border-left-color: var(--primary);
}

.toc-list .toc-h3 {
    padding-left: 1.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 1024px) {
    .project-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .prototype-col {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 70vh;
    }

    .toc-col {
        display: none;
    }

    .article-col {
        padding: 1.5rem 1.25rem;
    }
}

@media (max-width: 640px) {
    .article-title {
        font-size: 1.5rem;
    }

    .article-col {
        padding: 1.25rem 1rem;
    }

    .article-h2 {
        font-size: 1.2rem;
    }
}

/* 滚动条 */
.prototype-col::-webkit-scrollbar,
.toc-col::-webkit-scrollbar {
    width: 4px;
}

.prototype-col::-webkit-scrollbar-track,
.toc-col::-webkit-scrollbar-track {
    background: transparent;
}

.prototype-col::-webkit-scrollbar-thumb,
.toc-col::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
