/* 3D Card Stack Carousel with Modern Design */
.gallery {
    position: relative;
    margin: 3rem auto;
    max-width: 900px;
    padding: 0 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
    background: transparent;
    border: none;
    box-shadow: none;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

.gallery.gallery-visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-container {
    position: relative;
    height: 400px;
    background: #1a1a1a;
    border-radius: 0;
    overflow: hidden; /* Changed from visible to hidden to prevent overflow */
    box-shadow: none;
    perspective: 1200px;
    perspective-origin: center center;
}

/* 3D slides container */
.gallery-slides {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    overflow: hidden; /* Prevent overflow in slides container */
}

/* Card wrapper for 3D positioning */
.card-wrapper {
    position: absolute;
    width: 450px;
    height: 320px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
    opacity: 1 !important; /* Force full opacity for all cards */
}

/* Individual gallery cards */
.gallery-card {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    background: transparent;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1 !important; /* Force full opacity for all cards */
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
    opacity: 1 !important; /* Force full opacity for all images */
}

.gallery-card img.loaded {
    opacity: 1 !important;
}

/* Active card styling */
.card-wrapper.active {
    z-index: 100;
    opacity: 1 !important;
}

.card-wrapper.active .gallery-card {
    box-shadow: none;
    transform: scale(1);
    opacity: 1 !important;
}

.card-wrapper.active .gallery-card img {
    transform: scale(1.05);
    opacity: 1 !important;
}

/* Hover effects */
.card-wrapper:hover .gallery-card {
    transform: translateY(-10px) scale(1.02);
    box-shadow: none;
    opacity: 1 !important;
}

.card-wrapper.active:hover .gallery-card {
    transform: translateY(-15px) scale(1.05);
    box-shadow: none;
    opacity: 1 !important;
}

/* Navigation buttons with modern design */
.gallery-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    pointer-events: none;
    z-index: 200;
}

.gallery-nav button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    font-size: 18px;
}

.gallery-nav button::before {
    content: '';
    width: 12px;
    height: 12px;
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
}

.gallery-nav .prev-btn::before {
    transform: rotate(135deg);
    margin-left: 4px;
}

.gallery-nav .next-btn::before {
    transform: rotate(-45deg);
    margin-right: 4px;
}

.gallery-nav button:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gallery-nav button:active {
    transform: scale(0.95);
}

/* Modern dots with progress indicators */
.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 2rem;
    padding: 0 2rem;
}

.dot-wrapper {
    position: relative;
}

.gallery-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    position: relative;
    overflow: hidden;
}

.gallery-dot::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid transparent;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
}

.gallery-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.3);
}

.gallery-dot.active {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

.gallery-dot.active::before {
    border-color: rgba(255, 255, 255, 0.6);
}

/* Card flip animation */
@keyframes cardFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.card-wrapper.flipping .gallery-card {
    animation: cardFlip 0.8s cubic-bezier(0.23, 1, 0.320, 1);
}

/* Loading placeholder */
.gallery-card::before {
    display: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .gallery {
        padding: 0 1rem;
        margin: 2rem auto;
        max-width: 100%;
    }
    
    .gallery-container {
        height: 300px;
    }
    
    .card-wrapper {
        width: 300px;
        height: 220px;
    }
    
    .gallery-nav {
        padding: 0 1rem;
    }
    
    .gallery-nav button {
        width: 48px;
        height: 48px;
    }
    
    .gallery-nav button::before {
        width: 10px;
        height: 10px;
        border-width: 2px;
    }
    
    .gallery-dots {
        gap: 12px;
        margin-top: 1.5rem;
    }
    
    .gallery-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .gallery {
        padding: 0 0.5rem;
        max-width: 100%;
    }
    
    .gallery-container {
        height: 250px;
    }
    
    .card-wrapper {
        width: 280px;
        height: 190px;
    }
    
    .gallery-nav button {
        width: 44px;
        height: 44px;
    }
    
    .gallery-nav button::before {
        width: 8px;
        height: 8px;
    }
    
    .gallery-dots {
        gap: 10px;
    }
    
    .gallery-dot {
        width: 8px;
        height: 8px;
    }
}

/* Focus states for accessibility */
.gallery-nav button:focus,
.gallery-dot:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .gallery,
    .card-wrapper,
    .gallery-card,
    .gallery-nav button,
    .gallery-dot {
        transition: none !important;
        animation: none !important;
    }
    
    .gallery-card img {
        transform: none !important;
    }
}

/* Performance optimizations */
.card-wrapper,
.gallery-card,
.gallery-nav button,
.gallery-dot {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .gallery-container {
        background: #1a1a1a;
        box-shadow: none;
    }
    
    .gallery-nav button {
        background: rgba(45, 55, 72, 0.9);
        color: #fff;
    }
    
    .gallery-nav button:hover {
        background: rgba(45, 55, 72, 1);
    }
} 