/* --- Gallery Hero Section --- */
.gallery-hero {
    background: #29abe2; /* Matches your brand Blue */
    padding: 100px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Optional pattern overlay for texture */
.gallery-hero::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 10%, transparent 10%);
    background-size: 30px 30px;
    opacity: 0.3;
}

.gallery-section {
    background: #fafafa;
    padding: 60px 0 80px;
}

/* --- New Mosaic Gallery Grid Container --- */
.gallery-grid {
    display: grid;
    /* 5 Columns as per your layout design */
    grid-template-columns: repeat(5, 1fr);
    /* Fixed height for rows to keep the mosaic uniform */
    grid-auto-rows: 200px; 
    gap: 15px; 
    /* CRITICAL: This fills empty gaps automatically if items fit */
    grid-auto-flow: dense; 
    padding-bottom: 50px;
}

/* --- Grid Item Base Styles --- */
.gallery-grid-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #000; /* Loading background */
}

.gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

/* --- Hover Effects --- */
.gallery-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    z-index: 5; /* Brings item to top */
}

.gallery-grid-item:hover img {
    transform: scale(1.1);
}

/* --- Overlay with Magnifying Glass --- */
.gallery-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-overlay i {
    color: white;
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    backdrop-filter: blur(5px);
    transform: scale(0.8);
    transition: transform 0.3s;
}

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

.gallery-grid-item:hover .gallery-overlay i {
    transform: scale(1);
}

/* --- THE MOSAIC PATTERN (Repeats every 10 items) --- */
/* This logic maps your Div 1-11 layout into a repeating cycle */

/* 1. Top Wide Bar */
.gallery-grid-item:nth-child(10n + 1) {
    grid-column: span 4;
    grid-row: span 2;
}

/* 2. Tall Box Left */
.gallery-grid-item:nth-child(10n + 2) {
    grid-column: span 2;
    grid-row: span 2;
}

/* 3. Top Right Small Hole Filler */
.gallery-grid-item:nth-child(10n + 3) {
    grid-column: span 1;
    grid-row: span 2;
}

/* 4. Center Small */
.gallery-grid-item:nth-child(10n + 4) {
    grid-column: span 1; 
}

/* 5. Right Wide */
.gallery-grid-item:nth-child(10n + 5) {
    grid-column: span 2; 
}

/* 6. Tall Middle */
.gallery-grid-item:nth-child(10n + 6) {
    grid-column: span 1; 
    grid-row: span 2;
}

/* 7. Big Square Right */
.gallery-grid-item:nth-child(10n + 7) {
    grid-column: span 2;
    grid-row: span 2;
}

/* 8. Bottom Left Wide */
.gallery-grid-item:nth-child(10n + 8) {
    grid-column: span 2;
}

/* 9. Bottom Left Small */
.gallery-grid-item:nth-child(10n + 9) {
    grid-column: span 1;
    grid-row: span 2;
}

/* 10. Bottom Wide Bar */
.gallery-grid-item:nth-child(10n + 10) {
    grid-column: span 4;
    grid-row: span 2;
}

/* --- Responsive Design --- */

/* Tablet (max-width: 992px) */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr); /* Switch to 3 columns */
        grid-auto-rows: 200px;
    }
    
    /* Reset all complex spans to default 1x1 */
    .gallery-grid-item:nth-child(n) {
        grid-column: span 1;
        grid-row: span 1;
    }

    /* Create a simpler pattern for Tablet */
    .gallery-grid-item:nth-child(5n + 1) {
        grid-column: span 2; /* Every 5th item is wide */
    }
    .gallery-grid-item:nth-child(5n + 4) {
        grid-row: span 2; /* Every 4th item is tall */
    }
}

/* Mobile (max-width: 576px) */
@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr; /* Single column */
        grid-auto-rows: 250px;
        gap: 15px;
    }

    /* Force everything to full width */
    .gallery-grid-item:nth-child(n) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
    
    /* Adjust hero text size */
    .gallery-hero h1 {
        font-size: 40px !important;
    }
}