/**
 * HB Foto Grid - Frontend Styles
 * Author: Hummingbirds bv
 */

/* Grid Layout */
.hb-foto-grid {
    --hb-grid-columns: 4;
    --hb-grid-gap: 10px;
    
    display: grid;
    grid-template-columns: repeat(var(--hb-grid-columns), 1fr);
    gap: var(--hb-grid-gap);
    margin: 2rem 0;
    padding: 0;
}

/* Responsive grid */
@media (max-width: 1024px) {
    .hb-foto-grid[data-columns="5"],
    .hb-foto-grid[data-columns="6"] {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .hb-foto-grid[data-columns="4"],
    .hb-foto-grid[data-columns="5"],
    .hb-foto-grid[data-columns="6"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .hb-foto-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Grid item */
.hb-foto-grid-item {
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f5f5f5;
}


.hb-foto-grid-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.hb-foto-grid-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    max-width: none !important;
}

/* Caption (optional, below image) */
.hb-foto-grid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease;
}

.hb-foto-grid-item:hover .hb-foto-grid-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Empty state */
.hb-foto-grid-empty {
    padding: 40px;
    text-align: center;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
}

/* Lightbox */
.hb-foto-grid-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.hb-foto-grid-lightbox.hb-active {
    opacity: 1;
    visibility: visible;
}

.hb-foto-grid-lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hb-foto-grid-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.hb-foto-grid-lightbox-caption {
    margin-top: 16px;
    padding: 0 20px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
}

.hb-foto-grid-lightbox-caption:empty {
    display: none;
}

/* Lightbox controls */
.hb-foto-grid-lightbox-close,
.hb-foto-grid-lightbox-prev,
.hb-foto-grid-lightbox-next {
    position: absolute;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 16px;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.hb-foto-grid-lightbox-close:hover,
.hb-foto-grid-lightbox-prev:hover,
.hb-foto-grid-lightbox-next:hover {
    opacity: 1;
}

.hb-foto-grid-lightbox-close {
    top: 10px;
    right: 10px;
    font-size: 40px;
    line-height: 1;
}

.hb-foto-grid-lightbox-close:hover {
    transform: scale(1.1);
}

.hb-foto-grid-lightbox-prev {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.hb-foto-grid-lightbox-next {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.hb-foto-grid-lightbox-prev:hover {
    transform: translateY(-50%) translateX(-3px);
}

.hb-foto-grid-lightbox-next:hover {
    transform: translateY(-50%) translateX(3px);
}

/* Counter */
.hb-foto-grid-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
}

/* Focus styles */
.hb-foto-grid-lightbox-close:focus,
.hb-foto-grid-lightbox-prev:focus,
.hb-foto-grid-lightbox-next:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .hb-foto-grid-lightbox-prev,
    .hb-foto-grid-lightbox-next {
        font-size: 24px;
        padding: 12px;
    }
    
    .hb-foto-grid-lightbox-close {
        font-size: 32px;
    }
}

/* Loading state */
.hb-foto-grid-lightbox.hb-loading .hb-foto-grid-lightbox-image {
    opacity: 0.3;
}

/* Animation */
@keyframes hb-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.hb-foto-grid-lightbox.hb-active .hb-foto-grid-lightbox-image {
    animation: hb-fade-in 0.3s ease;
}
