/* ================= Collage Photo Gallery (Block) ================= */
.collage-photo-gallery { 
    background-size: auto; 
    background-position: center top; 
    background-repeat: repeat; 
    padding: 36px 0 60px; 
}

.collage-photo-gallery .gallery-header { 
    text-align: center; 
    max-width: 1100px; 
    margin: 0 auto 20px; 
    color: #000; 
}

.entry-content img{
    margin: 0 !important;
}

.gallery-kicker { 
    font-family: "Averia Serif Libre", sans-serif;
    font-weight: 400;
    font-size: 2rem;
    line-height: 1.2;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.gallery-title { 
    color: #cb3638; 
    font-size: 40px; 
    margin: 0 0 12px; 
    font-weight: 900; 
    letter-spacing: 1px; 
    text-transform: uppercase;
}

.gallery-desc { 
    opacity: .9; 
    font-size: 1.2rem; 
}

/* Collage Grid Layout - 4 columns with flexible heights (Masonry) */
.collage-grid { 
    column-count: 4;
    column-gap: 26px;
    max-width: 1200px;
    margin: 0 auto;
}

.collage-item { 
    display: inline-block;
    width: 100%;
    margin-bottom: 26px;
    break-inside: avoid;
    box-sizing: border-box;
    border-radius: 6px; 
    overflow: hidden; 
    box-shadow: 0 10px 24px rgba(0,0,0,.3); 
}

.collage-item img { 
    width: 100%; 
    height: auto; 
    object-fit: cover; 
    display: block; 
    transition: transform 0.3s ease;
}

.collage-item:hover img {
    transform: scale(1.05);
}

.collage-item {
    cursor: pointer;
    position: relative;
}

.collage-item:hover .image-alt-tooltip {
    opacity: 1;
    visibility: visible;
}

.image-alt-tooltip {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
    word-wrap: break-word;
}

/* Popup Overlay Styles */
.gallery-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.popup-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.popup-image-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-image-container.loading {
    opacity: 0.7;
}

.popup-image-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.popup-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.popup-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 10001;
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.popup-nav {
    position: absolute;
    bottom: -60px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 10001;
}

.popup-nav:hover {
    background: rgba(0, 0, 0, 0.9);
}

.popup-prev {
    left: 20px;
}

.popup-next {
    right: 20px;
}

.popup-counter {
    position: absolute;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10001;
}

.popup-alt-text {
    position: absolute;
    bottom: -130px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 12px;
    font-weight: 400;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 15px;
    max-width: 80%;
    text-align: center;
    line-height: 1.3;
    z-index: 10001;
    word-wrap: break-word;
}

/* Prevent body scroll when popup is open */
body.popup-open {
    overflow: hidden;
}

/* Responsive popup styles */
@media (max-width: 768px) {
    .popup-container {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .popup-nav {
        width: 45px;
        height: 45px;
    }
    
    .popup-prev {
        left: 15px;
    }
    
    .popup-next {
        right: 15px;
    }
    
    .popup-close {
        top: -40px;
        width: 35px;
        height: 35px;
    }
    
    .popup-counter {
        bottom: -90px;
    }
    
    .popup-alt-text {
        bottom: -120px;
        font-size: 11px;
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .popup-nav {
        width: 40px;
        height: 40px;
    }
    
    .popup-prev {
        left: 10px;
    }
    
    .popup-next {
        right: 10px;
    }
    
    .popup-counter {
        bottom: -85px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .popup-alt-text {
        bottom: -115px;
        font-size: 10px;
        padding: 4px 8px;
        max-width: 90%;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .collage-grid { 
        column-count: 3;
        column-gap: 20px;
    }
}

@media (max-width: 768px) {
    .collage-grid { 
        column-count: 2;
        column-gap: 16px;
    }
}

@media (max-width: 480px) {
    .collage-grid { 
        column-count: 1;
        column-gap: 12px;
    }
    
    .gallery-title {
        font-size: 32px;
    }
    
    .gallery-kicker {
        font-size: 1.5rem;
    }
}
