/* Gallery Grid Layout */
.sasq-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Gallery Item Styling */
.sasq-gallery-item {
    position: relative;
    overflow: hidden; /* Critical for the caption and zoom effects */
    border-radius: 12px;
    height: 300px;
    cursor: pointer;
    background: #f0f0f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.sasq-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
}

.sasq-gallery-item:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.sasq-gallery-item:hover img {
    transform: scale(1.08);
}

/* Hover Overlay & Icon */
.sasq-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.sasq-gallery-item:hover .sasq-gallery-overlay {
    opacity: 1;
}

.sasq-gallery-overlay svg {
    width: 40px;
    height: 40px;
    color: #fff;
    transform: scale(0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sasq-gallery-item:hover .sasq-gallery-overlay svg {
    transform: scale(1);
}

/* Item Captions - Fixed with TranslateY */
.sasq-gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 15px 15px; /* Extra top padding for the gradient */
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transform: translateY(100%); 
    transition: transform 0.3s ease-out;
    z-index: 2;
}

.sasq-gallery-item:hover .sasq-gallery-caption {
    transform: translateY(0);
}

/* Responsive Grid Heights & Columns */
@media (max-width: 1024px) {
    .sasq-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .sasq-gallery-item {
        height: 240px;
    }
}

@media (max-width: 767px) {
    .sasq-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .sasq-gallery-item {
        height: 180px;
    }
}

/* Load More Button Styles */
.sasq-load-more-container {
    text-align: center;
    margin-top: 30px;
}

.sasq-load-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    position: relative;
    overflow: hidden;
}

.sasq-load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.6);
}

.sasq-load-more-btn.loading {
    pointer-events: none;
    color: transparent;
}

.sasq-load-more-btn.loading::after {
    content: "";
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

/* Newly Loaded Items Animation */
.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    100% { left: 200%; }
}

/* Lightbox Styling */
.sasq-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.sasq-lightbox.active {
    display: flex;
}

.sasq-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sasq-lightbox.active .sasq-lightbox-overlay {
    opacity: 1;
}

.sasq-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 85vh;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.4s ease;
}

.sasq-lightbox.active .sasq-lightbox-content {
    opacity: 1;
    transform: scale(1);
}

.sasq-lightbox-content img {
    max-width: 100%;
    max-height: 80vh; /* Leave room for the caption */
    border-radius: 8px 8px 0 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: block;
    object-fit: contain;
}

.sasq-lightbox-caption {
    color: #fff;
    text-align: center;
    background: #09789b;
    font-size: 16px;
    padding: 12px 20px;
    border-radius: 0 0 8px 8px;
    font-weight: 500;
}

.sasq-lightbox-close,
.sasq-lightbox-prev,
.sasq-lightbox-next {
    position: absolute;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 45px;
    cursor: pointer;
    z-index: 10;
    transition: color 0.3s ease, transform 0.3s ease;
}

.sasq-lightbox-close:hover,
.sasq-lightbox-prev:hover,
.sasq-lightbox-next:hover {
    color: #fff;
    transform: scale(1.1);
}

.sasq-lightbox-close { top: 20px; right: 30px; }
.sasq-lightbox-prev { left: 30px; top: 50%; transform: translateY(-50%); }
.sasq-lightbox-next { right: 30px; top: 50%; transform: translateY(-50%); }

/* Grid Shimmer Preloader */
.sasq-img-inner {
    position: relative;
    overflow: hidden;
    background: #f6f7f8;
    height: 100%;
}

.sasq-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: sasq-shimmer-anim 1.5s infinite;
}

@keyframes sasq-shimmer-anim {
    100% { transform: translateX(100%); }
}

@media (max-width: 767px) {
    .sasq-lightbox-prev { left: 10px; }
    .sasq-lightbox-next { right: 10px; }
    .sasq-lightbox-close { top: 10px; right: 15px; font-size: 35px; }
}