@charset "UTF-8";

/* ==========================================
   程序研习随笔 - 简约风格
   配色：白底 + 深灰文字 + 护眼绿强调
   ========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 15px;
    color: #2d3748;
    background: #ffffff;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ===== 顶部导航 ===== */
.tech-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #edf2f7;
    height: 56px;
}

.tech-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tech-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    text-decoration: none;
}

.tech-brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #38b2ac, #319795);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.tech-nav-meta {
    font-size: 13px;
    color: #a0aec0;
}

/* ===== 主体布局 ===== */
.tech-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px 40px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    min-height: 100vh;
}

/* ===== 左侧导航 ===== */
.tech-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    border-radius: 12px;
    padding: 8px;
    background: #ffffff;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
    border: 1px solid #edf2f7;
}

/* ===== 两种导航类型：明显视觉区分 ===== */

/* 类型 A：文章列表（首页） —— 强调"入口感"：卡片化 + 顶部色带 + 分组徽章 */
.tech-sidebar--home {
    background:
        linear-gradient(180deg, #e6fffa 0%, #ffffff 72px),
        #ffffff;
    border-color: #bee5e2;
    box-shadow: 0 1px 2px rgba(56, 178, 172, 0.08);
}

/* 顶部类型色带：文章列表 —— 绿色 */
.tech-sidebar--home::before {
    content: "";
    display: block;
    height: 3px;
    margin: -8px -8px 8px;
    background: linear-gradient(90deg, #38b2ac 0%, #81e6d9 100%);
    border-radius: 12px 12px 0 0;
}

/* 类型 B：文章目录（阅读页） —— 强调"目录感"：蓝色顶带 + 轻微缩进 + 二级前编号 */
.tech-sidebar--reader {
    background:
        linear-gradient(180deg, #ebf8ff 0%, #ffffff 72px),
        #ffffff;
    border-color: #bee3f8;
    box-shadow: 0 1px 2px rgba(66, 153, 225, 0.08);
}

/* 顶部类型色带：文章目录 —— 蓝色 */
.tech-sidebar--reader::before {
    content: "";
    display: block;
    height: 3px;
    margin: -8px -8px 8px;
    background: linear-gradient(90deg, #4299e1 0%, #90cdf4 100%);
    border-radius: 12px 12px 0 0;
}

/* 类型标识小角标（右上），一眼看出当前是什么导航 */
.tech-sidebar::after {
    content: attr(data-sidebar-label);
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 10px;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
}
.tech-sidebar--home::after {
    content: "文章列表";
    color: #319795;
    background: #e6fffa;
    border: 1px solid #bee5e2;
    opacity: 1;
}
.tech-sidebar--reader::after {
    content: "文章目录";
    color: #2b6cb0;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    opacity: 1;
}

/* 类型差异：home 一级分组更强卡片化；reader 分组更像文字目录 */
.tech-sidebar--home .tech-nav-group-toggle {
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #edf2f7;
    border-radius: 10px;
    transition: all 0.2s;
}
.tech-sidebar--home .tech-nav-group-toggle:hover {
    border-color: #bee5e2;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(56, 178, 172, 0.1);
    transform: translateY(-1px);
}
.tech-sidebar--home .tech-nav-group.is-active > .tech-nav-group-toggle {
    background: linear-gradient(135deg, #e6fffa, #ffffff);
    border-color: #38b2ac;
    color: #319795;
    box-shadow: 0 2px 8px rgba(56, 178, 172, 0.15);
}
.tech-sidebar--home .tech-nav-group.is-expanded > .tech-nav-group-toggle {
    border-color: #bee5e2;
}

.tech-sidebar--reader .tech-nav-group-toggle {
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
}
.tech-sidebar--reader .tech-nav-group-toggle:hover {
    background: #f7fafc;
}
.tech-sidebar--reader .tech-nav-group.is-active > .tech-nav-group-toggle {
    color: #2b6cb0;
    background: linear-gradient(90deg, #ebf8ff, #ffffff);
    box-shadow: inset 3px 0 0 #4299e1;
}

/* reader 二级条目前显示文章序号（CSS counter + ::after 叠加 ::before 位置） */
.tech-sidebar--reader {
    counter-reset: reader-article;
}
.tech-sidebar--reader .tech-nav-item {
    counter-increment: reader-article;
}
/* 用 ::before 当圆形背景，::after 显示序号；两者叠放同位置 */
.tech-sidebar--reader .tech-nav-item::before {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    left: -14px;
    top: 14px;
    background: #edf2f7;
    transform: none;
}
.tech-sidebar--reader .tech-nav-item:hover::before {
    background: #bee3f8;
}
.tech-sidebar--reader .tech-nav-item::after {
    content: counter(reader-article);
    position: absolute;
    left: -14px;
    top: 14px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #4a5568;
    pointer-events: none;
    z-index: 1;
}
.tech-sidebar--reader .tech-nav-item:hover::after { color: #2b6cb0; }

/* 激活态：让激活条目前的圆变成蓝色实心，文字变白 */
.tech-sidebar--reader .tech-nav-item.is-active::before { background: #4299e1; }
.tech-sidebar--reader .tech-nav-item.is-active::after { color: #ffffff; }
.tech-sidebar--reader .tech-nav-item.is-active:hover::before { background: #4299e1; }
.tech-sidebar--reader .tech-nav-item.is-active:hover::after { color: #ffffff; }

/* home 二级保留小圆点但换为绿色感 */
.tech-sidebar--home .tech-nav-item::before { background: #a7d9d3; }
.tech-sidebar--home .tech-nav-item:hover::before { background: #38b2ac; }

.tech-nav-list {
    list-style: none;
    padding-top: 24px;
    position: relative;
}

/* ===== 一级分组 ===== */
.tech-nav-group {
    margin-bottom: 6px;
    position: relative;
}

.tech-nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: 8px;
    cursor: pointer;
    color: #2d3748;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    user-select: none;
    position: relative;
}

.tech-nav-group-toggle:hover {
    background: #f7fafc;
    color: #319795;
}

/* 当前激活的一级（首页/对应栏目页） */
.tech-nav-group.is-active > .tech-nav-group-toggle {
    background: linear-gradient(90deg, #e6fffa 0%, #f7fafc 100%);
    color: #319795;
    box-shadow: inset 3px 0 0 #38b2ac;
}

.tech-nav-group-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tech-nav-group-arrow {
    font-size: 11px;
    color: #a0aec0;
    transition: transform 0.25s ease, color 0.2s;
    margin-left: 8px;
    flex-shrink: 0;
    display: inline-block;
}

.tech-nav-group.is-expanded .tech-nav-group-arrow {
    transform: rotate(180deg);
    color: #319795;
}

.tech-nav-group.is-expanded > .tech-nav-group-toggle {
    background: #f7fafc;
    color: #319795;
}

/* 一级之间细分隔线（除最后一个） */
.tech-nav-group + .tech-nav-group::before {
    content: "";
    display: block;
    height: 1px;
    margin: 6px 14px 6px;
    background: #edf2f7;
}

/* ===== 二级子菜单 ===== */
.tech-nav-sub {
    list-style: none;
    padding-left: 12px;
    margin-top: 6px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease, padding-top 0.3s ease;
    /* 左侧引导线，体现层级 */
    border-left: 2px solid #edf2f7;
    margin-left: 14px;
}

.tech-nav-group.is-expanded > .tech-nav-sub {
    max-height: 1000px;
    padding-top: 2px;
}

.tech-nav-item {
    margin-bottom: 4px;
    position: relative;
}

/* 二级条目左侧小圆点 */
.tech-nav-item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 22px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e0;
    transition: background 0.2s, transform 0.2s;
}

.tech-nav-item:hover::before {
    background: #a0aec0;
    transform: scale(1.2);
}

.tech-nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    border-left: 2px solid transparent;
}

.tech-nav-link:hover {
    background: #f7fafc;
    color: #2d3748;
    transform: translateX(2px);
}

.tech-nav-link.active {
    background: #e6fffa;
    color: #319795;
    border-left-color: #319795;
    font-weight: 500;
}

.tech-nav-link.active::before {
    background: #38b2ac;
    transform: scale(1.3);
}

.tech-nav-article-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.4;
}

.tech-nav-article-desc {
    font-size: 12px;
    color: #a0aec0;
    line-height: 1.5;
}

.tech-nav-link.active .tech-nav-article-desc {
    color: #718096;
}

/* ===== 右侧内容 ===== */
.tech-content {
    min-width: 0;
}

.tech-article {
    display: none;
    animation: techFadeIn 0.3s ease;
}

.tech-article.active {
    display: block;
}

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

.tech-article-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf2f7;
}

.tech-article-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
    margin-bottom: 12px;
}

.tech-article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #a0aec0;
}

.tech-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e6fffa;
    color: #319795;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.tech-article-body {
    color: #4a5568;
    font-size: 15px;
    line-height: 1.8;
}

.tech-article-body h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
    margin: 32px 0 14px;
    padding-left: 12px;
    border-left: 3px solid #38b2ac;
}

.tech-article-body h3 {
    font-size: 17px;
    font-weight: 600;
    color: #2d3748;
    margin: 24px 0 10px;
}

.tech-article-body p {
    margin-bottom: 14px;
}

.tech-article-body ul,
.tech-article-body ol {
    margin: 0 0 14px 22px;
}

.tech-article-body li {
    margin-bottom: 6px;
}

.tech-article-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    background: #f7fafc;
    color: #d53f8c;
    padding: 2px 6px;
    border-radius: 3px;
}

.tech-article-body pre {
    background: #1a202c;
    color: #e2e8f0;
    padding: 16px 18px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 14px 0 18px;
    font-size: 13px;
    line-height: 1.6;
}

.tech-article-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 13px;
}

.tech-article-body blockquote {
    margin: 16px 0;
    padding: 10px 16px;
    background: #f7fafc;
    border-left: 3px solid #38b2ac;
    color: #718096;
    border-radius: 0 4px 4px 0;
}

.tech-article-body strong {
    color: #1a202c;
    font-weight: 600;
}

/* 代码高亮（简易） */
.tk-kw { color: #f687b3; }
.tk-str { color: #9ae6b4; }
.tk-com { color: #718096; font-style: italic; }
.tk-type { color: #90cdf4; }
.tk-fn { color: #fbd38d; }

/* ===== 下载按钮 ===== */
.tech-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    margin-top: 8px;
    background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(56, 178, 172, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.tech-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(56, 178, 172, 0.45);
}

.tech-download-btn:active {
    transform: translateY(0);
    opacity: 0.9;
}

/* ===== 底部 ===== */
.tech-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: #a0aec0;
    border-top: 1px solid #edf2f7;
}

.tech-footer a {
    color: #a0aec0;
    text-decoration: none;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .tech-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 72px 16px 32px;
    }

    .tech-sidebar {
        position: static;
        max-height: none;
    }

    .tech-nav-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .tech-nav-item {
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .tech-nav-link {
        white-space: nowrap;
    }

    .tech-article-title {
        font-size: 22px;
    }
}
