/* Basic Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}

h1 {
    text-align: center;
}

/* Intro Content Styles */
.intro-content {
    max-width: 1200px; /* Same max-width as gallery for alignment */
    margin: 20px auto 40px; /* Top, auto horizontal, bottom */
    padding: 0 15px; /* Horizontal padding */
    text-align: left; /* Default for content inside */
}

/* Override centered h1 for the intro section */
.intro-content h1 {
    text-align: left;
}

/* Gallery Styles */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    height: 150px; /* Set a fixed height to prevent layout shift */
    border-radius: 8px; /* Match the image's border-radius */
    background-color: #eee; /* A light placeholder color while the image loads */
    overflow: hidden; /* Ensures content respects the border-radius */
}

.gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    /* Helps browser render scaled images more smoothly, reducing moiré patterns */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.gallery-item img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}

.modal-content {
    margin: auto;
    display: block;
    width: auto;
    height: auto;
    max-width: 85%;
    max-height: 75vh;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
    font-size: 1.2em;
}

/* Animation */
.modal-content, #caption {
    animation-name: zoom;
    animation-duration: 0.4s;
}

@keyframes zoom {
    from {transform:scale(0.8)}
    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;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}