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

:root {
    --env-body: #f8f5f0;
    --env-flap: #e8ddd0;
    --env-liner: #d4c4a8;
    --card-bg: #ffffff;
    --card-shadow: rgba(139, 117, 95, 0.25);
    --btn-bg: linear-gradient(135deg, #d4a574 0%, #c19660 100%);
    --btn-text: #ffffff;
    --btn-shadow: rgba(196, 150, 96, 0.4);
    --text-primary: #3c3c3c;
    --text-secondary: #8b7563;
    --accent-gold: #d4a574;
    --bg-gradient: linear-gradient(135deg, #faf8f4 0%, #f5f1ea 100%);
}

/* Envelope Animation Container */
.animate-body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.invite-scene {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Floating particles background effect */
.invite-scene::before {
    content: '';
    position: absolute;
    top: -50vh;
    left: -50vw;
    right: -50vw;
    bottom: -50vh;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(212, 165, 116, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(212, 165, 116, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(212, 165, 116, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.invite-envelope {
    position: relative;
    width: 100%;
    aspect-ratio: 3/2;
    max-width: 380px;
    perspective: 1200px;
    cursor: pointer;
    transition: transform 0.3s ease;
    outline: none;
}

.invite-envelope:hover {
    transform: translateY(-2px);
}

/* Envelope body with enhanced styling */
.invite-envelope__body {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--env-body), #f0e8db);
    box-shadow:
        0 25px 50px -12px var(--card-shadow),
        0 0 0 1px rgba(212, 165, 116, 0.1);
    overflow: hidden;
}

/* Enhanced liner with subtle pattern */
.invite-envelope__liner {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, var(--env-liner) 0%, transparent 40%),
        radial-gradient(ellipse at top, rgba(212, 165, 116, 0.1) 0%, transparent 70%);
    opacity: 0.3;
}

/* Elegant flap with better shadow */
.invite-envelope__flap {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(145deg, var(--env-flap), #ddd0c0);
    transform-origin: 50% 0%;
    transform: rotateX(0deg);
    transition: transform 1s cubic-bezier(0.25, 0.8, 0.25, 1);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    box-shadow:
        0 15px 35px -5px var(--card-shadow),
        inset 0 -2px 4px rgba(212, 165, 116, 0.2);
    z-index: 3;
}

/* Decorative seal */
.invite-envelope__flap::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: var(--accent-gold);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.4);
    transition: transform 0.3s ease;
}

/* Enhanced card design */
.invite-card {
    position: absolute;
    left: 50%;
    top: 15%;
    transform: translate(-50%, 25px);
    width: 85%;
    border-radius: 16px;
    background: var(--card-bg);
    box-shadow:
        0 25px 60px -15px var(--card-shadow),
        0 0 0 1px rgba(212, 165, 116, 0.1);
    overflow: hidden;
    opacity: 0;
    transition:
        transform 0.9s 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity 0.7s 0.5s ease;
    z-index: 2;
}

.invite-card__content {
    padding: 24px;
    text-align: center;
}

.invite-card__img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 180px;
    max-height: 400px;
    object-fit: contain;
    object-position: center;
    background: linear-gradient(45deg, #f8f5f0, #f0e8db);
}

.invite-card__title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 8px;
    letter-spacing: 0.5px;
}

.invite-card__subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 300;
}

/* Enhanced button with premium styling */
.invite-card__cta {
    display: inline-block;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        0 8px 25px var(--btn-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.invite-card__cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.invite-card__cta:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 35px var(--btn-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.invite-card__cta:hover::before {
    left: 100%;
}

.invite-card__cta:active {
    transform: translateY(0);
}

/* Open state animations */
.invite-envelope.is-open .invite-envelope__flap {
    transform: rotateX(-185deg);
}

.invite-envelope.is-open .invite-envelope__flap::after {
    transform: translateX(-50%) scale(1.2);
}

.invite-envelope.is-open .invite-card {
    opacity: 1;
    transform: translate(-50%, -5px);
}

/* Interactive hint with pulse animation */
.invite-open-hint {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.4;
    }
}

/* Sparkle effects */
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-gold);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkleFloat 3s infinite ease-in-out;
}

.sparkle:nth-child(1) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.sparkle:nth-child(2) {
    top: 30%;
    right: 20%;
    animation-delay: 1s;
}

.sparkle:nth-child(3) {
    bottom: 25%;
    left: 25%;
    animation-delay: 2s;
}

@keyframes sparkleFloat {

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

    50% {
        opacity: 1;
        transform: translateY(-10px) scale(1);
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .animate-body {
        padding: 16px;
    }

    .invite-scene {
        gap: 16px;
    }

    .invite-card__content {
        padding: 20px;
    }

    .invite-card__title {
        font-size: 20px;
    }

    .invite-card__cta {
        font-size: 14px;
        padding: 14px 20px;
    }

    .invite-envelope {
        max-width: 320px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {

    .invite-envelope__flap,
    .invite-card,
    .sparkle,
    .invite-open-hint {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus states for accessibility */
.invite-envelope:focus-visible,
.invite-card__cta:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}