/* CSS Variables & Reset */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --accent-color: #000;
    --overlay-bg: rgba(255, 255, 255, 0.95);
    --transition-speed: 0.4s;
    --gap-size: 2rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
header {
    text-align: center;
    padding: 4rem 1rem 2rem;
    opacity: 0;
    animation: fadeInDown 1s ease-out forwards;
}

header h1 {
    font-weight: 300;
    letter-spacing: -0.05em;
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

header p {
    font-weight: 300;
    color: #6c757d;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Gallery Grid */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--gap-size);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 4px;
    background: #e9ecef; /* Placeholder color */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: calc(var(--i) * 0.1s);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: transform var(--transition-speed) cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow var(--transition-speed);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 1 / 1; /* Square aspect ratio */
    transition: transform 0.8s ease;
}

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

/* Caption Overlay (visible on hover) */
.gallery-item figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
    color: white;
    font-weight: 300;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.gallery-item:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    backdrop-filter: blur(5px);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    text-align: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    border-radius: 4px;
    transform: scale(0.95);
    transition: transform 0.4s ease;
}

.lightbox.active .lightbox-content img {
    transform: scale(1);
}

#lightbox-caption {
    margin-top: 1rem;
    font-weight: 400;
    color: var(--text-color);
}

#close-lightbox {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    font-size: 3rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 1;
}

#close-lightbox:hover {
    opacity: 1;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: #adb5bd;
}

/* Keyframes */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 1.5rem;
    }

    /* On mobile, maybe show caption always or differently? Keep hover for simplicity now, 
       but hover often maps to tap. */
}
