@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@400;500;600;700&family=Caveat:wght@400;500;600&display=swap');

:root {
    --primary: #ff6f9f;
    --secondary: #b58cff;
    --background: #fff7fa;
    --text: #392631;
    --muted: #8f7882;
    --card: rgba(255,255,255,0.78);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family: 'Inter', sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 10% 10%,
            rgba(255,111,159,.18),
            transparent 30%
        ),
        radial-gradient(
            circle at 90% 85%,
            rgba(181,140,255,.18),
            transparent 30%
        ),
        var(--background);

    overflow-x: hidden;
}


/* =========================
   MAIN
========================= */

#app {
    position: relative;
    min-height: 100vh;
}


/* =========================
   FLOATING HEARTS
========================= */

#hearts {
    position: fixed;
    inset: 0;

    overflow: hidden;

    pointer-events: none;

    z-index: 0;
}

.heart {
    position: absolute;

    bottom: -30px;

    color: var(--primary);

    opacity: 0;

    animation: floatHeart linear forwards;

    
}

@keyframes floatHeart {

    0% {
        transform:
            translateY(0)
            rotate(0deg)
            scale(.7);

        opacity: 0;
    }

    15% {
        opacity: .65;
    }

    100% {
        transform:
            translateY(-110vh)
            rotate(25deg)
            scale(1.15);

        opacity: 0;
    }
}


/* =========================
   HERO
========================= */

.hero {
    position: relative;

    z-index: 2;

    min-height: 100vh;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    padding: 50px 25px;

    transition:
        opacity .8s ease,
        transform .8s ease;
}

.hero.fade-out {
    opacity: 0;

    transform:
        translateY(-30px)
        scale(.98);
}

.small-label {
    display: inline-block;

    padding: 10px 18px;

    border-radius: 50px;

    background: rgba(255,255,255,.72);

    color: var(--primary);

    font-size: 11px;

    font-weight: 600;

    letter-spacing: 1.5px;

    box-shadow:
        0 10px 35px rgba(255,111,159,.12);
}

h1 {
    margin: 25px 0 20px;

    font-family: 'DM Serif Display', serif;

    font-size: clamp(48px, 10vw, 90px);

    line-height: .98;

    font-weight: 400;

    letter-spacing: -2px;
}

h1 span {
    color: var(--primary);
}

.hero > p {
    max-width: 560px;

    margin: 0 auto 35px;

    color: var(--muted);

    font-size: 16px;

    line-height: 1.8;
}

.hero > p span {
    color: var(--primary);

    font-weight: 600;
}

#openBtn,
.soft-btn {
    border: none;

    padding: 16px 26px;

    border-radius: 50px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--secondary)
        );

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    box-shadow:
        0 15px 35px rgba(255,111,159,.25);

    transition:
        transform .25s ease,
        box-shadow .25s ease;
}

#openBtn:hover,
.soft-btn:hover {
    transform: translateY(-3px);

    box-shadow:
        0 20px 45px rgba(255,111,159,.35);
}

.scroll-hint {
    margin-top: 28px;

    color: #b8a7ae;

    font-size: 10px;

    letter-spacing: 1px;
}


/* =========================
   HIDDEN
========================= */

.hidden {
    display: none !important;
}


/* =========================
   LETTER
========================= */

.letter-section {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 80px 20px;

    animation: reveal .9s ease;
}

@keyframes reveal {

    from {
        opacity: 0;
        transform: translateY(35px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.letter-card {
    position: relative;

    width: min(650px, 100%);

    padding: 55px 45px;

    text-align: center;

    border-radius: 30px;

    background: var(--card);

    border: 1px solid rgba(255,255,255,.8);

    box-shadow:
        0 30px 80px rgba(150,90,110,.14);

    backdrop-filter: blur(18px);
}

.flower {
    font-size: 35px;

    margin-bottom: 15px;
}

.letter-small,
.final-label {
    color: var(--primary);

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 3px;
}

.letter-card h2 {
    margin: 18px 0;

    font-family: 'DM Serif Display', serif;

    font-size: clamp(38px, 8vw, 60px);

    font-weight: 400;
}

.letter-card h2 span,
.final-card h2 span {
    color: var(--primary);
}

.letter-line {
    width: 50px;

    height: 2px;

    margin: 25px auto;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--secondary)
        );
}

.letter-text {
    max-width: 500px;

    margin: 22px auto;

    color: #76636c;

    font-size: 16px;

    line-height: 1.9;

    white-space: pre-line;
}

.letter-text strong {
    color: var(--primary);
}

.letter-text.soft {
    font-family: 'Caveat', cursive;

    font-size: 25px;

    color: #8d6878;
}

.soft-btn {
    margin-top: 18px;
}


/* =========================
   FINAL
========================= */

.final-section {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 80px 20px;

    animation: reveal 1s ease;
}

.final-card {
    position: relative;

    width: min(700px, 100%);

    padding: 55px 45px;

    text-align: center;

    border-radius: 30px;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.88),
            rgba(255,241,247,.82)
        );

    border: 1px solid rgba(255,255,255,.9);

    box-shadow:
        0 30px 90px rgba(160,80,120,.16);

    overflow: hidden;
}

.final-card::before {
    content: "";

    position: absolute;

    width: 230px;
    height: 230px;

    top: -120px;
    right: -100px;

    border-radius: 50%;

    background: rgba(255,111,159,.12);

    filter: blur(20px);
}

.heart-big {
    color: var(--primary);

    font-size: 45px;

    animation: heartbeat 1.8s infinite;
}

@keyframes heartbeat {

    0%,100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}

.final-card h2 {
    margin: 18px 0 25px;

    font-family: 'DM Serif Display', serif;

    font-size: clamp(38px, 8vw, 62px);

    font-weight: 400;
}

#finalMessage {
    max-width: 550px;

    margin: auto;

    color: #76636c;

    font-size: 16px;

    line-height: 2;

    white-space: pre-line;
}

.signature {
    margin-top: 35px;

    color: #806a73;

    line-height: 1.8;
}

.signature strong {
    color: var(--primary);

    font-family: 'Caveat', cursive;

    font-size: 28px;
}

.signature span {
    display: block;

    color: #a18d95;

    font-size: 12px;
}

.tiny-code {
    margin-top: 40px;

    color: #b6a8ae;

    font-family: monospace;

    font-size: 9px;

    line-height: 1.7;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {

    .hero {
        padding: 35px 18px;
    }

    h1 {
        font-size: 52px;
    }

    .hero > p {
        font-size: 15px;
    }

    .letter-card,
    .final-card {
        padding: 42px 25px;
    }

    .letter-text {
        font-size: 15px;
    }
}


/* =========================
   PHOTO MEMORIES
========================= */

.memories-section {
    min-height: 100vh;

    padding: 90px 20px;

    text-align: center;

    animation: reveal 1s ease;
}

.memories-heading p {
    margin: 0 0 15px;

    color: var(--primary);

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 3px;
}

.memories-heading h2 {
    margin: 0 auto 55px;

    font-family: 'DM Serif Display', serif;

    font-size: clamp(35px, 7vw, 58px);

    line-height: 1.05;

    font-weight: 400;
}

.memory-grid {
    width: min(850px, 100%);

    margin: auto;

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 25px;

    align-items: start;
}

.memory-photo {
    position: relative;

    padding: 10px 10px 22px;

    background: #fff;

    border-radius: 4px;

    box-shadow:
        0 18px 45px rgba(90,50,65,.14);

    transform:
        rotate(var(--rotation));

    transition:
        transform .35s ease,
        box-shadow .35s ease;
}

.memory-photo:nth-child(2) {
    margin-top: 35px;
}

.memory-photo:hover {
    transform:
        rotate(0deg)
        translateY(-8px)
        scale(1.025);

    box-shadow:
        0 25px 55px rgba(90,50,65,.22);

    z-index: 3;
}

.memory-photo img {
    width: 100%;

    aspect-ratio: 4 / 5;

    display: block;

    object-fit: cover;
}

.memory-caption {
    padding-top: 12px;

    font-family: 'Caveat', cursive;

    font-size: 21px;

    color: #806a73;
}

.memory-number {
    position: absolute;

    top: -9px;
    right: -9px;

    width: 28px;
    height: 28px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--primary);

    color: white;

    font-size: 11px;

    box-shadow:
        0 5px 15px rgba(255,111,159,.3);
}

#memoryContinue {
    margin-top: 55px;
}

@media (max-width: 700px) {

    .memory-grid {
        grid-template-columns:
            repeat(2, 1fr);

        gap: 18px;
    }

    .memory-photo:nth-child(2) {
        margin-top: 20px;
    }
}

@media (max-width: 450px) {

    .memory-grid {
        grid-template-columns: 1fr;
        max-width: 310px;
    }

    .memory-photo:nth-child(2) {
        margin-top: 0;
    }
}


/* =========================
   BIRTHDAY DATE
========================= */

.birthday-date {
    margin-top: 18px;

    color: #a9939c;

    font-family: monospace;

    font-size: 10px;

    letter-spacing: 4px;

    opacity: .75;
}


/* =========================
   CINEMATIC GLOW
========================= */

.hero::before {
    content: "";
    position: absolute;

    width: 420px;
    height: 420px;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255,111,159,.08),
            transparent 68%
        );

    pointer-events: none;
    z-index: -1;
}




/* =========================
   LITTLE QUESTION
========================= */

.question-section {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 40px 20px;

    animation: reveal .8s ease;
}

.question-card {
    width: min(580px, 100%);

    padding: 55px 35px;

    text-align: center;

    border-radius: 32px;

    background:
        rgba(255,255,255,.72);

    border: 1px solid rgba(255,255,255,.9);

    box-shadow:
        0 30px 80px rgba(150,80,110,.13);

    backdrop-filter: blur(18px);
}

.question-heart {
    font-size: 45px;

    color: var(--primary);

    margin-bottom: 15px;

    animation: gentleHeart 2s ease-in-out infinite;
}

@keyframes gentleHeart {

    0%,100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}

.question-label {
    color: var(--primary);

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 3px;
}

.question-card h2 {
    margin: 20px 0;

    font-family: 'DM Serif Display', serif;

    font-size: clamp(38px, 8vw, 58px);

    line-height: 1.05;

    font-weight: 400;
}

.question-text {
    color: var(--muted);

    font-size: 16px;

    margin: 0 auto 28px;
}

.tiny-hint {
    margin-top: 20px;

    color: #b7a6ae;

    font-size: 10px;
}

.countdown {
    margin-top: 25px;
}

.countdown span {
    display: inline-flex;

    width: 90px;
    height: 90px;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--secondary)
        );

    font-family: 'DM Serif Display', serif;

    font-size: 45px;

    box-shadow:
        0 15px 40px rgba(255,111,159,.25);

    animation: countdownPop .7s ease;
}

@keyframes countdownPop {

    0% {
        transform: scale(.4);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}



/* =========================
   CINEMATIC MEMORY REVEAL
========================= */

.memory-photo {
    opacity: 0;

    transform:
        translateY(35px)
        rotate(var(--rotation))
        scale(.96);

    animation:
        memoryReveal .9s cubic-bezier(.2,.75,.25,1)
        forwards;

    will-change: transform, opacity;
}

.memory-photo:nth-child(1) {
    animation-delay: .08s;
}

.memory-photo:nth-child(2) {
    animation-delay: .22s;
}

.memory-photo:nth-child(3) {
    animation-delay: .36s;
}

.memory-photo:nth-child(4) {
    animation-delay: .50s;
}

.memory-photo:nth-child(5) {
    animation-delay: .64s;
}

@keyframes memoryReveal {

    from {
        opacity: 0;

        transform:
            translateY(35px)
            rotate(var(--rotation))
            scale(.96);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            rotate(var(--rotation))
            scale(1);
    }
}

.memory-subtitle {
    max-width: 460px;

    margin:
        -35px auto 45px;

    color: var(--muted);

    font-size: 14px;

    line-height: 1.8;
}

.memory-photo img {
    transition:
        transform .6s cubic-bezier(.2,.75,.25,1);
}

.memory-photo:hover img {
    transform: scale(1.035);
}

.memory-caption {
    transition:
        color .3s ease,
        transform .3s ease;
}

.memory-photo:hover .memory-caption {
    color: var(--primary);

    transform: translateY(-1px);
}


/* Don't animate if the device asks for reduced motion */

@media (prefers-reduced-motion: reduce) {

    .memory-photo {
        animation: none;

        opacity: 1;

        transform:
            rotate(var(--rotation))
            scale(1);
    }
}



@media (max-width: 600px) {

    .memory-photo {
        animation-duration: .75s;
    }

    .memory-subtitle {
        margin-top: -25px;

        padding: 0 15px;

        font-size: 13px;
    }
}



/* =========================
   SELECTED MEMORY PHOTO
========================= */

.memory-photo.selected {
    transform:
        rotate(0deg)
        translateY(-6px)
        scale(1.015);

    z-index: 10;

    box-shadow:
        0 25px 55px rgba(90, 50, 65, .22);
}

.memory-photo.selected .memory-caption {
    color: var(--primary);
    transform: translateY(-1px);
    font-weight: 600;
}

/*
   Hover should NOT straighten the photo.
   Only the selected/tapped photo becomes straight.
*/

.memory-photo:hover {
    transform:
        rotate(var(--rotation))
        translateY(-3px);

    box-shadow:
        0 20px 48px rgba(90, 50, 65, .17);

    z-index: 3;
}

.memory-photo.selected:hover {
    transform:
        rotate(0deg)
        translateY(-6px)
        scale(1.015);

    z-index: 10;
}


/* =========================
   FINAL PHOTO SELECTION FIX
========================= */

.memory-photo.selected {
    animation: none !important;
    opacity: 1 !important;

    transform:
        rotate(0deg)
        translateY(-6px)
        scale(1.015) !important;

    z-index: 10;
}

.memory-photo.selected .memory-caption {
    color: var(--primary) !important;
    transform: translateY(-1px);
    font-weight: 600;
}

.memory-photo.selected:hover {
    animation: none !important;

    transform:
        rotate(0deg)
        translateY(-6px)
        scale(1.015) !important;

    z-index: 10;
}

/* =========================
   SMOOTH PHOTO SELECTION
========================= */

.memory-photo {
    transition:
        transform .55s cubic-bezier(.22,.61,.36,1),
        box-shadow .55s ease,
        opacity .35s ease !important;
    will-change: transform;
}

.memory-photo.selected {
    animation: none !important;
    opacity: 1 !important;

    transform:
        rotate(0deg)
        translateY(-6px)
        scale(1.015) !important;

    transition:
        transform .55s cubic-bezier(.22,.61,.36,1),
        box-shadow .55s ease !important;

    z-index: 10;
}

.memory-photo.selected:hover {
    animation: none !important;

    transform:
        rotate(0deg)
        translateY(-6px)
        scale(1.015) !important;
}

.memory-photo.selected .memory-caption {
    transition:
        color .4s ease,
        transform .4s ease !important;

    color: var(--primary) !important;
    transform: translateY(-1px);
    font-weight: 600;
}

/* =========================================
   ULTRA SMOOTH PHOTO SELECTION
   No re-animation when changing photos
========================================= */

.memory-photo {
    transition:
        transform 650ms cubic-bezier(.22, .61, .36, 1),
        box-shadow 650ms cubic-bezier(.22, .61, .36, 1),
        opacity 350ms ease !important;

    will-change: transform;
}

/* Once the gallery has finished its initial reveal,
   photos become stable and no animation is restarted. */

.memory-grid.memory-ready .memory-photo {
    animation: none !important;
    opacity: 1 !important;

    transform:
        rotate(var(--rotation))
        translateY(0)
        scale(1) !important;
}

/* Selected photo */

.memory-grid.memory-ready .memory-photo.selected {
    animation: none !important;

    transform:
        rotate(0deg)
        translateY(-7px)
        scale(1.018) !important;

    box-shadow:
        0 22px 48px rgba(90, 50, 65, .20);

    z-index: 10;
}

/* Keep selected state stable while touching/hovering */

.memory-grid.memory-ready .memory-photo.selected:hover {
    animation: none !important;

    transform:
        rotate(0deg)
        translateY(-7px)
        scale(1.018) !important;
}

/* Smooth caption change */

.memory-grid.memory-ready .memory-caption {
    transition:
        color 450ms ease,
        transform 450ms cubic-bezier(.22, .61, .36, 1),
        font-weight 250ms ease !important;
}

.memory-grid.memory-ready .memory-photo.selected .memory-caption {
    color: var(--primary) !important;
    transform: translateY(-1px);
    font-weight: 600;
}

/* =========================================
   PREMIUM PHOTO POLISH
========================================= */

.memory-photo {
    transition:
        transform 700ms cubic-bezier(.22,.61,.36,1),
        box-shadow 700ms cubic-bezier(.22,.61,.36,1),
        opacity 350ms ease !important;
}

.memory-grid.memory-ready .memory-photo.selected {
    box-shadow:
        0 22px 48px rgba(90,50,65,.18),
        0 0 24px rgba(255,150,190,.16) !important;
}

.memory-grid.memory-ready .memory-caption {
    transition:
        color 500ms ease,
        transform 500ms cubic-bezier(.22,.61,.36,1),
        opacity 500ms ease !important;
}

.memory-grid.memory-ready .memory-photo.selected .memory-caption {
    color: var(--primary) !important;
    transform: translateY(-2px);
    opacity: 1;
}

/* =========================================
   SECRET ENVELOPE REVEAL
========================================= */

.secret-reveal {
    text-align: center;
    margin: 30px auto 10px;
    max-width: 520px;
}

.secret-envelope {
    width: 110px;
    height: 78px;
    margin: 0 auto 24px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
}

.secret-envelope .envelope-body {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg,#fff7fa,#ffe5ee);
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(90,50,65,.14);
    overflow: hidden;
}

.secret-envelope .envelope-body::before,
.secret-envelope .envelope-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

.secret-envelope .envelope-body::before {
    left: 0;
    border-width: 0 55px 42px 0;
    border-color: transparent #f7d4df transparent transparent;
}

.secret-envelope .envelope-body::after {
    right: 0;
    border-width: 42px 55px 0 0;
    border-color: #f2ccd9 transparent transparent transparent;
}

.secret-envelope .envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 55px solid transparent;
    border-right: 55px solid transparent;
    border-top: 42px solid #f8dce6;
    transform-origin: top center;
    transition: transform 850ms cubic-bezier(.22,.61,.36,1);
    z-index: 3;
}

.secret-envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

.secret-envelope .envelope-heart {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-45%);
    font-size: 22px;
    z-index: 4;
    transition: opacity .4s ease, transform .5s ease;
}

.secret-envelope.open .envelope-heart {
    opacity: 0;
    transform: translate(-50%,-65%) scale(.8);
}

.secret-letter {
    opacity: 0;
    transform: translateY(15px);
    transition:
        opacity 900ms ease,
        transform 900ms cubic-bezier(.22,.61,.36,1);
    pointer-events: none;
}

.secret-letter.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.secret-letter p {
    font-family: "Caveat", cursive;
    font-size: clamp(1.35rem, 4vw, 1.8rem);
    line-height: 1.55;
    color: var(--text);
    margin: 0;
}

/* =========================================
   LIGHTWEIGHT AMBIENT EFFECTS
========================================= */

.ambient-particle {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    font-size: 10px;
    opacity: 0;
    animation: ambientFloat 6s ease-in-out forwards;
}

@keyframes ambientFloat {
    0% {
        opacity: 0;
        transform: translate3d(0,12px,0) scale(.8);
    }
    20% {
        opacity: .28;
    }
    80% {
        opacity: .16;
    }
    100% {
        opacity: 0;
        transform: translate3d(0,-70px,0) scale(1.05);
    }
}

.ambient-sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    font-size: 9px;
    opacity: 0;
    animation: sparkleFade 1.8s ease forwards;
}

@keyframes sparkleFade {
    0% { opacity: 0; transform: scale(.5); }
    35% { opacity: .35; transform: scale(1); }
    100% { opacity: 0; transform: scale(.7); }
}

/* =========================================
   LETTER GRADUAL REVEAL
========================================= */

.letter-reveal-line {
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 900ms ease,
        transform 900ms cubic-bezier(.22,.61,.36,1);
}

.letter-reveal-line.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   SECRET EASTER EGG
========================================= */

.secret-easter-egg {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(255,245,248,.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 700ms ease;
}

.secret-easter-egg.show {
    opacity: 1;
    pointer-events: auto;
}

.secret-easter-content {
    max-width: 440px;
    text-align: center;
    transform: translateY(15px);
    transition: transform 800ms cubic-bezier(.22,.61,.36,1);
}

.secret-easter-egg.show .secret-easter-content {
    transform: translateY(0);
}

.secret-easter-content .secret-small {
    font-size: .75rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    opacity: .55;
    margin-bottom: 16px;
}

.secret-easter-content h3 {
    font-family: "Caveat", cursive;
    font-size: clamp(2rem,8vw,3rem);
    margin: 0 0 15px;
}

.secret-easter-content p {
    line-height: 1.7;
}

/* =========================================
   FINAL MOMENT POLISH
========================================= */

.final-heart {
    display: inline-block;
    opacity: 0;
    transform: scale(.7);
    transition:
        opacity 1000ms ease,
        transform 1000ms cubic-bezier(.22,.61,.36,1);
}

.final-heart.visible {
    opacity: 1;
    transform: scale(1);
}

/* =========================================
   FINAL CLEAN UPGRADE OVERRIDES
========================================= */

/* ---------- PHOTO ---------- */

.memory-photo {
    transition:
        transform 700ms cubic-bezier(.22,.61,.36,1),
        box-shadow 700ms cubic-bezier(.22,.61,.36,1) !important;
}

.memory-grid.memory-ready .memory-photo {
    animation: none !important;
    opacity: 1 !important;
    transform:
        rotate(var(--rotation))
        translateY(0)
        scale(1) !important;
}

.memory-grid.memory-ready .memory-photo.selected {
    transform:
        rotate(0deg)
        translateY(-7px)
        scale(1.018) !important;

    box-shadow:
        0 22px 48px rgba(90,50,65,.18),
        0 0 25px rgba(255,150,190,.16) !important;

    z-index: 10;
}

.memory-grid.memory-ready
.memory-photo.selected:hover {
    transform:
        rotate(0deg)
        translateY(-7px)
        scale(1.018) !important;
}

.memory-grid.memory-ready .memory-caption {
    transition:
        color 500ms ease,
        transform 500ms cubic-bezier(.22,.61,.36,1) !important;
}

.memory-grid.memory-ready
.memory-photo.selected
.memory-caption {
    color: var(--primary) !important;
    transform: translateY(-2px);
}


/* ---------- ENVELOPE ---------- */

#secretReveal {
    margin: 30px auto 20px;
    text-align: center;
}

.secret-envelope {
    width: 120px;
    height: 84px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
}

.secret-envelope .envelope-body {
    position: absolute;
    inset: 0;
    display: block;
    background:
        linear-gradient(145deg,#fff8fb,#ffe3ed);
    border-radius: 9px;
    box-shadow:
        0 16px 40px rgba(90,50,65,.16);
    overflow: hidden;
}

.secret-envelope .envelope-body::before,
.secret-envelope .envelope-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

.secret-envelope .envelope-body::before {
    left: 0;
    border-width: 0 60px 45px 0;
    border-color:
        transparent #f5d1dd transparent transparent;
}

.secret-envelope .envelope-body::after {
    right: 0;
    border-width: 45px 60px 0 0;
    border-color:
        #f0cbd8 transparent transparent transparent;
}

.secret-envelope .envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-top: 45px solid #f8dbe5;
    transform-origin: top center;
    transition:
        transform 850ms cubic-bezier(.22,.61,.36,1);
    z-index: 3;
}

.secret-envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

.secret-envelope .envelope-heart {
    position: absolute;
    left: 50%;
    top: 52%;
    transform:
        translate(-50%,-50%);
    font-size: 24px;
    z-index: 4;
    transition:
        opacity 450ms ease,
        transform 550ms ease;
}

.secret-envelope.open .envelope-heart {
    opacity: 0;
    transform:
        translate(-50%,-50%)
        scale(.7);
}

.envelope-hint {
    margin-top: 16px;
    color: #a9939c;
    font-size: 11px;
    letter-spacing: .5px;
}


/* ---------- FINAL MESSAGE ---------- */

.final-content-hidden {
    opacity: 0;
    transform: translateY(18px);
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
        opacity 900ms ease,
        transform 900ms cubic-bezier(.22,.61,.36,1),
        max-height 900ms ease;
}

.final-content-visible {
    opacity: 1;
    transform: translateY(0);
    max-height: 10000px;
    pointer-events: auto;
}

.final-content-visible h2 {
    animation:
        finalTitleReveal 900ms
        cubic-bezier(.22,.61,.36,1);
}

@keyframes finalTitleReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ---------- LETTER ---------- */

.letter-text {
    transition:
        opacity 800ms ease,
        transform 800ms cubic-bezier(.22,.61,.36,1);
}

.letter-text.letter-reveal-line {
    opacity: 0;
    transform: translateY(12px);
}

.letter-text.letter-reveal-line.letter-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ---------- EASTER EGG ---------- */

.secret-easter-egg {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background:
        rgba(255,245,248,.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 600ms ease;
}

.secret-easter-egg.show {
    opacity: 1;
    pointer-events: auto;
}

.secret-easter-content {
    max-width: 440px;
    text-align: center;
    transform: translateY(15px);
    transition:
        transform 700ms cubic-bezier(.22,.61,.36,1);
}

.secret-easter-egg.show
.secret-easter-content {
    transform: translateY(0);
}

.secret-small {
    color: var(--primary);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.secret-easter-content h3 {
    margin: 0 0 15px;
    font-family: 'Caveat', cursive;
    font-size: clamp(28px,7vw,42px);
    font-weight: 400;
    line-height: 1.2;
}

.secret-easter-content p {
    color: #806a73;
    line-height: 1.8;
}


/* ---------- AMBIENT ---------- */

.ambient-particle {
    position: fixed;
    pointer-events: none;
    z-index: 1;
    color: var(--primary);
    font-size: 11px;
    opacity: 0;
    animation:
        ambientFloat 6s ease-in-out forwards;
}

@keyframes ambientFloat {

    0% {
        opacity: 0;
        transform:
            translate3d(0,15px,0)
            scale(.8);
    }

    20% {
        opacity: .20;
    }

    80% {
        opacity: .10;
    }

    100% {
        opacity: 0;
        transform:
            translate3d(0,-65px,0)
            scale(1);
    }
}

.ambient-sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 1;
    color: var(--secondary);
    font-size: 9px;
    opacity: 0;
    animation:
        sparkleFade 1.8s ease forwards;
}

@keyframes sparkleFade {

    0% {
        opacity: 0;
        transform: scale(.5);
    }

    35% {
        opacity: .35;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(.7);
    }
}


/* ---------- FINAL HEART ---------- */

.final-heart {
    display: inline-block;
    opacity: 0;
    transform: scale(.7);
    transition:
        opacity 900ms ease,
        transform 900ms cubic-bezier(.22,.61,.36,1);
}

.final-heart.visible {
    opacity: 1;
    transform: scale(1);
}


/* ---------- MOBILE ---------- */

@media (max-width: 600px) {

    .secret-envelope {
        width: 110px;
        height: 78px;
    }

    .secret-envelope .envelope-flap {
        border-left-width: 55px;
        border-right-width: 55px;
        border-top-width: 42px;
    }

    .secret-envelope .envelope-body::before {
        border-width: 0 55px 42px 0;
    }

    .secret-envelope .envelope-body::after {
        border-width: 42px 55px 0 0;
    }
}


/* FINAL POLISH - PHOTO GLOW + LETTER REVEAL */

/* Stronger but still soft selected-photo glow */
.memory-photo.selected {
    box-shadow:
        0 22px 48px rgba(90, 50, 65, .18),
        0 0 0 1px rgba(255, 111, 159, .18),
        0 0 28px rgba(255, 111, 159, .22),
        0 0 55px rgba(255, 180, 205, .10) !important;
}

/* Soft one-by-one letter reveal */
.letter-text.letter-reveal-line {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(4px);
    transition:
        opacity .9s ease,
        transform .9s cubic-bezier(.22, 1, .36, 1),
        filter .9s ease;
}

.letter-text.letter-reveal-line.letter-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* Keep the final handwritten paragraph feeling soft */
.letter-text.soft.letter-reveal-line.letter-visible {
    transform: translateY(0);
}



/* FINAL EASTER EGG + PHOTO GLOW FIX */

/* ---------------------------------
   SECRET EASTER EGG OVERLAY
--------------------------------- */

.secret-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        radial-gradient(
            circle at center,
            rgba(255, 220, 235, .88),
            rgba(245, 225, 245, .96)
        );

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity .35s ease,
        visibility .35s ease;
}

.secret-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.secret-box {
    width: min(90vw, 420px);
    padding: 38px 28px;

    text-align: center;

    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 28px;

    box-shadow:
        0 25px 70px rgba(100, 50, 80, .18),
        0 0 35px rgba(255, 140, 185, .20);

    transform: translateY(18px) scale(.96);
    transition: transform .4s cubic-bezier(.22, 1, .36, 1);
}

.secret-overlay.show .secret-box {
    transform: translateY(0) scale(1);
}

.secret-sparkle {
    font-size: 30px;
    margin-bottom: 10px;
}

.secret-box h3 {
    margin: 0 0 14px;
    font-family: "DM Serif Display", serif;
    font-size: 30px;
}

.secret-box p {
    margin: 0 auto 18px;
    max-width: 330px;
    line-height: 1.7;
    color: #6f5c67;
}

.secret-box span {
    font-family: "Caveat", cursive;
    font-size: 22px;
    color: var(--primary);
}


/* ---------------------------------
   PHOTO SELECTED GLOW
--------------------------------- */

.memory-photo.selected {
    box-shadow:
        0 22px 48px rgba(90, 50, 65, .20),
        0 0 0 1px rgba(255, 105, 160, .28),
        0 0 25px rgba(255, 105, 160, .30),
        0 0 50px rgba(255, 170, 200, .16) !important;
}

/* Visible soft pink glow around selected photo */
.memory-photo.selected::after {
    content: "";
    position: absolute;
    inset: -5px;

    border-radius: 9px;
    border: 1px solid rgba(255, 105, 160, .22);

    box-shadow:
        0 0 22px rgba(255, 105, 160, .22),
        0 0 42px rgba(255, 170, 200, .12);

    pointer-events: none;
    z-index: -1;
}


/* ---------------------------------
   MR. ATTITUDE = SECRET TAP TARGET
--------------------------------- */

.signature span {
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}


/* Message-only font experiment */
#finalMessage {
    font-family: Georgia, "Times New Roman", serif;
}

