/* General Styling */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
}

/* Main Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    max-width: 900px;
    margin: auto;
    padding: 20px;
}

/* Image Wrapper */
.grid-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    padding: 10px; /* Adds spacing inside each item */
    border-radius: 8px; /* Optional: Rounded corners */
    box-shadow: 5px 5px 5px 5px rgba(0, 0, 0, 0.1); /* Optional: Shadow for depth */
}

/* Title Above Image */
.title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin-bottom: 5px; /* Space between title and image */
}

/* Image Styling */
.grid-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* Overlay Effect */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay-title {
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.3s ease;
    white-space: normal;
    word-break: break-word;
    max-width: 90%;
}

/* Hover Effects */
.grid-item:hover .title {
    opacity: 0;
}

.grid-item:hover img {
    transform: scale(1.1);
}

.grid-item:hover .overlay {
    opacity: 1;
}

.grid-item:hover .overlay-title {
    transform: scale(1.2);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 900px; /* Adjust max width */
    max-height: 90vh; /* Prevent overflow */
    overflow-y: auto; /* Enable scrollbar */
    position: relative;
    text-align: center;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
}

/* Modal Grid */
.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 20px;
}

.modal-grid img {
    width: 100%;
    height: 120px; /* Fixed height for consistency */
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.modal-grid img:hover {
    transform: scale(1.3); /* Increase zoom effect */
}

/* Responsive */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: repeat(1, 1fr);
    }

    .modal-content {
        width: 95%;
    }

    .modal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
