@font-face {
    font-family: "Roboto Mono";
    src: url("https://cdn.jsdelivr.net/gh/googlefonts/RobotoMono@main/fonts/webfonts/RobotoMono-Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    text-rendering: optimizeLegibility;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("https://cdn.jsdelivr.net/gh/googlefonts/RobotoMono@main/fonts/webfonts/RobotoMono-Italic.woff2") format("woff2");
    font-style: italic;
    font-weight: 400;
    text-rendering: optimizeLegibility;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("https://cdn.jsdelivr.net/gh/googlefonts/RobotoMono@main/fonts/webfonts/RobotoMono-Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 700;
    text-rendering: optimizeLegibility;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("https://cdn.jsdelivr.net/gh/googlefonts/RobotoMono@main/fonts/webfonts/RobotoMono-BoldItalic.woff2") format("woff2");
    font-style: italic;
    font-weight: 700;
    text-rendering: optimizeLegibility;
}

@font-face {
    font-family: "HarmonyOS Sans SC";
    src: url("https://cdn.jsdelivr.net/gh/KincaidYang/fonts@main/HarmonyOS_Sans_SC_Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 375;
    font-display: swap;
    text-rendering: optimizeLegibility;
}

@font-face {
    font-family: "HarmonyOS Sans SC";
    src: url("https://cdn.jsdelivr.net/gh/KincaidYang/fonts@main/HarmonyOS_Sans_SC_Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 650;
    font-display: swap;
    text-rendering: optimizeLegibility;
}

:root {
    --global-font-size: 18px;
    --global-font-color: #444;
    --mono-font-stack: Roboto Mono, Menlo, Monaco, Lucida Console,
        Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono,
        Courier New, monospace, serif;
    --font-stack: Roboto Mono, HarmonyOS Sans SC, Menlo, Monaco, Lucida Console, Liberation Mono,
        DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace,
        serif;
    --global-line-height: 1.6em;
    --page-width: 60em;  /* 修改默认页宽为65em作为中间值 */
    --display-h1-decoration: 1;
}

@media (prefers-color-scheme: dark) {
    :root {
	--background-color: #222225;
	--page-width: 60em;  /* 将黑暗模式页宽改为65em */
	--font-color: #e8e9ed;
	--invert-font-color: #222225;
	--secondary-color: #a3abba;
	--tertiary-color: #a3abba;
	--primary-color: #62c4ff;
	--error-color: #ff3c74;
	--progress-bar-background: #3f3f44;
	--progress-bar-fill: #62c4ff;
	--code-bg-color: #3f3f44;
    --block-background-color: #252525;
    --prism-background: #252525;
    }
}

@media (prefers-color-scheme: light) {
    :root {
	--background-color:#fff;
	--page-width: 65em;  /* 明确设置浅色模式页宽为65em */
	--font-color:#151515;
	--invert-font-color:#fff;
	--primary-color:#1a95e0;
	--secondary-color:#727578;
	--error-color:#d20962;
	--progress-bar-background:#727578;
	--progress-bar-fill:#151515;
	--code-bg-color:#e8eff2;
    --block-background-color: #d8d8d8;
    --prism-background: #d8d8d8;
    }
}

@media only screen and (max-width: 850px) {
    :root {
        --global-font-size: 17px;
        --global-font-color: #444;
        --global-line-height: 1.6em;
        --page-width: 70em;
    }

    p {
        text-align: justify;
        text-justify: inter-word;
        hyphens: auto;
    }
}

@media only screen and (max-width: 450px) {
    :root {
        --global-font-size: 16px;
        --global-font-color: #444;
        --global-line-height: 1.6em;
        --page-width: 70em;
    }
}

.sidebar-heading {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.box-masonry .box-masonry-image {
    background: #fff;
}

.box-masonry,
.box-masonry:hover {
    box-shadow: none;
}

.label {
    font-family: var(--font-stack);
}

body {
    font-family: var(--font-stack);
    font-size: var(--global-font-size);
    background-color: var(--background-color);
    margin-bottom: 75px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family: var(--font-stack);
    clear: both;
}

h1 {
    margin-bottom: 150px;
}

.content-column-content p,
.content-column-content li {
    color: #666;
}

.btn-ghost {
    color: #666;
    background-color: transparent;
    border-color: #333;
    font-weight: 400;
    font-family: var(--font-stack);
    padding: 6px 12px;
    font-size: 18px;
    line-height: 1.55;
    border-radius: 0;
    margin-left: 0;
    margin-top: 5px;
}

.content-column-content .command {
    color: #aaa;
}

p.social a {
    margin: 0 0 10px 0;
    color: #fff;
    display: inline-block;
    width: 30px;
    height: 30px;
    border: none;
    line-height: 30px;
    font-size: 25px;
    text-align: center;
    vertical-align: bottom;
    color: #999999;
    -webkit-transition: all 0.2s ease-out;
    -moz-transition: all 0.2s ease-out;
    transition: all 0.2s ease-out;
}

.active a {
    text-decoration: underline;
}

strong {
    font-weight: bold;
}

.logo {
    font-weight: normal;
}

.terminal-menu li {
    margin-right: 30px;
}

figure {
    margin-top: 15px;
    margin-bottom: 15px;
    margin-left: 60px;
    margin-right: 60px;
}

.footer {
    clear: both;
    margin-top: 75px;
    padding-top: 10px;
    border-top: 1px solid var(--secondary-color);
    color: var(--global-font-color);
}

.image-grid {
    display: grid;
    grid-template-rows: auto;
    display: grid;
    grid-gap: 1em;
    grid-template-rows: auto;
    grid-template-columns: repeat(
        auto-fit,
        minmax(calc(var(--page-width) / 4), 1fr)
    );
}

.terminal-prompt::after {
    -webkit-animation: cursor 1s infinite;
    animation: cursor 1s infinite;
    width: 10px;
}

.terminal-prompt::before {
    content: none;
}

.gallery-image {
    margin-top: 10px;
    margin-bottom: 10px;
}

.posts-list {
    position: relative;
    padding-left: 100px;
    top: 0;
}

.post h1,
.post h2 {
    padding-top: 0;
    margin: 0;
    margin-bottom: 5px;
}

.posts-list .date {
    display: inline-block;
    position: absolute;
    left: 0px;
    width: 100px;
    z-index: 400;
    padding-top: 0;
}

@media only screen and (max-width: 850px) {
    .site-name {
        width: 2ch;
        overflow: hidden;
        display: inline-block;
    }

    .terminal-nav {
        align-items: flex-start;
        flex-direction: column;
        display: flex;
    }

    .terminal-menu ul {
        align-items: flex-start;
        display: flex;
        flex-direction: row;
        justify-content: left;
        margin-top: 0;
    }

    .terminal-menu li {
        margin-right: 20px;
    }

    .logo {
        padding: calc(var(--global-space) * 1) 0 calc(var(--global-space) * 1);
    }

    figure {
        margin-top: 5px;
        margin-bottom: 5px;
        margin-left: 30px;
        margin-right: 30px;
    }

    .posts-list {
        position: relative;
        padding-left: 0;
        top: 0;
    }

    .post h1,
    .post h2 {
        padding-top: 0;
    }

    .posts-list .date {
        display: inline-block;
        position: absolute;
        left: 0px;
        width: 150px;
        z-index: 400;
        font-weight: bold;
        padding-top: 0;
        display: none;
    }

    .footer {
        margin-top: 50px;
        padding-top: 5px;
    }
}

/* 手动切换深色模式覆盖媒体查询 */
html.dark-mode, .dark-mode {
    --background-color: #222225;
    --page-width: 60em;  /* 将手动切换的黑暗模式页宽改为65em */
    --font-color: #e8e9ed;
    --invert-font-color: #222225;
    --secondary-color: #a3abba;
    --tertiary-color: #a3abba;
    --primary-color: #62c4ff;
    --error-color: #ff3c74;
    --progress-bar-background: #3f3f44;
    --progress-bar-fill: #62c4ff;
    --code-bg-color: #3f3f44;
    --block-background-color: #252525;
    --prism-background: #252525;
}

html.light-mode, .light-mode {
    --background-color:#fff;
    --page-width: 60em;  /* 明确设置手动切换的浅色模式页宽为65em */
    --font-color:#151515;
    --invert-font-color:#fff;
    --primary-color:#1a95e0;
    --secondary-color:#727578;
    --error-color:#d20962;
    --progress-bar-background:#727578;
    --progress-bar-fill:#151515;
    --code-bg-color:#e8eff2;
    --block-background-color: #d8d8d8;
    --prism-background: #d8d8d8;
}

/* 主题切换按钮样式 */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--font-color);
    font-family: var(--font-stack);
    display: flex;
    align-items: center;
    margin-left: 15px;
    font-size: var(--global-font-size);
}

.theme-toggle:hover {
    opacity: 0.8;
}

.theme-toggle-icon {
    margin-right: 5px;
}

/* 导航栏样式优化 */
.terminal-nav {
    padding: 5px 0;
    border-bottom: 1px solid var(--secondary-color);
    margin-bottom: 5px;
}

/* 代码高亮相关样式 */
pre[class*="language-"] {
    border-radius: 3px;
    margin: 1em 0;
    overflow: auto;
    padding: 1em;
}

code[class*="language-"], pre[class*="language-"] {
    font-family: var(--mono-font-stack);
    font-size: 0.9em;
    line-height: 1.4;
    /* 移除默认的文本阴影 */
    text-shadow: none !important;
}

/* 自定义Prism.js token样式 */
.token.operator {
    background: none !important;
    /* 高亮运算符 */
    color: #ff5f87 !important;
    font-weight: bold;
}

.dark-mode pre[class*="language-"] {
    background: var(--prism-background);
}

.light-mode pre[class*="language-"] {
    background: var(--prism-background);
}

/* 适应移动设备的代码块样式 */
@media only screen and (max-width: 850px) {
    pre[class*="language-"] {
        padding: 0.7em;
        margin: 0.5em 0;
        font-size: 0.85em;
    }
}

/* 内联代码样式 */
:not(pre) > code {
    background-color: var(--code-bg-color);
    color: var(--font-color);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: var(--mono-font-stack);
    font-size: 0.85em;
}