/* 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-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 Grid */
.blog-posts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 30px;
    margin-top: 20px;
}

/* 单篇文章卡片 */
.post {
    width: 250px;                  /* 可选：统一宽度 */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(116, 16, 16, 0.1);
    margin-bottom: 20px;
    transition: transform 0.2s;
    position: relative;            /* 文字绝对定位参考 */
}

.post:hover {
    transform: translateY(-3px);
}

/* 文章封面图片 */
.post img {
    width: 100%;
    height: 250px;                 /* 可调整高度 */
    object-fit: cover;
    display: block;
}

/* 文字覆盖在图片下1/3区域 */
.post .post-content {
    position: absolute;            /* 文字覆盖 */
    bottom: 0;                     /* 位于图片底部 */
    width: 100%;
    height: 53%;                   /* 下1/3 */
    background-color: rgba(231, 235, 240, 0.4); /* 半透明背景 */
    color: #ffffff;                   /* 白色文字 */
    display: flex;
    flex-direction: column;        /* 标题在上，摘要在下 */
    align-items: center;
    justify-content: center;       /* 垂直居中 */
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
}

/* 标题 */
.post .post-content h3 {
    color: #f7f7f7;
    font-weight: bold;
    margin: 0;
    font-size: 1rem;
}

/* 摘要文字 */
.post .post-content p {
    color: #ffffff;
    font-size: 0.75rem;
    margin: 2px 0 0;
    line-height: 1.2;
    display: -webkit-box;
    line-clamp: 2;        /* 最多两行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 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 */
@media (max-width: 768px) {
    nav {
        display: none;
        flex-direction: column;
        gap: 10px;
        background-color: #1e3a8a;
        padding: 10px 20px;
        position: absolute;
        top: 70px;
        right: 20px;
        border-radius: 8px;
    }

    nav.show {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }
}

.about-container {
    display: flex;
    align-items: center; /* 垂直居中 */
    gap: 20px;
    padding: 40px 0;
}

.avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%; /* 圆形头像 */
    object-fit: cover;  /* 保持比例裁剪 */
    border: 3px solid #1e3a8a; /* 可选边框 */
}

.about-text {
    flex: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .about-container {
        flex-direction: column;
        text-align: center;
    }
    .avatar img {
        width: 120px;
        height: 120px;
    }
}

body {
    background-image: url('assets/bg.png'); /* 背景图片路径 */
    background-size: cover;     /* 图片铺满屏幕 */
    background-repeat: no-repeat; /* 不重复 */
    background-attachment: fixed; /* 固定背景，滚动时不动 */
    background-position: center;  /* 居中显示 */
}

.about-container {
    position: relative;
    padding: 40px;
    border-radius: 12px;
    color: #fff;
}

.about-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); /* 半透明黑色遮罩 */
    border-radius: 12px;
    z-index: 0;
}

.about-container > * {
    position: relative;
    z-index: 1; /* 确保文字和头像在遮罩上方 */
}

/* 移动端导航 */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
        cursor: pointer;
        font-size: 1.5rem;
        background: none;
        border: none;
        color: #fff;
    }

    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;
    }
}
