:root {
    --blush: #fbe3e6;
    --cream: #fff6ee;
    --rose: #d8576f;
    --wine: #4a0f23;
    --gold: #c9a45c;
    --ink: #4a2530;
    --serif: 'Cormorant Garamond', Georgia, serif;
    --sans: 'Nunito', system-ui, sans-serif;
    --hand: 'Caveat', cursive
}

* {
    box-sizing: border-box;
    margin: 0
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 56px
}

body {
    font-family: var(--sans);
    color: var(--ink);
    background: linear-gradient(180deg, var(--cream), var(--blush) 60%, var(--cream));
    line-height: 1.65;
    overflow-x: hidden;
    font-size: 17px
}

body.locked {
    overflow: hidden;
    height: 100vh
}

body.locked main>section:not(#intro) {
    visibility: hidden
}

img {
    max-width: 100%;
    display: block
}

button {
    font: inherit;
    cursor: pointer;
    border: 0;
    color: inherit;
    background: none
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: var(--wine);
    font-size: 3rem;
    transition: opacity .8s
}

#loader.off {
    opacity: 0;
    pointer-events: none
}

.beat {
    animation: beat 1s infinite
}

@keyframes beat {
    50% {
        transform: scale(1.25)
    }
}

#fx {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50
}

#progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--rose), var(--gold));
    z-index: 60
}

/* chrome */
.fab {
    position: fixed;
    z-index: 70;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--wine);
    color: var(--cream);
    font-size: 1.3rem;
    box-shadow: 0 6px 18px #4a0f2355
}

.fab.top {
    top: calc(10px + env(safe-area-inset-top));
    right: 12px
}

.fab.bottom {
    bottom: calc(76px + env(safe-area-inset-bottom));
    right: 12px
}

#menu {
    position: fixed;
    z-index: 69;
    top: 0;
    right: 0;
    left: 0;
    padding: 70px 16px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #4a0f23ee;
    backdrop-filter: blur(8px)
}

#menu[hidden] {
    display: none
}

#menu a {
    color: var(--cream);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 30px;
    border: 1px solid #fff4;
    min-height: 44px
}

.glass {
    background: #ffffff80;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid #fff9;
    box-shadow: 0 10px 30px #d8576f22;
    border-radius: 22px
}

#player {
    position: fixed;
    z-index: 70;
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px
}

#player button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--rose);
    color: #fff
}

#vol {
    width: 70px;
    accent-color: var(--rose)
}

#eq {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 18px;
    width: 16px;
    opacity: .3
}

#eq i {
    flex: 1;
    background: var(--rose);
    height: 30%
}

#player.on #eq {
    opacity: 1
}

#player.on #eq i {
    animation: eq .8s infinite alternate
}

#player.on #eq i:nth-child(2) {
    animation-delay: .25s
}

#player.on #eq i:nth-child(3) {
    animation-delay: .5s
}

@keyframes eq {
    to {
        height: 100%
    }
}

/* scenes */
.scene {
    min-height: 100svh;
    padding: 90px 20px 110px;
    max-width: 640px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 18px
}

.scene.wide {
    max-width: 1100px
}

h1,
h2 {
    font-family: var(--serif);
    color: var(--wine);
    line-height: 1.12;
    font-weight: 700
}

h1 {
    font-size: clamp(2.4rem, 11vw, 4.6rem)
}

h2 {
    font-size: clamp(1.9rem, 7.5vw, 3.2rem)
}

.lead {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-style: italic
}

.soft {
    opacity: .8
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 12px 28px;
    border-radius: 40px;
    background: linear-gradient(135deg, var(--rose), #b73654);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 22px #d8576f66;
    transition: transform .2s
}

.btn:active {
    transform: scale(.96)
}

.btn.ghost {
    background: transparent;
    color: var(--wine);
    border: 2px solid var(--rose);
    box-shadow: none
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center
}

.reveal>* {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .9s, transform .9s
}

.reveal.in>* {
    opacity: 1;
    transform: none
}

.reveal.in>*:nth-child(2) {
    transition-delay: .15s
}

.reveal.in>*:nth-child(3) {
    transition-delay: .3s
}

.reveal.in>*:nth-child(4) {
    transition-delay: .45s
}

.bigheart {
    font-size: 4.5rem;
    animation: beat 1.4s infinite
}

/* envelope */
#envelope {
    position: relative;
    width: 240px;
    height: 160px;
    margin: 20px 0;
    transition: transform .8s
}

#envelope>* {
    position: absolute;
    inset: 0;
    border-radius: 10px
}

#envelope .back {
    background: #e9a8b4
}

#envelope .paper {
    background: #fff;
    inset: 10px 14px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    transition: transform .9s .4s
}

#envelope .front {
    background: linear-gradient(135deg, #f3b7c2 50%, transparent 50%), linear-gradient(225deg, #f6c6cf 50%, transparent 50%);
    background-color: transparent
}

#envelope .flap {
    background: #d8576f;
    clip-path: polygon(0 0, 100% 0, 50% 62%);
    transform-origin: top;
    transition: transform .7s;
    z-index: 3
}

#envelope .seal {
    inset: auto;
    left: calc(50% - 22px);
    top: 50px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(#ff7b93, #b3243f);
    color: #fff;
    display: grid;
    place-items: center;
    z-index: 4;
    animation: beat 1.4s infinite;
    box-shadow: 0 0 22px #ff7b93
}

#envelope.open .flap {
    transform: rotateX(180deg);
    z-index: 0
}

#envelope.open .seal {
    opacity: 0;
    transition: opacity .4s
}

#envelope.open .paper {
    transform: translateY(-70px)
}

#intro.go {
    animation: glow 2s forwards
}

@keyframes glow {
    to {
        filter: brightness(1.1) saturate(1.2)
    }
}

/* timeline */
.timeline {
    position: relative;
    width: 100%;
    padding-left: 28px;
    text-align: left
}

.timeline:before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(var(--rose), var(--gold))
}

.tcard {
    position: relative;
    padding: 22px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 30px #d8576f22
}

.tcard:before {
    content: "";
    position: absolute;
    left: -28px;
    top: 26px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 0 6px #d8576f33, 0 0 18px var(--rose)
}

.tcard time {
    font-family: var(--serif);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--rose)
}

/* gallery */
.photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%
}

.ph {
    background: #fff;
    padding: 8px 8px 12px;
    border-radius: 6px;
    box-shadow: 0 12px 28px #4a0f2338;
    transform: rotate(var(--r, 0deg));
    transition: transform .3s;
    text-align: center
}

.ph:nth-child(3n+1) {
    grid-column: span 2
}

.ph:active,
.ph:hover {
    transform: rotate(0) scale(1.03)
}

.ph .frame {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--blush), #f3b7c2);
    display: grid;
    place-items: center;
    font-size: 2.5rem
}

.ph:nth-child(3n+2) .frame {
    aspect-ratio: 1
}

.ph:nth-child(3n) .frame {
    border-radius: 40% 40% 4px 4px
}

.ph img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 35%
}

.ph span {
    display: block;
    font-family: var(--hand);
    font-size: 1.25rem;
    margin-top: 6px;
    line-height: 1.2
}

.lb {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: #1b0610f2;
    display: grid;
    place-items: center;
    touch-action: pan-y
}

.lb[hidden] {
    display: none
}

.lb figure {
    max-width: 94vw;
    text-align: center;
    color: #fff
}

.lb img {
    max-height: 72vh;
    margin: auto;
    border-radius: 10px;
    object-fit: contain
}

.lb figcaption {
    font-family: var(--hand);
    font-size: 1.6rem;
    margin-top: 12px
}

.lbx,
.lbn {
    position: absolute;
    color: #fff;
    font-size: 2rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffffff22
}

.lbx {
    top: calc(10px + env(safe-area-inset-top));
    right: 12px
}

.lbn {
    top: 50%;
    transform: translateY(-50%)
}

.prev {
    left: 6px
}

.next {
    right: 6px
}

/* cards */
.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%
}

.fc {
    perspective: 800px;
    min-height: 150px;
    aspect-ratio: 1/1.05
}

.fc>div {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .7s;
    transform-style: preserve-3d
}

.fc.flip>div {
    transform: rotateY(180deg)
}

.fc .f,
.fc .b {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 12px;
    border-radius: 20px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    font-size: .98rem
}

.fc .f {
    background: linear-gradient(145deg, #fff, var(--blush));
    border: 2px solid var(--gold);
    font-size: 2.2rem;
    box-shadow: 0 0 18px #c9a45c55
}

.fc .b {
    background: linear-gradient(145deg, var(--rose), #a52c47);
    color: #fff;
    transform: rotateY(180deg);
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3
}

.dreams .dc {
    padding: 20px 12px;
    border-radius: 20px;
    background: #ffffffb0;
    border: 1px solid #c9a45c88;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.15rem;
    opacity: 0;
    transform: scale(.9);
    transition: .6s
}

.dreams.in .dc {
    opacity: 1;
    transform: none
}

/* messages & letter */
.msg {
    width: 100%;
    min-height: 170px;
    display: grid;
    place-items: center;
    padding: 24px;
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--wine)
}

.msg.pop {
    animation: pop .6s
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(.8) rotate(-3deg)
    }
}

.letter {
    position: relative;
    width: 100%;
    text-align: left;
    padding: 34px 22px 26px;
    background: #fffdf7 repeating-linear-gradient(transparent 0 33px, #e9c9cf 33px 34px);
    border-radius: 8px;
    box-shadow: 0 14px 36px #4a0f2330;
    font-family: var(--hand);
    font-size: 1.45rem;
    line-height: 34px;
    min-height: 200px
}

.letter .wax {
    position: absolute;
    right: -6px;
    top: -14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(#ff7b93, #b3243f);
    color: #fff;
    display: grid;
    place-items: center;
    line-height: 1
}

#letterText p {
    margin-bottom: 34px
}

#letterText span {
    opacity: 0;
    transition: opacity .6s
}

#letterText span.on {
    opacity: 1
}

/* date & birthday */
.datebox {
    padding: 26px 34px
}

.dnum {
    font-family: var(--serif);
    font-size: 6rem;
    line-height: 1;
    color: var(--rose);
    font-weight: 700
}

.dmon {
    font-family: var(--serif);
    font-size: 1.6rem
}

.since {
    margin-top: 10px;
    font-weight: 700;
    color: var(--wine)
}

.cake {
    font-size: 5rem;
    position: relative;
    animation: beat 2s infinite
}

.flame {
    position: absolute;
    top: -22px;
    left: calc(50% - 14px);
    font-size: 1.8rem;
    animation: flick .4s infinite alternate
}

@keyframes flick {
    to {
        transform: scale(1.15) rotate(5deg)
    }
}

#balloons span {
    position: fixed;
    bottom: -80px;
    font-size: 2.4rem;
    z-index: 45;
    pointer-events: none;
    animation: rise 6s linear forwards
}

@keyframes rise {
    to {
        transform: translateY(-120vh) rotate(15deg)
    }
}

/* proposal */
.dark {
    max-width: none;
    width: 100%;
    background: radial-gradient(circle at 50% 30%, #a52c47, var(--wine) 70%);
    color: var(--cream);
    padding-inline: 24px
}

.dark h2 {
    color: var(--cream)
}

.glowheart {
    font-size: 5rem;
    color: #ff7b93;
    text-shadow: 0 0 40px #ff4d6d;
    animation: beat 1.3s infinite
}

#pSteps,
.yesmsg {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center
}

#pSteps[hidden],
.yesmsg[hidden] {
    display: none
}

.ps {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(6px);
    transition: all 1.2s
}

.ps.show {
    opacity: 1;
    transform: none;
    filter: none
}

.ps.big {
    font-family: var(--serif);
    font-size: 2.4rem
}

.ps.gold {
    color: #f0d28a;
    text-shadow: 0 0 24px #c9a45c88
}

.yes {
    background: linear-gradient(135deg, #f0d28a, var(--gold));
    color: var(--wine)
}

.yesmsg {
    animation: pop 1s
}

/* final */
.finalpic {
    width: 100%;
    max-width: 420px;
    border: 8px solid #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 50px #4a0f2355;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--blush), #f3b7c2)
}

.finalpic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 35%
}

.script {
    font-family: var(--hand);
    font-size: 1.8rem;
    color: var(--rose)
}

.secret {
    width: 44px;
    height: 44px;
    opacity: .55;
    font-size: 1.3rem
}

[hidden] {
    display: none !important
}

@media(min-width:768px) {
    .scene {
        padding-inline: 40px
    }

    .photos {
        grid-template-columns: repeat(4, 1fr)
    }

    .ph:nth-child(3n+1) {
        grid-column: auto
    }

    .ph:nth-child(1),
    .ph:nth-child(6) {
        grid-column: span 2
    }

    .cards {
        grid-template-columns: repeat(5, 1fr)
    }

    .dreams {
        grid-template-columns: repeat(4, 1fr)
    }

    .letter {
        font-size: 1.7rem
    }

    .fab.bottom {
        bottom: 24px
    }

    #player {
        bottom: 20px
    }
}

@media(max-width:380px) {
    body {
        font-size: 16px
    }

    #vol {
        width: 50px
    }

    .msg {
        font-size: 1.4rem
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        animation: none !important;
        transition-duration: .01s !important;
        scroll-behavior: auto !important
    }

    .ps {
        opacity: 1;
        filter: none;
        transform: none
    }
}