/* Animated gradient background */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes gradient-colors {
    0% { background-image: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe); }
    25% { background-image: linear-gradient(-45deg, #764ba2, #f093fb, #fcad22, #667eea); }
    50% { background-image: linear-gradient(-45deg, #f093fb, #fcad22, #f89c1a, #764ba2); }
    75% { background-image: linear-gradient(-45deg, #fcad22, #667eea, #4facfe, #f093fb); }
    100% { background-image: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe); }
}

.animated-bg {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite, gradient-colors 15s ease infinite;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    min-height: 100vh;
    animation: gradient-shift 15s ease infinite, gradient-colors 15s ease infinite;
    position: relative;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(240, 147, 251, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 90% 30%, rgba(252, 173, 34, 0.2) 0%, transparent 50%);
    filter: blur(60px);
    opacity: 0.8;
    pointer-events: none;
    z-index: 0;
    animation: blob-movement 20s ease-in-out infinite;
}

@keyframes blob-movement {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(5%, -5%) scale(1.1); }
    50% { transform: translate(-5%, 5%) scale(0.9); }
    75% { transform: translate(5%, 5%) scale(1.05); }
}

* {
    -webkit-overflow-scrolling: touch;
}

/* Fade in animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.fade-in-up-delay-1 {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.fade-in-up-delay-2 {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.fade-in-up-delay-3 {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.fade-in-up-delay-4 {
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

/* Particle effect container */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: particle-float 20s infinite;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5), 0 0 12px rgba(255, 255, 255, 0.3);
}

/* Different particle sizes for variety */
.particle:nth-child(3n) {
    width: 3px;
    height: 3px;
}
.particle:nth-child(5n) {
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.9);
}
.particle:nth-child(7n) {
    width: 2px;
    height: 2px;
    background: rgba(252, 173, 34, 0.6);
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: translateY(90vh) translateX(10px) scale(1);
    }
    50% {
        opacity: 0.8;
    }
    95% {
        opacity: 1;
        transform: translateY(10vh) translateX(80px) scale(1);
    }
    100% {
        transform: translateY(-10vh) translateX(100px) scale(0);
        opacity: 0;
    }
}

/* Twinkle effect for some particles */
@keyframes particle-twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.particle:nth-child(4n) {
    animation: particle-float 20s infinite, particle-twinkle 2s ease-in-out infinite;
}

/* Navigation bar scroll effect */
#navbar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#navbar.scrolled {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border-bottom-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Navigation link underline effect */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Pulse glow animation - enhanced */
@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4), 0 0 40px rgba(102, 126, 234, 0.2);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(118, 75, 162, 0.6), 0 0 60px rgba(118, 75, 162, 0.3);
        transform: scale(1.02);
    }
}

.pulse-glow {
    animation: pulse-glow 2.5s ease-in-out infinite;
    transition: all 0.3s ease;
}

.pulse-glow:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 0 40px rgba(118, 75, 162, 0.8), 0 0 80px rgba(102, 126, 234, 0.4) !important;
}

/* Shimmer effect - glance/twinkle sweep */
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0.1) 75%,
        transparent 100%
    );
    animation: shimmer 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* CTA Button styles */
.cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* Feature card hover effect */
.feature-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.4);
}

.feature-card svg {
    transition: all 0.3s ease;
}

.feature-card:hover svg {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.6));
}

/* Section entrance animation */
@keyframes section-entrance {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.section-entrance {
    animation: section-entrance 1s ease-out;
}

/* Section spacing */
.section {
    padding: 80px 0;
}

/* Animated Hamburger Icon */
.hamburger-icon {
    width: 24px;
    height: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-line {
    width: 100%;
    height: 2.5px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

#mobileMenuToggle.active .hamburger-line:first-child {
    transform: translateY(5.75px) rotate(45deg);
}

#mobileMenuToggle.active .hamburger-line:last-child {
    transform: translateY(-5.75px) rotate(-45deg);
}

/* Mobile Menu - Animated slide-down + fade */
#mobileMenu {
    max-height: 80vh;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out;
}

#mobileMenu.mobile-menu-hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out;
}

/* Staggered fade-in for menu items */
@keyframes menuItemFadeIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

#mobileMenu:not(.mobile-menu-hidden) .mobile-menu-item {
    animation: menuItemFadeIn 0.3s ease-out forwards;
}

#mobileMenu.mobile-menu-hidden .mobile-menu-item {
    opacity: 0;
}

/* Blur overlay when mobile menu is open */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
    z-index: 30;
}

body.menu-open::before {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .section {
        padding: 30px 0;
    }
    
    h1 {
        font-size: 2.5rem !important;
    }
    
    h2 {
        font-size: 2rem !important;
    }
    
    h3 {
        font-size: 1.75rem !important;
    }
    
    .feature-card {
        padding: 1rem !important;
    }
    
    .feature-card svg {
        width: 3rem !important;
        height: 3rem !important;
    }
    
    .cta-button {
        width: 100%;
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important;
    }
    
    #particles {
        display: none; /* Hide particles on mobile for performance */
    }
    
    .min-h-screen {
        min-height: auto !important;
        padding-top: 4rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-12, .mb-16 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Mobile navbar improvements */
    #navbar {
        backdrop-filter: blur(20px);
        background: rgba(0, 0, 0, 0.4) !important;
    }
    
    /* Better mobile button spacing */
    #navbar .flex.items-center {
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .section {
        padding: 20px 0;
    }
    
    .px-4 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .min-h-screen {
        padding-top: 3rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Amelia & Tobias sections – responsive image/video */
#amelia img,
#tobias video {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    #amelia .rounded-3xl,
    #tobias .rounded-3xl {
        padding: 1.5rem 1rem;
    }
    
    #amelia img {
        width: 12rem;
        height: 12rem;
        min-width: 12rem;
        min-height: 12rem;
    }
    
    #tobias .aspect-\[9\/16\] {
        max-width: 16rem;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 640px) {
    #amelia img {
        width: 10rem;
        height: 10rem;
        min-width: 10rem;
        min-height: 10rem;
    }
    
    #tobias .aspect-\[9\/16\] {
        max-width: 14rem;
    }
}

/* Walkthrough section – responsive list & form */
#walkthrough-app .space-y-4 > div {
    padding: 1rem;
}

@media (max-width: 640px) {
    #walkthrough-app .rounded-2xl {
        padding: 1rem !important;
    }
    
    #walkthrough-app button.walkthrough-select-event,
    #walkthrough-app #walkthrough-submit-btn,
    #walkthrough-app .walkthrough-back {
        width: 100%;
        min-height: 2.75rem;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    #walkthrough-app input,
    #walkthrough-app textarea {
        min-height: 2.75rem;
        font-size: 16px; /* avoids zoom on focus on iOS */
    }
    
    #walkthrough-app textarea {
        min-height: 4rem;
    }
    
    #walkthrough-app .flex.flex-wrap.gap-4 {
        gap: 0.75rem;
    }
    
    #walkthrough-app .walkthrough-back {
        display: inline-block;
        margin-bottom: 0.5rem;
    }
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
    border-radius: 4px;
}
