:root {
    --width: 720px;
    --font-scale: 1.1rem;
    --background-color: #fff;
    --heading-color: #222;
    --text-color: #222;
    --link-color: #222;
    --visited-color: #222;
    --code-background-color: #F0F0F0;
    --code-color: #222;
    --blockquote-color: #222;
    --gray-color: #666;
}


@media (prefers-color-scheme: dark) {
    :root {
        --width: 780px;
        --font-scale: 1.1rem;
        --background-color: #1c1c1c;
        --heading-color: #e0e0e0;
        --text-color: #e0e0e0;
        --link-color: #e0e0e0;
        --visited-color: #e0e0e0;
        --code-background-color: #2d2d2d;
        --code-color: #e0e0e0;
        --blockquote-color: #e0e0e0;
        --gray-color: #aaa;
    }
}

body {
    font-size: var(--font-scale);
    margin: auto;
    max-width: var(--width);
    text-align: left;
    background-color: var(--background-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.7;
    font-weight: 400;
    color: var(--text-color);
    font-family: sans-serif;
    height: 100%;
    word-break: break-all;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

time {
    font-family: consolas, monospace;
    font-style: normal;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading-color);
    display: inherit;
}

a {
    color: var(--link-color);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

a:hover,
nav .current {
    color: var(--gray-color);
    text-decoration: underline;
}

nav a {
    margin-right: 8px;
}

article a {
    text-decoration: underline;
}

strong,
b {
    color: var(--heading-color);
}

pre {
    padding: 5px 12px;
    overflow: auto;
    max-height: 400px;
}

hr {
    border: 0;
    border-top: 1px solid;
}

article hr {
    border: 0;
    border-top: 1px dashed;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 0.3rem;
}

time,
.intro {
    color: var(--gray-color);
}

pre,
code {
    font-size: 0.9em;
    font-family: sans-serif;
    background-color: var(--code-background-color);
    color: var(--code-color);
    border-radius: 0.3rem;
}

code {
    padding: 2px 3px;
}

pre code {
    padding: 3px 0px;
}

blockquote {
    border-left: 5px solid var(--heading-color);
    padding: 10px 15px;
    margin: 10px 0;
    font-weight: bold;
    color: var(--blockquote-color);
    background-color: var(--code-background-color);
    border-radius: 0.3rem;
}

blockquote footer {
    text-align: right;
    font-size: 0.9em;
    color: #777;
}

header,
footer {
    padding: 10px 0;
}

.title h1,
.title h2 {
    font-size: 3.5em;
}

.title:hover {
    text-decoration: none;
}

main {
    margin-top: 50px;
    flex: 1;
    box-sizing: border-box;
}

nav a {
    font-size: 1.2em;
}

ul.posts {
    list-style-type: none;
    padding: unset;
}

ul.posts li {
    display: flex;
    margin: 3px 0;
}

ul.posts li span {
    flex: 0 0 115px;
}

ul.posts li a:visited {
    color: var(--visited-color);
}

.tags {
    margin-top: 30px;
    color: var(--gray-color);
}

.tags a {
    color: #888;
    margin: 0 5px 0 2px;
}

.post-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.post-content {
    flex: 1;
    margin-right: 20px;
    min-width: 0;
    overflow: hidden;
}

.post-item a {
    display: block;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
    width: 100%;
}

.post-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    max-height: 3em;
    word-wrap: break-word;
    word-break: break-all;
}

.post-item time {
    color: #666;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

footer,
footer a {
    letter-spacing: 0;
    line-height: 2;
    color: var(--gray-color);
    text-decoration: none;
    font-size: 13px;
}

.home {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (max-width:768px) {
    body {
        padding: 0px 20px;
    }
}

@media (min-width:769px) {
    body {
        padding: 0;
    }
}

.post-pagination ol {
    list-style: none;
    display: inline-flex;
    padding: 0;
}

.post-pagination .page-numbers,
.post-pagination ol a {
    width: 35px;
    height: 35px;
    line-height: 35px;
    margin-right: 8px;
    display: inline-block;
    text-align: center;
    border-radius: 4px;
}

.post-pagination .pagination a:hover,
.post-pagination .pagination .current,
.post-pagination ol a:hover,
.post-pagination ol .current a {
    background: #333;
    color: #fff;
    text-decoration: none;
}

.post-pagination .page-numbers,
.post-pagination ol a {
    background: #f8f8f8;
    color: #555;
}

.post-pagination {
    margin: 80px 0 50px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th,
td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    position: sticky;
    top: 0;
    z-index: 10;
}

@media (max-width:600px) {

    th,
    td {
        display: block;
        width: 100%;
    }

    th {
        position: static;
    }

    tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
    }
}

.site-logo {
    max-height: 64px;
    width: auto;
    margin-right: 12px;
}

.site-title {
    position: relative;
    padding-bottom: 5px;
}

.site-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #333;
}

/* 分类列表页样式 */
.category-title span {
    position: relative;
}
.category-title span::after {
    content: " · ";
    margin: 0 8px;
}

/* 内容页样式 */
.post-meta .post-time::after {
    content: " · ";
    margin: 0 8px;
}

/* 首页链接后面的斜杠 */
.post-meta .category-wrapper {
    position: relative;
}
.post-meta .category-wrapper::before {
    content: " / ";
    margin: 0 8px;
}

/* 分类链接之间的点号 */
.post-meta .category-wrapper a::after {
    content: " · ";
    margin: 0 8px;
}

.post-meta .category-wrapper a:last-child::after {
    display: none;
}

/* 上一篇文章分隔线 */
.prev-post {
    position: relative;
    margin-top: 30px;
    padding-top: 20px;
}
.prev-post::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #eee;
}

/* 分类页文章列表样式 */
.category-list .post-item {
    margin: 8px 0;
}

.category-list .post-time {
    position: relative;
    margin-right: 1em;
    display: inline-block;
}

.category-list .post-time::after {
    content: " · ";
    margin-left: 8px;
}

.category-list .post-desc {
    margin-top: 8px;
    margin-left: 110px; /* 与时间和标题对齐 */
}

/* 首页标题样式 */
h1 .title {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .post-item {
        flex-direction: column;
    }
    
    .post-content {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .post-item time {
        width: 100%;
        text-align: left;
        margin-top: 4px;
    }
}