/* ================= 全局基础重置 ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #333333;
    overflow-x: hidden; /* 防止出现水平滚动条 */
}

/* ================= 头部和导航栏 ================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 60px;
    background: #fff;
    position: relative;
    z-index: 1000;
}

.logo-link {
    display: inline-block;
}

.logo {
    height: 160px;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 35px;
}

.nav-links a {
    text-decoration: none;
    color: #000000;
    font-weight: 500;
    font-size: 16px;
    transition: color 0.3s ease;
}

/* 预留高亮 Home 页面 */
.nav-links a.active {
    color: #E87A24; /* 匹配 Logo 的橙色 */
}

.nav-links a:hover {
    color: #E87A24;
}

/* 汉堡菜单按钮隐藏（桌面端不显示） */
.menu-toggle {
    display: none;
}

/* ================= 主视觉与内容区域 ================= */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 220px);
    padding-bottom: 50px;
}

/* 图片聚合的舞台 */
.scene {
    position: relative;
    width: 750px;
    height: 500px;
    margin-bottom: 30px;
    transform-origin: center center;
}

/* 模拟底部纸箱的背景 */
.box-base {
    position: absolute;
    top: 70px;
    left: 45px;
    width: 660px;
    height: 380px;
    background-color: #CDA681;
    border: 2px solid #BA8A5A;
    box-shadow: inset 0 0 50px rgba(139, 90, 43, 0.4), 0 20px 40px rgba(0,0,0,0.05);
    border-radius: 3px;
    z-index: 0;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

/* 包装每一个图片的容器，用来控制入场动画的位置 */
.item-wrapper {
    position: absolute;
    z-index: 1;
    opacity: 0;
    /* 入场聚合动画 */
    animation: converge 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* 针对图片本身的悬浮特效 */
.item-wrapper img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.4s ease;
}

/* 鼠标悬浮时，容器层级提到最高，图片放大并增加阴影 */
.item-wrapper:hover {
    z-index: 100 !important;
}

.item-wrapper:hover img {
    transform: scale(1.15);
    filter: drop-shadow(0px 25px 30px rgba(0,0,0,0.35));
    cursor: pointer;
}

/* ================= 聚合入场动画 ================= */
@keyframes converge {
    0% {
        opacity: 0;
        /* 从四周外部飞入 (由变量控制具体初始位置) */
        transform: translate(var(--start-x), var(--start-y)) scale(0.6) rotate(var(--start-rot));
    }
    100% {
        opacity: 1;
        /* 停留在预设好的中心位置 */
        transform: translate(0, 0) scale(1) rotate(var(--end-rot));
    }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ================= 各个素材的精确定位与入场参数 ================= */

/* 1. 卷宗 (Top Middle) */
.item-folder {
    width: 320px;
    top: 0px;
    left: 280px;
    --start-x: 200px;
    --start-y: -300px;
    --start-rot: 30deg;
    --end-rot: 10deg;
    z-index: 2;
    animation-delay: 0.1s;
}

/* 2. 水果纸袋 (Top Left) */
.item-fruit {
    width: 250px;
    top: 40px;
    left: 100px;
    --start-x: -300px;
    --start-y: -200px;
    --start-rot: -20deg;
    --end-rot: -5deg;
    z-index: 3;
    animation-delay: 0.2s;
}

/* 3. 橙色卡片 (Right) */
.item-card {
    width: 220px;
    top: 150px;
    left: 480px;
    --start-x: 400px;
    --start-y: 50px;
    --start-rot: 45deg;
    --end-rot: 15deg;
    z-index: 4;
    animation-delay: 0.3s;
}

/* 4. 包裹 (Bottom Left) */
.item-parcel {
    width: 270px;
    top: 240px;
    left: 50px;
    --start-x: -300px;
    --start-y: 200px;
    --start-rot: -15deg;
    --end-rot: 5deg;
    z-index: 5;
    animation-delay: 0.4s;
}

/* 5. 地图折页 (Bottom Middle) */
.item-map {
    width: 300px;
    top: 300px;
    left: 250px;
    --start-x: 0px;
    --start-y: 300px;
    --start-rot: 10deg;
    --end-rot: -2deg;
    z-index: 6;
    animation-delay: 0.5s;
}

/* 6. 果酱罐 (Bottom Right) */
.item-jam {
    width: 160px;
    top: 280px;
    left: 480px;
    --start-x: 300px;
    --start-y: 300px;
    --start-rot: -20deg;
    --end-rot: 5deg;
    z-index: 7;
    animation-delay: 0.6s;
}

/* ================= 底部文本 ================= */
.description {
    text-align: center;
    margin-top: 40px;
    font-size: 18px;
    line-height: 1.6;
    color: #111;
    font-weight: 500;
    opacity: 0;
    animation: fadeInText 1s ease forwards;
    animation-delay: 1.5s; /* 确保在图片聚合完成后浮现 */
}

@keyframes fadeInText {
    to { opacity: 1; }
}

/* ================= 响应式设计 (Media Queries) ================= */

/* 平板端适配 (例如 iPad 竖屏) */
@media screen and (max-width: 900px) {
    header {
        padding: 20px 40px;
    }
    
    .nav-links {
        gap: 20px;
    }
    
    .logo {
        height: 120px;
    }
    
    /* 缩小舞台整体比例 */
    .scene {
        transform: scale(0.85);
        margin-bottom: 0;
    }
    
    .description {
        margin-top: 10px;
        font-size: 16px;
    }
}

/* 手机端适配 (小屏幕) */
@media screen and (max-width: 768px) {
    header {
        padding: 15px 20px;
    }
    
    .logo {
        height: 80px;
    }

    /* === 汉堡菜单设计 === */
    .menu-toggle {
        display: block;
        cursor: pointer;
    }

    .menu-toggle .bar {
        display: block;
        width: 25px;
        height: 3px;
        margin: 5px auto;
        -webkit-transition: all 0.3s ease-in-out;
        transition: all 0.3s ease-in-out;
        background-color: #333;
    }
    
    /* 汉堡菜单变成 X */
    .menu-toggle.is-active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* 隐藏普通导航，做成侧边/下拉菜单 */
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #fff;
        flex-direction: column;
        align-items: center;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
        box-shadow: 0 10px 15px rgba(0,0,0,0.05);
    }

    .nav-links.active {
        max-height: 400px; /* 展开后的高度 */
    }

    .nav-links a {
        padding: 15px;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* === 缩小中间的聚合区域 === */
    .scene {
        /* 使用 transform scale 将整个区域等比缩小以适应手机屏幕 */
        transform: scale(0.45);
        margin-bottom: -150px; /* 因为缩放后，实际占用的布局空间未变，需要往上提 */
        margin-top: -80px;
    }

    .description {
        padding: 0 20px;
        font-size: 14px;
        margin-top: 0;
    }
}

/* 更小屏幕的手机端适配 */
@media screen and (max-width: 480px) {
    .scene {
        transform: scale(0.4);
        margin-bottom: -180px;
        margin-top: -100px;
    }
    
    .description {
        font-size: 13px;
    }
}