/* Reset and global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    padding: 20px;
}

/* Header styling */
.gallery-header {
    text-align: center;
    margin: 40px 0;
}

.gallery-header h1 {
    font-size: 2.5rem;
    color: #222;
    margin-bottom: 10px;
}

.gallery-header p {
    color: #666;
}

/* Responsive Grid Layout */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

/* Individual Gallery Cards */
.gallery-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: max-content;
    margin: 0 auto;
}

/* Wrap thumbnail in a pointer link */
.gallery-link {
    display: block;
    cursor: pointer;
    overflow: hidden;
}

/* Container for images to control zoom */
.gallery-item img {
    width: auto;
    height: 120px;
    object-fit: normal; 
    display: block;
    transition: transform 0.5s ease;
    margin: 0 auto; 
}

/* Image Captions */
.gallery-item .caption {
    padding: 10px 15px; /* Slightly tighter top/bottom padding */
    text-align: center;
    font-weight: 600;
    font-size: 0.825rem; 
    color: #444;
    background-color: #fff;
    white-space: normal; 
    word-break: break-word; 
}

/* Hover Effects on Grid Items */
.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

/* ==========================================================================
   PURE CSS LIGHTBOX MODAL
   ========================================================================== */

.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    
    /* Center the high-res image */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Activated State via URL fragment anchor (#) */
.lightbox-modal:target {
    opacity: 1;
    pointer-events: auto;
}

/* The High-Res Image inside the Modal */
.lightbox-content {
    max-width: 90%;
    max-height: 85%;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

/* Close Button (X) */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #ff6b6b;
}

/* Background Click Dismiss Target */
.lightbox-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
    z-index: -1;
}
