/* Remove global styles that might interfere with parent layouts */
.lenis-card-stack-container * {
    box-sizing: border-box;
}

.spacer-top,
.spacer-bottom {
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.lenis-card-stack-container {
    position: relative;
    width: 100%;
    /* Create enough height for scroll hijacking to work */
    height: calc(100vh + 200vh); /* Base viewport + scroll space for cards */
    min-height: 600px;
}

.lenis-card-stack {
    position: sticky;
    top: 0;
    /* Use container-relative height instead of viewport */
    height: 400px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.lenis-card {
    position: absolute;
    width: 100%;
    max-width: 100%;
    /* Use container-relative height instead of viewport */
    height: 320px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
}

.lenis-card-image {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.lenis-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.lenis-card-image:hover img {
    transform: scale(1.05);
}

.lenis-card-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    text-decoration: none;
}

.lenis-card-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.lenis-card-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 700;
    line-height: 1.2;
}

.lenis-card-text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #666;
}

/* Card stacking states */
.lenis-card[data-state="hidden-top"] {
    transform: translateY(-400px) scale(0.8);
    opacity: 0;
    z-index: 1;
}

.lenis-card[data-state="stacked-top"] {
    transform: translateY(-20px) scale(0.95);
    opacity: 0.7;
    z-index: 2;
}

.lenis-card[data-state="active"] {
    transform: translateY(0) scale(1);
    opacity: 1;
    z-index: 3;
}

.lenis-card[data-state="stacked-bottom"] {
    transform: translateY(20px) scale(0.95);
    opacity: 0.7;
    z-index: 2;
}

.lenis-card[data-state="hidden-bottom"] {
    transform: translateY(400px) scale(0.8);
    opacity: 0;
    z-index: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .lenis-card-stack-container {
        height: calc(100vh + 150vh); /* Reduced scroll space for mobile */
    }
    
    .lenis-card-stack {
        height: 350px;
    }
    
    .lenis-card {
        flex-direction: column;
        height: 280px;
        margin: 0 10px;
    }
    
    .lenis-card-content {
        padding: 20px;
    }
    
    .lenis-card-title {
        font-size: 2rem;
    }
    
    .lenis-card-text {
        font-size: 1rem;
    }
    
    /* Update hidden states for mobile */
    .lenis-card[data-state="hidden-top"] {
        transform: translateY(-350px) scale(0.8);
    }
    
    .lenis-card[data-state="hidden-bottom"] {
        transform: translateY(350px) scale(0.8);
    }
}

@media (max-width: 480px) {
    .lenis-card-stack-container {
        height: calc(100vh + 100vh); /* Further reduced for small mobile */
    }
    
    .lenis-card-stack {
        height: 300px;
    }
    
    .lenis-card {
        margin: 0 5px;
        height: 240px;
    }
    
    .lenis-card-content {
        padding: 15px;
    }
    
    .lenis-card-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .lenis-card-text {
        font-size: 0.9rem;
    }
    
    /* Update hidden states for small mobile */
    .lenis-card[data-state="hidden-top"] {
        transform: translateY(-300px) scale(0.8);
    }
    
    .lenis-card[data-state="hidden-bottom"] {
        transform: translateY(300px) scale(0.8);
    }
}

/* Loading animation */
.lenis-card {
    animation: cardLoad 0.8s ease-out;
}

@keyframes cardLoad {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}