/* Custom styles for Laura & Gerard Wedding */

/* Alpine.js cloak - hide elements until Alpine initializes */
[x-cloak] {
    display: none !important;
}

/* Base styles */
body {
    font-family: "Montserrat", sans-serif;
    scroll-behavior: smooth;
    background-color: #fffef8; /* Cream background */
    color: #4a5568;
}

.font-hand {
    font-family: "Caveat", cursive;
}

/* Playful Hero */
.hero-gradient {
    background: #fffef8;
    position: relative;
}

/* Hero Slideshow */
.hero-slideshow {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: heroFade 70s infinite;
}

.hero-slide img,
.hero-slide.hero-slide-img,
img.hero-slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Stagger each slide: 10s visible, fade over ~1s */
.hero-slide:nth-child(1) {
    animation-delay: 0s;
}
.hero-slide:nth-child(2) {
    animation-delay: 10s;
}
.hero-slide:nth-child(3) {
    animation-delay: 20s;
}
.hero-slide:nth-child(4) {
    animation-delay: 30s;
}
.hero-slide:nth-child(5) {
    animation-delay: 40s;
}
.hero-slide:nth-child(6) {
    animation-delay: 50s;
}
.hero-slide:nth-child(7) {
    animation-delay: 60s;
}

@keyframes heroFade {
    0% {
        opacity: 0;
    }
    1.43% {
        opacity: 1;
    }
    14.29% {
        opacity: 1;
    }
    15.71% {
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

.hero-blob {
    position: absolute;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
}

/* Glass morphism navigation */
.glass-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Playful Card styles */
.card-shadow {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(0, 0, 0, 0.05);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        opacity 0.3s ease;
    background: white;
    border-radius: 24px;
}

.card-shadow:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
}

/* Glass Card variant for colored backgrounds */
.card-glass {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 24px;
}

.card-glass:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

/* Animations */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float 8s ease-in-out infinite;
    animation-delay: 2s;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #fffef8;
}

::-webkit-scrollbar-thumb {
    background: #e8837c;
    border-radius: 5px;
    border: 2px solid #fffef8;
}

::-webkit-scrollbar-thumb:hover {
    background: #e5793b;
}

/* Selection color */
::selection {
    background: rgba(232, 131, 124, 0.2);
    color: inherit;
}

/* Mobile menu transition */
#mobile-menu {
    transition: max-height 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-gradient {
        background-attachment: scroll;
    }
}

/* Colored section hover effect - makes colored sections appear to float */
.section-colored {
    position: relative;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Easter Egg: Ampersand to Heart */
#ampersand-easter-egg {
    transition:
        transform 0.3s ease,
        color 0.3s ease;
}

#ampersand-easter-egg.heart-mode {
    animation: heartPulse 0.6s ease-out;
}

@keyframes heartPulse {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.4);
    }
    50% {
        transform: scale(1.2);
    }
    70% {
        transform: scale(1.35);
    }
    100% {
        transform: scale(1.1);
    }
}

/* Confetti particle styles */
.confetti-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 3s ease-out forwards;
}

.confetti-particle.circle {
    border-radius: 50%;
}

.confetti-particle.square {
    border-radius: 2px;
}

.confetti-particle.heart::before {
    content: "❤";
    font-size: 12px;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) rotate(720deg) scale(0.5);
    }
}

/* Print styles */
@media print {
    nav,
    #countdown,
    .faq-question {
        display: none;
    }

    .card-shadow {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Place Card Modal - body scroll lock handled by Alpine */
body.place-modal-open {
    overflow: hidden;
}

/* ===== RSVP Envelope Styles ===== */

.envelope-overlay {
    position: absolute;
    /* 20px larger on each side than the card */
    inset: -20px;
    z-index: 20;
    perspective: 1000px;
    pointer-events: none;
    overflow: visible;
}

.envelope-overlay > * {
    pointer-events: auto;
}

.envelope-body {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #faf6ec 0%, #f0ebdb 100%);
    border-radius: 0;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.08);
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, #f5efe0 0%, #e8e0cc 100%);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    transform-origin: top center;
    transform-style: preserve-3d;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wax-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease;
}

.wax-seal i {
    width: 64px;
    height: 64px;
    background: radial-gradient(
        circle at 35% 35%,
        #f2978f 0%,
        #e8837c 60%,
        #d46b63 100%
    );
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.25),
        0 3px 8px rgba(0, 0, 0, 0.25);
    animation: sealPulse 2s ease-in-out infinite;
    transition: transform 0.2s ease;
}

.wax-seal-text {
    font-family: "Caveat", cursive;
    font-size: 1.5rem;
    color: #5a5247;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.wax-seal:hover i {
    transform: scale(1.08);
    animation: none;
}

.wax-seal:focus {
    outline: 3px solid rgba(232, 131, 124, 0.5);
    outline-offset: 4px;
}

/* Seal pulse animation - draws attention to click */
@keyframes sealPulse {
    0%,
    100% {
        box-shadow:
            inset 0 2px 4px rgba(255, 255, 255, 0.25),
            0 3px 6px rgba(0, 0, 0, 0.15),
            0 0 0 0 rgba(232, 131, 124, 0.4);
    }
    50% {
        box-shadow:
            inset 0 2px 4px rgba(255, 255, 255, 0.25),
            0 3px 6px rgba(0, 0, 0, 0.15),
            0 0 0 10px rgba(232, 131, 124, 0);
    }
}

/* ===== Envelope Opening Animation ===== */

.envelope-opening .wax-seal {
    animation: sealBreak 0.3s ease-out forwards;
}

.envelope-opening .envelope-flap {
    animation: flapOpen 0.6s ease-in-out forwards;
}

.envelope-opening .envelope-body {
    animation: envelopeFade 0.4s ease-out 0.5s forwards;
}

.envelope-opening .envelope-flap {
    animation:
        flapOpen 0.6s ease-in-out forwards,
        flapFade 0.3s ease-out 0.6s forwards;
}

@keyframes sealBreak {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.15);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 0;
    }
}

@keyframes flapOpen {
    0% {
        transform: rotateX(0deg);
    }
    100% {
        transform: rotateX(170deg);
    }
}

@keyframes flapFade {
    0% {
        opacity: 1;
        transform: rotateX(170deg) translateY(0);
    }
    100% {
        opacity: 0;
        transform: rotateX(170deg) translateY(-30px);
    }
}

@keyframes envelopeFade {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* ===== Envelope Responsive Adjustments ===== */

@media (max-width: 640px) {
    .envelope-overlay {
        /* Fit within screen with proportional envelope aspect ratio */
        position: absolute;
        inset: auto;
        top: -16px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% + 32px);
        aspect-ratio: 4 / 3;
    }

    .wax-seal i {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    .wax-seal-text {
        font-size: 1.1rem;
    }
}

/* ===== RSVP Card Collapse Animation (mobile) ===== */

@media (max-width: 640px) {
    .rsvp-card-collapsed {
        max-height: 280px;
        overflow: hidden;
        opacity: 0;
    }

    #rsvp {
        transition: 
            max-height 0.5s ease-out 0.4s, 
            opacity 0.4s ease-out 0.5s,
            transform 0.3s ease,
            box-shadow 0.3s ease;
    }
}

/* ===== Floral Decorations ===== */

/* Base flower decoration positioning */
.flower-decoration {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    opacity: 0.7;
}

/* Title flanking positions - left cluster (mobile-first) */
.flower-left {
    left: -35px;
    top: 50%;
    transform: translateY(-50%) rotate(-15deg);
    width: 30px;
    height: auto;
}

/* Title flanking positions - right cluster (mobile-first) */
.flower-right {
    right: -35px;
    top: 50%;
    transform: translateY(-50%) rotate(15deg);
    width: 30px;
    height: auto;
}

/* Divider flower styling */
.flower-divider {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

/* Responsive adjustments for flowers - tablet */
@media (min-width: 640px) {
    .flower-left {
        left: -50px;
        width: 45px;
    }
    
    .flower-right {
        right: -50px;
        width: 45px;
    }
    
    .flower-divider {
        width: 24px;
        height: 24px;
    }
}

/* Responsive adjustments for flowers - desktop */
@media (min-width: 768px) {
    .flower-left {
        left: -80px;
        width: 70px;
    }
    
    .flower-right {
        right: -80px;
        width: 70px;
    }
}

@media (min-width: 1024px) {
    .flower-left {
        left: -100px;
        width: 80px;
    }
    
    .flower-right {
        right: -100px;
        width: 80px;
    }
}
