/* --- CSS 变量定义 (方便后期换肤) --- */
:root {
    --primary-color: #255ace;
    /* 主色调：现代蓝 */
    --text-main: #304050;
    /* 主要文字颜色 */
    --text-secondary: #4b5563;
    --text-muted: #9099aa;
    --text-link: #2b6cb0;
    --text-accent: #339e53;
    /* 次要文字颜色 */
    --bg-body: #ffffff;
    /* 背景色 */
    --bg-sidebar: #f9fafb;
    /* 侧边栏背景 */
    --border-color: #e5e7eb;
    /* 分割线颜色 */
    --code-bg: #f3f4f6;
    /* 代码块背景 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --aside-width: 260px;
    /* 侧边栏宽度 */
    --header-height: 50px;
    /* 顶部高度 */


    --text-heading: #0f172a;/* 标题颜色*/

    --radius: 10px;
}

/* --- 基础重置 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    list-style: none;
}

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--bg-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

hr{
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
    width: 100%;
    display: block;
}


/* --- 布局结构 --- */
body {
    width: 100%;
    height: 100%;
    overflow: hidden;

}

header.header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    justify-content: space-between;

    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);

    & .brand {
        font-weight: 500;
        font-size: 1.1rem;
        color: var(--text-main);
        display: flex;
        align-items: center;
        gap: 10px;

        & img {
            height: 1.1rem;
        }
    }

    & .leftarea {
        display: flex;
        align-items: center;
        gap: 3px;
    }

}

main,
aside,
article {
    height: calc(100vh - var(--header-height));
}

main {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;


}

aside,
article {
    overflow-y: auto;    
}

aside {
    flex-shrink: 0;
    flex-grow: 0;
    width: var(--aside-width);
    overflow-y: auto;
    overflow-x: hidden;

    background-color: var(--bg-sidebar);
    padding: 2rem 1.5rem;

    transform: translateX(0);  

}

article {
    flex-grow: 1;
    overflow-y: auto;      
}

article .article-inner{
    max-width: 1000px;
    padding: 2rem 3.5rem;

    &>section{
        margin-top: 4.5rem;
    }

}

@media (max-width: 800px) {
    aside{
        transform: translateX(calc(-1 * var(--aside-width)));
        margin-right: calc(-1 * var(--aside-width));
    }
    article{
        flex: 1;
        min-width: 0;

        & .article-inner{
            padding: 2rem 1.5rem;
        }
       
    }

}


/* =========================== 文档 侧边栏定义 ====================================*/

aside{

    & .toc-title {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #94a3b8;
        margin-bottom: 1rem;
        font-weight: 700;
    }

    &>ul {
        /* width: var(--aside-width); */
        background: var(--bg-sidebar);
        border-right: 1px solid var(--border);
        /* position: sticky;
        top: 0; */
        /* height: fit-content; */


    }

    & .toc-item { 
        margin: 0.25rem 0; 
    
    
        &>a { 
            text-decoration: none;
            color: #64748b;
            font-size: 0.9rem;
            display: block;
            padding: 0.4rem 0 0.4rem 0.4rem;
            border-radius: 6px;
            transition: 0.2s; 

            &::before {
                content: "›";
                display: inline-block;
                margin-right: 0.2rem;
                color: hsl(from var(--text-main) h s l / 0.15);
            }

            &.active::before, &:hover::before {
                color: var(--text-main) !important;
            }

            &:hover {
                color: var(--accent);
                background: #f1f5f9;
            }

            &.active {
                color: var(--accent);
                background: #e0f2fe;
                font-weight: 500;
            }
            &.level-H3 {
                padding-left: 1.2rem;
                font-size: 0.85rem;
            }
        
        }
    }



}


/*=========================== 文档 正文定义 ====================================*/


article {
    line-height: 1.8;
    box-sizing: border-box;
    list-style: none;

    & header{
        & h1{ 
            div.title{
                display: flex;
                align-items: center;
                gap: 10px;
            }
            div.title-info{
                font-weight: normal;
            }
        }
        & img{
            max-width: 40px;
            max-height: 40px;
        }
    }

    .muted{
        color: var(--text-muted);
        font-size: 0.9rem;
    }

    strong{
        color: var(--text-accent);
    }

    a, a:visited{
        color: var(--text-link);
       

    }
    a:hover,a:active{
        color: var(--primary-color);
        text-decoration: underline dotted 1px;
    }



    /* 字体大小设定 */
    h1 {
        font-size: 2.25rem;
        color: var(--text-heading);
        margin-bottom: 1.5rem;
        letter-spacing: -0.02em;
    }

    h2 {
        font-size: 1.5rem;
        color: var(--text-heading);
        margin: 3rem 0 1.1rem;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 0.2rem;
    }

    h3 {
        font-size: 1.1rem;
        color: var(--text-heading);
        margin: 1.8rem 0 0.6rem;
    }

    p {
        margin: 0.6rem 0;
    }

    /* 语义化的多媒体容器 */
    figure {
        margin: 2.5rem 0;
        background: #f8fafc;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 1rem;
        text-align: center;

        figcaption { font-size: 0.875rem; color: #94a3b8; margin-top: 0.75rem; }
    }

    img{
        max-width: 100%;
        max-height: 100%;
    }


    /* 代码块样式 */
    pre {
        background-color: var(--code-bg);
        padding: 1.5rem;
        border-radius: var(--radius);
        overflow-x: auto;
        margin: 1.5rem 0;
        border: 1px solid var(--border-color);
    }
    
    code {
        font-family: 'Consolas', 'Monaco', monospace;
        font-size: 0.9em;
        color: #9f6fa7; /* 代码高亮色示例 */
        display: inline-block;
        padding: 2px 4px;
        margin: 0 4px;
        border-radius: var(--radius);
        background-color: var(--code-bg);
    }
    
    pre code { color: var(--text-main); background: none; padding: 0; }

    footer{
        font-size: 0.875rem;
        color: var(--text-muted);
        margin-top: 4rem;
        &>div{
            display: flex;
            align-items: center;
            gap: 4px;
        }
    }

    em{
        font-size: small;
        display: block;
        margin: 6px 0;
        padding: 4px 8px;

        background: linear-gradient(to right,
                rgba(153, 153, 153, 0.06) 0%,
                rgba(153, 153, 153, 0.05) 50%,
                rgba(153, 153, 153, 0.0) 90%);
        color: #555;
    }

    & ul, & ol{
        margin: 0.6em 0 0.6em 0.8em;
        padding: 0;
    }

    & li{
        position: relative;
        margin: 0.3em 0;
        padding: 0 0 0 0.7em;
        border:none;

        &::before{
            content: "•";
            position: absolute;
            left: 0;
            color: rgba(153, 153, 153, 0.8);
        }

        &:hover{
            box-shadow: none;
            border-radius: none;
        }

    }





}



.related-links{
    font-size: 0.875rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap:0.5rem;

    &>p{
        margin:0;
    }
}

.contact{
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4rem;
}