* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --fz-1: 5.5rem;
    --fz-2: 4rem;
    --base-black-100: #282828;
    --base-black-20: #eee1cd;
    --transition-1: .4s;
    --main: #ff9fba;

    --primary: #fff;
    --bg-envelope-color: #f5edd1;
    --envelope-tab: #ffbdd0;
    --envelope-cover: #ff9fba;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --txt-color: #444;
    --heart-color: #ff477e;
}

/* bgm control button */
.audio-control {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 159, 186, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(255, 159, 186, 0.3);
    user-select: none; 
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    touch-action: none;
}

.audio-control:active {
    cursor: grabbing;
}

.audio-control:hover {
    background: rgba(255, 159, 186, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 159, 186, 0.5);
}

.audio-control.muted {
    background: rgba(128, 128, 128, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}

.audio-control.muted:hover {
    background: rgba(128, 128, 128, 0.9);
}

.wrapper, .content {
    position: relative;
    width: 100%;
    z-index: 1;
}

.content {
    overflow: hidden;
}

.deck {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content section {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* first page */
.sticky-cards {
    background-color: var(--main);
}

.card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
    width: 45%;
    height: 60%;
    padding: 0.5em;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.card-img {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
}

/* landing page */
.image-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 2;
    perspective: 500px;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* second page - sticky text animation */
.sticky-scroll {
    position: relative;
    width: 100vw;
    /* height determines the scroll distance/speed for the animation */
    height: calc(100vh * 13);
    overflow: hidden;
}

.content-second {
    padding-bottom: 150px;
}

.section-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.section-wrapp {
    position: relative; 
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--main) 
}

.section-item {
    position: absolute;
    width: 100%;
    height: auto;
    padding: 10px 0;
    left: 0;
    background: var(--base-black-100);
    color: var(--base-black-20);
    text-align: center;
    font-size: 50px;
    border-radius: 10px;
    will-change: transform, opacity;
    font-family: "Viaoda Libre", serif;
}

/* scattered hearts */
.scattered-heart {
    position: absolute;
    pointer-events: none;
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
}

/* hearts animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(var(--rotation));
    }
    50% {
        transform: translateY(-25px) rotate(var(--rotation));
    }
}

/* hearts - cards section */
.heart-1 {
    top: 15%;
    left: 10%;
    width: 80px;
    height: 80px;
    --rotation: -5deg;
    transform: rotate(-5deg);
    filter: blur(3.8px);
    z-index: -1;
    animation-delay: 0s;
}

.heart-2 {
    top: 60%;
    left: 0%;
    width: 200px;
    height: 200px;
    --rotation: 45deg;
    transform: rotate(45deg);
    filter: blur(8px);
    z-index: -1;
    animation-delay: 1.5s;
}

.heart-3 {
    top: 35%;
    left: 5%;
    width: 60px;
    height: 60px;
    --rotation: 0deg;
    transform: rotate(0deg);
    filter: blur(5px);
    z-index: 3;
    animation-delay: 3s;
}

.heart-4 {
    bottom: 8%;
    left: 70%;
    width: 250px;
    height: 250px;
    --rotation: 0deg;
    transform: rotate(0deg);
    filter: blur(7px);
    z-index: -1;
    animation-delay: 4.5s;
}

/* hearts - text section */
.heart-5 {
    top: 20%;
    left: 5%;
    width: 70px;
    height: 70px;
    --rotation: 20deg;
    transform: rotate(20deg);
    filter: blur(4px);
    z-index: -1;
    animation-delay: 2s;
}

.heart-6 {
    bottom: 15%;
    right: -2%;
    width: 180px;
    height: 180px;
    --rotation: -5deg;
    transform: rotate(-5deg);
    filter: blur(5.8px);
    z-index: -1;
    animation-delay: 3.5s;
}

.heart-7 {
    top: 50%;
    left: 10%;
    width: 55px;
    height: 55px;
    --rotation: 0deg;
    transform: rotate(0deg);
    filter: blur(2.3px);
    z-index: -1;
    animation-delay: 1s;
}

/* hearts - letter section */
.heart-8 {
    top: 10%;
    left: 10%;
    width: 85px;
    height: 85px;
    --rotation: -25deg;
    transform: rotate(-25deg);
    filter: blur(2px);
    z-index: -1;
    animation-delay: 0.5s;
}

.heart-9 {
    top: 15%;
    right: 12%;
    width: 65px;
    height: 65px;
    --rotation: 35deg;
    transform: rotate(35deg);
    filter: blur(3px);
    z-index: -1;
    animation-delay: 2.5s;
}

.heart-10 {
    bottom: 20%;
    left: 8%;
    width: 95px;
    height: 95px;
    --rotation: -50deg;
    transform: rotate(-50deg);
    filter: blur(1.5px);
    z-index: -1;
    animation-delay: 4s;
}

.heart-11 {
    bottom: 10%;
    right: 20%;
    width: 75px;
    height: 75px;
    --rotation: 15deg;
    transform: rotate(15deg);
    filter: blur(2.5px);
    z-index: -1;
    animation-delay: 5s;
}

/* hearts - cards section */
.heart-12 {
    top: 5%;
    right: 25%;
    width: 60px;
    height: 60px;
    --rotation: 45deg;
    transform: rotate(45deg);
    filter: blur(4px);
    z-index: -1;
    animation-delay: 1.8s;
}

.heart-13 {
    bottom: 45%;
    left: 35%;
    width: 100px;
    height: 100px;
    --rotation: 10deg;
    transform: rotate(10deg);
    filter: blur(0.8px);
    z-index: -1;
    animation-delay: 3.2s;
}

.heart-14 {
    top: 50%;
    right: 5%;
    width: 65px;
    height: 65px;
    --rotation: 50deg;
    transform: rotate(50deg);
    filter: blur(2.8px);
    z-index: -1;
    animation-delay: 4.7s;
}

.heart-15 {
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    --rotation: 30deg;
    transform: rotate(30deg);
    filter: blur(0.5px);
    z-index: -1;
    animation-delay: 2.1s;
}

.heart-16 {
    bottom: 10%;
    right: 35%;
    width: 85px;
    height: 85px;
    --rotation: 30deg;
    transform: rotate(30deg);
    filter: blur(3px);
    z-index: -1;
    animation-delay: 5.3s;
}

.heart-17 {
    top: 75%;
    left: 35%;
    width: 50px;
    height: 50px;
    --rotation: 0deg;
    transform: rotate(0deg);
    filter: blur(2.5px);
    z-index: -1;
    animation-delay: 0.7s;
}

/* additional hearts - text section */
.heart-18 {
    top: 5%;
    right: 30%;
    width: 40px;
    height: 40px;
    --rotation: 40deg;
    transform: rotate(40deg);
    filter: blur(4.5px);
    z-index: -1;
    animation-delay: 1.3s;
}

.heart-19 {
    top: 80%;
    left: 40%;
    width: 90px;
    height: 90px;
    --rotation: 10deg;
    transform: rotate(-5deg);
    filter: blur(3px);
    z-index: -1;
    animation-delay: 4.1s;
}

.heart-20 {
    top: 20%;
    right: 10%;
    width: 55px;
    height: 55px;
    --rotation: 40deg;
    transform: rotate(40deg);
    filter: blur(3.5px);
    z-index: -1;
    animation-delay: 2.8s;
}

.heart-21 {
    bottom: 4%;
    left: -5%;
    width: 180px;
    height: 180px;
    --rotation: 40deg;
    transform: rotate(40deg);
    filter: blur(8px);
    z-index: -1;
    animation-delay: 5.5s;
}

.heart-22 {
    top: 5%;
    left: 35%;
    width: 75px;
    height: 75px;
    --rotation: 30deg;
    transform: rotate(30deg);
    filter: blur(3.5px);
    z-index: 3;
    animation-delay: 3.9s;
}

/* center hearts - cards section */
.heart-23 {
    top: 48%;
    left: 18%;
    width: 70px;
    height: 70px;
    --rotation: 40deg;
    transform: rotate(40deg);
    filter: blur(2.5px);
    z-index: -1;
    animation-delay: 1.2s;
}

.heart-24 {
    top: 30%;
    left: 55%;
    width: 70px;
    height: 70px;
    --rotation: 40deg;
    transform: rotate(40deg);
    filter: blur(1px);
    z-index: -1;
    animation-delay: 4.2s;
}

.heart-25 {
    top: 10%;
    left: 30%;
    width: 45px;
    height: 45px;
    --rotation: 20deg;
    transform: rotate(20deg);
    filter: blur(3.5px);
    z-index: -1;
    animation-delay: 2.7s;
}

.heart-26 {
    top: 30%;
    left: 75%;
    width: 55px;
    height: 55px;
    --rotation: 40deg;
    transform: rotate(40deg);
    filter: blur(3px);
    z-index: -1;
    animation-delay: 5.8s;
}

/* center hearts - text section */
.heart-27 {
    top: 45%;
    left: 50%;
    width: 40px;
    height: 40px;
    --rotation: 25deg;
    transform: rotate(25deg);
    filter: blur(1px);
    z-index: -1;
    animation-delay: 1.7s;
}

.heart-28 {
    top: 30%;
    left: 25%;
    width: 70px;
    height: 70px;
    --rotation: 0deg;
    transform: rotate(0deg);
    filter: blur(1.2px);
    z-index: -1;
    animation-delay: 3.4s;
}

.heart-29 {
    top: 70%;
    left: 60%;
    width: 55px;
    height: 55px;
    --rotation: 42deg;
    transform: rotate(42deg);
    filter: blur(1.8px);
    z-index: -1;
    animation-delay: 0.9s;
}

.heart-30 {
    top: 25%;
    left: 65%;
    width: 75px;
    height: 75px;
    --rotation: 15deg;
    transform: rotate(15deg);
    filter: blur(2.2px);
    z-index: -1;
    animation-delay: 4.6s;
}



/* third page - letter */
section.last {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "IM Fell DW Pica", serif;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100%;
    overflow: hidden;
}

/* bokeh effect */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 183, 208, 0.8) 0%, rgba(255, 159, 186, 0.6) 30%, rgba(255, 159, 186, 0.2) 80%, transparent 100%);
    pointer-events: none;
    animation: floatBokeh 15s infinite ease-in-out;
}

/* animation for bokeh particles */
@keyframes floatBokeh {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-40px) translateX(-15px);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-25px) translateX(20px);
        opacity: 0.9;
    }
}

.subtitle {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 680px;
    text-align: center;
    margin: 0 auto;
    color: #000000;
}


.scene {
    position: relative;
    width: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    z-index: 10;
}


.scene > .envelope-wrapper {
    background: #f094ae;
    box-shadow: 0 0 40px var(--shadow-color);
}

.scene > .envelope-wrapper > .envelope {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 480px;
    height: 360px;
    
}

.envelope-wrapper > .envelope::before {
    content: "";
    position: absolute;
    z-index: 2;
    border-top: 200px solid var(--envelope-tab);
    border-right: 240px solid transparent;
    border-left: 240px solid transparent;
    top: 0;
    transform-origin: top;
    transition: all 0.5s ease-in-out 0.7s;
}

.envelope-wrapper > .envelope::after {
    content: "";
    position: absolute;
    z-index: 2;
    border-top: 200px solid transparent;
    border-left: 240px solid var(--envelope-cover);
    border-right: 240px solid var(--envelope-cover);
    border-bottom: 160px solid var(--envelope-cover);
    bottom: 0;
}

.letter {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 90%;
    height: 90%;
    background: var(--primary);
    transition: all 1s ease-in-out;
    padding: 20px 20px;
    box-shadow: 0 0 10px var(--shadow-color);
    overflow: hidden;
    transform: translate(-50%, -50%);
}

.envelope-seal {
    position: absolute;
    top: 156px;
    width: 73px;
    height: 73px;
    background: var(--heart-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 9;
    transform: rotate(0deg);
}

/* seal rotation animation */
@keyframes sealRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


.open .envelope-seal {
    animation: sealRotate 1.2s ease-in-out forwards;
}

.envelope-seal:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 117, 140, 0.7);
}

.letter > .letter-content {
    height: 100%;
    display: flex;
    flex-direction: column;
} 

.letter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed #ffb6c1;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.letter-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #ff7eb3;
    letter-spacing: 1px;
}

.letter-body {
    flex: 1;
    overflow-y: scroll;
    text-align: left;
    color: #5a3d5c;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.letter-body p {
    margin-bottom: 10px;
}

.letter-signature {
    text-align: right;
    margin-top: 10px;
    font-style: italic;
    color: #ff7eb3;
    font-weight: bold;
}

/* decorative elements */
.envelope-seal i {
    font-size: 29px;
}

.fas fa-feather-alt {
    font-size: 500px;
}

/* dynamic classes */
.open .envelope::before {
    transform: rotateX(180deg);
    z-index: 0;
}

.open .envelope-seal {
    transform: rotate(180deg);
    transition-delay: 0.4s;
}

.letter.show-letter {
    transform: translate(-50%, calc(-50% - 348px));
    transition: transform .5s ease-in-out;
}

.letter.closing-letter {
    transform: translate(-50%, calc(-50% - 348px));
    transition: transform .5s ease-in-out;
}

.letter.open {
    z-index: 10000;
}

.envelope-wrapper.deactivate-envelope .envelope::before {
    pointer-events: none;
}