/**
 * SW Gallery - Front CSS
 *
 * @author    SW
 * @copyright SW
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 */

/* Container */
.swgallery-container {
    margin: 20px 0;
}

/* Header */
.swgallery-header {
    margin-bottom: 25px;
}

.swgallery-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #232323;
}

.swgallery-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.swgallery-description p:last-child {
    margin-bottom: 0;
}

/* Masonry Grid - Adaptive columns to fill container width */
.swgallery-grid {
    margin: 0 -5px;
}

.swgallery-grid-sizer,
.swgallery-item {
    margin: 5px;
}

/* Default: 4 columns (large desktop 1200px+) */
.swgallery-grid-sizer,
.swgallery-item {
    width: calc(25% - 10px);
}

/* 3 columns (desktop 992px - 1199px) */
@media (max-width: 1199px) {
    .swgallery-grid-sizer,
    .swgallery-item {
        width: calc(33.333% - 10px);
    }
}

/* 2 columns on tablets (768px - 991px) */
@media (max-width: 991px) {
    .swgallery-grid-sizer,
    .swgallery-item {
        width: calc(50% - 10px);
    }
}

/* 1 column on mobile (< 768px) */
@media (max-width: 767px) {
    .swgallery-grid-sizer,
    .swgallery-item {
        width: calc(100% - 10px);
    }
}

/* Image item */
.swgallery-item {
    margin-bottom: 10px;
}

.swgallery-item a {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
}

.swgallery-item a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 1;
}

.swgallery-item a:hover::before {
    background: rgba(0, 0, 0, 0.15);
}

.swgallery-item a::after {
    content: '\e8ff'; /* Material icon: zoom_in */
    font-family: 'Material Icons', sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: #fff;
    font-size: 32px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.swgallery-item a:hover::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.swgallery-img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.swgallery-item a {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
}

.swgallery-item a:hover .swgallery-img {
    transform: scale(1.03);
}

/* Loading spinner */
.swgallery-loader {
    text-align: center;
    padding: 30px;
    color: #999;
}

.swgallery-spinner {
    display: inline-block;
    width: 70px;
    text-align: center;
}

.swgallery-spinner > div {
    width: 12px;
    height: 12px;
    background-color: #25b9d7;
    border-radius: 100%;
    display: inline-block;
    animation: swgallery-bounce 1.4s infinite ease-in-out both;
}

.swgallery-spinner .bounce1 {
    animation-delay: -0.32s;
}

.swgallery-spinner .bounce2 {
    animation-delay: -0.16s;
}

@keyframes swgallery-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.swgallery-loader p {
    margin: 15px 0 0;
    font-size: 14px;
}

/* Footer link */
.swgallery-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.swgallery-view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #25b9d7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.swgallery-view-all:hover {
    color: #1a8a9e;
    text-decoration: none;
}

.swgallery-view-all .material-icons {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.swgallery-view-all:hover .material-icons {
    transform: translateX(4px);
}

/* Info line */
.swgallery-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Hidden state for infinite scroll */
.swgallery-loader.hidden {
    display: none;
}

/* Image placeholder while loading */
.swgallery-img[src=""],
.swgallery-img:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: swgallery-shimmer 1.5s infinite;
    min-height: 150px;
}

@keyframes swgallery-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Fancybox custom styles */
.fancybox__container {
    --fancybox-bg: rgba(0, 0, 0, 0.92);
}

.fancybox__caption {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 14px;
}

/* Hook display specific styles */
.swgallery-hook {
    padding: 20px 0;
}

.swgallery-hook .swgallery-title {
    text-align: center;
}

.swgallery-hook .swgallery-description {
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Page specific styles */
#content .swgallery-container {
    padding: 0;
}

#content .swgallery-title {
    text-align: left;
}

#content .swgallery-description {
    text-align: left;
    max-width: none;
}

/* Dedicated gallery page title */
.swgallery-page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #232323;
}
