/**
 * Gallery Carousel Component
 * Auto-scrolling carousel with optimized image display for beauty website
 */

/* Carousel Wrapper */
.gallery-carousel-wrapper {
    position: relative;
    padding: 0 3.5rem;
}

@media (max-width: 768px) {
    .gallery-carousel-wrapper {
        padding: 0 3rem;
    }
}

/* Carousel Container */
.gallery-carousel-container {
    overflow: hidden;
    position: relative;
}

/* Carousel Track */
.gallery-carousel-track {
    display: flex;
    gap: 2rem;
    transition: transform 0.5s ease;
    will-change: transform;
}

@media (max-width: 768px) {
    .gallery-carousel-track {
        gap: 1.5rem;
    }
}

/* Carousel Item - Responsive Sizing */
.gallery-carousel-item {
    flex: 0 0 100%;
    min-width: 0;
}

/* Mobile: 1 item (full width) */
@media (min-width: 640px) and (max-width: 1023px) {
    /* Tablet Portrait: 2 items */
    .gallery-carousel-item {
        flex: 0 0 calc(50% - 1rem);
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    /* Tablet Landscape: 3 items */
    .gallery-carousel-item {
        flex: 0 0 calc(33.333% - 1.334rem);
    }
}

@media (min-width: 1280px) {
    /* Desktop: 4 items */
    .gallery-carousel-item {
        flex: 0 0 calc(25% - 1.5rem);
    }
}

/* Gallery Card */
.gallery-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.gallery-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15), 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* Image Wrapper - Optimized Aspect Ratios for Beauty Photos */
.gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

/* Mobile: Portrait ratio for better face visibility */
@media (max-width: 639px) {
    .gallery-image-wrapper {
        aspect-ratio: 3 / 4;
        min-height: 400px;
    }
}

/* Tablet: Balanced ratio */
@media (min-width: 640px) and (max-width: 1023px) {
    .gallery-image-wrapper {
        aspect-ratio: 3 / 4;
        min-height: 350px;
    }
}

/* Desktop: Portrait ratio to showcase transformations */
@media (min-width: 1024px) {
    .gallery-image-wrapper {
        aspect-ratio: 3 / 4;
        min-height: 400px;
    }
}

/* Large screens: Taller images for premium look */
@media (min-width: 1536px) {
    .gallery-image-wrapper {
        aspect-ratio: 2 / 3;
        min-height: 450px;
    }
}

/* Gallery Image */
.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover .gallery-image {
    transform: scale(1.15);
}

/* Overlay - Premium gradient for beauty brand */
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top, 
        rgba(0, 0, 0, 0.85) 0%, 
        rgba(0, 0, 0, 0.5) 40%,
        rgba(0, 0, 0, 0.2) 70%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: flex-end;
    padding: 2rem;
}

@media (max-width: 768px) {
    .gallery-overlay {
        padding: 1.5rem;
    }
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    width: 100%;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover .gallery-overlay-content {
    transform: translateY(0);
}

.gallery-overlay-content h3 {
    font-size: 1.25rem;
    line-height: 1.4;
}

@media (min-width: 1024px) {
    .gallery-overlay-content h3 {
        font-size: 1.5rem;
    }
}

/* Navigation Buttons - Larger and more prominent */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-600);
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.gallery-carousel-wrapper:hover .gallery-nav-btn {
    opacity: 1;
}

.gallery-nav-btn:hover {
    background: var(--primary-600);
    color: white;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.12);
}

.gallery-nav-btn:active {
    transform: translateY(-50%) scale(1.05);
}

.gallery-nav-prev {
    left: 0;
}

.gallery-nav-next {
    right: 0;
}

/* Mobile: Always show navigation buttons */
@media (max-width: 768px) {
    .gallery-nav-btn {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
        opacity: 1;
        background: rgba(255, 255, 255, 0.95);
    }
}

/* Carousel Dots - Larger and more visible */
.gallery-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding: 1rem 0;
}

@media (max-width: 768px) {
    .gallery-carousel-dots {
        margin-top: 2rem;
    }
}

.gallery-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    padding: 0;
}

.gallery-dot:hover {
    background: var(--primary-400);
    transform: scale(1.3);
}

.gallery-dot.active {
    width: 2.5rem;
    border-radius: 0.375rem;
    background: var(--primary-600);
}

/* Pause animation on hover */
.gallery-carousel-wrapper:hover .gallery-carousel-track {
    animation-play-state: paused !important;
}

/* Smooth scroll behavior */
.gallery-carousel-container {
    scroll-behavior: smooth;
}

/* Premium touch: Add subtle border to images */
.gallery-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    border-radius: inherit;
}

/* Loading skeleton for images */
.gallery-image-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e8e8e8 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
    z-index: 1;
}

.gallery-image {
    position: relative;
    z-index: 2;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Hide skeleton once image loads */
.gallery-image-wrapper img[src] ~ ::before {
    display: none;
}

/* Focus styles for accessibility */
.gallery-nav-btn:focus-visible,
.gallery-dot:focus-visible {
    outline: 3px solid var(--primary-300);
    outline-offset: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gallery-card {
        border: 2px solid currentColor;
    }
    
    .gallery-overlay {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, transparent 100%);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-carousel-track,
    .gallery-card,
    .gallery-image,
    .gallery-overlay,
    .gallery-overlay-content,
    .gallery-nav-btn,
    .gallery-dot {
        transition: none;
        animation: none;
    }
}