/* Square Media Gallery Block Styles */
.square-media-gallery {
    width: 100%;
    margin: 0 auto;
    padding: 0px 0 !important;
}

/* Square Gallery Grid */
.square-gallery-grid {
    display: grid;
    width: 100%;
}

/* Desktop Columns */
.cols-desktop-2 .square-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
}

.cols-desktop-3 .square-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
}

.cols-desktop-4 .square-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
}

.cols-desktop-5 .square-gallery-grid {
    grid-template-columns: repeat(5, 1fr);
}

.cols-desktop-6 .square-gallery-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Tablet Columns */
@media (max-width: 1024px) {
    .cols-tablet-2 .square-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cols-tablet-3 .square-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .cols-tablet-4 .square-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile Columns */
@media (max-width: 768px) {
    .cols-mobile-1 .square-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .cols-mobile-2 .square-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Single column on very small mobile */
@media (max-width: 480px) {
    .square-gallery-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Gallery Item */
.square-gallery-item {
    position: relative;
    overflow: hidden;
}

/* Image Container */
.image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 0 / 1;
    overflow: hidden;
}

/* Square Images */
.square-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.square-gallery-item:hover img {
    transform: scale(1.05);
}

/* Image Borders */
.has-border .image-container {
    border-style: solid;
    border-color: #000000;
}

.border-thin .has-border .image-container {
    border-width: 1px;
}

.border-medium .has-border .image-container {
    border-width: 2px;
}

.border-thick .has-border .image-container {
    border-width: 3px;
}

/* Caption Styles */
.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 15px;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.3;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.image-caption-below {
    margin-top: 8px;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    text-align: center;
    padding: 0 5px;
}

/* Caption Display Modes */
.caption-hover .image-caption {
    transform: translateY(100%);
}

.caption-hover .square-gallery-item:hover .image-caption {
    transform: translateY(0);
}

.caption-always .image-caption {
    transform: translateY(0);
}

.caption-always.caption-position-overlay .image-caption {
    position: relative;
    background: #f8f8f8;
    color: #333;
    margin-top: -1px;
}

/* Gallery Gaps */
.gap-none .square-gallery-grid {
    gap: 0;
}

.gap-small .square-gallery-grid {
    gap: 5px;
}

.gap-medium .square-gallery-grid {
    gap: 10px;
}

.gap-large .square-gallery-grid {
    gap: 15px;
}

/* Focus styles for accessibility */
.square-gallery-item:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .square-media-gallery {
        break-inside: avoid;
    }
    
    .square-gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .image-caption {
        background: #f0f0f0 !important;
        color: #000 !important;
        position: relative !important;
        transform: none !important;
    }
}