/* --- Keep general Body and Layout Styles as they are --- */
body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9em;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
}

header {
    background-color: #f8f8f8;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

h1 {
    font-size: 2em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    padding: 10px;
    max-width: 1200px;
    margin: 20px auto;
    position: relative;
    z-index: 1; /* Place the gallery below the lightbox */
}

.image-item {
    border: 1px solid #ddd;
    padding: 5px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
}

.image-item img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

footer {
    background-color: black;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    font-size: 0.85em;
}

footer a {
    color: white;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* --- Lightbox Styles --- */
.lightbox-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place relative to the viewport */
    z-index: 1000; /* Sit on top of everything else */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: hidden; /* Prevent scrollbars from the modal itself, image handles overflow */
    background-color: rgba(0,0,0,0.8); /* Translucent background */
    backdrop-filter: blur(5px); /* Optional: Adds blur effect */
    -webkit-backdrop-filter: blur(5px); /* For Safari compatibility */
    display: flex; /* This will be set by JS when visible */
    align-items: center; /* Vertically center content */
    justify-content: center; /* Horizontally center content */
}

.lightbox-content {
    /* This targets the <img> element directly */
    max-width: 98vw;   /* Max width relative to viewport width */
    max-height: 98vh;  /* Max height relative to viewport height */
    width: auto;       /* Allow image to take its natural width up to max */
    height: auto;      /* Allow image to take its natural height up to max */
    display: block;    /* Ensure it's a block element for sizing */
    object-fit: contain; /* Scales image down while preserving aspect ratio and fitting within bounds */
    background-color: #fff; /* DEBUGGING: Add a white background to the image area */
    padding: 5px;     /* DEBUGGING: Add padding to see the background area */
    box-sizing: border-box; /* Include padding in width/height calculations */
    box-shadow: 0 0 15px rgba(0,0,0,0.5); /* Optional: subtle shadow */
}

.close-button {
    position: absolute;
    top: 20px;
    right: 10px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001; /* Ensure close button is above the image and background */
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}
