/* Fixed Background Override for Subdirectory */
.fixed-background {
    background-image: url('../pozadina.jpg');
}

/* Mobile Background Image */
@media (max-width: 480px) {
    .fixed-background {
        background-image: url('../pozadina-mobile.jpg');
    }
}

/* Gallery Section */
.gallery-section {
    padding: 60px 60px 80px 60px;
    min-height: 100vh;
}

.gallery-title {
    font-family: 'Baskerville', 'Instrument Sans', serif;
    font-size: clamp(48px, 6vw, 72px);
    font-weight: 400;
    font-style: italic;
    opacity: 0.9;
    text-align: center;
    margin-bottom: 60px;
}

/* Bento Grid Layout - Masonry Style */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    grid-auto-rows: 300px;
}

.bento-item {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease;
    opacity: 0;
    animation: fadeInImage 0.6s ease-in-out forwards;
}

.bento-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Fade-in animation */
@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delays for sequential loading */
.bento-item-1 { animation-delay: 0.05s; }
.bento-item-2 { animation-delay: 0.1s; }
.bento-item-3 { animation-delay: 0.15s; }
.bento-item-4 { animation-delay: 0.2s; }
.bento-item-5 { animation-delay: 0.25s; }
.bento-item-6 { animation-delay: 0.3s; }
.bento-item-7 { animation-delay: 0.35s; }
.bento-item-8 { animation-delay: 0.4s; }
.bento-item-9 { animation-delay: 0.45s; }
.bento-item-10 { animation-delay: 0.5s; }
.bento-item-11 { animation-delay: 0.55s; }
.bento-item-12 { animation-delay: 0.6s; }
.bento-item-13 { animation-delay: 0.65s; }
.bento-item-14 { animation-delay: 0.7s; }
.bento-item-15 { animation-delay: 0.75s; }
.bento-item-16 { animation-delay: 0.8s; }
.bento-item-17 { animation-delay: 0.85s; }
.bento-item-18 { animation-delay: 0.9s; }
.bento-item-19 { animation-delay: 0.95s; }
.bento-item-20 { animation-delay: 1s; }
.bento-item-21 { animation-delay: 1.05s; }
.bento-item-22 { animation-delay: 1.1s; }
.bento-item-23 { animation-delay: 1.15s; }
.bento-item-24 { animation-delay: 1.2s; }
.bento-item-25 { animation-delay: 1.25s; }
.bento-item-26 { animation-delay: 1.3s; }
.bento-item-27 { animation-delay: 1.35s; }
.bento-item-28 { animation-delay: 1.4s; }
.bento-item-29 { animation-delay: 1.45s; }
.bento-item-30 { animation-delay: 1.5s; }
.bento-item-31 { animation-delay: 1.55s; }
.bento-item-32 { animation-delay: 1.6s; }
.bento-item-33 { animation-delay: 1.65s; }
.bento-item-34 { animation-delay: 1.7s; }
.bento-item-35 { animation-delay: 1.75s; }
.bento-item-36 { animation-delay: 1.8s; }
.bento-item-37 { animation-delay: 1.85s; }
.bento-item-38 { animation-delay: 1.9s; }
.bento-item:hover {
    transform: scale(1.025);
    z-index: 10;
}

/* Specific Grid Positions - Based on the image layout */
.bento-item-1 {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.bento-item-2 {
    grid-column: 2;
    grid-row: 1;
}

.bento-item-3 {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.bento-item-4 {
    grid-column: 2;
    grid-row: 2 / span 2;
}

.bento-item-5 {
    grid-column: 1;
    grid-row: 3;
}

.bento-item-6 {
    grid-column: 3;
    grid-row: 3;
}

.bento-item-7 {
    grid-column: 1;
    grid-row: 4 / span 2;
}

.bento-item-8 {
    grid-column: 2;
    grid-row: 4;
}

.bento-item-9 {
    grid-column: 3;
    grid-row: 4;
}

.bento-item-10 {
    grid-column: 2 / span 2;
    grid-row: 5;
}

.bento-item-11 {
    grid-column: 1;
    grid-row: 6;
}

.bento-item-12 {
    grid-column: 2;
    grid-row: 6 / span 2;
}

.bento-item-13 {
    grid-column: 3;
    grid-row: 6;
}

.bento-item-14 {
    grid-column: 1;
    grid-row: 7 / span 2;
}

.bento-item-15 {
    grid-column: 3;
    grid-row: 7;
}

.bento-item-16 {
    grid-column: 2;
    grid-row: 8;
}

.bento-item-17 {
    grid-column: 3;
    grid-row: 8 / span 2;
}

.bento-item-18 {
    grid-column: 1;
    grid-row: 9;
}

.bento-item-19 {
    grid-column: 2;
    grid-row: 9;
}

.bento-item-20 {
    grid-column: 1 / span 2;
    grid-row: 10;
}

.bento-item-21 {
    grid-column: 3;
    grid-row: 10;
}

.bento-item-22 {
    grid-column: 1;
    grid-row: 11;
}

.bento-item-23 {
    grid-column: 2;
    grid-row: 11 / span 2;
}

.bento-item-24 {
    grid-column: 3;
    grid-row: 11;
}

.bento-item-25 {
    grid-column: 1;
    grid-row: 12 / span 2;
}

.bento-item-26 {
    grid-column: 3;
    grid-row: 12;
}

.bento-item-27 {
    grid-column: 2;
    grid-row: 13;
}

.bento-item-28 {
    grid-column: 3;
    grid-row: 13 / span 2;
}

.bento-item-29 {
    grid-column: 1;
    grid-row: 14;
}

.bento-item-30 {
    grid-column: 2;
    grid-row: 14;
}

.bento-item-31 {
    grid-column: 1 / span 2;
    grid-row: 15;
}

.bento-item-32 {
    grid-column: 3;
    grid-row: 15;
}

.bento-item-33 {
    grid-column: 1;
    grid-row: 16;
}

.bento-item-34 {
    grid-column: 2;
    grid-row: 16;
}

.bento-item-35 {
    grid-column: 3;
    grid-row: 16;
}

.bento-item-36 {
    grid-column: 1;
    grid-row: 17;
}

.bento-item-37 {
    grid-column: 2;
    grid-row: 17;
}

.bento-item-38 {
    grid-column: 3;
    grid-row: 17;
}

/* Make images clickable */
.bento-item {
    cursor: none;
}

/* Lightbox Overlay */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

/* Lightbox Image Container */
.lightbox-image-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.lightbox-image-container img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

/* Close Button */
.lightbox-close {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    z-index: 9999;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.lightbox-close::before,
.lightbox-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
}

.lightbox-close::before {
    transform: rotate(45deg);
}

.lightbox-close::after {
    transform: rotate(-45deg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 250px;
    }
    
    .bento-item-1,
    .bento-item-3,
    .bento-item-4,
    .bento-item-7,
    .bento-item-12,
    .bento-item-14,
    .bento-item-17,
    .bento-item-23,
    .bento-item-25,
    .bento-item-28 {
        grid-row: span 2;
    }
    
    .bento-item-10,
    .bento-item-20,
    .bento-item-31 {
        grid-column: 1 / span 2;
        grid-row: span 1;
    }
    
    .lightbox-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .gallery-section {
        padding: 40px 30px 60px 30px;
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 300px;
        gap: 16px;
    }
    
    .bento-item-1,
    .bento-item-3,
    .bento-item-4,
    .bento-item-7,
    .bento-item-10,
    .bento-item-12,
    .bento-item-14,
    .bento-item-17,
    .bento-item-20,
    .bento-item-23,
    .bento-item-25,
    .bento-item-28,
    .bento-item-31 {
        grid-column: 1;
        grid-row: span 1;
    }
    
    .lightbox-image-container {
        max-width: 95vw;
        max-height: 85vh;
    }
}

/* Mobile Responsive - Under 480px */
@media (max-width: 480px) {
    .gallery-section {
        padding: 64px 20px 60px 20px;
    }
    
    .gallery-title {
        font-size: 48px;
        margin-bottom: 48px;
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 20px;
    }
    
    .bento-item {
        grid-column: 1 !important;
        grid-row: auto !important;
        border-radius: 12px;
    }
    
    .bento-item img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .lightbox-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-image-container img {
        max-width: 90vw;
        max-height: 80vh;
        width: auto;
        height: auto;
    }
}
