/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::after,
*::before {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0a0a0a;
    color: #f0f0f0;
    line-height: 1.6;
}

.back-to-home {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 100;
    color: #888;
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
    background: rgba(10, 10, 10, 0.8);
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
}

.back-to-home:hover {
    color: #f0f0f0;
}

img {
    display: block;
    max-width: 100%;
}

/* ============================================================
   GALLERY HEADER
   ============================================================ */
.gallery {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.gallery-title {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 300;
    text-align: center;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #f0f0f0, #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    margin-bottom: 3rem;
}

/* ============================================================
   GALLERY GRID — CSS Masonry Layout
   Uses grid-auto-rows + span for masonry-like effect
   ============================================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 200px;
    gap: 0.75rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
}

/* Tall items span 2 rows */
.gallery-item.tall {
    grid-row: span 2;
}

/* Wide items span 2 columns */
.gallery-item.wide {
    grid-column: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.5s ease;
    filter: brightness(0.85) saturate(0.9);
}

/* Hover: zoom + brighten */
.gallery-item:hover img {
    transform: scale(1.08);
    filter: brightness(1) saturate(1.1);
}

/* ============================================================
   OVERLAY ON HOVER
   ============================================================ */
.gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.overlay-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.overlay-desc {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 0.25rem;
}

/* ============================================================
   LIGHTBOX — Pure CSS Checkbox Hack
   Hidden checkboxes toggle full-screen overlay
   ============================================================ */
.lightbox-toggle {
    display: none;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

.lightbox-toggle:checked + .lightbox-overlay {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: lightboxIn 0.3s ease;
}

@keyframes lightboxIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-caption {
    text-align: center;
}

.lightbox-caption h2 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.lightbox-caption p {
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.25rem;
}

.lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

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

/* ============================================================
   RESPONSIVE — Tablet (800px)
   ============================================================ */
@media (max-width: 800px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
    }

    .gallery-item.tall {
        grid-row: span 2;
    }

    .gallery-item.wide {
        grid-column: span 1;
    }
}

/* ============================================================
   RESPONSIVE — Mobile (500px)
   ============================================================ */
@media (max-width: 500px) {
    .gallery {
        padding: 2rem 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 250px;
    }

    .gallery-item.tall {
        grid-row: span 1;
    }

    .gallery-item.wide {
        grid-column: span 1;
    }

    .gallery-overlay {
        opacity: 1;
    }

    .lightbox-content {
        max-width: 95vw;
    }

    .lightbox-close {
        top: -2rem;
        right: -0.5rem;
        font-size: 1.5rem;
    }
}
