/* DIG Image Collections - Frontend Styles */

/* Masonry Gallery Container */
.dig-gallery-container {
    width: 100%;
    margin: 0 auto;
}

/* Masonry Grid - Elementor-style Layout */
.dig-masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 0;
    grid-auto-flow: dense;
    grid-auto-rows: 250px;
}

.dig-masonry-grid.dig-masonry-loaded {
    opacity: 1;
}

/* Masonry Items - Percentage-based Heights */
.dig-masonry-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
    height: 0;
    padding-bottom: var(--item-height, 100%);
    margin: 0;
    border: none;
    background: #f5f5f5;
}

/* Portrait images - taller (133.33% height) */
.dig-masonry-item[data-aspect="portrait"] {
    grid-row-end: span 2;
}

/* Landscape images - shorter (75% height) */
.dig-masonry-item[data-aspect="landscape"] {
    grid-row-end: span 1;
}

/* Square images - standard (100% height) */
.dig-masonry-item[data-aspect="square"] {
    grid-row-end: span 1;
}

.dig-masonry-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.dig-masonry-item:hover img {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Image Caption Overlay */
.dig-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.4), transparent);
    color: #fff;
    padding: 30px 15px 15px;
    font-size: 13px;
    line-height: 1.4;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.dig-masonry-item:hover .dig-image-caption {
    transform: translateY(0);
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .dig-masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        grid-auto-rows: 220px;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .dig-masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .dig-masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 150px;
        gap: 8px;
    }
}

/* Lightbox Modal */
.dig-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s;
    padding: 20px;
}

.dig-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Close Button */
.dig-close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: white;
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000001;
    transition: all 0.3s ease;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.dig-close:hover,
.dig-close:focus {
    color: #f1f1f1;
    transform: scale(1.1);
}

/* Navigation Arrows */
.dig-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 30px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    user-select: none;
    z-index: 1000001;
}

.dig-modal-nav:hover {
    background: rgba(255, 255, 255, 0.4);
}

.dig-modal-prev {
    left: 20px;
}

.dig-modal-next {
    right: 20px;
}

/* Modal Content Wrapper */
.dig-modal-content-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    margin: auto;
    padding: 20px;
}

.dig-modal-content {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Modal Image */
.dig-modal-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    background: #000;
}

/* Modal Info Section */
.dig-modal-info {
    padding: 20px;
    background: #f9f9f9;
    border-top: 3px solid #8b6f47;
}

.dig-modal-caption {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #5a4a3a;
    line-height: 1.4;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.dig-modal-title {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    font-weight: 500;
    color: #2a2a2a;
    line-height: 1.4;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.dig-modal-description {
    margin: 0 0 10px 0;
    font-size: 1em;
    line-height: 1.6;
    color: #4a4a4a;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.dig-credit {
    margin: 15px 0 0 0;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    font-family: 'Georgia', 'Times New Roman', serif;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .dig-modal-content-wrapper {
        max-width: 95%;
        padding: 10px;
    }
    
    .dig-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .dig-close {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }
    
    .dig-modal-nav {
        font-size: 20px;
        padding: 10px 15px;
    }
    
    .dig-modal-prev {
        left: 10px;
    }
    
    .dig-modal-next {
        right: 10px;
    }
    
    .dig-modal-info {
        padding: 15px;
    }
    
    .dig-modal-caption {
        font-size: 1.1em;
    }
    
    .dig-modal-title {
        font-size: 1em;
    }
    
    .dig-modal-description {
        font-size: 0.95em;
    }
}

/* Prevent body scroll when modal is open */
body.dig-modal-open {
    overflow: hidden;
}

/* Loading State */
.dig-masonry-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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