/* Basic Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: sans-serif; background: #f4f4f4; padding: 20px; }

/* --- Responsive Grid --- */
.gallery-container {
    display: grid;
    /* This magic line creates a responsive grid without media queries */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.gallery-item {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: scale(1.03);
}

.thumb-img {
    width: 100%;
    height: 200px; /* Fixed height for uniformity */
    object-fit: cover; /* Crops image to fit the box cleanly */
    display: block;
}
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    max-height: 90vh;
    object-fit: contain;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

/* Close Button */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

/* --- New Navigation Buttons --- */
.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px; /* Offset to center exactly */
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.3s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    z-index: 1001; /* Ensure above image */
}

/* Position the "next button" to the right */
.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

/* Position the "prev button" to the left */
.prev {
    left: 0;
    border-radius: 3px 0 0 3px;
}

/* Hover effects */
.prev:hover, .next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.download-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 1002; /* Above everything */
    transition: background-color 0.3s;
    font-family: sans-serif;
}

.download-btn:hover {
    background-color: #fff;
    color: #000;
}

/* Adjustments for Close/Prev/Next buttons to ensure they don't overlap */
.prev, .next {
    /* Ensure arrows don't cover the download button on small screens */
    z-index: 1001; 
}