/* ================= 1. 基础全局设置 ================= */
:root {
    --theme-green: #d0e7b8;      /* 你的核心主题色 */
    --light-green: #D4E4BC;
    --text-color: #3B4D2B;
    --white-soft: rgba(255, 255, 255, 0.9); /* 半透明白，用于容器 */
    --theme-dark-green: #85A366; /* 深一点的绿色用于阴影 */
    --bg-paper: #f7f9f1;         /* 温暖的米白色背景 */
    --wood-brown: #A06B35;       /* 木质书架主色 */
    --wood-shadow: #8B5A2B;      /* 木质书架深色边缘 */
    --white: #ffffff;
}

body {
    /* 双渐变设计：左上角偏浅，右下角深绿 */
    background: linear-gradient(135deg, var(--light-green) 0%, var(--theme-green) 100%);
    
    /* 即使页面很长，背景也会固定住，不会产生断层 */
    background-attachment: fixed; 
    
    margin: 0;
    padding: 0;
    color: var(--text-color);
    min-height: 100vh;
}

h2 {
    font-size: 2rem;
    color: var(--theme-green);
    text-align: center;
    margin-bottom: 40px;
}

/* ================= 2. 木质书架模块 ================= */
.bookshelf-section {
    padding: 80px 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.shelf-row {
    display: flex;
    justify-content: space-around;
    align-items: flex-end; /* 关键：让所有内容向下对齐 */
    padding: 40px 40px 0 40px; /* 重点：底部 padding 设为 0，让书直接踩在 border 上 */
    margin-bottom: 120px; /* 增加底部外边距，给下沉的文字留位置 */
    position: relative;
    
    background: 
        repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px, transparent 1px, transparent 40px),
        linear-gradient(to bottom, #86562b 0%, #664220 100%);
    
    border-bottom: 22px solid var(--wood-brown); /* 书本会踩在这个边框上 */
    border-left: 12px solid #7D5226;
    border-right: 12px solid #7D5226;
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.3);
}

.shelf-row::after {
    content: '';
    position: absolute;
    bottom: -32px;
    left: -12px; /* 配合左右边框的宽度 */
    right: -12px;
    height: 10px;
    background: var(--wood-shadow);
    border-radius: 0 0 10px 10px;
}

.book-item {
    width: 130px;
    height: 180px;
    cursor: pointer;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
    margin-bottom: 0; /* 消除间距 */
}

/* 模拟书脊的立体感 */
.book-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 3px 0 0 3px;
}

.book-item:hover {
    transform: translateY(-20px) rotate(-3deg);
}

.book-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px 8px 8px 3px;
    box-shadow: 2px 0px 10px rgba(0,0,0,0.3); /* 调整投影，让底部看起来更实 */
    display: block;
}

/* ================= 3. 详情弹窗 (Modal) ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none; /* 由JS控制显示 */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    /* 1. 背景改用半透明的奶油白，能透出底层的绿色渐变，更有层次感 */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px); /* 磨砂玻璃效果 */
    
    border: 6px solid #FFF; /* 纯白粗边框，像绘本的边框一样 */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    border-radius: 40px;
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    display: flex;
    overflow: hidden;
    position: relative;
    animation: modalPop 0.4s ease-out;
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-left { flex: 1; background: #eee; }
.modal-left {
    background: #F0F4E8; /* 图片没加载时的浅绿底色 */
    display: flex;
    align-items: center;
    justify-content: center;
}

#modalDesc {
    color: #5C4A3D; /* 保持柔和的棕色，适合长文阅读 */
    line-height: 1.8;
    font-size: 1.1rem;
}
h2[data-aos] {
    color: #FFFFFF !important;
    text-shadow: 0 4px 10px rgba(59, 77, 43, 0.3);
    font-size: 2.5rem;
    letter-spacing: 2px;
}
.modal-left img { width: 100%; height: 100%; object-fit: cover; }

.modal-title, #modalTitle {
    /* 使用一种更活泼的深橙色或深绿，在白底上跳跃出来 */
    color: #E67E22; /* 温暖的橙色，和绿色背景是对比色，非常醒目 */
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.05);
}

.modal-right {
    flex: 1.2;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.close-btn {
    position: absolute;
    top: 20px; right: 20px;
    font-size: 28px; cursor: pointer;
    background: none; border: none; color: #ccc;
}

.buy-button {
    align-self: flex-end;
    background-color: var(--theme-green);
    color: #fb8e11;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 0 var(--theme-dark-green);
    transition: 0.2s;
}

.buy-button:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--theme-dark-green); }

/* ================= 4. 作者介绍与留言板 ================= */
.author-section, .message-section {
    padding: 80px 20px;
    max-width: 900px;
    margin: 0 auto;
}

.author-card {
    border-radius: 40px;
    padding: 40px;
    display: flex;
    gap: 40px;
}

.author-card, .message-box {
    background: var(--white-soft) !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.avatar {
    width: 180px; height: 180px;
    border-radius: 50%;
    border: 5px solid var(--theme-green);
}

.message-box {
    background: var(--white);
    padding: 30px;
    border-radius: 25px;
    border: 3px dashed var(--theme-green);
}

textarea {
    width: 100%;
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 15px;
    font-size: 1rem;
    margin-bottom: 20px;
    resize: none;
    box-sizing: border-box;
}

/* ================= 5. 两侧弹出人物样式 ================= */
.side-character {
    position: fixed; /* 固定在视口 */
    bottom: 10%;     /* 距离底部位置 */
    z-index: -1;     /* 放在文字底层，避免挡住点击 */
    pointer-events: none; /* 鼠标可以穿透，不影响点击按钮 */
    width: 200px;    /* 根据你的图片尺寸调整 */
    opacity: 0.8;    /* 稍微透明一点，更有氛围 */
}

.char-left {
    left: -10px;     /* 稍微露出一点或者贴边 */
}

.char-right {
    right: -10px;
    bottom: 25%;     /* 错开高度，更有灵动感 */
}

.side-character img {
    width: 100%;
    height: auto;
    /* 给人物加一个轻微的上下漂浮动画 */
    animation: floating 3s ease-in-out infinite;
}

/* 呼吸漂浮动画 */
@keyframes floating {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

/* 响应式适配：屏幕太小时隐藏角色，以免堆叠混乱 */
@media (max-width: 1200px) {
    .side-character {
        width: 120px;
        opacity: 0.5;
    }
}

@media (max-width: 768px) {
    .side-character {
        display: none; /* 手机端建议隐藏，保持排版整洁 */
    }
}

.book-item-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative; /* 必须设为 relative，方便文字定位 */
    z-index: 10;
    /* 确保包裹层本身没有高度撑开多余空间 */
    height: 180px; 
}

.book-title-label {
    position: absolute;
    bottom: -55px; /* 将文字推到 22px 的 border-bottom 之下 */
    left: 50%;
    transform: translateX(-50%);
    
    font-size: 14px;
    color: var(--text-color); /* 掉出书架后，用深绿色文字配合浅绿背景 */
    font-weight: bold;
    width: 160px;
    text-align: center;
    text-shadow: none; /* 掉出书架后不需要阴影了 */
    white-space: nowrap;
}

h1, h2 {
    color: white; /* 标题用白色，在绿底上非常醒目且有童趣 */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}
/* ================= 手机版适配 (屏幕宽度小于 768px) ================= */
@media (max-width: 768px) {
    .bookshelf-section {
        padding-top: 0px;
        margin-top: 0px
    }
    /* 1. 书架部分：增加垂直间距，防止文字遮挡下一行 */
    .shelf-row {
        display: grid;
        grid-template-columns: 1fr 1fr; 
        /* 增加垂直 gap 到 70px，为下沉的书名留出充足空间 */
        gap: 70px 15px; 
        padding: 30px 15px 0 15px; 
        justify-items: center;
        border-bottom-width: 15px; 
        margin-bottom: 100px; /* 增加书架行与行之间的距离 */
    }

    .shelf-row::after {
        bottom: -23px;
        height: 8px;
    }

    /* 2. 书本容器：稍微缩小一点尺寸，匹配手机屏幕 */
    .book-item-wrapper {
        width: 90px;  
        height: 130px; 
        position: relative;
        display: flex;
        justify-content: center;
        align-items: flex-end;
    }

    .book-item {
        width: 90px;
        height: 130px;
        margin-bottom: 0;
    }

    /* 3. 书名标签：缩小字体并优化颜色 */
    .book-title-label {
        position: absolute;
        bottom: -50px;      /* 确保文字落在 15px 的木板下方 */
        left: 50%;
        transform: translateX(-50%);
        
        font-size: 11px;    
        color: var(--text-color); 
        font-weight: 600;
        width: 100px;       
        text-align: center;
        line-height: 1.3;
        
        white-space: normal; 
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        
        text-shadow: none;  
    }

    /* 4. 详情页弹窗：针对窄屏优化比例 */
    .modal-content {
        flex-direction: column;
        max-height: 90vh;
        width: 92%;
        border-radius: 25px; /* 手机端圆角稍微小一点更协调 */
    }

    .modal-left {
        height: 160px; /* 减小图片区域，给文字留空间 */
    }

    .modal-right {
        padding: 20px;
    }

    #modalDesc {
        font-size: 0.95rem; /* 缩小弹窗正文字体 */
    }

    /* 5. 关于作者：头像尺寸微调 */
    .avatar {
        width: 60px;
        height: 60px;
    }

    /* 6. 顶部大标题：适配小屏幕 */
    h2[data-aos] {
        font-size: 1.4rem !important;
        margin-bottom: 20px;
    }

    /* 首页那段欢迎语在手机上的边距调整 */
    body > h2:first-of-type {
        margin: 40px 20px !important; /* 覆盖原本的 250px 巨大边距 */
        font-size: 1.2rem !important;
    }

    /* ================= 手机版作者部分深度优化 ================= */
    .author-card {
        display: flex !important;
        flex-direction: column !important; /* 强制纵向：头像在上，文字在下 */
        align-items: center !important;    /* 保证头像居中 */
        width: 100% !important;            /* 撑满父容器 */
        padding: 20px !important;
        box-sizing: border-box !important;
        gap: 15px !important;
    }

    .avatar {
        width: 120px !important;           /* 适当调大，不再显得寒碜 */
        height: 120px !important;
        flex: 0 0 auto !important;         /* 绝对禁止被 Flex 压缩 */
        margin: 0 auto 10px auto !important;
        border-width: 4px !important;
    }

    .author-info {
        display: block !important;         /* 强制变成块级，不再受 Flex 挤压干扰 */
        width: 100% !important;            /* 核心：物理宽度 100% 拒绝侧边缝隙 */
        flex: none !important;             /* 取消任何可能的 flex-grow 分配 */
        text-align: left !important;       /* 恢复左对齐，方便阅读长文 */
    }

    .author-info p, .author-info ul, .author-info li {
        width: 100% !important;
        font-size: 14px !important;
        line-height: 1.7 !important;       /* 增加行距，拒绝拥挤感 */
        margin-bottom: 8px !important;
    }

    /* 获奖经历列表优化：去掉缩进，利用手机全屏宽度 */
    .author-info ul {
        padding-left: 0 !important;
        list-style-position: inside !important;
    }
}