/* ==========================================================================
   1. Reset & Global Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000000; /* Sleek dark background */
    color: #f8fafc;
    min-height: 100vh;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    color: #38bdf8; /* Bright accent blue */
}

header p {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* ==========================================================================
   2. Gallery Grid Layout
   ========================================================================== */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    /* Automatically creates columns that fit the screen, minimum 300px wide */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 0 1rem;
}

/* ==========================================================================
   3. Interactive Gallery Cards
   ========================================================================== */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    background-color: #1e293b;
}

/* Image Handling & Zoom Animation */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1); /* Smooth zoom out/in effect */
}

/* ==========================================================================
   4. Interactive Overlay (Caption)
   ========================================================================== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to top,
        rgba(15, 23, 42, 0.95) 0%,
        rgba(15, 23, 42, 0.4) 60%,
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;

    /* Initially hidden and shifted down */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Reveal Overlay on Hover */
.gallery-item:hover .overlay {
    opacity: 1;
    transform: translateY(0);
}

.overlay h3 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    color: #fff;
    font-weight: 600;
}

.overlay p {
    font-size: 0.95rem;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* ==========================================================================
   5. Lightbox / Preview System
   ========================================================================== */

/* The full-screen overlay backdrop */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.9); /* Dark semi-transparent background */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;

    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

/* The magic ingredient: triggers when the URL hash matches the ID */
.lightbox:target {
    opacity: 1;
    pointer-events: auto;
}

/* Invisible link covering the background so clicking outside the photo closes it */
.lightbox-close-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
}

/* Container for the high-res image and close button */
.lightbox-content {
    position: relative;
    max-width: 85%;
    max-height: 85%;
    transform: scale(0.9);
    transition: transform 0.4s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

/* Scale up the image container smoothly when the lightbox opens */
.lightbox:target .lightbox-content {
    transform: scale(1);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    display: block;
    object-fit: contain;
}

/* The 'X' Close Button */
.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 2rem;
    text-decoration: none;
    font-weight: bold;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-button:hover {
    color: #38bdf8; /* Accent color change on hover */
}