* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #171312;
    color: #332824;
    font-family: "Inter", sans-serif;
    overflow-x: hidden;
}


/* ========================= */
/* INTRO */
/* ========================= */

.screen {
    min-height: 100vh;
    min-height: 100svh;

    display: flex;
    justify-content: center;
    align-items: center;

    background:
        radial-gradient(
            circle at center,
            #3a2a27 0%,
            #211917 45%,
            #110e0d 100%
        );

    color: #f8eee4;

    transition:
        opacity 1s ease,
        transform 1s ease;
}

.screen.hidden {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.intro-content {
    text-align: center;
    width: 90%;
    max-width: 600px;
}

.small-text {
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 10px;
    opacity: 0.65;
    margin-bottom: 20px;
}

.intro-content h1 {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(42px, 11vw, 72px);
    font-weight: 400;
    margin-bottom: 12px;
}

.intro-subtitle {
    font-family: "Cormorant Garamond", serif;
    font-size: 19px;
    line-height: 1.6;
    opacity: 0.8;
}


/* ========================= */
/* /* ========================= */
/* ENVELOPE */
/* ========================= */

.envelope-wrapper {
    width: 280px;
    height: 190px;

    margin: 55px auto 35px;

    perspective: 1000px;

    position: relative;

    overflow: visible;
}

.envelope {
    position: relative;

    width: 280px;
    height: 180px;

    cursor: pointer;

    transform-style: preserve-3d;

    transition: transform 0.5s ease;
}

.envelope:hover {
    transform: translateY(-5px);
}


/* Envelope back */

.envelope-back {
    position: absolute;

    width: 100%;
    height: 100%;

    background: #e7d2bd;

    border-radius: 5px;

    box-shadow:
        0 20px 45px rgba(0, 0, 0, 0.4);

    z-index: 1;
}


/* Paper inside envelope */

.letter-preview {
    position: absolute;

    width: 220px;
    height: 155px;

    left: 30px;
    top: 5px;

    background: #fff9ef;

    color: #55443d;

    display: flex;

    justify-content: center;

    align-items: flex-start;

    padding-top: 25px;

    font-family: "Great Vibes", cursive;

    font-size: 26px;

    z-index: 2;

    transform: translateY(0);

    transition:
        transform 1.4s cubic-bezier(.4, 0, .2, 1);
}


/* Envelope front */

.envelope-front {
    position: absolute;

    bottom: 0;

    width: 100%;
    height: 100%;

    background: #caa990;

    clip-path:
        polygon(
            0 0,
            50% 55%,
            100% 0,
            100% 100%,
            0 100%
        );

    z-index: 4;
}


/* Envelope flap */

.envelope-flap {
    position: absolute;

    top: 0;

    width: 100%;
    height: 100%;

    background: #dbc0a8;

    clip-path:
        polygon(
            0 0,
            100% 0,
            50% 55%
        );

    transform-origin: top center;

    transform: rotateX(0deg);

    transition:
        transform 1s cubic-bezier(.4, 0, .2, 1);

    z-index: 5;

    backface-visibility: hidden;
}


/* Wax seal */

.wax-seal {
    position: absolute;

    width: 52px;
    height: 52px;

    border-radius: 50%;

    background: #7b3434;

    border: 3px solid #a85b5b;

    color: #f8ddd1;

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 22px;

    left: 50%;
    top: 48%;

    transform:
        translate(-50%, -50%);

    z-index: 10;

    box-shadow:
        0 5px 15px rgba(0,0,0,.3);

    transition:
        opacity .5s ease,
        transform .7s ease;
}


/* ========================= */
/* OPEN STATE */
/* ========================= */

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 5;
}

/* The paper does NOT move when the envelope opens */
.envelope.open .letter-preview {
    transform: translateY(0);
    z-index: 2;
}

/* Start the paper animation only when JS adds this class */
.envelope.paper-out .letter-preview {
    transform: translateY(-110px);
    z-index: 20;
}


.envelope.open .wax-seal {
    opacity: 0;

    transform:
        translate(-50%, -50%)
        scale(0.3);
}

.open-button,
.reveal-button {
    border: 1px solid rgba(255,255,255,.3);

    background: transparent;

    color: #fff5ec;

    padding: 14px 30px;

    border-radius: 100px;

    font-family: "Inter", sans-serif;

    font-size: 12px;

    letter-spacing: 1.5px;

    text-transform: uppercase;

    cursor: pointer;

    transition:
        background .3s ease,
        transform .3s ease;
}

.open-button:hover,
.reveal-button:hover {
    background: rgba(255,255,255,.12);
    transform: translateY(-2px);
}

.hint {
    margin-top: 15px;
    font-size: 10px;
    opacity: .4;
}


/* ========================= */
/* LETTER SECTION */
/* ========================= */

.letter-section {
    display: none;

    min-height: 100vh;

    background:
        radial-gradient(
            circle at top,
            #ead8c6,
            #c9b09a
        );

    padding: 60px 15px;
}

.letter-section.visible {
    display: block;

    animation:
        letterAppear 1.5s ease forwards;
}

@keyframes letterAppear {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }

}


/* ========================= */
/* LETTER PAPER */
/* ========================= */

.letter-container {
    max-width: 720px;
    margin: auto;
}

.letter-paper {
    position: relative;

    background:
        linear-gradient(
            rgba(255,255,255,.3),
            rgba(255,255,255,.3)
        ),
        #f8f0e4;

    padding:
        60px clamp(25px, 7vw, 75px)
        70px;

    box-shadow:
        0 25px 70px rgba(50,30,20,.25);

    border-radius: 2px;
}


/* Paper texture */

.letter-paper::before {
    content: "";

    position: absolute;

    inset: 0;

    pointer-events: none;

    opacity: .12;

    background-image:
        radial-gradient(#765f52 0.5px, transparent 0.5px);

    background-size: 8px 8px;
}


/* ========================= */
/* HEADER */
/* ========================= */

.letter-header {
    text-align: center;

    margin-bottom: 50px;
}

.date {
    font-size: 10px;

    letter-spacing: 3px;

    text-transform: uppercase;

    color: #88756a;

    margin-bottom: 15px;
}

.script-title {
    font-family: "Great Vibes", cursive;

    font-size: 48px;

    color: #6f3f3f;
}


/* ========================= */
/* LETTER CONTENT */
/* ========================= */

.letter-content {
    position: relative;

    z-index: 2;

    font-family: "Cormorant Garamond", serif;

    font-size: 20px;

    line-height: 1.85;

    color: #40332d;
}

.letter-content p {
    margin-bottom: 25px;
}

.greeting {
    font-family: "Great Vibes", cursive;

    font-size: 38px;

    color: #6f3f3f;

    margin-bottom: 30px !important;
}

.emphasis {
    font-weight: 600;

    text-align: center;

    font-size: 25px;

    color: #6f3f3f;

    margin: 45px 0 !important;
}

.big-message {
    font-family: "Great Vibes", cursive;

    text-align: center;

    font-size: clamp(38px, 9vw, 58px);

    line-height: 1.2;

    color: #743d3d;

    margin:
        50px 0;

}


/* ========================= */
/* PHOTOS */
/* ========================= */

.photo-card {
    margin: 45px auto;

    max-width: 550px;

    text-align: center;
}

.photo-card img {
    display: block;

    width: 100%;

    max-height: 600px;

    object-fit: cover;

    border-radius: 3px;

    box-shadow:
        0 15px 35px rgba(50,30,20,.25);

    filter: saturate(.85);
}

.photo-caption {
    margin-top: 12px;

    font-size: 13px;

    font-style: italic;

    color: #817066;
}


/* ========================= */
/* SIGNATURE */
/* ========================= */

.signature {
    text-align: right;

    margin-top: 70px;

    padding-right: 10px;
}

.signature-text {
    font-family: "Great Vibes", cursive;

    font-size: 55px;

    color: #6f3f3f;
}

.signature-line {
    font-size: 11px;

    letter-spacing: 2px;

    text-transform: uppercase;

    color: #88756a;
}


/* ========================= */
/* FINAL SECTION */
/* ========================= */

.final-section {
    text-align: center;

    padding:
        100px 20px
        120px;

    color: #332824;
}

.final-line {
    width: 60px;
    height: 1px;

    background: #8a6659;

    margin: 0 auto 40px;
}

.final-small {
    font-size: 12px;

    letter-spacing: 3px;

    text-transform: uppercase;

    color: #765f52;
}

.final-section h2 {
    font-family: "Great Vibes", cursive;

    font-size: clamp(42px, 10vw, 65px);

    font-weight: 400;

    margin:
        15px 0
        40px;

    color: #673838;
}

.reveal-button {
    color: #533a32;

    border-color: #8b6c5c;
}

.final-message {
    max-width: 600px;

    margin: 60px auto 0;

    display: none;

    animation:
        finalReveal 1.5s ease forwards;
}

.final-message.visible {
    display: block;
}

@keyframes finalReveal {

    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

.heart {
    font-size: 45px;

    color: #7a3c3c;

    animation:
        heartbeat 2s infinite;
}

@keyframes heartbeat {

    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

}

.final-message p {
    font-family: "Cormorant Garamond", serif;

    font-size: 21px;

    line-height: 1.7;

    margin: 25px 0;
}

.final-message h3 {
    font-family: "Cormorant Garamond", serif;

    font-size: 30px;

    font-weight: 500;

    line-height: 1.4;

    color: #673838;
}

.final-signature {
    font-family: "Great Vibes", cursive;

    font-size: 45px;

    margin-top: 40px;

    color: #673838;
}


/* ========================= */
/* MUSIC BUTTON */
/* ========================= */

.music-button {
    position: fixed;

    right: 18px;
    bottom: 18px;

    width: 44px;
    height: 44px;

    border-radius: 50%;

    border: 1px solid rgba(255,255,255,.25);

    background: rgba(30,20,18,.75);

    backdrop-filter: blur(10px);

    color: white;

    cursor: pointer;

    z-index: 100;

    display: none;
}

.music-button.visible {
    display: block;
}


/* ========================= */
/* PARTICLES */
/* ========================= */

.particles {
    position: fixed;

    inset: 0;

    pointer-events: none;

    z-index: 1;
}

.particle {
    position: absolute;

    width: 4px;
    height: 4px;

    border-radius: 50%;

    background: rgba(255,220,205,.5);

    animation:
        floatParticle linear infinite;
}

@keyframes floatParticle {

    from {
        transform:
            translateY(100vh)
            scale(.5);

        opacity: 0;
    }

    20% {
        opacity: .7;
    }

    80% {
        opacity: .7;
    }

    to {
        transform:
            translateY(-20vh)
            scale(1);

        opacity: 0;
    }

}


/* ========================= */
/* MOBILE */
/* ========================= */

@media (max-width: 600px) {

    .letter-section {
        padding: 25px 10px;
    }

    .letter-paper {
        padding:
            45px 25px
            55px;
    }

    .letter-content {
        font-size: 19px;
        line-height: 1.75;
    }

    .photo-card img {
        max-height: 450px;
    }

}