/* =========================================================
   FOR U BB — MAIN STYLE
   Mobile First 💗
========================================================= */

:root {
    --pink-light: #f9d9e5;
    --pink: #f4bfd2;
    --pink-dark: #e9a5bd;

    --text: #684452;
    --text-soft: #8b6977;

    --paper: #fffaf1;
    --paper-line: rgba(166, 125, 139, 0.12);

    --white-soft: rgba(255, 255, 255, 0.65);

    --shadow:
        0 15px 35px rgba(107, 65, 81, 0.16);

    --transition:
        0.6s cubic-bezier(0.22, 1, 0.36, 1);
}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;

    overflow-x: hidden;

    font-family: "Quicksand", sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 10% 10%,
            rgba(255, 255, 255, 0.75),
            transparent 28%
        ),
        radial-gradient(
            circle at 90% 85%,
            rgba(255, 255, 255, 0.45),
            transparent 25%
        ),
        linear-gradient(
            135deg,
            var(--pink-light),
            var(--pink) 55%,
            var(--pink-dark)
        );
}


/* =========================================================
   BUTTON RESET
========================================================= */

button {
    border: none;
    outline: none;

    font-family: inherit;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   APP
========================================================= */

#app {
    width: 100%;
    min-height: 100svh;
}


/* =========================================================
   PAGE SYSTEM
========================================================= */

.page {
    position: relative;

    display: none;

    width: 100%;
    min-height: 100svh;

    padding:
        max(25px, env(safe-area-inset-top))
        18px
        max(30px, env(safe-area-inset-bottom))
        18px;

    overflow-x: hidden;
}

.page.active {
    display: flex;
}


/* =========================================================
   FLOATING DECORATION
========================================================= */

.floating-hearts {
    position: fixed;

    inset: 0;

    pointer-events: none;

    overflow: hidden;

    z-index: 0;
}

.floating-hearts span {
    position: absolute;

    color: rgba(255, 255, 255, 0.55);

    font-family: Georgia, serif;

    animation:
        floatingHeart
        6s
        ease-in-out
        infinite;
}

.floating-hearts span:nth-child(1) {
    top: 13%;
    left: 8%;

    font-size: 18px;

    animation-delay: 0s;
}

.floating-hearts span:nth-child(2) {
    top: 25%;
    right: 10%;

    font-size: 13px;

    animation-delay: 1.2s;
}

.floating-hearts span:nth-child(3) {
    bottom: 20%;
    left: 14%;

    font-size: 15px;

    animation-delay: 2.3s;
}

.floating-hearts span:nth-child(4) {
    right: 16%;
    bottom: 14%;

    font-size: 20px;

    animation-delay: 3s;
}

.floating-hearts span:nth-child(5) {
    top: 48%;
    left: 48%;

    font-size: 10px;

    animation-delay: 4s;
}


@keyframes floatingHeart {

    0% {
        opacity: 0.2;

        transform:
            translateY(0)
            rotate(0deg);
    }

    50% {
        opacity: 0.6;

        transform:
            translateY(-12px)
            rotate(8deg);
    }

    100% {
        opacity: 0.2;

        transform:
            translateY(0)
            rotate(0deg);
    }
}


/* =========================================================
   OPENING PAGE
========================================================= */

#opening {
    align-items: center;
    justify-content: center;

    text-align: center;
}

.opening-content {
    position: relative;

    z-index: 2;

    width: 100%;
    max-width: 430px;

    margin: auto;

    padding:
        20px
        10px;
}


/* =========================================================
   OPENING TITLE
========================================================= */

.opening-title {
    position: relative;

    margin-bottom: 14px;

    color: var(--text);

    font-family: "Pacifico", cursive;

    font-size:
        clamp(
            32px,
            9.5vw,
            52px
        );

    font-weight: 400;

    line-height: 1.15;

    text-shadow:
        0 4px 10px rgba(101, 55, 74, 0.08);

    animation:
        openingTitle
        1s
        cubic-bezier(0.22, 1, 0.36, 1)
        both;
}


@keyframes openingTitle {

    from {
        opacity: 0;

        transform:
            translateY(-25px)
            scale(0.94);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   OPENING SUBTITLE
========================================================= */

.opening-subtitle {
    margin-bottom: 28px;

    color: var(--text-soft);

    font-size: 14px;

    letter-spacing: 0.5px;

    animation:
        fadeUp
        0.8s
        0.25s
        both;
}


/* =========================================================
   ENVELOPE BUTTON
========================================================= */

.envelope-button {
    position: relative;

    display: block;

    width: min(
        78vw,
        315px
    );

    aspect-ratio: 1.55;

    margin: 0 auto;

    background: transparent;

    animation:
        envelopeAppear
        1s
        0.4s
        both;
}


@keyframes envelopeAppear {

    from {
        opacity: 0;

        transform:
            translateY(30px)
            scale(0.88);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


.envelope {
    position: absolute;

    inset: 0;

    filter:
        drop-shadow(
            0 15px 18px
            rgba(93, 53, 70, 0.18)
        );

    transition:
        transform
        0.25s
        ease;
}


.envelope-button:active .envelope {
    transform: scale(0.94);
}


/* =========================================================
   ENVELOPE BODY
========================================================= */

.envelope-back {
    position: absolute;

    inset: 13% 0 0;

    background:
        linear-gradient(
            145deg,
            #fffdf8,
            #f0e6d6
        );

    border-radius:
        5px
        5px
        12px
        12px;

    box-shadow:
        inset 0 0 0 1px
        rgba(100, 65, 75, 0.08);
}


.envelope-front {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    height: 82%;

    background: #f5ecdd;

    clip-path:
        polygon(
            0 0,
            50% 54%,
            100% 0,
            100% 100%,
            0 100%
        );
}


/* =========================================================
   ENVELOPE LETTER
========================================================= */

.letter {
    position: absolute;

    z-index: 2;

    left: 50%;

    top: 15%;

    width: 62%;

    height: 70%;

    transform:
        translateX(-50%);

    background:
        linear-gradient(
            180deg,
            #fffdf8,
            #f7eee1
        );

    border-radius: 4px;

    box-shadow:
        0 5px 12px
        rgba(87, 52, 64, 0.12);

    transition:
        transform
        0.8s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        );
}


.letter span {
    position: absolute;

    top: 18px;
    left: 50%;

    transform:
        translateX(-50%);

    color: #e894b2;

    font-size: 30px;
}


/* =========================================================
   ENVELOPE FLAP
========================================================= */

.envelope-flap {
    position: absolute;

    z-index: 4;

    left: 0;
    right: 0;

    top: 13%;

    height: 62%;

    background: #fffaf1;

    clip-path:
        polygon(
            0 0,
            100% 0,
            50% 100%
        );

    transform-origin: 50% 0;

    transition:
        transform
        0.85s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        );
}


.envelope.open .envelope-flap {
    transform:
        rotateX(180deg);
}


.envelope.open .letter {
    transform:
        translateX(-50%)
        translateY(-24%);
}


/* =========================================================
   HEART SEAL
========================================================= */

.heart-seal {
    position: absolute;

    z-index: 7;

    left: 50%;
    top: 59%;

    display: grid;

    width: 56px;
    height: 56px;

    place-items: center;

    transform:
        translate(
            -50%,
            -50%
        );

    border-radius: 50%;

    color: white;

    background:
        radial-gradient(
            circle at 35% 28%,
            #ff9cbd,
            #e6739d 65%,
            #c95782
        );

    box-shadow:
        0 8px 15px
        rgba(132, 54, 87, 0.24);

    font-size: 24px;

    transition:
        opacity
        0.4s ease,
        transform
        0.5s ease;
}


.envelope.open .heart-seal {
    opacity: 0;

    transform:
        translate(
            -50%,
            -50%
        )
        scale(0.4);
}


/* =========================================================
   TAP TEXT
========================================================= */

.tap-text {
    margin-top: 18px;

    color: var(--text-soft);

    font-size: 13px;

    animation:
        tapPulse
        2s
        ease-in-out
        infinite;
}


@keyframes tapPulse {

    0%,
    100% {
        opacity: 0.55;

        transform: translateY(0);
    }

    50% {
        opacity: 1;

        transform: translateY(3px);
    }
}


/* =========================================================
   MENU
========================================================= */

#menu {
    align-items: center;
    justify-content: center;
}


.menu-container {
    position: relative;

    z-index: 2;

    width: 100%;
    max-width: 650px;

    margin: auto;

    text-align: center;
}


/* =========================================================
   MENU TITLE
========================================================= */

.menu-title {
    margin-bottom:
        clamp(
            35px,
            9vw,
            65px
        );

    color: var(--text);

    font-family: "Pacifico", cursive;

    font-size:
        clamp(
            38px,
            11vw,
            65px
        );

    font-weight: 400;

    line-height: 1;

    animation:
        menuTitleIn
        0.8s
        both;
}


@keyframes menuTitleIn {

    from {
        opacity: 0;

        transform:
            translateY(-20px)
            scale(0.95);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   MENU ITEMS
========================================================= */

.menu-items {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap:
        clamp(
            20px,
            7vw,
            55px
        );

    width: 100%;
}


.menu-card {
    position: relative;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    background: transparent;

    color: var(--text);

    animation:
        menuItemIn
        0.8s
        both;
}


.menu-card:nth-child(1) {
    animation-delay: 0.18s;
}


.menu-card:nth-child(2) {
    animation-delay: 0.32s;
}


@keyframes menuItemIn {

    from {
        opacity: 0;

        transform:
            translateY(30px)
            scale(0.9);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   MENU ICON
========================================================= */

.menu-icon {
    display: grid;

    width:
        clamp(
            105px,
            31vw,
            165px
        );

    aspect-ratio: 1;

    place-items: center;

    border-radius: 50%;

    background:
        rgba(
            255,
            255,
            255,
            0.48
        );

    box-shadow:
        0 16px 35px
        rgba(74, 39, 56, 0.13),

        inset
        0 0 0 1px
        rgba(255, 255, 255, 0.55);

    font-size:
        clamp(
            48px,
            14vw,
            82px
        );

    transition:
        transform
        0.25s
        ease,

        box-shadow
        0.25s
        ease;
}


.menu-card:active .menu-icon {
    transform:
        scale(0.91);
}


.menu-label {
    margin-top: 13px;

    font-family: "Pacifico", cursive;

    font-size:
        clamp(
            20px,
            5.5vw,
            29px
        );

    font-weight: 400;

    color: var(--text);
}


/* =========================================================
   BACK BUTTON
========================================================= */

.back-button {
    position: absolute;

    z-index: 20;

    top:
        max(
            17px,
            env(safe-area-inset-top)
        );

    left: 16px;

    display: flex;

    align-items: center;

    gap: 5px;

    padding:
        9px
        15px;

    border-radius: 999px;

    background:
        rgba(
            255,
            255,
            255,
            0.68
        );

    color: var(--text);

    font-size: 13px;

    font-weight: 700;

    letter-spacing: 0.3px;

    box-shadow:
        0 7px 20px
        rgba(75, 40, 55, 0.12);

    backdrop-filter:
        blur(8px);

    transition:
        transform
        0.2s
        ease;
}


.back-button:active {
    transform:
        scale(0.93);
}


/* =========================================================
   FOR U PAGE
========================================================= */

#foru {
    display: none;

    align-items: flex-start;
    justify-content: center;

    padding-top:
        max(
            75px,
            calc(
                env(safe-area-inset-top)
                + 65px
            )
        );
}


#foru.active {
    display: flex;
}


.letter-page-container {
    position: relative;

    z-index: 2;

    width: 100%;

    max-width: 720px;

    margin: 0 auto;
}


/* =========================================================
   BOOK PAPER
========================================================= */

.letter-paper {
    position: relative;

    width: 100%;

    padding:
        clamp(
            30px,
            8vw,
            60px
        )
        clamp(
            20px,
            6vw,
            60px
        );

    background-color:
        var(--paper);

    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 34px,
            var(--paper-line) 35px
        );

    border-radius: 8px;

    box-shadow:
        var(--shadow);

    border:
        1px solid
        rgba(
            130,
            88,
            98,
            0.08
        );

    transform:
        rotate(-0.25deg);

    animation:
        paperOpen
        0.9s
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        )
        both;
}


@keyframes paperOpen {

    from {
        opacity: 0;

        transform:
            translateY(45px)
            rotate(-3deg)
            scale(0.96);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            rotate(-0.25deg)
            scale(1);
    }
}


/* =========================================================
   PAPER DECORATIONS
========================================================= */

.paper-decoration {
    position: absolute;

    color:
        rgba(
            208,
            128,
            156,
            0.55
        );

    font-family: Georgia, serif;

    font-size: 20px;
}


.top-left {
    top: 16px;
    left: 17px;

    transform:
        rotate(-12deg);
}


.top-right {
    top: 18px;
    right: 18px;

    transform:
        rotate(10deg);
}


/* =========================================================
   LETTER TITLE
========================================================= */

.letter-title {
    margin-bottom: 25px;

    color: var(--text);

    font-family:
        "Pacifico",
        cursive;

    font-size:
        clamp(
            27px,
            7vw,
            42px
        );

    font-weight: 400;

    line-height: 1.25;

    text-align: center;
}


/* =========================================================
   LETTER TEXT
========================================================= */

.letter-text {
    color:
        #554049;

    font-family:
        "Quicksand",
        sans-serif;

    font-size:
        clamp(
            15px,
            4.2vw,
            19px
        );

    font-weight: 500;

    line-height: 1.9;

    letter-spacing: 0.01em;
}


.letter-text p {
    margin-bottom:
        1.35em;

    opacity: 0;

    transform:
        translateY(12px);

    transition:
        opacity
        0.8s
        ease,

        transform
        0.8s
        ease;
}


.letter-text.reveal p {
    opacity: 1;

    transform:
        translateY(0);
}


.letter-text.reveal p:nth-child(1) {
    transition-delay: 0.15s;
}


.letter-text.reveal p:nth-child(2) {
    transition-delay: 0.5s;
}


.letter-text.reveal p:nth-child(3) {
    transition-delay: 0.85s;
}


/* =========================================================
   LETTER ENDING
========================================================= */

.letter-ending {
    margin-top: 25px;

    padding-top: 15px;

    text-align: center;
}


.ending-text {
    color: var(--text-soft);

    font-family:
        "Pacifico",
        cursive;

    font-size:
        clamp(
            18px,
            5vw,
            25px
        );

    font-weight: 400;
}


.ending-hearts {
    margin-top: 12px;

    color:
        #dc86a7;

    font-family: Georgia, serif;

    font-size: 23px;

    letter-spacing: 8px;

    opacity: 0;

    animation:
        endingHeart
        1s
        2s
        forwards;
}


@keyframes endingHeart {

    from {
        opacity: 0;

        transform:
            scale(0.5);
    }

    65% {
        opacity: 1;

        transform:
            scale(1.18);
    }

    to {
        opacity: 1;

        transform:
            scale(1);
    }
}


/* =========================================================
   PLAYLIST PAGE
========================================================= */

#playlist {
    display: none;

    align-items: flex-start;
    justify-content: center;

    padding-top:
        max(
            75px,
            calc(
                env(safe-area-inset-top)
                + 65px
            )
        );
}


#playlist.active {
    display: flex;
}


.playlist-container {
    position: relative;

    z-index: 2;

    width: 100%;

    max-width: 850px;

    margin: auto;
}


/* =========================================================
   PLAYLIST TITLE
========================================================= */

.playlist-title {
    margin-bottom: 28px;

    color: var(--text);

    font-family:
        "Pacifico",
        cursive;

    font-size:
        clamp(
            37px,
            11vw,
            65px
        );

    font-weight: 400;

    line-height: 1;

    text-align: center;

    animation:
        playlistTitleIn
        0.8s
        both;
}


@keyframes playlistTitleIn {

    from {
        opacity: 0;

        transform:
            translateY(-20px)
            scale(0.94);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   PLAYLIST CONTENT
========================================================= */

.playlist-content {
    display: grid;

    grid-template-columns:
        1fr;

    gap: 24px;

    align-items: center;
}


/* =========================================================
   MUSIC PLAYER
========================================================= */

.music-player-wrapper {
    width: 100%;

    animation:
        playerAppear
        0.8s
        0.15s
        both;
}


@keyframes playerAppear {

    from {
        opacity: 0;

        transform:
            translateY(25px)
            scale(0.96);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


.music-player {
    width: 100%;

    padding: 8px;

    background:
        rgba(
            255,
            255,
            255,
            0.48
        );

    border:
        1px solid
        rgba(
            255,
            255,
            255,
            0.65
        );

    border-radius: 16px;

    box-shadow:
        var(--shadow);
}


.youtube-player {
    width: 100%;

    aspect-ratio: 16 / 9;

    border-radius: 10px;

    overflow: hidden;

    background:
        #302932;
}


.youtube-player iframe {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
}


.music-caption {
    margin-top: 10px;

    color: var(--text-soft);

    font-size: 12px;

    text-align: center;

    letter-spacing: 0.4px;
}


/* =========================================================
   PHOTO GALLERY
========================================================= */

.photo-gallery {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            1fr
        );

    gap: 8px;

    width: 100%;
}


.photo-frame {
    padding: 6px;

    background:
        linear-gradient(
            135deg,
            #f6dba8,
            #b77d35 45%,
            #f0cf8b 72%,
            #996127
        );

    border-radius: 2px;

    box-shadow:
        0 10px 25px
        rgba(
            75,
            40,
            25,
            0.23
        );

    animation:
        photoAppear
        0.8s
        both;
}


.photo-frame:nth-child(1) {
    animation-delay: 0.25s;
}


.photo-frame:nth-child(2) {
    animation-delay: 0.42s;

    transform:
        translateY(10px);
}


.photo-frame:nth-child(3) {
    animation-delay: 0.59s;
}


.photo-frame img {
    display: block;

    width: 100%;

    aspect-ratio: 1 / 1;

    object-fit: cover;

    background:
        #eee;

    border: 0;
}


@keyframes photoAppear {

    from {
        opacity: 0;

        transform:
            translateY(25px)
            scale(0.9);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   PLAYLIST DECORATION
========================================================= */

.playlist-decoration {
    display: flex;

    justify-content: center;

    gap: 20px;

    margin-top: 18px;

    font-size: 38px;

    filter:
        drop-shadow(
            0 8px 10px
            rgba(
                70,
                40,
                50,
                0.13
            )
        );

    animation:
        decorationAppear
        0.8s
        0.7s
        both;
}


@keyframes decorationAppear {

    from {
        opacity: 0;

        transform:
            translateY(15px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


/* =========================================================
   MUSIC BACKGROUND
========================================================= */

.youtube-background {
    position: fixed;

    width: 1px;
    height: 1px;

    left: -10px;
    bottom: -10px;

    opacity: 0;

    pointer-events: none;

    overflow: hidden;
}


.youtube-background iframe {
    width: 1px;
    height: 1px;

    border: 0;
}


/* =========================================================
   MUSIC TOGGLE
========================================================= */

.music-toggle {
    position: fixed;

    z-index: 100;

    right: 15px;

    bottom:
        max(
            15px,
            env(safe-area-inset-bottom)
        );

    display: none;

    width: 43px;
    height: 43px;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        rgba(
            255,
            255,
            255,
            0.76
        );

    color: var(--text);

    font-size: 18px;

    box-shadow:
        0 8px 22px
        rgba(
            75,
            40,
            55,
            0.15
        );

    backdrop-filter:
        blur(8px);

    transition:
        transform
        0.2s
        ease;
}


.music-toggle:active {
    transform:
        scale(0.9);
}


/* =========================================================
   PAGE TRANSITION
========================================================= */

.page-transition {
    position: fixed;

    z-index: 999;

    inset: 0;

    pointer-events: none;

    background:
        linear-gradient(
            135deg,
            var(--pink-light),
            var(--pink)
        );

    transform:
        scaleY(0);

    transform-origin:
        bottom;

    opacity: 1;
}


.page-transition.play {
    animation:
        pageTransition
        0.75s
        cubic-bezier(
            0.77,
            0,
            0.18,
            1
        );
}


@keyframes pageTransition {

    0% {
        transform:
            scaleY(0);

        transform-origin:
            bottom;
    }

    45% {
        transform:
            scaleY(1);

        transform-origin:
            bottom;
    }

    55% {
        transform:
            scaleY(1);

        transform-origin:
            top;
    }

    100% {
        transform:
            scaleY(0);

        transform-origin:
            top;
    }
}


/* =========================================================
   GENERAL ANIMATION
========================================================= */

@keyframes fadeUp {

    from {
        opacity: 0;

        transform:
            translateY(18px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


/* =========================================================
   MOBILE OPTIMIZATION
========================================================= */

@media (max-width: 390px) {

    .page {
        padding-left: 13px;
        padding-right: 13px;
    }

    .opening-title {
        font-size: 32px;
    }

    .envelope-button {
        width: 76vw;
    }

    .menu-items {
        gap: 12px;
    }

    .menu-icon {
        width: 34vw;

        font-size: 52px;
    }

    .menu-label {
        font-size: 19px;
    }

    .letter-paper {
        padding:
            30px
            19px;
    }

    .letter-text {
        font-size: 15px;

        line-height: 1.85;
    }

    .photo-gallery {
        gap: 6px;
    }

    .photo-frame {
        padding: 5px;
    }
}


/* =========================================================
   TABLET / DESKTOP
   Tetap responsive, tapi fokus utama tetap HP.
========================================================= */

@media (min-width: 700px) {

    .page {
        padding-left: 35px;
        padding-right: 35px;
    }

    .playlist-content {
        grid-template-columns:
            1.1fr
            0.9fr;

        gap: 30px;
    }

    .photo-gallery {
        grid-template-columns:
            repeat(
                2,
                1fr
            );

        gap: 12px;
    }

    .photo-frame:nth-child(3) {
        grid-column:
            1 / span 2;

        width: 62%;

        justify-self: center;
    }

    .letter-paper {
        padding:
            55px
            60px;
    }
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;

        scroll-behavior: auto !important;
    }
}