/* Reset and basics */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f4f6f8;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    background-color: #1e3a8a;
    color: #fff;
    padding: 20px 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
}

.nav-toggle {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}

/* Hero Section */
.hero {
    background-color: #2563eb;
    color: #fff;
    padding: 80px 0;
    text-align: center;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

#search-box {
    padding: 10px;
    width: 80%;
    max-width: 400px;
    border-radius: 5px;
    border: none;
    font-size: 1rem;
}

/* Blog Posts */
.blog-posts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.post {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.post:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.post h3 {
    color: #1e3a8a;
    margin-bottom: 10px;
}

.post p {
    font-size: 0.95rem;
    color: #555;
}

/* Footer */
footer {
    background-color: #1e293b;
    color: #ccc;
    padding: 30px 0;
    text-align: center;
}

footer a {
    color: #4f46e5;
    text-decoration: none;
    margin: 0 5px;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Navigation */
@media (max-width: 768px) {
    nav {
        display: flex;
        flex-direction: column;
        gap: 10px;
        background-color: #1e3a8a;
        padding: 10px 20px;
        position: absolute;
        top: 70px;
        right: 20px;
        border-radius: 8px;
        transform: translateX(100%); /* 默认隐藏到右侧 */
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 1000;
    }

    nav.show {
        transform: translateX(0);   /* 滑入 */
        opacity: 1;                 /* 渐显 */
    }

    .nav-toggle {
        display: block;
        cursor: pointer;
        font-size: 1.5rem;
        background: none;
        border: none;
        color: #fff;
    }
}


/* 文章样式 */
.post-article {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    margin-top: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.post-article h2 {
    color: #1e3a8a;
    font-size: 24px;
    margin-bottom: 20px;
}
.post-article h4 {
    color: #1e3a8a;
    font-size: 23px;
    margin-bottom: 20px;
}

.post-date {
    color: #777;
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.post-content {
    text-align: justify;          /* 两端对齐 */
    text-justify: inter-word;     /* 单词间距调整更自然 */
    line-height: 1.6;             /* 行高，提升可读性 */
    font-size: 1rem;              /* 文字大小，可适应移动端 */
    margin: 0;
    padding: 0 10px;              /* 左右内边距，防止贴边 */
}


.post-content p {
    margin-bottom: 16px;
    font-size: 1.3rem;
    line-height: 1.7;
    color: #333;
}


/*------------------------------*/
/* 布局 */
.post-page {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

/* 主内容 */
.main-content {
    flex: 3;
}

/* 侧边栏 */
.sidebar {
    flex: 1;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sidebar h3 {
    color: #1e3a8a;
    margin-bottom: 15px;
}

/* 推荐文章卡片 */
/* 推荐文章卡片：相框风格 */
.recommended-card {
    width: 250px; /* 卡片宽度，可调整 */
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column; /* 图片在上，文字在下 */
    transition: transform 0.2s;
    margin-bottom: 20px;
}

.recommended-card:hover {
    transform: translateY(-3px);
}

/* 图片部分 */
.recommended-card img {
    width: 100%;        /* 宽度自适应卡片 */
    height: 90px;      /* 图片高度，可调整 */
    object-fit: cover;  /* 保持比例并裁剪多余部分 */
    display: block;
}

/* 文字内容部分 */
.recommended-card .card-content {
    padding: 12px;           /* 底部留白空间 */
    background-color: #dbd6d6;  /* 可以改成浅色背景 */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;        /* 保证底部有足够空间 */
}

/* 标题样式 */
.recommended-card .card-content  {
    color: #000000;
    font-weight: bold;
    text-decoration: none;
}

.recommended-card .card-content a:hover {
    text-decoration: none;
}


/* 响应式：侧边栏在移动端显示在下方 */
@media (max-width: 768px) {
    .post-page {
        flex-direction: column;
    }
    .post-content {
        font-size: 0.95rem;       /* 小屏文字稍微缩小 */
        padding: 0 15px;          /* 保证左右空白 */
    }

    .post-content p {
    text-indent: 2em;
}


    .sidebar {
        margin-top: 30px;
    }
}




/*关联文章*/
.related-card {
    width: 250px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: relative;       /* 文字定位需要相对定位 */
}

.related-card img {
    width: 100%;
    height: 150px;            /* 图片高度可调整 */
    object-fit: cover;
    display: block;
}

/* 文字覆盖在图片下1/3区域 */
.related-card .card-content {
    position: absolute;       /* 绝对定位覆盖在图片上 */
    bottom: 0;                /* 位于图片底部 */
    width: 100%;
    height: 35%;              /* 占图片下1/3 */
    background-color: rgba(170, 165, 165, 0.6); /* 半透明背景，可调透明度 */
    color: #fff;              /* 白色文字，确保可读 */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px;
}

.related-card .card-content a {
    color: #fff;
    font-weight: bold;
    text-decoration: none;
}

.related-card .card-content a:hover {
    text-decoration: underline; /* 可选 */
}

  html, body {
        height: 100%;
        margin: 0;
    }
    body {
        display: flex;
        flex-direction: column;
    }
    main {
        flex: 1; /* 占据剩余空间，推动 footer 到底部 */
    }
    footer {
        text-align: center;
        padding: 20px;
        background: #1e3a8a;
        color: #fff;
    }

    
/* styles.css */
body {
    position: relative;     /* 允许伪元素定位 */
    margin: 0;
    padding: 0;
    min-height: 100vh;      /* 保证背景覆盖整个页面 */
}

body::before {
    content: ""; 
    position: fixed;        /* 固定整个屏幕 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("../assets/08.jpg") center/cover no-repeat;
    opacity: 0.5;           /* 半透明度，可调 0~1 */
    z-index: -1;            /* 放到内容下面 */
}
