@charset "UTF-8";

/* noto-serif-sc-regular - chinese-simplified_latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: '思源宋体';
    font-style: normal;
    font-weight: normal;
    src: local('Source Han Serif CN Light'), local('Source Han Serif SC Light'), /*如果可能，调用本地字体*/
         url('fonts/noto-serif-sc-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* noto-serif-sc-700 - chinese-simplified_latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: '思源宋体';
    font-style: normal;
    font-weight: bold;
    src: local('Source Han Serif CN Bold'), local('Source Han Serif SC Bold'), /*如果可能，调用本地字体*/
         url('fonts/noto-serif-sc-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

span.katex, div.katex {
    font-size: 1em;      /* 或者 0.9em / 0.95em，看你喜欢多大 */
    line-height: inherit; /* 可选，防止行高怪异 */
}

:root {
    --root-font-size: 20px;
}

html {
  font-size: var(--root-font-size);
}

body, html {
    font-family: Arial, sans-serif;
    margin: 0px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    height: 100%;
    width: 100%;
    padding: 0%;
    background-color: #888888;
    overflow: hidden;
}

#top {
    display: flex;
    height: 5%;
}

.body-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-height: 0;
}

header {
    display: flex;                /* 使用flex布局 */
    justify-content: space-between; /* 使logo和toggle-btn在左右两侧 */
    width: 100%;
    background-color: #333;
    color: white;
    padding: 10px 0px;
    text-align: center;

    .root-page {
        color: #888888;
    }

    h1 {
        font-size: 1.3em;
        display: flex;
        margin: auto;
    }
    
    a {
        margin: 0%;
        text-decoration: none;   /* 去掉下划线 */
        color: white;
        cursor: pointer;        /* 鼠标悬停时显示为手指形状 */
    }

    span {
        color: rgb(181, 181, 181)
    }

    .toggle-btn {
        display: none;
    }
}

footer {
    display: flex;
    background-color: #333;
    color: white;
    justify-content: center;
    padding: 10px 0px;
    width: 100%;
    bottom: 0;

    p {
        text-align: center;
        margin-top: 4px;
        margin-bottom: 4px;
    }
}

.bar {
    width: 30px;
    height: 4px;
    background-color: white;
    border-radius: 2px;
}

.container {
    flex: 1 1 auto; /* main部分占用剩余空间 */
    /* height: 300px; 固定main的高度 */
    overflow-y: auto; /* 使main内部可滚动 */
    min-height: 0;
    width: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

/* 左侧整体 */
.sidebars {
    width: 25%;
    height: 95%;
    display: flex;
    flex-direction: column; /* 👈 关键：上下排列 */
    gap: 10px;
}

/* 样式提升 */
.sidebar {
    background-color: #f4f4f4;
    /* width: 25%; */
    /* height: 60%; */
    position: static; /* 固定位置 */
    top: 0px; /* 留出header空间 */
    padding: 5px 20px;
    box-sizing: border-box;
    overflow-y: auto; /* 让目录可以垂直滚动 */

    h2 {
        font-size: 1.2em;
        margin: 10px 0.5em;
        padding: 0 0;
    }

    ul {
        list-style: none;
        padding: 0;

        li {
            margin: 10px 0;
    
            a {
                text-decoration: none;
                color: #333;

                &:hover {
                    color: #007bff;
                }
            }

            &.ct-h1 a{
                /* font-weight: bold; */
                padding-left: 0px;
                font-size: 0.9em;
            }
    
            &.ct-h2 a{
                /* font-weight: bold; */
                padding-left: 0px;
                font-size: 0.75em;
            }
    
            &.ct-h3 a{
                padding-left: 8px;
                font-size: 0.7em;
            }

            &.ct-h4 a{
                padding-left: 15px;
                font-size: 0.6em;
            }
        }

        li.ct-h2 {
            position: relative;      /* 🔴 关键：建立定位上下文 */
            padding: 0 10px;
        }

        li.ct-h2.checked::before {
            content: "";
            position: absolute;
            inset: -6px -6px;     /* 等价于 top/right/bottom/left */
            background: #d9d9d9;
            border-radius: 10px;
            display: block;       /* 🔴 关键 */
            z-index: 0;
        }

        li.ct-h2 > * {
            position: relative;
            z-index: 1;
        }
        
        a.toc-ver {
            display: flex;
            width: 100%;
        }

        span.toc-date {
            text-align: left;
            font-size: 0.8em;
            font-weight: normal;
            min-width: 10em;
        }

        span.toc-msg {
            text-align: left;
            font-size: 0.9em;
            min-width: 5em;
        }
    }
}

.tools {
    user-select: none;
    padding: 10px 5px;
    flex: 0 0 auto;
    background: #e5e5e5;
    display: flex;
    justify-content: end;
    align-items: center;
    color: #333;
}

.controls {
    flex: 1 1 auto;
    display: flex;
    justify-content: start;
    align-items: center;
    gap: 5px;

    button {
        padding: 0;
        width: 2em;
    }
}

.sidebar span {
    text-align: right;
    font-size: 0.8em;
    line-height: 1.2em;
    max-height: 1.2em;
    font-weight: bold;
}

/* 目录：按内容高度，不主动吃空间 */
.toc {
    flex: 0 0 auto;   /* 👈 关键 */
    max-height: 40vh; /* 可选：防止极端情况下太高 */
}

/* 更新日志：吃掉剩余空间 */
.commits {
    flex: 1 1 auto;   /* 👈 关键 */
    min-height: 0;    /* 允许内部滚动 */
}

.content {
    background-color: #f4f4f4;
    width: 75%;
    height: 95%;
    padding: 0px 5%;
    overflow-y: auto; /* 让目录可以垂直滚动 */

    line-height: 1.6;
    font-size: 1em;
	font-family:"Times New Roman", '思源宋体', serif;

    h1 {
        text-align: center;
        margin-top: 5%;
        line-height: 1.6;
        font-size: 1.5em;
    }

    h2 {
        text-align: center;
        margin-top: 5%;
        line-height: 1.6;
        font-size: 1.2em;
    }
    
    h3 {
        text-indent: 1.8em;
        line-height: 1.6;
        font-size: 1em;
    }
    
    h4 {
        font-size: 1em;
    }
    
    .end {
	text-indent: 0;
        text-align: center;
        font-weight: bold;
        line-height: 2;
        background-color: #DDDDDD;
    }

    ol, ul {
        padding-left: 5%;
        margin-top: 0.2em;
        margin-bottom: 0.5em;
    }
    
    .plain-text {
        display: block;
        text-indent: 2em;
    }

    .ul-content {
        /* width: 60%; */
        margin-left: 5%;
        margin-right: 5%;
    }

    li.time-li {
        margin-top: 1%;
        margin-bottom: 0em;
    }

    .article-cell {
        /* margin-top: 1%;
        margin-bottom: 0em; */
        border-top: 1px dotted #ddd;
        border-bottom: 1px dotted #ddd;
        padding: 6px 10px;
        font-size: 1em;
    }
    
    .article-div {
        display: flex;
        flex-direction: row;
    }

    .article-main {
        display: flex;
        align-items: center;        /* 垂直居中 */
    }

    .article-info {
        margin-left: auto;          /* 关键：把这一整块推到最右边 */
        display: flex;
    }

    .article-mtime {
        display: flex;
        margin-top: 2px;
        font-size: 0.8em;
        color: #999;
    }

    p {
        text-indent: 1.8em;
        display: block;
        text-align: justify;
        line-height: 1.6;
    }
    
    p.footnote {
        text-indent: 0;
        background-color: #eef;
    }

    .added {
        background-color: #DDFFD0;
    }

    .removed {
        background-color: #FFCCCC;
        text-decoration: line-through;
    }

    a {
        text-decoration: none;   /* 去掉下划线 */
        color: rgb(30, 126, 130) ;
        cursor: pointer;        /* 鼠标悬停时显示为手指形状 */
        margin: auto;
    }

    a.tag-link {
        margin: auto 0.2em;
    }

    span.keyword {
        font-weight: bold;
        margin: auto 0.2em;
    }
    
    figure.fig {
        display: flex;
        flex-direction: column;
        align-items: center;
        /* margin-bottom: 15px; */

        figcaption.fig {
            font-size: 0.8em;
            text-align: center;
        }
        
        img.fig-image {
            max-width: 80%;
            max-height: 960px;
        }

        video.fig-video {
            max-width: 80%;
            max-height: 960px;
        }
    }
    
    table caption.table-caption {
        margin: 0.5em auto 0.5em;
        font-size: 0.8em;
    }

    table.multihead-table {
        margin: 1em auto;
        font-size: 0.9em;

        table-layout: fixed;
    
        .col2 {
            width: 5em;
        }

        .col3 {
            width: 6em;
        }

        .col4 {
            width: 6em;
        }

        .col5 {
            width: 6em;
        }

        th, td {
            font-weight: normal;
            padding: 6px 20px;
            border-bottom: 1px dotted lightgray;
        }
    
        .minimal {
            text-align: center;
            font-size: 0.9em;
            color: #444;
        }

        td.stat {
            padding: 3px 3px;
            
            /* display: flex; */
        }

        span {
            display: flex;
            border-radius: 10px;
            align-items: center;
            justify-content: center;
            width: 100%;
            padding: 3px 3px;
        }

        .st {
            color: #666;
            background-color: #eee;
        }
        .eu {
            color: #644;
            background-color: #eee;
        }
        .ug {
            color: #444;
            background-color: #cef;
        }
        .ud {
            font-weight: bold;
            color: #222;
            background-color: #8df;
        }
        .fi {
            color: #666;
            background-color: #dfd;
        }
        .ot {
            color: #822;
            background-color: #007bff;
        }

        .bottom-1 {
            border-bottom: 1px solid darkgray;
        }

        .bottom-2 {
            border-bottom: 1px solid;
        }
        
        .bottom-3 {
            border-bottom: 2px solid;
        }

        tr:first-child th {
            border-top: 1px solid;
        }

        tr:first-child td {
            border-top: 1px solid;
        }
    }

    .spantime {
        /* position: absolute;
        left: 0; */
        font-family: 'Courier New', Courier, monospace;
        margin-right: 10px;
        font-weight: bold;
        color: #444488;
        /* font-size: 14px; */
    }
    
    .hashtag {
        display: inline;
        margin-left: 5px;
        margin-right: 5px;
        color: #007BFF;
        text-decoration: none;
        cursor: pointer;

        &:hover {
            text-decoration: underline;
        }
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    :root {
        --root-font-size: 18px;
    }

    /* html {
        font-size: var(--root-font-size);
    } */
    
    .container {
        width: 100%;
        gap: 0;
        flex-direction: column;
    }

    .sidebars {
        /* display: none; /* 在窄屏幕上隐藏目录 */
        display: contents;
    }

    .commits, .toc {
        display: none;
    }

    .content { order: 1; }

    .tools{
        padding: 10px 5%;
        background-color: #f4f4f4;
        order: 2;
        width: 100%;
    }

    .sidebar span {
        line-height: 1.2em;
        font-size: 0.8em;
        font-weight: bold;
    }

    header {
        justify-content: space-between;
        align-items: center;

        h1 {
            margin-left: 20px;
            font-size: 1.125em;
        }

        a {
            margin: 0;
        }

        p {
            font-size: 36px;
            display: flex;
            margin: 0;
            line-height: 0.6;
        }
    
        .toggle-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            width: 20px;
            height: 20px;
            margin: 5px;
            margin-right: 20px;
        }
    }

    footer {
        display: none;
    }

    .content {
        flex: 1 1 auto;
        padding: 0px 5%;
        box-sizing: border-box;
        width: 100%;
        font-size: 1em;
        
        strong {
            font-weight: bold;
        }

        h4, h5, h6{
            margin: 0;
            font-weight: normal;
        }

        h1 {
            margin-top: 5%;
            text-align: center;
            font-size: 1.5em;
        }
    
        h2 {
            margin-top: 5%;
            font-size: 1.25em;
        }
        
        h3 {
            font-size: 1em;
        }
        
        h4 {
            font-size: 1.125em;
        }
        
        ol, ul {
            padding-left: 5%;
            margin: 0 0;
            margin-bottom: 30px;
        }

        li.time-li {
            margin-top: 1%;
            margin-bottom: 0em;;
        }
        
        .ul-content {
            /* width: 60%; */
            padding-left: 0%;
            margin-left: 0%;
            margin-right: 0%;
            list-style: none;
        }

        .article-cell {
            font-size: 14px;
        }

        .article-mtime {
            font-size: 12px;
        }

        p {
            display: block;
            line-height: 1.6;
        }
        
        figure.fig {
            display: flex;
            flex-direction: column;
            align-items: center;
            
            figcaption.fig {
                font-size: 12px;
                text-align: center;
            }

            img.fig-image {
                max-width: 100%;
                max-height: 1000px;
            }

            video.fig-video {
                max-width: 100%;
                max-height: 1000px;
            }
        }

        table.multihead-table {
            font-size: 0.8em;
            
            .col2 {
                width: 1em;
            }

            .col3 {
                width: 1em;
            }

            .col4 {
                width: 2.8em;
            }

            .col5 {
                width: 3.5em;
            }

            th {
                text-align: left;
                font-size: 0.8em;
                padding: 3px 0;
                text-align: center;
            }

            td {
                /* text-align: left; */
                padding: 3px 3px;
            }

            td.stat {
                height: 100%;
                padding: 3px 2px;
                /* display: flex; */
            }

            span {
                width: 100%;
                padding: 1px 1px;
            }

        }

        .minimal {
            text-align: center;
            font-size: 0.8em;
            color: #444;
        }
        
    }
}

/* 弹出的目录菜单样式 */
.popup-menu {
    max-height: 50%;      /* 设置最大高度为 200px */
    overflow-y: auto;       /* 使超出部分可以垂直滚动 */
    position: fixed;
    top: 6.5%;
    right: -70%;  /* 初始位置在视口右侧外 */
    /* width: 40%; */
    background-color: #333;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: right 0.3s ease;
    z-index: 999px;

    &.open {
        right: 0;  /* 菜单完全展示 */
    }

    nav {
        margin: 10px 30px 5px 30px;

        h2 {
            color: white;
            font-weight: bold;
            padding-left: 10px;
            font-size: 20px;
            margin-top: 0;
            margin-bottom: 10px;
        }

        ul {
            list-style-type: none;
            padding: 0;
            margin: 0;

            li {
                margin: 10% 0;

                a {
                    color: white;
                    text-decoration: none;
                    font-size: 14px;
                    padding-left: 10%;
                }

                &.ct-h1 a{
                    padding-left: 10px;
                    font-size: 1em;
                }
                
                &.ct-h2 a{
                    padding-left: 10px;
                    font-size: 0.9em;
                }
                
                &.ct-h3 a{
                    padding-left: 15px;
                    font-size: 0.8em;
                }
                
                &.ct-h4 a{
                    padding-left: 20px;
                    font-size: 14px;
                }
            }
            
            li.ct-h2 {
                position: relative;      /* 🔴 关键：建立定位上下文 */
                padding: 0 0px;
            }

            li.ct-h2.checked a {
                color: #444444
            }

            li.ct-h2.checked::before {
                content: "";
                position: absolute;
                inset: -6px -6px;     /* 等价于 top/right/bottom/left */
                background: #d9d9d9;
                border-radius: 10px;
                display: block;       /* 🔴 关键 */
                z-index: 0;
            }

            li.ct-h2 > * {
                position: relative;
                z-index: 1;
            }

            a.toc-ver {
                padding: 0;
                display: flex;
                flex-direction: row;
                align-items: baseline;
                width: 100%;
            }

            span.toc-date {
                line-height: 1;
                text-align: left;
                font-size: 0.9em;
                font-weight: normal;
                min-width: 9em;
                color: #BBBBBB;
            }

            li.checked span.toc-date {
                color: #666;
            }

            span.toc-msg {
                line-height: 1;
                text-align: left;
                font-size: 1em;
                min-width: 3em;
            }
        }
    }
}

#popup-toc {
    max-width: 250px;
}

#popup-commits {
    nav {
        margin: 10px 10px 5px 10px;;
    }
}
