/* 基础布局样式 */
body {
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    font-family: "Microsoft YaHei", sans-serif;
}

/* 文章列表容器 */
.essay-list-container {
    max-width: 1200px;
    margin: 12vh auto;
    padding: 0 5vw;
    display: flex;
    flex-direction: column;
    gap: 4vh;
}

/* 文章卡片样式 - 核心修改：增加padding-bottom预留按钮位置，优化overflow */
.essay-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 3vh 3vw 8vh; /* 底部增加padding，避免内容被按钮覆盖 */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden; /* 缩略时隐藏溢出，展开时通过类修改 */
    transition: all 0.4s ease;
    height: auto; /* 确保高度完全自适应 */
}

/* 展开状态：取消overflow限制，让内容完全显示 */
.essay-card.expanded {
    overflow: visible;
}

/* 缩略状态：限制内容高度，隐藏超出部分 */
.essay-card .essay-content {
    max-height: 18vh;
    overflow: hidden;
    transition: max-height 0.4s ease;
    color: #666;
    line-height: 1.8;
    font-size: 2.5vh;
    margin: 2vh 0;
}

/* 展开状态：彻底取消高度限制（核心修改） */
.essay-card.expanded .essay-content {
    max-height: none; /* 替换1000px，无任何高度限制 */
}

/* 文章标题 */
.essay-title {
    font-size: 3.2vh;
    font-weight: bold;
    color: #4c4c4c;
    margin: 0 0 1vh 0;
}

/* 创作时间 */
.essay-time {
    font-size: 2.2vh;
    color: #999;
    margin-top: 1vh;
}

/* 展开/收起按钮 - 调整定位，适配padding-bottom */
.toggle-btn {
    position: absolute;
    bottom: 3vh; /* 与卡片padding-bottom配合，不遮挡内容 */
    right: 3vw;
    background-color: #6ec4ba;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 1.2vh 2vw;
    font-size: 2.2vh;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10; /* 确保按钮始终在最上层 */
}

.toggle-btn:hover {
    background-color: #6ec4ba;
    transform: scale(1.05);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 5vh;
    right: 3vw;
    width: 7vh;
    height: 7vh;
    border-radius: 50%;
    background-color: #6ec4ba;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3vh;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 0.8;
    z-index: 99;
}

.back-to-top:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* 移动端适配（max-width: 440px） */
@media screen and (max-width: 440px) {
    /* 文章列表容器 */
    .essay-list-container {
        margin: 12vh auto;
        padding: 0 3vw;
        gap: 3vh;
    }

    /* 文章卡片 - 适配移动端padding */
    .essay-card {
        padding: 2.5vh 4vw 7vh; /* 底部padding同步调整 */
    }

    /* 文章标题 */
    .essay-title {
        font-size: 2.8vh;
    }

    /* 文章内容 */
    .essay-card .essay-content {
        max-height: 20vh;
        font-size: 2.3vh;
        line-height: 1.7;
    }

    /* 创作时间 */
    .essay-time {
        font-size: 2vh;
    }

    /* 展开/收起按钮 */
    .toggle-btn {
        padding: 1vh 3vw;
        font-size: 2vh;
        bottom: 2.5vh;
        right: 4vw;
    }

    /* 返回顶部按钮 */
    .back-to-top {
        width: 6vh;
        height: 6vh;
        font-size: 2.5vh;
        bottom: 4vh;
        right: 4vw;
    }
}