/* Basic page styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: black;
    color: #f4f4f4;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

/* --- THIS SECTION IS COMPLETELY CHANGED --- */
.gallery-container {
    /* Instead of Grid, we use columns */
    /* Adjust '3' for more or fewer columns */
    column-count: 3; 
    column-gap: 15px; /* Space between columns */
}

.gallery-item {
    /* This prevents a single image from breaking across columns */
    break-inside: avoid;
    margin-bottom: 15px; /* Space between rows */
    display: inline-block; /* Important for this layout */
    width: 100%; /* Make item fill the column */
}

.gallery-item img {
    width: 100%;
    height: auto; /* THIS IS THE KEY: lets height be natural */
    /* object-fit: cover is no longer needed */
    
    /* We can keep the hover effects */
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-item img:hover {
    transform: scale(1.03);
    opacity: 0.8;
}
/* --- END OF MAJOR CHANGES --- */


/* The lightbox overlay (hidden by default) */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: black; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* The large image inside the lightbox */
.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    border-radius: 5px; 
}

/* The caption text */
.caption {
    color: #ccc;
    font-size: 1.2rem;
    margin-top: 15px;
}

/* The close button */
.close-button {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover {
    color: #bbb;
}

/* Common style for Next/Prev buttons */
.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    z-index: 1001;
    padding: 10px 15px;
}

.nav-button:hover {
    color: #bbb;
}

/* Position specific buttons */
.prev-button {
    left: 10px;
}

.next-button {
    right: 10px;
}