/* —————————— CSS变量定义 */
:root {
    /* 颜色变量 */
    --color-primary: #0052d9;
    --color-background-gray: #f4f4f4;
    --color-background-light: #fff;
    --color-background-dark: #030d28;
    --color-text: #222;
    --color-text-gray: #797C80;
    --color-text-light: #d6d6d6;
    --color-border: #F5F6F7;
    --color-link: var(--color-primary);
    --padding: 1em;
}

/* —————————— 重置基础样式 */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    letter-spacing: 0.05em;
}

ul,
ol {
    margin: 0;
    padding: 0;
}

li {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    text-decoration: none;
}

/* —————————— 基础布局 */
/* 页面布局 */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1em;
}

header,
footer {
    flex: 0 0 auto;
}

main {
    flex: 1;
}

/* 主内容区域布局 */
main {
    display: flex;
    gap: 1em;
    align-items: flex-start;
}

aside {
    /* display: none; */
    flex: 0 0 250px;
    min-width: 0;
}

article {
    flex: 1;
    min-width: 0;
}

/* —————————— 工具类 */

/* 容器 */
.lw-container {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* 
 * 小屏幕断点：576px (sm)
 * 对应Bootstrap的小屏幕设备
 */
@media (min-width: 576px) {
    /* 小屏幕设备样式扩展点 */
}

/* 
 * 中等屏幕断点：768px (md)
 * 对应Bootstrap的中等屏幕设备（平板）
 */
@media (min-width: 768px) {
    /* 中等屏幕设备样式扩展点 */
}

/* 
 * 大屏幕断点：992px (lg)
 * 对应Bootstrap的大屏幕设备（小桌面）
 */
@media (min-width: 992px) {
    /* 大屏幕设备样式扩展点 */
}

/* 
 * 超大屏幕断点：1200px (xl)
 * 对应Bootstrap的超大屏幕设备（桌面）
 */
@media (min-width: 1200px) {
    .lw-container {
        /* 最大宽度：桌面设备上限制为1140px，保持内容可读性 */
        max-width: 1140px;
    }
}

/* 
 * 超超大屏幕断点：1400px (xxl)
 * 对应Bootstrap的超超大屏幕设备（大桌面）
 */
@media (min-width: 1400px) {
    .lw-container {
        /* 最大宽度：大桌面设备上扩展为1320px，充分利用屏幕空间 */
        max-width: 1320px;
    }
}

/* 白色背景 */
.lw-bg-light {
    background-color: var(--color-background-light);
}

/* 边框 */
.lw-border {
    border-radius: 2px;
    box-shadow: 0 0 2px #627c991a;
}

.lw-border-half {
    display: block;
    padding: 1em 0;
    position: relative;
}

.lw-border-half::before {
    position: absolute;
    content: '';
    left: 0;
    bottom: 0;
    width: 40px;
    height: 1px;
    background-color: var(--color-primary);
}

/* 内边距 */
.lw-padding {
    padding: var(--padding);
}

.lw-text-gray {
    color: var(--color-text-gray);
}

.lw-full-width {
    width: 100%;
}

.lw-text-center {
    text-align: center;
}

/* —————————— 自定义样式 */
body {
    background-color: var(--color-background-gray);
    color: var(--color-text);
}

/* 头部导航 */
#header-nav ul {
    /* 布局 */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.header-nav-brand {
    font-size: 1.1em;
    font-weight: bold;
    letter-spacing: 0.2em;
}

#header-nav li a {
    display: block;
    padding: 1em;
    letter-spacing: 0.1em;
}

#header-nav a:hover {
    background-color: var(--color-background-gray);
}

/* 底部 */
footer {
    background-color: var(--color-background-dark);
    font-size: 0.9em;
    color: var(--color-text-light);
}

#footer-main {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 2em;
}

#footer-main section {
    flex: 1;
    min-width: 0;
}

.footer-title {
    font-weight: bold;
    margin-bottom: 1em;
    font-size: 1.3em;
}

#footer-posts {
    display: flex;
    flex-direction: column;
}

#footer-posts a {
    display: block;
    padding: 0.2em;
    font-size: 0.9em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#footer-posts a:hover {
    color: var(--color-primary);
}

#footer-links {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.5em;
    flex-wrap: wrap;
    font-size: 0.9em;
    margin-top: 1em;
    border-top: 1px solid var(--color-primary);
    padding-top: 1em;
}

#footer-links span {
    font-weight: bold;
}

/* 首页 */
.post-item {
    border-bottom: 1px solid var(--color-border);
    padding: 1em 0;
    /* flex */
    display: flex;
    flex-direction: row;
    gap: 1em;
    align-items: center;
}

.post-img {
    flex: 0 1 240px;
    max-height: 160px;
    overflow: hidden;
}

.post-img img {
    border-radius: 5px;
}

.post-info {
    flex: 1;
    min-width: calc((100% - 1em)*3/5);
    /* flex */
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.post-meta {
    font-size: 0.9em;
    letter-spacing: 1px;
    color: var(--color-text-gray);
    line-height: 1em;
    height: 1em;
    overflow: hidden;
}

.post-meta a {
    color: var(--color-link);
}

.post-title h2 {
    font-size: 1.2em;
    line-height: 1.1em;
    font-weight: normal;
    margin: 0;
    max-height: 2.2em;
    overflow: hidden;
}

.post-excerpt {
    font-size: 0.95em;
    line-height: 1.1em;
    max-height: 2.2em;
    overflow: hidden;
}

#pagination {
    margin-top: 1em;
    /* flex */
    display: flex;
    justify-content: space-around;
    gap: 1em;
}

#pagination a {
    border: 1px solid var(--color-border);
    display: block;
    padding: 0.5em 1em;
    color: var(--color-link);
    background-color: var(--color-background-gray);
}

/* 页面内容 */
#series-posts {
    display: none;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;

    @media (min-width: 992px) {
        display: block;
    }
}

#series-posts a {
    padding: 0.5em 0;
    display: block;
    font-family: monospace;
    font-size: 1.15em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-bottom: 1px solid var(--color-border);
}

#series-posts a:hover {
    color: var(--color-link);
    background-color: var(--color-background-gray);
}

#series-posts a.active {
    color: var(--color-text-gray);
    background-color: var(--color-background-gray);
    pointer-events: none;
}

#single-title {
    margin: 1em 0;
    font-size: 1.7em;
    font-weight: 800;
    word-break: break-word;
}

#single-toc {
    display: none;
    float: right;
    margin-left: 1em;
    background-color: var(--color-background-gray);
    box-sizing: content-box;
    max-width: 200px;
    max-height: 50vh;
    overflow-y: auto;
    font-size: 1.1em;

    @media (min-width: 768px) {
        position: sticky;
        top: 0em;
    }

}

#single-toc h3 {
    font-size: 0.9em;
}

#single-toc a {
    padding: 0.3em 0;
    color: var(--color-link);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
}

#single-toc a.node-name--H3 {
    font-size: 0.95em;
}

#single-toc a.node-name--H4 {
    font-size: 0.85em;
}


#single-content a {
    color: var(--color-link);
    margin-right: 1.5em;
}