/* Photo Grid Styling */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    grid-auto-rows: 280px;
}

@media (min-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        grid-auto-rows: 320px;
    }
}

@media (min-width: 1024px) {
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: 280px;
    }
}

.photo-item {
    position: relative;
    overflow: hidden;
    background: var(--card-bg);
    border: 3px solid var(--text-color);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInPhoto 0.6s ease forwards;
}

.photo-item:nth-child(1) { animation-delay: 0.05s; }
.photo-item:nth-child(2) { animation-delay: 0.1s; }
.photo-item:nth-child(3) { animation-delay: 0.15s; }
.photo-item:nth-child(4) { animation-delay: 0.2s; }
.photo-item:nth-child(5) { animation-delay: 0.25s; }
.photo-item:nth-child(6) { animation-delay: 0.3s; }
.photo-item:nth-child(7) { animation-delay: 0.35s; }
.photo-item:nth-child(8) { animation-delay: 0.4s; }
.photo-item:nth-child(9) { animation-delay: 0.45s; }
.photo-item:nth-child(10) { animation-delay: 0.5s; }
.photo-item:nth-child(11) { animation-delay: 0.55s; }
.photo-item:nth-child(12) { animation-delay: 0.6s; }
.photo-item:nth-child(n+13) { animation-delay: 0.65s; }

@keyframes fadeInPhoto {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.photo-item.large {
    grid-column: span 2;
    grid-row: span 2;
}

.photo-item.wide {
    grid-column: span 2;
    grid-row: span 1;
}

.photo-item.tall {
    grid-column: span 1;
    grid-row: span 2;
}

@media (max-width: 1023px) {
    .photo-item.large {
        grid-column: span 2;
        grid-row: span 1;
    }

    .photo-item.wide {
        grid-column: span 2;
        grid-row: span 1;
    }

    .photo-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }
}

@media (max-width: 767px) {
    .photo-item.large,
    .photo-item.wide,
    .photo-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }
}

.photo-item:hover {
    transform: translateY(-8px);
    box-shadow: 12px 12px 0 var(--text-color);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, filter 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
    filter: contrast(1.1);
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        var(--text-color) 100%
    );
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1.5rem;
}

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

.photo-details {
    color: var(--bg-color);
    width: 100%;
}

.photo-details h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    text-transform: uppercase;
    margin: 0;
    color: var(--bg-color) !important;
}

@media (hover: none) and (pointer: coarse) {
    .photo-overlay {
        opacity: 0.8;
    }

    .photo-item:hover {
        transform: none;
        box-shadow: 8px 8px 0 var(--text-color);
    }

    .photo-item:hover img {
        transform: none;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: var(--bg-color);
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: transform 0.3s ease;
    background: var(--text-color);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-color);
}

.modal-close:hover {
    transform: rotate(90deg);
}

#modalImage {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border: 3px solid var(--bg-color);
    box-shadow: 15px 15px 0 var(--bg-color);
}

.modal-info {
    text-align: center;
    color: var(--bg-color);
    margin-top: 20px;
    max-width: 600px;
}

.modal-info h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--bg-color) !important;
    text-transform: uppercase;
}

.modal-info p {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
    color: var(--bg-color) !important;
}

@media (max-width: 768px) {
    .modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    #modalImage {
        max-height: 60vh;
    }

    .modal-info {
        margin-top: 15px;
        padding: 0 10px;
    }

    .modal-info h3 {
        font-size: 1.5rem;
    }
}

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