* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    color: #3e3831;
}

.birthday-container {
    width: 100%;
    height: 100vh;
    position: relative;
}


/* ================================================= */
/* COMMON PAGE */
/* ================================================= */

.page {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    opacity: 0;
    visibility: hidden;

    transform: translateX(100%);

    transition:
        opacity 0.9s ease,
        transform 0.9s cubic-bezier(0.77, 0, 0.175, 1),
        visibility 0.9s;

    overflow: hidden;
}

.page.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.page.previous {
    transform: translateX(-100%);
}


/* ================================================= */
/* PAGE 1 — BIRTHDAY */
/* ================================================= */

.page-one {
    background: #f7f3ea;
}

.page-one::before {
    content: "";

    position: absolute;
    inset: 0;

    opacity: 0.25;

    background-image:
        radial-gradient(
            rgba(62, 56, 49, 0.12) 0.7px,
            transparent 0.7px
        );

    background-size: 8px 8px;

    pointer-events: none;
}

.birthday-content {
    position: relative;

    z-index: 2;

    text-align: center;

    max-width: 800px;

    padding: 40px;
}

.small-heading {
    font-size: 12px;

    letter-spacing: 5px;

    text-transform: uppercase;

    color: #130c04;

    margin-bottom: 28px;
}

.birthday-content h2 {
    font-family: Georgia, serif;

    font-size: clamp(50px, 4vw, 40px);

    font-weight: 400;

    letter-spacing: -3px;

    color: #3e3831;

    margin-bottom: 30px;
}

.birthday-message {
    font-size: 19px;

    letter-spacing: 0.5px;

    color: #5b534a;

    margin-bottom: 12px;
}

.sub-message {
    font-size: 14px;

    color: #8b8175;

    line-height: 1.8;
}


/* ================================================= */
/* DECORATIVE DETAILS */
/* ================================================= */

.confetti {
    position: absolute;

    color: #7c8770;

    opacity: 0.55;

    font-size: 18px;

    animation: gentleFloat 6s ease-in-out infinite;
}

.confetti-1 {
    top: 18%;
    left: 16%;
}

.confetti-2 {
    top: 25%;
    right: 18%;

    animation-delay: 1s;
}

.confetti-3 {
    bottom: 20%;
    left: 22%;

    animation-delay: 2s;
}

.confetti-4 {
    bottom: 17%;
    right: 22%;

    animation-delay: 3s;
}

.confetti-5 {
    top: 45%;
    left: 9%;

    animation-delay: 1.5s;
}

@keyframes gentleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}


/* ================================================= */
/* BUTTON */
/* ================================================= */

.next-btn {
    margin-top: 38px;

    padding: 13px 34px;

    border: 1px solid #9a8975;

    border-radius: 0;

    background: transparent;

    color: #3e3831;

    font-family: 'Poppins', sans-serif;

    font-size: 13px;

    letter-spacing: 2px;

    text-transform: uppercase;

    cursor: pointer;

    transition: all 0.35s ease;
}

.next-btn:hover {
    background: #3e3831;

    color: #f7f3ea;

    transform: translateY(-2px);
}


/* ================================================= */
/* PAGE 2 — VIDEO */
/* ================================================= */

.page-two {
    background: #24231f;
}

.video-container {
    width: min(850px, 88%);

    display: flex;

    flex-direction: column;

    align-items: center;
}

.video-container video {
    width: 100%;

    max-height: 72vh;

    object-fit: contain;

    background: #111;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.35);
}

.page-two .next-btn {
    color: #f7f3ea;

    border-color: #a9a295;
}

.page-two .next-btn:hover {
    background: #f7f3ea;

    color: #24231f;
}


/* ================================================= */
/* PAGE 3 — VINTAGE HANDWRITTEN LETTER */
/* ================================================= */

.page-three {
    background: #cfc3ad;
    padding: 35px;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
}


/* ================================================= */
/* LETTER SCENE */
/* ================================================= */

.letter-scene {

    width: min(780px, 94%);

    display: flex;

    flex-direction: column;

    align-items: center;

    padding: 30px 0;

    padding: 30px 0;
}


/* ================================================= */
/* VINTAGE PAPER */
/* ================================================= */

.vintage-letter {

    margin-top: 5px;

    position: relative;

    width: 100%;

    min-height: 620px;

    padding: 65px 80px 70px;

    background: #f3ead8;

    color: #443a2f;

    font-family: 'Kalam', cursive;

    font-size: 25px;

    line-height: 1.7;

    /*
       Straight letter.
       No rotation.
    */
    transform: none;

    border: 1px solid rgba(88, 68, 45, 0.15);

    box-shadow:
        0 18px 45px rgba(60, 47, 33, 0.22);

    overflow: hidden;
}


/* ================================================= */
/* PAPER TEXTURE */
/* ================================================= */

.vintage-letter::before {

    content: "";

    position: absolute;

    inset: 0;

    pointer-events: none;

    opacity: 0.20;

    background-image:
        radial-gradient(
            rgba(70, 55, 38, 0.20) 0.5px,
            transparent 0.5px
        );

    background-size: 7px 7px;
}


/* ================================================= */
/* AGED PAPER EDGES */
/* ================================================= */

.vintage-letter::after {

    content: "";

    position: absolute;

    inset: 0;

    pointer-events: none;

    box-shadow:
        inset 0 0 55px rgba(111, 82, 50, 0.12);
}


/* ================================================= */
/* TOP LINE */
/* ================================================= */

.letter-top {

    position: relative;
    
    transform: translateY(-15px);
    
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 35px;

    font-size: 18px;

    color: #85745e;
}


/* ================================================= */
/* DATE */
/* ================================================= */

.letter-date {

    position: relative;

    text-align: right;

    font-size: 18px;

    color: #8b7962;

    margin-bottom: 45px;
}


/* ================================================= */
/* GREETING */
/* ================================================= */

.vintage-letter h2 {

    position: relative;

    font-family: 'Kalam', cursive;

    font-size: 42px;

    font-weight: 400;

    color: #3f352b;

    margin-bottom: 25px;
}


/* ================================================= */
/* LETTER CONTENT */
/* ================================================= */

.letter-content {

    position: relative;

    max-width: 650px;

    margin-top: 50px;
}

.letter-content p {

    margin-bottom: 25px;
}


/* ================================================= */
/* SIGNATURE */
/* ================================================= */

.letter-signature {

    position: relative;

    margin-top: 45px;

    font-size: 22px;

    color: #665440;
}

.letter-signature span {

    font-size: 31px;

    font-weight: 400;
}


/* ================================================= */
/* LETTER BUTTON */
/* ================================================= */

.letter-btn {

    margin-top: 40px;
}


/* ================================================= */
/* PAGE 4 — END */
/* ================================================= */

.page-four {

    background: #f7f3ea;

    text-align: center;
}

.ending {

    max-width: 700px;

    padding: 40px;
}

.ending-small {

    font-size: 12px;

    letter-spacing: 5px;

    text-transform: uppercase;

    color: #9a8975;

    margin-bottom: 25px;
}

.ending h1 {

    font-family: Georgia, serif;

    font-size: clamp(50px, 8vw, 90px);

    font-weight: 400;

    color: #3e3831;

    margin-bottom: 30px;
}

.ending-message {

    font-size: 18px;

    line-height: 1.9;

    color: #635b52;
}

.final-line {

    margin-top: 25px;

    font-family: 'Caveat', cursive;

    font-size: 30px;

    color: #7c8770;
}

.heart {

    margin-top: 30px;

    font-size: 45px;

    color: #7c8770;

    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}


/* ================================================= */
/* MOBILE */
/* ================================================= */

@media (max-width: 600px) {

    /* ------------------------- */
    /* PAGE 1 */
    /* ------------------------- */

    .birthday-content {
        padding: 25px;
    }

    .small-heading {
        letter-spacing: 3px;
    }

    .birthday-content h1 {
        letter-spacing: -1px;

        font-size: 55px;
    }

    .birthday-message {
        font-size: 17px;
    }

    .sub-message {
        font-size: 13px;
    }

    .confetti {
        font-size: 14px;
    }


    /* ------------------------- */
    /* PAGE 2 */
    /* ------------------------- */

    .video-container {
        width: 94%;
    }


    /* ------------------------- */
    /* PAGE 3 */
    /* ------------------------- */

    .page-three {
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
}

    .letter-scene {

        width: 100%;

        padding: 15px 0;

        transform: translateY(25px);

    }

    .vintage-letter {

        margin-top: 100px;
        
        min-height: 620px;

        padding: 45px 28px 55px;

        font-size: 21px;

        line-height: 1.65;

    }

    .letter-top {

        font-size: 15px;

        margin-bottom: 28px;

        /* transform: translateY(-10px); */
    }

    .letter-date {

        font-size: 16px;

        margin-bottom: 35px;

    }

    .vintage-letter h2 {

        font-size: 34px;

        margin-bottom: 22px;

    }

    .letter-content p {

        /* transform: translateY(-10px) */
        margin-bottom: 21px;

    }

    .letter-signature {

        margin-top: 35px;

        font-size: 19px;

    }

    .letter-signature span {

        font-size: 27px;

    }


    /* ------------------------- */
    /* PAGE 4 */
    /* ------------------------- */

    .ending {

        padding: 25px;
    }

    .ending h1 {

        font-size: 55px;
    }

    .ending-message {

        font-size: 16px;
    }

    .final-line {

        font-size: 27px;
    }
}


/* Keep birthday pages hidden until the link is validated */
body:not(.access-granted) #page1,
body:not(.access-granted) #page2,
body:not(.access-granted) #page3,
body:not(.access-granted) #page4 {
    display: none !important;
}

/* Message for invalid or already-used links */
#access-message {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 24px;
    background: #fff;
    color: #333;
    font-family: inherit;
}

#access-message.visible {
    display: flex;
}

body.access-granted #access-message {
    display: none;
}
