:root {
    --accent-gold: #d4af37;
    --navy-blue: #0a1172;
    --charcoal: #2c3e50;
    --white: #ffffff;
    --light-bg: #f8f9fa;
    --medium-gray: #e9ecef;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--light-bg);
    color: var(--charcoal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Search Section */
.search-container {
    max-width: 500px;
    margin: 40px auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 2px solid var(--medium-gray);
    border-radius: 30px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-md);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--navy-blue);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.gallery-item {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.image-container {
    height: 200px;
    overflow: hidden;
    background: #f0f0f0;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.gallery-content {
    padding: 15px;
}

.gallery-title {
    font-size: 1rem;
    color: var(--navy-blue);
    margin-bottom: 5px;
}

.gallery-date {
    font-size: 0.8rem;
    color: #666;
}

/* Lightbox - REWRITTEN FOR EXACT PHOTO SIZE */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Semi-transparent backdrop */
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    display: inline-block;
    /* Wraps tight to the image */
    max-width: 95vw;
    max-height: 90vh;
}

.lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    object-fit: contain;
    /* Ensures photo shows fully */
}

.lightbox-close {
    position: fixed;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 10001;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#lightbox-caption {
    width: 100%;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.7);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .image-container {
        height: 140px;
    }

    .gallery-title {
        font-size: 0.9rem;
    }
}