/* ==================== 全局重置 ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "Courier New", Courier, monospace;
    background-color: #fef7e8;
    color: #333;
    line-height: 1.6;
    font-weight: 500;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==================== 隐藏页眉页脚 ==================== */
.navbar,
.footer {
    display: none;
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ==================== 文本容器 ==================== */
.post-container {
    background-color: #fffff2;
    border: 3px solid #2c2c2c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* ==================== 增加文章按钮 ==================== */
.add-post-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #2c2c2c;
    color: #fffff2 !important;
    border: 2px solid #2c2c2c;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.add-post-btn:hover {
    background-color: #fffff2;
    color: #2c2c2c !important;
}

/* ==================== 添加文章按钮容器 ==================== */
.add-post-wrapper {
    margin-bottom: 1.5rem;
}

/* ==================== 瀑布流布局 ==================== */
.waterfall {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* ==================== 卡片 ==================== */
.card {
    background: #fffff2;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}

.card-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: auto;
    display: block;
}

.card-body {
    padding: 1rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body p {
    font-weight: 500;
}

.card-body h1,
.card-body h2,
.card-body h3,
.card-body h4,
.card-body h5,
.card-body h6 {
    border-left: 5px solid #b22222;
    padding-left: 0.75rem;
    margin-left: 0;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.card-title a:hover {
    color: #000;
}

.card-date {
    display: block;
    font-size: 0.875rem;
    color: #999;
    margin-bottom: 0.75rem;
}

.card-summary {
    color: #666;
    font-size: 0.9375rem;
    line-height: 1.6;
    font-weight: 500;
    flex: 1;
    margin-bottom: 1rem;
    max-height: none;
    overflow: visible;
}

/* 文章内容中的图片宽度适配 */
.card-summary img {
    max-width: 100%;
    height: auto;
}

.card-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s;
    align-self: flex-start;
}

.card-link:hover {
    color: #000;
}

/* ==================== 文章分割线 ==================== */
.post-separator {
    border: none;
    border-top: 2px dashed #aaa;
    margin: 1rem 0 0.5rem 0;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #999;
    font-size: 1.125rem;
}

.empty-state a {
    color: #333;
    text-decoration: none;
}

/* ==================== 上传表单 ==================== */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-container h1 {
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    padding: 0.625rem 0.75rem;
    border: 1px solid #ccc;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="file"]:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: 1px solid #333;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #333;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #000;
}

.btn-danger {
    background-color: #e53e3e;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c53030;
}

/* ==================== 管理页面表格 ==================== */
.admin-container {
    max-width: 800px;
    margin: 0 auto;
}

.admin-container h1 {
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fffff2;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background-color: #fafafa;
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td a {
    color: #333;
    text-decoration: none;
}

.admin-table td a:hover {
    text-decoration: underline;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .main-content {
        padding: 0 0.5rem;
    }
}

/* ==================== 代码高亮（Pygments 默认主题） ==================== */
.codehilite {
    background: #fafafa;
    border: 1px solid #eee;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.codehilite pre {
    margin: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ==================== 文章内容段落加粗 ==================== */
.post-content p {
    font-weight: 500;
}

/* ==================== 分割线样式 ==================== */
.post-separator {
    border: none;
    border-top: 2px dashed #aaa;
    margin: 1rem 0 0.5rem 0;
}

/* ==================== “下一篇文章”固定按钮 ==================== */
.next-article-btn {
    position: fixed;
    right: 20px;
    bottom: 50px;
    width: 48px;
    height: 48px;
    background-color: #2c2c2c;
    color: #fffff2;
    border: 2px solid #2c2c2c;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.next-article-btn:hover {
    background-color: #fffff2;
    color: #2c2c2c;
    transform: scale(1.1);
}
