/**
 * Gallery Grid Styles
 * Matches the "Galerij" styling from React HomePage
 */

.fuziion-gallery-grid-wrapper {
    width: 100%;
}

.fuziion-gallery-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}

/* Elementor responsive classes - Desktop (default) - Fallback if inline styles don't work */
.elementor-grid-1 .fuziion-gallery-grid {
    grid-template-columns: repeat(1, 1fr);
}

.elementor-grid-2 .fuziion-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
}

.elementor-grid-3 .fuziion-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
}

.elementor-grid-4 .fuziion-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
}

.elementor-grid-5 .fuziion-gallery-grid {
    grid-template-columns: repeat(5, 1fr);
}

.elementor-grid-6 .fuziion-gallery-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Default grid columns - only apply if no Elementor class is present on widget wrapper */
.elementor-widget:not([class*="elementor-grid-"]) .fuziion-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* Default responsive behavior - only when no Elementor classes are applied */
@media (max-width: 1024px) and (min-width: 769px) {
    .elementor-widget:not([class*="elementor-grid-"]) .fuziion-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .elementor-widget:not([class*="elementor-grid-"]) .fuziion-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .elementor-widget:not([class*="elementor-grid-"]) .fuziion-gallery-grid {
        gap: 8px;
    }
}

/* Elementor responsive classes - Tablet (iPad) - Fallback */
@media (max-width: 1024px) and (min-width: 769px) {
    .elementor-grid-tablet-1 .fuziion-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .elementor-grid-tablet-2 .fuziion-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .elementor-grid-tablet-3 .fuziion-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .elementor-grid-tablet-4 .fuziion-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .elementor-grid-tablet-5 .fuziion-gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .elementor-grid-tablet-6 .fuziion-gallery-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Elementor responsive classes - Mobile - Fallback */
@media (max-width: 768px) {
    .elementor-grid-mobile-1 .fuziion-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .elementor-grid-mobile-2 .fuziion-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .elementor-grid-mobile-3 .fuziion-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .elementor-grid-mobile-4 .fuziion-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Gallery Item Wrapper - Scroll-triggered Animation */
.fuziion-gallery-item-wrapper {
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: var(--animation-delay, 0ms);
    will-change: opacity, transform;
}

.fuziion-gallery-item-wrapper.in-view {
    opacity: 1;
    transform: scale(1);
    will-change: auto; /* Remove will-change after animation */
}

/* If animations are disabled, show items immediately */
[data-animations-enabled="false"] .fuziion-gallery-item-wrapper {
    opacity: 1;
    transform: scale(1);
    transition: none;
}

/* Show items in Elementor editor */
.elementor-editor-active .fuziion-gallery-item-wrapper,
.elementor-editor-preview .fuziion-gallery-item-wrapper {
    opacity: 1;
    transform: scale(1);
    transition: none;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .fuziion-gallery-item-wrapper {
        opacity: 1;
        transform: scale(1);
        transition: none;
    }
}

.fuziion-gallery-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

.fuziion-gallery-link:hover {
    text-decoration: none;
}

/* Gallery Item - matches React: relative aspect-square overflow-hidden rounded-lg shadow-lg group */
.fuziion-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: calc(.625rem + 4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    height: 100%;
    display: block;
}

/* Aspect ratio support - using padding-top technique for proper image covering */
.fuziion-gallery-item::before {
    content: '';
    display: block;
    width: 100%;
    padding-top: 100%; /* Default square */
}

.fuziion-gallery-item.aspect-square::before {
    padding-top: 100%;
}

.fuziion-gallery-item.aspect-portrait::before {
    padding-top: 133.33%;
}

.fuziion-gallery-item.aspect-landscape::before {
    padding-top: 75%;
}

.fuziion-gallery-item.aspect-video::before {
    padding-top: 56.25%;
}

/* Modern browsers - use aspect-ratio if supported */
@supports (aspect-ratio: 1 / 1) {
    .fuziion-gallery-item.aspect-square {
        aspect-ratio: 1 / 1;
    }

    .fuziion-gallery-item.aspect-square::before {
        padding-top: 0;
    }

    .fuziion-gallery-item.aspect-portrait {
        aspect-ratio: 3 / 4;
    }

    .fuziion-gallery-item.aspect-portrait::before {
        padding-top: 0;
    }

    .fuziion-gallery-item.aspect-landscape {
        aspect-ratio: 4 / 3;
    }

    .fuziion-gallery-item.aspect-landscape::before {
        padding-top: 0;
    }

    .fuziion-gallery-item.aspect-video {
        aspect-ratio: 16 / 9;
    }

    .fuziion-gallery-item.aspect-video::before {
        padding-top: 0;
    }
}

/* Gallery Image - matches React: w-full h-full object-cover group-hover:scale-110 transition-transform duration-700 */
.fuziion-gallery-image {
    width: 100%!important;
    height: 100%!important;
    object-fit: cover;
    object-position: center;
    transition: transform 0.7s ease;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.fuziion-gallery-item:hover .fuziion-gallery-image {
    transform: scale(1.1);
}

/* Gallery Overlay - matches React: absolute inset-0 bg-gradient-to-t from-black/40 to-transparent opacity-0 group-hover:opacity-100 transition-opacity */
.fuziion-gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.4) 0%,
            transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.fuziion-gallery-item:hover .fuziion-gallery-overlay {
    opacity: 1;
}


/* Ensure proper spacing */
.fuziion-gallery-grid-wrapper + * {
    margin-top: 32px;
}

