/**
 * References Gallery Styles
 */

/* Grid Layout */
.references-gallery {
    margin: 30px 0;
}

.references-grid {
    display: grid;
    gap: 24px;
}

.references-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

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

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

@media (max-width: 991px) {
    .references-cols-4,
    .references-cols-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .references-cols-3,
    .references-cols-4,
    .references-cols-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .references-grid {
        grid-template-columns: 1fr;
    }
}

/* Reference Item */
.reference-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

.reference-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.reference-image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.reference-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.reference-item:hover .reference-image {
    transform: scale(1.05);
}

/* Overlay */
.reference-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reference-item:hover .reference-overlay {
    opacity: 1;
}

.reference-zoom-icon {
    color: #fff;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(4px);
}

/* Title */
.reference-title {
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    background: #fff;
    color: #333;
}

/* Empty State */
.references-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Lightbox */
.references-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.references-lightbox.active {
    display: flex;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    margin-top: 16px;
    color: #fff;
    font-size: 1rem;
    text-align: center;
    max-width: 600px;
}

/* Lightbox Navigation */
.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 16px;
    border-radius: 50%;
    opacity: 0.8;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Animations */
@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes lightboxZoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.references-lightbox.active .lightbox-overlay {
    animation: lightboxFadeIn 0.3s ease;
}

.references-lightbox.active .lightbox-container {
    animation: lightboxZoomIn 0.3s ease;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .lightbox-nav {
        padding: 12px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: -40px;
    }
}
