/* Gallery Hero Section */

.gallery-hero {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../images/pania.jpg');
    background-size: cover;
    background-position: center;
    height: 40vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 0 1rem;
    margin-top: 80px;
}

    .gallery-hero h1 {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .gallery-hero p {
        font-size: 1.2rem;
    }


/* Gallery Filter */

.gallery-filter {
    padding: 2rem 1rem;
    background-color: var(--light-bg);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.filter-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    background-color: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

    .filter-btn:hover,
    .filter-btn.active {
        background-color: var(--secondary-color);
        color: white;
    }


/* Gallery Container */

.gallery-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.gallery-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
}

    .gallery-item:hover {
        transform: translateY(-5px);
    }

.gallery-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    flex: 1;
}

    .gallery-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        image-rendering: optimize-contrast;
        -ms-interpolation-mode: nearest-neighbor;
        filter: contrast(1.1) brightness(1.05) saturate(1.1);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

.gallery-item:hover .gallery-image img {
    transform: scale(1.05);
    filter: contrast(1.15) brightness(1.08) saturate(1.15);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
    transition: all 0.3s ease;
}

/* بهبود کیفیت تصاویر WebP */
.gallery-image img[src$=".webp"] {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
}

/* بهبود کیفیت تصاویر JPG */
.gallery-image img[src$=".jpg"],
.gallery-image img[src$=".jpeg"] {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
}

.gallery-info {
    padding: 1rem;
    flex-shrink: 0;
    background: white;
}

.location,
.usage,
.description {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.location {
    color: var(--secondary-color);
}

.usage {
    color: var(--primary-color);
}

.description {
    color: var(--text-color);
}

.location i,
.usage i {
    margin-left: 0.5rem;
}


/* Responsive Design */

@media (max-width: 1400px) {
    .gallery-container {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1200px;
    }
}

@media (max-width: 1200px) {
    .gallery-container {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1000px;
    }
}

@media (max-width: 992px) {
    .gallery-container {
        grid-template-columns: repeat(3, 1fr);
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        height: 30vh;
    }

        .gallery-hero h1 {
            font-size: 2rem;
        }

    .gallery-container {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
}

/* بهبود کیفیت تصاویر در Retina Display */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .gallery-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        image-rendering: optimize-contrast;
        -ms-interpolation-mode: nearest-neighbor;
        filter: contrast(1.08) brightness(1.03) saturate(1.08);
    }
    
    .lightbox-content {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        image-rendering: optimize-contrast;
        -ms-interpolation-mode: nearest-neighbor;
        filter: contrast(1.08) brightness(1.03) saturate(1.08);
    }
}

/* بهبود کیفیت تصاویر در حالت Loading */
.gallery-image img[loading="lazy"] {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
    filter: contrast(1.1) brightness(1.05) saturate(1.1);
}

/* بهبود کیفیت تصاویر در حالت Focus */
.gallery-image img:focus {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
    filter: contrast(1.12) brightness(1.06) saturate(1.12);
    outline: 2px solid #3498db;
    outline-offset: 2px;
}