/* ==========================================================================
   字体导入 (Font Imports)
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@100..900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600&display=swap");

/* ==========================================================================
   基础样式 (Base Styles)
   ========================================================================== */
body {
    background-color: #FFF;
    color: #444;
    font-family: "Noto Sans SC", sans-serif;
    font-size: 87.5%;
}

/* 链接样式 (Link Styles) */
a {
    color: rgb(67, 135, 193);
    text-decoration: none;
}
a:hover,
a:active {
    color: #444;
}

/* ==========================================================================
   代码块样式优化 (Code Block Styling Optimization)
   固定头部 / 独立滚动区 / 代码高亮 / 行号功能
   ========================================================================== */

/* 1. <pre> 容器样式 (边框和整体布局) */
pre {
    position: relative;
    margin: 1.5em 0;
    padding: 0;
    border: 1px solid #ccc;
    background-color: #F0F8FF;
    border-radius: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 2. 固定头部栏 (Code Header) */
.code-header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    line-height: 30px;
    padding: 0 15px;
    font-size: 0.85em;
    font-weight: bold;
    color: #fff;
    background-color: rgba(93, 150, 199, 0.98);
    z-index: 1;
    border-bottom: 1px solid #4A90E2;
    border-radius: 0;
}

/* 3. 复制按钮样式 (Copy Button) */
.copy-button {
    position: absolute;
    top: 5px;
    right: 8px;
    background-color: rgba(67, 135, 193, 0.8);
    color: white;
    border: none;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.8em;
    line-height: 1.4;
    transition: background-color 0.2s;
    font-family: "Noto Sans SC", sans-serif;
}
.copy-button:hover {
    background-color: rgba(67, 135, 193, 1);
}

/* 4. 代码内容滚动容器 (Content Scroller) */
.code-content {
    max-height: 400px;
    overflow: auto;
    background-color: inherit;
    counter-reset: line-counter; /* 启用行号计数器 */
}

/* 5. 代码 <code> 样式 (作为行号容器) */
pre code {
    display: block;
    font-family: "Source Code Pro", Menlo, Monaco, Consolas, "Lucida Console", "Courier New", monospace;
    font-size: .92857em;
    padding: 0; /* 取消左右 padding，由行号和行元素提供 */
    color: #444;
    background: transparent;
    line-height: 1.4;
    white-space: pre;
    border: none;
    border-radius: 0;
}

/* 6. 单行代码容器 (由 JS 动态创建) */
.code-line {
    padding: 0 15px; /* 行的右侧内边距 */
    padding-left: 55px; /* 行的左侧内边距，为行号腾出空间 */
    position: relative;
    min-height: 1.4em; /* 确保空行也有高度 */
   
    /* 鼠标悬停在单行时的效果 (已注释) */
    /* transition: background-color 0.1s; */
}

/* 7. 行号样式 (Line Number) */
.code-line::before {
    counter-increment: line-counter; /* 计数器递增 */
    content: counter(line-counter); /* 显示计数器的值 */
   
    position: absolute;
    left: 0;
    top: 0;
   
    color: #999; /* 较浅的颜色 */
    text-align: right;
    width: 40px; /* 行号区域宽度 */
    padding-right: 10px;
   
    user-select: none; /* 防止行号被选中 */
    pointer-events: none; /* 允许点击穿透 */
    background-color: #EAEAEA; /* 行号背景色 */
   
    min-height: 1.4em;
    line-height: 1.4;
}

/* 8. 代码高亮配色方案 (Syntax Highlighting) */
.h-keyword {
    color: #0077CC; /* 蓝色 */
    font-weight: 600;
}
.h-string {
    color: #990000; /* 深红色 */
}
.h-comment {
    color: #777777; /* 灰色 */
    font-style: italic;
}
.h-number {
    color: #AA0000; /* 红色 */
}

/* 9. 行内代码 <code> 样式 (Inline Code) */
code {
    font-family: "Source Code Pro", Menlo, Monaco, Consolas, "Lucida Console", "Courier New", monospace;
    font-size: .92857em;
    padding: 2px 4px;
    color: #B94A48;
    background: #EEE;
    border-radius: 2px;
}

/* ==========================================================================
   内容与布局 (Content and Layout Styles)
   ========================================================================== */

/* 引用块 (Blockquote) */
blockquote {
    margin: 1em 0em;
    padding: 10px 15px;
    border-left: 8px solid #4A90E2;
    background-color: #F0F8FF;
    color: #444;
    font-style: normal;
}

/* 表单元素 (Form Elements) */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea {
    padding: 5px;
    border: 1px solid #E9E9E9;
    width: 100%;
    border-radius: 2px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
textarea {
    resize: vertical;
}

/* 内容区域链接样式 (Content Area Link Styles) */
.post-meta a,
.post-content a,
.widget a,
.comment-content a {
    border-bottom: 1px solid #EEE;
}
.post-meta a:hover,
.post-content a:hover,
.widget a:hover,
.comment-content a:hover {
    border-bottom-color: transparent;
}

/* 浏览器兼容性提示 (Browse Happy) */
.browsehappy {
    padding: 8px 0;
    background: #FBE3E4;
    color: #8A1F11;
    text-align: center;
}
.browsehappy a {
    color: #8A1F11;
    text-decoration: underline;
    font-weight: bold;
}

/* 头部区域 (Header) */
#header {
    padding-top: 15px;
    border-bottom: 1px solid #EEE;
    background: rgba(93, 150, 199, 0.98);
}
#logo {
    color: #fff;
    font-size: 2.5em;
}
.description {
    margin: .5em 0 0;
    color: rgba(238, 238, 238, 0.55);
    font-style: italic;
}

/* 导航菜单 (Navigation Menu) */
#nav-menu {
    margin: 15px 0 0;
    padding: 0;
}
#nav-menu a {
    display: block;
    margin-right: -1px;
    padding: 0 20px;
    border: 1px solid #EEE;
    border-bottom: none;
    height: 32px;
    line-height: 32px;
    color: #444;
    float: left;
}
#nav-menu a:hover,
#nav-menu .current {
    background: #F6F6F6;
}

/* 搜索框 (Search) */
#search {
    position: relative;
    margin-top: 15px;
}
#search input {
    padding-right: 30px;
}
#search button {
    position: absolute;
    right: 4px;
    top: 2px;
    border: none;
    padding: 0;
    width: 24px;
    height: 24px;
    background: transparent url("https://www.gt.ac.cn/assist/theme/img/icon-search.png") no-repeat center center;
    direction: ltr;
    text-indent: -9999em;
}
@media (-webkit-min-device-pixel-ratio:2),
(min-resolution:192dpi) {
    #search button {
        background-image: url("https://www.gt.ac.cn/assist/theme/img/icon-search@2x.png");
        -webkit-background-size: 24px 24px;
        -moz-background-size: 24px 24px;
        -o-background-size: 24px 24px;
        background-size: 24px 24px;
    }
}

/* 文章容器 (Post Container) */
.post {
    padding: 10px;
    border: 1px solid #F1E5E5;
    border-left: 3px solid rgba(51, 84, 170, 0.53);
    background: rgba(240, 248, 255, 0.18);
    margin-top: 25px;
}
.post:hover {
    background: aliceblue;
}

/* 文章标题和元数据 (Post Title and Meta) */
.post-title {
    margin: .83em 0;
    font-size: 1.4em;
    margin-top: -1px;
}
.post-meta {
    margin-top: -0.5em;
    padding: 0;
    color: #999;
    font-size: .92857em;
}
.post-meta li {
    display: inline-block;
    margin: 0 8px 0 0;
    padding-left: 12px;
    border-left: 1px solid #EEE;
}
.post-meta li:first-child {
    margin-left: 0;
    padding-left: 0;
    border: none;
}

/* 文章内容 (Post Content) */
.post-content {
    line-height: 1.5;
}
.post .tags {
    clear: both;
}

/* 邻近文章 (Post Near) */
.post-near {
    list-style: none;
    margin: 30px 0;
    padding: 0;
    color: #999;
}
.post-near li {
    margin: 10px 0;
}

/* 归档标题 (Archive Title) */
.archive-title {
    margin: 1em 0 -1em;
    padding-top: 20px;
    color: #999;
    font-size: 1em;
}

/* 更多链接 (More Link) */
.more {
    text-align: center;
}
.more a {
    border: none;
}

/* 受保护文章 (Protected Post) */
.protected .text {
    width: 50%;
}

/* 分页导航 (Page Navigator) */
.page-navigator {
    list-style: none;
    margin: 25px 0;
    padding: 0;
    text-align: center;
}
.page-navigator li {
    display: inline-block;
    margin: 0 4px;
}
.page-navigator a {
    display: inline-block;
    padding: 0 10px;
    height: 30px;
    line-height: 30px;
}
.page-navigator a:hover {
    background: #EEE;
    text-decoration: none;
}
.page-navigator .current a {
    color: #444;
    background: #EEE;
}

/* 评论区 (Comments) */
#comments {
    padding-top: 15px;
}

/* 评论列表 (Comment List) */
.comment-list,
.comment-list ol {
    list-style: none;
    margin: 0;
    padding: 0;
}
.comment-list li {
    padding: 14px;
    margin-top: 10px;
    border: 1px solid #EEE;
}
.comment-list li.comment-level-odd {
    background: #F6F6F3;
}
.comment-list li.comment-level-even {
    background: #FFF;
}
.comment-list li.comment-by-author {
    background: #FFF9E8;
}
.comment-list li .comment-reply {
    text-align: right;
    font-size: .92857em;
}

/* 评论元数据与作者 (Comment Meta & Author) */
.comment-meta a {
    color: #999;
    font-size: .92857em;
}
.comment-author {
    display: block;
    margin-bottom: 3px;
    color: #444;
}
.comment-author .avatar {
    float: left;
    margin-right: 10px;
}
.comment-author cite {
    font-weight: bold;
    font-style: normal;
}

/* 评论回复表单 (Comment Reply Form) */
.comment-list .respond {
    margin-top: 15px;
    border-top: 1px solid #EEE;
}
.respond .cancel-comment-reply {
    float: right;
    margin-top: 15px;
    font-size: .92857em;
}

/* 评论表单 (Comment Form) */
#comment-form label {
    display: block;
    margin-bottom: .5em;
    font-weight: bold;
}
#comment-form .required:after {
    content: " *";
    color: #C00;
}

/* 侧边栏 (Secondary/Sidebar) */
#secondary {
    padding-top: 15px;
    word-wrap: break-word;
}

/* 小工具 (Widget) */
.widget {
    margin-bottom: 30px;
}
.widget-list {
    list-style: none;
    padding: 0;
}
.widget-list li {
    margin: 5px 0;
    line-height: 1.5;
}
.widget-list li ul {
    margin-left: 15px;
}

/* 底部区域 (Footer) */
#footer {
    margin-top: 25px;
    padding: 3em 0;
    line-height: 1.5;
    text-align: center;
    color: #999;
    background: aliceblue;
}

@media screen and (max-width: 600px) {
    /* 移动端样式 */
    .footer-container {
        display: block;
        padding: 0 20px;
    }
    .footer-left, 
    .footer-right {
        width: 100%;
        text-align: left;
    }
}

@media screen and (min-width: 601px) {
    /* 桌面端样式 */
    .footer-container {
        display: flex;
        justify-content: space-between;
        padding: 0 24px;
    }
    .footer-left, 
    .footer-right {
        width: calc(50% - 48px);
        text-align: left;
    }
}

/* 错误页面 (Error Page) */
.error-page {
    margin-top: 100px;
    margin-bottom: 100px;
}

/* 内容排版通用样式 (Content Typography Utilities) */
.post-content,
.comment-content {
    line-height: 1.5;
    word-wrap: break-word;
}
.post-content h2,
.comment-content h2 {
    font-size: 1.28571em;
}
.post-content img,
.comment-content img,
.post-content video,
.comment-content video {
    max-width: 100%;
}
.post-content a img,
.comment-content a img {
    background: #FFF;
    position: relative;
    bottom: -4px;
}
.post-content hr,
.comment-content hr {
    margin: 2em auto;
    width: 100px;
    border: 1px solid #E9E9E9;
    border-width: 2px 0 0 0;
}

/* 对齐辅助类 (Alignment Helper Classes) */
.aligncenter,
div.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.alignleft {
    float: left;
}
.alignright {
    float: right;
}
img.alignleft {
    margin: 0 15px 0 0;
}
img.alignright {
    margin: 0 0 0 15px;
}

/* 媒体查询 (Media Queries) */
@media (max-width:767px) {
    body {
        font-size: 81.25%;
    }
    #nav-menu a {
        float: none;
        display: inline-block;
        margin: 0 -2px;
    }
}
@media (max-width:768px) {
    #header,
    .post-title,
    .post-meta {
        text-align: center;
    }
}
@media (min-width:1200px) {
    .container {
        max-width: 952px;
    }
}

/* 辅助类 (Utility Classes) */
.hidden {
    display: none !important;
    visibility: hidden;
}
.sr-only {
    border: 0;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}
.sr-only.focusable:active,
.sr-only.focusable:focus {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    width: auto;
}
.invisible {
    visibility: hidden;
}

/* 文章详情页特殊样式 (Single Post Specific Style) */
.single:hover {
    background: rgba(240, 248, 255, .18) !important;
}

/* 表格样式 (Table Styles) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    border: 1px solid #000000;
}
table th,
table td {
    border: 1px solid #000000;
    padding: 8px;
    text-align: left;
}
table th {
    background-color: rgba(93, 150, 199, 0.98);
    font-weight: bold;
    color: #ffffff;
}
table td {
    background-color: rgba(240, 248, 255, 0.18);
}

/* 水平分割线 (Horizontal Rule) */
hr {
    margin: 2em auto;
    width: 100px;
    border: 1px solid #E9E9E9;
    border-width: 2px 0 0 0;
}

/* 列表样式 (List Styles) */
ul,
ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}
ul li,
ol li {
    margin-bottom: 0.5em;
}