/* General Body and Container Styles (can be reused from style.css) */
body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    width: 85%; /* Slightly wider for gallery */
    margin: auto;
    overflow: hidden;
    padding: 0 20px;
}

/* Header and Navigation (can be reused from style.css) */
header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    border-bottom: #77aaff 3px solid;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    float: left;
    margin: 0;
    padding: 0;
    font-size: 2em;
}

header nav {
    float: right;
    margin-top: 10px;
}

header ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

header li {
    display: inline;
    padding: 0 15px;
}

header a {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
    transition: color 0.3s ease;
}

header a:hover {
    color: #77aaff;
}

/* Section Padding (can be reused from style.css) */
.section-padding {
    padding: 60px 0;
    text-align: center;
}

/* Image Grid Styles */
.image-grid {
    display: grid;
    /* Responsive Grid: Adjust column count based on screen size */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px; /* Space between grid items */
    margin-top: 40px;
}

.grid-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    position: relative; /* For caption positioning */
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.grid-item img {
    width: 100%;
    height: 250px; /* Fixed height for consistent grid */
    object-fit: cover; /* Ensures images fill the space without distortion */
    display: block;
    transition: transform 0.3s ease;
}

/* Optional: Slight zoom on hover for the image */
.grid-item:hover img {
    transform: scale(1.03);
}

.caption {
    padding: 15px;
    font-size: 0.95em;
    color: #555;
    text-align: center;
    background-color: #f8f8f8;
    border-top: 1px solid #eee;
}

/* The Modal (Lightbox) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top */
    padding-top: 60px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}

/* Modal Content (Image) */
.modal-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 85vh; /* Max height relative to viewport height */
    object-fit: contain; /* Ensure the whole image fits */
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    animation-name: zoom;
    animation-duration: 0.6s;
}

/* Caption of Modal Image */
#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}

/* Add Animation - Zoom in the modal */
@keyframes zoom {
    from {transform:scale(0)}
    to {transform:scale(1)}
}

/* The Close Button */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001; /* Ensure it's above the image */
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Footer (can be reused from style.css) */
footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px; /* More space below gallery */
}

/* Responsive Adjustments */
@media only screen and (max-width: 768px) {
    .container {
        width: 95%; /* Wider on smaller screens */
    }

    header h1,
    header nav {
        float: none;
        text-align: center;
    }

    header nav ul {
        padding-top: 10px;
    }

    header li {
        display: block;
        padding: 5px 0;
    }

    .image-grid {
        grid-template-columns: 1fr; /* Stack images vertically on very small screens */
        gap: 15px;
    }

    .modal-content {
        max-width: 95%;
        max-height: 80vh;
    }

    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}