:root {
    --ag-transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --ag-modal-bg: rgba(0, 0, 0, 0.95);
}

.ag-overlap-gallery-wrapper {
    padding: 80px 40px;
    overflow: hidden;
    background: transparent;
    display: flex;
    justify-content: center;
}

.ag-overlap-gallery-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center; /* Better alignment for varying heights */
    max-width: 1400px;
    margin: 0 auto;
    gap: 60px; /* Minimum space between items */
}

.ag-gallery-item {
    position: relative;
    transition: var(--ag-transition);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: transparent !important; /* Force transparent background */
    cursor: pointer;
    flex-shrink: 0;
    transform: rotate(var(--ag-rotate)) translateY(var(--ag-offset-y));
    padding: 0 !important; /* Force no padding */
    margin: 0 !important; /* Let gap handle spacing */
    backface-visibility: hidden;
    will-change: transform;
    border: none !important; /* Force no border */
}

/* Specific widths for variability, but auto height */
.ag-gallery-item.ag-small {
    width: 250px !important;
}

.ag-gallery-item.ag-medium {
    width: 340px !important;
}

.ag-gallery-item.ag-large {
    width: 440px !important;
}

.ag-gallery-item img {
    width: 100% !important;
    height: auto !important; /* Ensure image is not cut off */
    display: block !important;
    transition: var(--ag-transition);
}



/* Hover effects */
.ag-gallery-item:hover {
    z-index: 100 !important;
    transform: scale(1.08) rotate(0deg) translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

/* Modal Styling */
.ag-gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ag-modal-bg);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.ag-gallery-modal.is-active {
    opacity: 1;
    visibility: visible;
}

.ag-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.ag-gallery-modal.is-active .ag-modal-content {
    transform: scale(1);
}

.ag-modal-content img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border: 15px solid #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.ag-modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    color: #fff;
    font-size: 40px;
    background: none;
    border: none;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
    .ag-overlap-gallery-container { gap: 40px; }
    .ag-gallery-item.ag-small { width: 180px; }
    .ag-gallery-item.ag-medium { width: 250px; }
    .ag-gallery-item.ag-large { width: 320px; }
}

@media (max-width: 768px) {
    .ag-overlap-gallery-container { gap: 30px; }
    .ag-gallery-item.ag-small { width: 130px; }
    .ag-gallery-item.ag-medium { width: 180px; }
    .ag-gallery-item.ag-large { width: 230px; }
    .ag-gallery-item { --ag-rotate: 0deg !important; --ag-offset-y: 0px !important; } /* Straighten on mobile */
}


