/* General Styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: white;
    text-align: center;
}

header {
    padding: 20px 20px;
}

/* --- The Grid System --- */
.gallery-container {
    display: grid;
    /* Automatically creates columns that fit the screen width */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    padding: 15px;
    max-width: 95%;
    margin: 0 auto;
}

.gallery-item {
    height: 250px;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.gallery-item:hover {
    transform: scale(1.03);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Keeps thumbnails uniform */
    display: block;
}

/* --- Lightbox Logic --- */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Show lightbox when JS adds 'active' class */
.lightbox.active {
    display: flex;
}

/* The core logic to prevent scrolling */
.lightbox-content {
    max-width: 95%;   /* Max width relative to screen */
    max-height: 85vh; /* Max height relative to screen height */
    object-fit: contain; /* Ensures entire image is visible without cropping */
    border: 2px solid #444;
    border-radius: 4px;
    animation: zoomIn 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 50px;
    color: white;
    cursor: pointer;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}