/* Gallery Page and Custom Lightbox Stylesheet */

/* Album Gallery Masonry Grid */
.masonry-grid {
    column-count: 4;
    column-gap: 20px;
    margin-top: 30px;
}

@media (max-width: 1200px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .masonry-grid {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .masonry-grid {
        column-count: 1;
    }
}

.masonry-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    background-color: var(--surface);
    cursor: pointer;
    transition: var(--transition);
}

.masonry-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.masonry-img-wrapper {
    position: relative;
    overflow: hidden;
}

.masonry-img-wrapper img {
    width: 100%;
    display: block;
    height: auto;
    transition: var(--transition-slow);
}

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

.masonry-caption {
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* Skeleton Loading Placeholder */
.skeleton-placeholder {
    width: 100%;
    height: 250px;
    background: linear-gradient(90deg, #f0f3f7 25%, #e1e7f0 50%, #f0f3f7 75%);
    background-size: 200% 100%;
    animation: skeletonGlow 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

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

/* --- CUSTOM JAVASCRIPT LIGHTBOX --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 42, 67, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    user-select: none;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Header toolbar */
.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    color: var(--surface);
    z-index: 2010;
}

.lightbox-counter {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lightbox-actions {
    display: flex;
    gap: 20px;
}

.lightbox-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.lightbox-btn:hover {
    color: var(--surface);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Lightbox Content Container */
.lightbox-stage {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 60px;
}

.lightbox-image-wrapper {
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
    opacity: 0;
}

.lightbox.active .lightbox-image {
    transform: scale(1);
    opacity: 1;
}

/* Lightbox Navigation Buttons */
.lightbox-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: var(--surface);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2025;
}

.lightbox-nav-arrow:hover {
    background-color: var(--primary-red);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Lightbox Footer Caption */
.lightbox-footer {
    padding: 24px;
    text-align: center;
    color: var(--surface);
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
    z-index: 2010;
}

.lightbox-caption {
    font-size: 16px;
    font-weight: 500;
    max-width: 800px;
    margin: 0 auto;
}

/* Fullscreen support */
.lightbox:fullscreen .lightbox-image {
    max-height: 90vh;
}
