/* Mobile-first base styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: #fcfcfc;
    color: #333;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* Loading Screen Styles */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #cda2eb; /* Beautiful pastel purple background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out;
}

.loading-text {
    color: white;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    text-align: center;
    padding: 0 20px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease-in-out;
}

.loading-bar-wrapper {
    width: 75%;
    max-width: 280px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    position: relative;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background-color: #8b31c9; /* Darker purple */
    border-radius: 10px;
    position: relative;
    animation: 
        loadBar 5s ease-in-out forwards, 
        pulsateGlow 1.2s infinite alternate;
}

.loading-heart {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    fill: white;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
    animation: heartBeat 0.7s infinite alternate;
}

/* Gift Wrap Styles */
#main-content {
    width: 100%;
    height: 100vh;
}

.gift-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #fcfcfc;
    /* Added perspective for 3D realism */
    perspective: 1200px; 
}

.gift-half {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: #ffb7b2;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.2) 0px,
        rgba(255,255,255,0.2) 20px,
        transparent 20px,
        transparent 40px
    );
    transition: transform 0.4s ease, opacity 0.8s ease;
}

.left-half {
    left: 0;
    transform-origin: left center;
    border-right: 2px solid #e08c8a; /* depth line */
    /* 3D Inner shadow for realistic overlapping/volume */
    box-shadow: inset -15px 0 25px rgba(0,0,0,0.1), 5px 0 15px rgba(0,0,0,0.2);
    z-index: 12;
}

.right-half {
    right: 0;
    transform-origin: right center;
    border-left: 2px solid #e08c8a;
    box-shadow: inset 15px 0 25px rgba(0,0,0,0.1);
    z-index: 11;
}

.gift-bow {
    font-size: 6rem;
    z-index: 20;
    cursor: pointer;
    /* Deep shadow to pop it out in 3D */
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.4));
    transition: transform 0.3s ease, opacity 0.5s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tap-text {
    position: absolute;
    bottom: 20%;
    z-index: 20;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    background-color: rgba(0, 0, 0, 0.25);
    padding: 12px 24px;
    border-radius: 30px;
    pointer-events: none;
    transition: opacity 0.4s ease;
    letter-spacing: 1px;
}

/* 3D Tearing Animation States */
/* Negative rotation curls the inner edge outward towards the viewer */
.gift-screen.tap-1 .left-half { transform: rotateY(-8deg); }
.gift-screen.tap-1 .right-half { transform: rotateY(8deg); }
.gift-screen.tap-1 .gift-bow { transform: scale(1.1); }

.gift-screen.tap-2 .left-half { transform: rotateY(-18deg); }
.gift-screen.tap-2 .right-half { transform: rotateY(18deg); }
.gift-screen.tap-2 .gift-bow { transform: scale(1.2) rotate(-5deg); }

.gift-screen.tap-3 .left-half { transform: rotateY(-30deg); }
.gift-screen.tap-3 .right-half { transform: rotateY(30deg); }
.gift-screen.tap-3 .gift-bow { transform: scale(1.3) rotate(5deg); }

.gift-screen.torn .left-half { 
    transform: rotateY(-90deg) translateX(-50%); 
    opacity: 0; 
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1), opacity 1.2s ease;
}
.gift-screen.torn .right-half { 
    transform: rotateY(90deg) translateX(50%); 
    opacity: 0; 
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1), opacity 1.2s ease;
}
.gift-screen.torn .gift-bow,
.gift-screen.torn .tap-text {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Splash Screen */
.splash-screen {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
    position: relative;
    /* Darker pastel purple that glows slowly */
    animation: splashBgGlow 4s infinite alternate ease-in-out;
    transition: opacity 0.8s ease;
}

.splash-title {
    color: white;
    font-size: 2.8rem; /* Big text but fits on mobile */
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* Extra margin to ensure it doesn't touch the edges */
    margin: 0 10px;
}

.splash-cta {
    position: absolute;
    bottom: 40px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 1px;
    animation: fadeInOut 2s infinite alternate;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

@keyframes splashBgGlow {
    0% { background-color: #a875d1; box-shadow: inset 0 0 30px rgba(168, 117, 209, 0.4); }
    100% { background-color: #8f53c2; box-shadow: inset 0 0 80px rgba(143, 83, 194, 0.8); }
}

@keyframes fadeInOut {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Staggered Character Animation */
.stagger-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    animation: charPopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes charPopIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Actual Website Styles */
.actual-website {
    width: 100%;
    min-height: 100vh;
    background-color: #1a0b2e; /* Very, very dark purple */
    color: white;
    padding: 40px 20px;
    animation: fadeIn 1s ease-in;
    position: relative;
    overflow: hidden; /* Contains the background pattern */
}

/* Moving Hearts Background */
.bg-pattern {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    /* Heart SVG with lighter purple color #2d1847 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'%3E%3Cpath fill='%232d1847' d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
    background-size: 40px 40px; /* Reduced from 80px */
    z-index: 0;
    pointer-events: none;
    animation: moveHearts 20s linear infinite; /* Reduced from 40s to make it faster */
}

@keyframes moveHearts {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

.main-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1; /* Keep above background */
}

.main-content-area {
    position: relative;
    z-index: 1;
}

#greeting-text {
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: lowercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dividers & Layout */
.main-divider {
    border: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    margin: 10px 0 30px 0;
}

.sub-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
    margin: 10px 0 25px 0;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.9);
}

/* Carousel */
.carousel-container {
    width: 100%;
}

.carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 10px 5px 20px 5px; /* bottom padding for shadow room */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.carousel-card {
    width: 150px;
    height: 185px;
    background-color: #fdfbf7;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.carousel-card, .photo-card {
    flex: 0 0 auto;
    border-radius: 12px;
    scroll-snap-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.carousel-card:active, .photo-card:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Gift Cover layer that overlays all un-opened cards */
.gift-cover {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #fdfbf7;
    /* Switzerland-style red ribbon cross edge to edge */
    background-image: 
        linear-gradient(to right, transparent 40%, #e63946 40%, #e63946 60%, transparent 60%),
        linear-gradient(to bottom, transparent 40%, #e63946 40%, #e63946 60%, transparent 60%);
    border: 2px solid #ccc;
    box-sizing: border-box;
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

/* Revealed Content Layer */
.revealed-content {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: inherit;
    overflow: hidden;
    z-index: 1;
}

/* Text Card Preview inside Revealed Content */
.text-preview-content {
    background-color: #fdfbf7;
    padding: 15px;
    color: #666;
    font-size: 0.5rem; /* Tiny unreadable text to look like a postcard preview */
    line-height: 1.4;
    text-align: left;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

/* States */
.opened .gift-cover {
    opacity: 0;
    pointer-events: none;
}

.opened .revealed-content {
    opacity: 1;
}

.card-image-placeholder {
    font-size: 3.5rem;
    margin: 0;
    z-index: 2;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.3));
    /* Slight rotation for playful aesthetic */
    transform: rotate(-5deg);
}

.card-title {
    position: absolute;
    bottom: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #e63946; /* Match the ribbon */
    background-color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #e63946;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
    text-transform: lowercase;
}

/* Postcard Dialog Overlay */
.postcard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.postcard-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.postcard-dialog {
    width: 85%;
    max-width: 360px;
    background-color: #fdfbf7; /* Off-white paper color */
    color: #333;
    border-radius: 8px;
    padding: 30px 25px;
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    /* Subtle paper texture using repeating gradient */
    background-image: repeating-linear-gradient(transparent, transparent 24px, rgba(0,0,0,0.04) 25px);
    background-position: 0 5px;
}

.postcard-overlay.show .postcard-dialog {
    transform: translateY(0) scale(1);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.postcard-content {
    margin-top: 5px;
}

#postcard-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
    font-weight: 700;
    color: #1a0b2e;
    text-transform: lowercase;
}

#postcard-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #444;
    font-weight: 500;
}

/* Photo Cards Section */
.photo-card {
    width: 140px;
    height: 249px; /* 9:16 aspect ratio roughly */
    background-color: #111;
    border: 3px solid rgba(255, 255, 255, 0.15);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

/* Photo Dialog Overlay */
.photo-dialog {
    width: 90%;
    max-width: 400px;
    background-color: transparent;
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.photo-overlay.show .photo-dialog {
    transform: translateY(0) scale(1);
}

.photo-dialog img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
    padding: 10px 10px 40px 10px; /* Polaroid effect */
    background-color: #fdfbf7;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.photo-dialog .close-btn {
    position: absolute;
    top: -45px;
    right: 0;
    color: white;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    font-size: 2.5rem;
}


/* Animations */
@keyframes loadBar {
    0% { width: 0%; }
    15% { width: 10%; }
    30% { width: 35%; }
    55% { width: 60%; }
    75% { width: 85%; }
    100% { width: 100%; }
}

@keyframes pulsateGlow {
    0% {
        box-shadow: 0 0 6px #8b31c9, 0 0 10px #8b31c9;
        background-color: #8b31c9;
    }
    100% {
        box-shadow: 0 0 15px #ba66f5, 0 0 25px #ba66f5;
        background-color: #ba66f5;
    }
}

@keyframes heartBeat {
    0% { transform: translateY(-50%) scale(1); }
    100% { transform: translateY(-50%) scale(1.15); }
}

/* Utility classes */
.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}
