* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    background-color: #fffdee;
    overflow-x: hidden;
}


body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    /* background: linear-gradient(180deg, #f7fcf1 0%, #e6f0dc 55%, #e9f3e7 100%); */
    margin: 0;
    padding: 0;
    /* box-sizing: border-box; */
}

.life-title {
    width: 50vw;
    margin: 3vh auto 0;
    background-image: url(../img/life/life-title.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    aspect-ratio: 5 / 1;
}

.life-content {
    width: 100%;
    position: relative;
}

.life-section {
    width: 100%;
    height: 100vh;
    position: relative;

     .pic{
        position: absolute;
        width: 50%;
        /* height: 30%; */
         aspect-ratio: 1 / 1;
        /* background-color: #fff; */
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
    }

    .title{
        width: 40%;
    }
}

.life-section-1 .text {
    margin-left: 5%;
    margin-right: 35%;
    /* background-color: rgba(0, 128, 0, 0.3); */
    .title{
       margin-top: 3%;
     }
}
.life-section-1 .pic{
    background-image: url(../img/life/chicken-pic.svg);
        right: 0%;
        transform: translateX(30%);
        top: -10%;
    }

.life-section-2 .text{
    margin-left: 37%;
    margin-right: 5%;
    /* background-color: rgba(0, 0, 255, 0.3); */
}
.life-section-2 .pic{
    background-image: url(../img/life/wa-pic.svg);
        left: 0%;
        transform: translateX(-30%);
        top: -10%;
    }


.life-section-3 .text {
    margin-left: 5%;
    margin-right: 33%;
    /* background-color: rgba(255, 255, 0, 0.3); */
}
.life-section-3 .pic{
    background-image: url(../img/life/dog-pic.svg);
        right: 0%;
        transform: translateX(30%);
        top: -10%;
    }

.life-section-4 .text {
    margin-left: 35%;
    margin-right: 5%;
    /* background-color: rgba(128, 0, 128, 0.3); */
}
.life-section-4 .pic{
    background-image: url(../img/life/human-pic.svg);
        left: 0%;
        transform: translateX(-30%);
        top: 0%;
    }

.life-envelope {
    position: relative;
    width: 100%;
    height: 100vh;
    /* background-color: #444; */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 5vh;
}

.envelope-cloud {
    position: absolute;
    width: 100%;
    height: 24%;
    background-image: url(../img/life/blue-cloud.svg);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: -50vw center;
    animation: cloudMove 15s linear infinite;
}

@keyframes cloudMove {
    0% {
        background-position: -80vw center;
    }
    100% {
        background-position: 100vw center;
    }
}

.envelope-letter {
    position: relative;
    flex: 1;
    margin-top: auto;
    background-image: url(../img/life/grass.svg);
    background-repeat: no-repeat;
    background-position:  center bottom;
    background-size: contain;
}
.envelope-post{
    position: absolute;
    width: 30%;
    height: 60%;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    background-image: url(../img/life/letter.svg);
    /* background-color: #fff; */
    background-repeat: no-repeat;
    background-position:  center bottom;
    background-size: contain;
    cursor: pointer;
    transition: filter 0.3s ease;
}
.envelope-post:hover{
    filter: brightness(1.3) drop-shadow(0 0 1.5vh rgba(255, 220, 100, 0.8));
}
.tishi{
    position: absolute;
    width: 30%;
    height: 30%;
    top: 10%;
    left: 65%;
    transform: translateX(-50%) scale(0.3);
    background-image: url(../img/life/tishi.svg);
    /* background-color: #fff; */
    background-repeat: no-repeat;
    background-position:  center bottom;
    background-size: contain;
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tishi.visible{
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* 文本区通用样式 */
.text {
    position: relative;
    height: 100%;
    z-index: 2;
    padding: 2vh 0vw;
    opacity: 0;
    transform: translateY(8vh);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.text.visible {
    opacity: 1;
    transform: translateY(0);
}
.text .contain {
    width: 100%;
    padding: 0 3vw;
}
.text .contain p {
    font-size: 2.8vh;
    line-height: 1.8;
    color: #333;
    letter-spacing: 0.1vw;
    text-align: justify;
    text-indent: 2em;
    padding-left: 2em;
    margin: 0.4em 0;
}

/* 图片盒子区域 */
.img {
    display: flex;
    justify-content: center;
    gap: 2vw;
    /* margin-top: 8vh; */
    flex-wrap: wrap;
}

.img-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
}

.img-card-pic {
    width: 12vw;
    height: 16vw;
    border-radius: 2vh;
    /* background-color: rgba(200, 200, 200, 0.4); */
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: contain;
    transition: all 0.3s ease-in-out;
    margin-top: auto;
}
.img-card-pic:hover {
    transform: scale(1.1);
    transition: all 0.3s ease-in-out;
}

.img-card span {
    font-size: 2.8vh;
    font-weight: bold;
    color: #444;
}

.life-section-1  .img-card-pic1{
    background-image: url(../img/life/chicken01.svg);
}
.life-section-1  .img-card-pic2{
    background-image: url(../img/life/chicken02.svg);
}
.life-section-1  .img-card-pic3{
    background-image: url(../img/life/chicken03.svg);
}


.life-section-2  .img-card-pic1{
    background-image: url(../img/life/wa01.svg);
}
.life-section-2  .img-card-pic2{
    background-image: url(../img/life/wa02.svg);
}
.life-section-2  .img-card-pic3{
    background-image: url(../img/life/wa03.svg);
}
.life-section-2  .img-card-pic4{
    background-image: url(../img/life/wa04.svg);
}


.life-section-3  .img-card-pic1{
    background-image: url(../img/life/dog01.svg);
}
.life-section-3  .img-card-pic2{
    background-image: url(../img/life/dog02.svg);
}

.life-section-4  .img-card-pic1{
    background-image: url(../img/life/human01.svg);
}
.life-section-4  .img-card-pic2{
    background-image: url(../img/life/human02.svg);
}
.life-section-4  .img-card-pic3{
     height: 20vw;
    background-image: url(../img/life/human03.svg);
}
.life-section-4  .img-card-pic4{
     height: 18vw;
    background-image: url(../img/life/human04.svg);
}

/* 弹窗遮罩层 */
.modal-overlay{
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(1vh);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    overflow: hidden;
}
.modal-overlay.active{
    opacity: 1;
    pointer-events: auto;
}

/* 关闭按钮 */
.modal-close{
    position: absolute;
    top: 3vh;
    right: 3vh;
    width: 5vh;
    height: 5vh;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.85);
    color: #333;
    font-size: 2.5vh;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.5vh 1.5vh rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 1001;
}
.modal-close:hover{
    transform: scale(1.1);
    background-color: #fff;
}

/* 3D 信封 */
.modal-3d-wrapper{
    perspective: 1200px;
    position: relative;
    width: 90vw;
    height: 90vh;
}
.envelope-3d{
    width: 40vw;
    height: 22vw;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}
.envelope-3d.down{
    transform: translate(-50%, -40%);
}
.envelope-back{
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #d4a054;
    border: 0.3vh solid #b8863a;
    border-radius: 1vh;
    box-shadow: 0 2vh 5vh rgba(0,0,0,0.3);
    z-index: 1;
}
.envelope-left{
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: #f2b46f;
    transform-origin: left center;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    border-left: 0.3vh solid #d4a05a;
    z-index: 3;
}
.envelope-right{
    position: absolute;
    right: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: #f2b46f;
    transform-origin: right center;
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
    border-right: 0.3vh solid #d4a05a;
    z-index: 3;
}
.envelope-top{
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 58%;
    background-color: #fdc281;
    transform-origin: center top;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    border-top: 0.3vh solid #d4a05a;
    z-index: 4;
    transform: translateZ(1px);
    backface-visibility: visible;
    transition: transform 0.8s ease;
}
.envelope-top.open{
    transform: rotateX(-180deg) translateZ(1px);
}
.envelope-bottom{
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 65%;
    background-color: #ffd29c;
    transform-origin: center bottom;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    border-bottom: 0.3vh solid #d4a05a;
    z-index: 3;
}
.envelope-content{
    position: absolute;
    width: 80%;
    height: 85%;
    top: 7.5%;
    left: 10%;
    background-color: #fff8ec;
    border-radius: 1vh;
    z-index: 2;
    cursor: pointer;
    transition: transform 0.6s ease, opacity 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.envelope-content.slide{
    transform: translateY(-10%);
    animation: glow 1.5s ease-in-out infinite;
}
.envelope-content.fade-out{
    opacity: 0;
    pointer-events: none;
}
@keyframes glow{
    0%, 100%{
        box-shadow: 0 0 1vh rgba(255, 220, 100, 0.4);
    }
    50%{
        box-shadow: 0 0 3vh rgba(255, 220, 100, 0.9), 0 0 6vh rgba(255, 200, 50, 0.4);
    }
}

.envelope-tishi{
    position: absolute;
    top: 25%;
    font-size: 2vh;
    color: #a07830;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.envelope-content.slide .envelope-tishi{
    opacity: 1;
}

/* 信件图片背景 */
.letter-img{
    position: absolute;
    width: 30vw;
    height: 20vw;
    top: 50%;
    right: 8vw;
    transform: translateY(-50%) rotate(5deg);
    /* background-color: #fff; */
    background-image: url(../img/life-pic/01.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    border-radius: 1vh;
    box-shadow: 0 2vh 4vh rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease, right 0.4s ease, transform 0.4s ease, z-index 0s;
    z-index: 5;
    cursor: pointer;
}
.letter-img.show{
    opacity: 1;
    pointer-events: auto;
}
.letter-img:hover{
    right: 5vw;
    transform: translateY(-50%) rotate(3deg);
    z-index: 99;
}

/* 信件内容 */
.letter{
    position: absolute;
    width: 33vw;
    height: 90vh;
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
    background-color: #fffdf5;
    border-radius: 2vh;
    border: 0.3vh solid #e0c99a;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    z-index: 6;
    overflow-y: auto;
    overflow-x: hidden;
}
.letter::-webkit-scrollbar{
    width: 0.8vh;
}
.letter::-webkit-scrollbar-track{
    background: transparent;
}
.letter::-webkit-scrollbar-thumb{
    background-color: #d4b896;
    border-radius: 1vh;
}
.letter.show{
    opacity: 1;
    pointer-events: auto;
}
.letter p{
    font-size: 2.2vh;
    line-height: 1.9;
    color: #333;
    text-align: justify;
    text-indent: 2em;
    padding: 0 5%;
    margin: 0.5em 0;
}
.letter .letter-to{
    text-indent: 0;
    font-size: 2.8vh;
    font-weight: bold;
    color: #a07830;
    margin-bottom: 0.3em;
}
.letter .letter-sign{
    text-indent: 0;
    text-align: right;
    font-weight: bold;
    color: #a07830;
    margin-top: 1.5em;
}

