/* 引入外部字体CSS */
@import url('https://new.mooe.ren/LXGWNeoZhiSong/lxgwneozhisong.css');

:root {
    --width: 780px;
    --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;
    --main-font: "LXGW Neo ZhiSong", sans-serif, serif;
    --heading-font: "LXGW Neo ZhiSong", sans-serif, serif;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    height: 100%;
    margin: auto;
    max-width: var(--width);
    padding-top: 70px;
    background-color: var(--background-color);
    color: var(--text-color);
    /* 使用霞鹜新宋体 */
    font-family: var(--main-font);
    font-size: var(--font-scale);
    font-weight: 400;
    line-height: 1.7;
    text-align: left;
    word-break: break-all;
    overflow-wrap: break-word;
    word-wrap: break-word;
    flex-direction: column;
    justify-content: flex-start;
}

main,
main p {
    box-sizing: border-box;
    word-break: break-all;
}

h1,
h2,
h3,
h4,
h5,
h6,
.post-header h1,
.friends-header h1,
.friend-name,
.friends-note h3 {
    color: var(--heading-color);
    display: inherit;
    font-family: var(--heading-font);
}

strong,
b {
    color: var(--heading-color);
    font-family: var(--heading-font);
}

time,
.post-header a,
.post-header p,
.intro {
    color: var(--gray-color);
    font-family: var(--main-font);
    font-style: normal;
    margin: 0;
}

/* 搜索按钮基础样式 */
#search-button {
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease; /* 平滑过渡效果 */
}

/* 正常模式下的悬停效果 */
#search-button:hover {
    color: #3b82f6; /* 蓝色系 hover 颜色，可根据主题调整 */
}

/* 黑暗模式下的悬停效果 */
@media (prefers-color-scheme: dark) {
    #search-button:hover {
        color: #93c5fd; /* 黑暗模式下更亮的蓝色，确保可见性 */
    }
}

/* 确保搜索按钮图标继承颜色属性 */
#search-button svg {
    transition: color 0.3s ease;
}

.search input {
    width: 100%;
    color: #333;
    padding: 0.6rem 0;
    border: none;
    background: none;
    border-radius: 0;
    border-bottom: 3px solid #555;
    margin-bottom: 3rem;
    font-size: 1.3rem;
    /* 搜索框使用霞鹜新宋体 */
    font-family: var(--main-font);
}

.search input:focus {
    outline: none;
}

.protected input {
    width: 100%;
    color: #333;
    padding: 0.6rem 0;
    border: none;
    background: none;
    border-radius: 0;
    border-bottom: 3px solid #555;
    margin-bottom: 3rem;
    font-size: 1.3rem;
    /* 密码输入框使用霞鹜新宋体 */
    font-family: var(--main-font);
}

.protected input:focus {
    outline: none;
}

a {
    color: var(--link-color);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

a:hover,
.nav a:hover,
.post-navigation a:hover,
.friends-note a:hover {
    color: var(--gray-color);
    text-decoration: underline;
}

.nav a:hover,
.post-navigation a:hover {
    color: var(--link-color);
}

.title:hover {
    color: var(--text-color);
    text-decoration: none;
}

.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;
    text-decoration: none;
}

.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;
}

main a,
.friends-note a {
    text-decoration: underline;
}

footer,
footer a {
    color: #666666;
    font-size: 16px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: color 0.3s;
    font-family: sans-serif;
}

.footer-container {
    max-width: 780px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: inherit;
}

.footer-divider {
    border-top: 1px solid #e5e7eb;
    width: 100%;
    margin: 10px 0 5px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.typecho-logo {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
}

.footer-logo {
    display: inline-block;
}

@media (max-width: 780px) {
    .footer-content {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .footer-left,
    .footer-logo {
        display: block;
        width: 100%;
    }
}

#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    z-index: 1000;
    background-color: #00000008;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: var(--width);
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    flex: 1;
    margin: 0;
    font-size: 1em;
}

.header-content .nav {
    order: 2;
}

.header-content .search-container {
    order: 3;
    margin-left: 10px;
}

.nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav li {
    margin-left: 20px;
}

.nav a {
    display: block;
    padding: 20px 0;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
    text-decoration: none;
    font-family: sans-serif;
}

footer-nav a {
    font-size: 1.2em;
    margin-right: 8px;
}

.main-container {
    padding-top: 70px;
}

.blog-posts {
    padding: 0;
}

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);
}

.post-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.post-item a {
    flex: 1;
    text-decoration: none;
}

.post-item time {
    /* 保持时间使用等宽字体以保证对齐 */
    --main-font: "LXGW Neo ZhiSong", monospace;
    margin-left: 10px;
    white-space: nowrap;
}

.post-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    font-size: 0.9em;
    border-bottom: #ccc 1px solid;
}

.post-header h1 {
    margin: 0;
    font-size: 1.5em;
}

.site-title,
.post-title {
    transition: opacity 0.3s ease;
    font-family: sans-serif;
}

.post-title {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.scrolled .site-title {
    opacity: 0;
}

.scrolled .post-title {
    opacity: 1;
    pointer-events: auto;
}

.tags {
    display: inline-block;
    padding: 0px 6px;
    margin-top: 4px;
    border-radius: 4px;
    color: #555;
    background-color: #f0f0f0;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.3s ease;
    /* 标签使用霞鹜新宋体 */
    font-family: var(--main-font);
}

.tags a {
    text-decoration: none;
    color: #555;
}

.tags:hover {
    background-color: #e0e0e0;
    color: #333;
    text-decoration: none;
}

.tags:active {
    background-color: #d0d0d0;
}

.home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.post-header-tag {
    display: inline-block;
    padding: 0px 6px;
    margin-top: 4px;
    border-radius: 4px;
    color: #555;
    background-color: #f0f0f0;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.3s ease;
    /* 文章头部标签使用霞鹜新宋体 */
    font-family: var(--main-font);
}

.post-content img {
    border-radius: 4px;
}

.post-cover {
    width: 100%;
    margin-bottom: 20px;
}

.post-header-tag:hover {
    background-color: #e0e0e0;
    color: #333;
    text-decoration: none;
}

.post-header-tag:active {
    background-color: #d0d0d0;
}

pre,
code {
    /* 代码保持等宽字体不变 */
    font-family: monospace;
    font-size: 0.9em;
    color: var(--code-color);
    background-color: var(--code-background-color);
    border-radius: 4px;
    white-space: pre-wrap;
}

pre {
    padding: 5px 12px;
    overflow: auto;
    max-height: 400px;
}

code {
    padding: 2px 3px;
}

pre code {
    padding: 3px 0px;
}

blockquote {
    margin: 0;
    padding: 3px 10px;
    border-left: 5px solid var(--heading-color);
    background: #F9F9F9;
    border-radius: 4px;
    color: var(--blockquote-color);
    font-weight: bold;
    /* 引用块使用霞鹜新宋体 */
    font-family: var(--main-font);
}

blockquote p {
    margin: 0;
}

blockquote footer {
    text-align: right;
    font-size: 0.9em;
    color: #777;
}

table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    overflow: hidden;
}

th,
td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
    color: #333;
    transition: background-color 0.3s, transform 0.3s;
    /* 表格文字使用霞鹜新宋体 */
    font-family: var(--main-font);
}

th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.friends-page {
    padding: 20px 0;
}

.friends-header {
    margin-bottom: 30px;
    text-align: center;
}

.friends-header p {
    font-size: 1em;
    color: var(--gray-color);
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.friend-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
}

.friend-card:hover {
    border-color: #ddd;
}

.friend-card a {
    height: 100%;
    display: block;
    text-decoration: none;
    color: inherit;
}

.friend-content {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #F5F5F5;
}

.friend-avatar {
    flex: 0 0 50px;
    height: 50px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.friend-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eee;
    color: var(--text-color);
    font-size: 1em;
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: center;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-description {
    padding: 15px 15px 15px;
    margin: 0;
    color: var(--gray-color);
    font-size: 0.9em;
    line-height: 1.4;
}

.no-friends {
    padding: 30px 0;
    text-align: center;
    color: var(--gray-color);
}

.friends-note {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 0.9em;
}

.friends-note ul {
    margin: 10px 0;
    padding-left: 15px;
}

.friends-note li {
    margin-bottom: 8px;
    color: var(--text-color);
}

.search-container {
    display: flex;
    align-items: center;
}

#search-button {
    padding: 8px;
    background: none;
    border: none;
    margin-top: 2px;
    cursor: pointer;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.search-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

#search-button-text {
    font-size: 0.9em;
    color: var(--gray-color);
}

.search-modal-content {
    margin: 10% auto;
    padding: 0;
    width: 80%;
    max-width: 600px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
    border: none;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
}

#search-modal-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    /* 搜索模态框输入框使用霞鹜新宋体 */
    font-family: var(--main-font);
}

#search-tip {
    display: none;
}

.floating-search-tip {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: white;
    background-color: #00000088;
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* 黑暗模式适配 */
.dark-mode .floating-search-tip {
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 按键样式 */
.floating-search-tip kbd {
    background: #2d2d2d;
    padding: 2px 6px;
    border-radius: 3px;
}

.dark-mode {
    background: #444;
    border-color: #555;
}

.search-modal-results {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    text-align: center;
}

.search-result-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.search-result-item h3 a {
    color: var(--link-color);
    text-decoration: none;
}

.search-result-item p {
    margin: 0;
    color: var(--gray-color);
    font-size: 14px;
    line-height: 1.5;
}

.search-empty,
.search-loading,
.search-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-color);
}

/* 找到小屏幕模式的媒体查询（max-width: 768px），添加以下代码 */
@media (max-width: 768px) {
    /* 其他现有样式保持不变... */
    
    /* 小屏模式下搜索框宽度缩小10px */
    #search-modal-input {
        width: calc(100% - 10px); /* 相比默认宽度减少10px */
        box-sizing: border-box; /* 确保宽度计算包含内边距 */
    }
}

mark {
    padding: 2px 4px;
    background-color: #ffeb3b;
    border-radius: 4px;
}

hr {
    border: 0;
    border-top: 1px dashed;
}

img {
    max-width: 100%;
    height: auto;
}

sub {
    font-size: 12px;
    color: #777;
}

@media (max-width: 779px) {
    body {
        padding: 0 20px;
    }
    
    ul.blog-posts li a {
        margin-left: 0;
        word-break: break-all;
    }
    
    th,
    td {
        display: block;
        width: 100%;
    }
    
    th {
        position: static;
    }
    
    tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
    }
    
    .site-title,
    .post-title {
        position: static;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .scrolled .site-title {
        opacity: 1 !important;
    }
}

@media (min-width: 780px) {
    body {
        padding: 0;
    }
}

@media (max-width: 768px) {
    .friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
    
    .header-content {
        text-align: center;
    }
    
    .header-content .nav {
        margin: 15px 0;
        order: 2;
    }
    
    .header-content .nav ul {
        justify-content: center;
    }
    
    .header-content .search-container {
        margin: 0;
        order: 3;
    }
    
    .nav li {
        margin: 0 10px;
    }
    
    .search-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .search-modal-header {
        padding: 15px;
    }
    
    #search-modal-input {
        padding: 10px;
        font-size: 14px;
    }
    
    .post-title {
        display: none;
    }
}

@media (max-width: 480px) {
    .friends-grid {
        grid-template-columns: 1fr;
    }
    
    .friend-content {
        padding: 12px;
    }
    
    .friend-avatar {
        flex: 0 0 40px;
        height: 40px;
        margin-right: 12px;
    }
    
    .friend-avatar img,
    .avatar-placeholder {
        width: 35px;
        height: 35px;
    }
    
    .friend-name {
        font-size: 1em;
    }
    
    .friend-description {
        padding: 12px 12px 12px;
        font-size: 0.85em;
    }
}

/* 暗黑模式样式 - 调整后的版本 */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a1a1a;
        --heading-color: #f0f0f0;
        --text-color: #e0e0e0;
        --link-color: #e0e0e0;
        --visited-color: #c0c0c0;
        --code-background-color: #2d2d2d;
        --code-color: #f0f0f0;
        --blockquote-color: #d0d0d0;
        --gray-color: #aaa;
        /* 新增表格和标签变量 */
        --table-cell-color: #e0e0e0;
        --table-border-color: #444;
        --tag-bg-color: #3a3a3a;
        --tag-text-color: #ddd;
    }

    #header {
        background-color: #00000080;
    }

    .friend-card {
        background: #2d2d2d;
        border-color: #3d3d3d;
    }

    .friend-card:hover {
        border-color: #4d4d4d;
    }

    .friend-content {
        background-color: #252525;
    }

    .avatar-placeholder {
        background: #3d3d3d;
        color: var(--text-color);
    }

    .friends-note {
        background: #252525;
    }

    blockquote {
        background: #2d2d2d;
    }
   
    /* 调整表格单元格样式 */
    th,
    td {
        color: var(--table-cell-color); /* 更亮的文字颜色 */
        border-color: var(--table-border-color); /* 稍浅的边框 */
    }
    
    th {
        background-color: #2a2a2a; /* 表头稍深一点但不刺眼 */
    }

    td {
        background-color: #222222; /* 单元格背景稍浅 */
    }

    .tags,
    .post-header-tag {
        background-color: var(--tag-bg-color); /* 稍浅的背景 */
        color: var(--tag-text-color); /* 更亮的文字 */
    }

    .tags:hover,
    .post-header-tag:hover {
        background-color: #4a4a4a;
        color: #fff;
    }

    .tags:active,
    .post-header-tag:active {
        background-color: #555;
    }

    .tags a {
        text-decoration: none;
        color: #ffffff;
    }

    .search input,
    .protected input {
        border-bottom-color: #777;
        color: var(--text-color);
    }

    #search-modal-input {
        border-color: #555;
        background-color: #2d2d2d;
        color: var(--text-color);
    }

    .search-modal-content {
        background-color: var(--background-color);
    }

    .footer-divider {
        border-top-color: #333;
    }

    mark {
        background-color: #5d4037;
        color: #ffccbc;
    }

    hr {
        border-top-color: #444;
    }
}

/* 暗黑模式样式 */
@media (prefers-color-scheme: dark) {
    /* 已有的暗黑模式样式保持不变... */

    /* 反转logo图片颜色 */
    .typecho-logo,
    .footer-logo img {
        filter: invert(1);
        transition: filter 0.3s ease; /* 可选：添加过渡效果 */
    }
}