/**
 * Miller Trucking Gallery Styles
 * Masonry layout with lightbox support
 */

/* ==========================================================================
   Gallery Page Layout (sidebar visible on large screens)
   ========================================================================== */

/* Large screens (≥1200px): sidebar on the side */
@media (min-width: 1200px) {
    .gallery-page {
        display: flex;
        flex-wrap: wrap;
    }

    .gallery-page #main {
        float: left;
        width: 68%;
        padding-right: 20px;
        box-sizing: border-box;
    }

    .gallery-page #sidebar {
        float: right;
        width: 32%;
        padding: 0 10px;
        box-sizing: border-box;
    }
}

/* ==========================================================================
   Masonry Gallery Layout
   ========================================================================== */

.masonry-gallery {
    column-count: 3;  /* Default: 3 columns when sidebar visible (≥1200px) */
    column-gap: 15px;
    padding: 20px 0;
}


.gallery-item {
    break-inside: avoid;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: hidden; /* Hide images until we get better quality */
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.gallery-item a {
    display: block;
    line-height: 0;
}

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

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

/* Overlay effect on hover */
.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 45, 145, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* View icon on hover */
.gallery-item::before {
    content: '\f002';
    font-family: 'FontAwesome';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    color: white;
    font-size: 2em;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.gallery-item:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   Facebook CTA Button
   ========================================================================== */

.facebook-cta {
    text-align: center;
    padding: 40px 20px;
    margin-top: 20px;
}

.facebook-cta a {
    display: inline-block;
    background: #1877f2;
    color: white !important;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(24, 119, 242, 0.3);
}

.facebook-cta a:hover {
    background: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(24, 119, 242, 0.4);
}

.facebook-cta a i {
    margin-right: 10px;
    font-size: 1.2em;
}

/* ==========================================================================
   Load More Pagination
   ========================================================================== */

.gallery-item.gallery-hidden {
    display: none;
}

.load-more-container {
    text-align: center;
    padding: 30px 0 10px;
}

.load-more-btn {
    background: none;
    border: none;
    color: #09F;
    font-size: 1em;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    font-family: inherit;
}

.load-more-btn:hover {
    text-decoration: underline;
    color: #09F;
}

.load-more-btn:disabled {
    color: #999;
    cursor: not-allowed;
    text-decoration: none;
}

.gallery-count {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-top: 10px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* No sidebar (1024px - 1199px): 4 columns */
@media (max-width: 1199px) {
    .masonry-gallery {
        column-count: 4;
    }
}

/* Tablet landscape (768px - 1023px): 3 columns */
@media (max-width: 1023px) {
    .masonry-gallery {
        column-count: 3;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    .masonry-gallery {
        column-count: 2;
        column-gap: 10px;
    }

    .gallery-item {
        margin-bottom: 10px;
    }

    .facebook-cta a {
        padding: 12px 24px;
        font-size: 1em;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .masonry-gallery {
        column-count: 2;
        column-gap: 8px;
    }

    .gallery-item {
        margin-bottom: 8px;
        border-radius: 4px;
    }

    .gallery-item::before {
        font-size: 1.5em;
    }

    .facebook-cta {
        padding: 30px 15px;
    }

    .facebook-cta a {
        padding: 12px 20px;
        font-size: 0.95em;
    }
}

/* ==========================================================================
   GLightbox Customization
   ========================================================================== */

.glightbox-clean .gslide-description {
    background: #662d91;
}

.glightbox-clean .gslide-title {
    color: white;
}

/* Loading placeholder for lazy images */
.gallery-item img[loading="lazy"] {
    background: linear-gradient(135deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 150px;
}

.gallery-item img[loading="lazy"].loaded {
    animation: none;
    background: none;
    min-height: auto;
}

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