/* ================================
   CLIENT GALLERY - MASONRY LAYOUT
   For WeirdspaceRPG and other client pages
   ================================ */

/* Gallery Section */
.project-gallery {
    padding: 80px 0;
    background: rgba(248, 246, 240, 0.9);
}

.project-gallery h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: #2c2c2c;
}

.project-gallery .section-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 3rem;
    font-size: 1.2rem;
    font-style: italic;
}

/* Masonry Grid Container - Desktop (3 columns) */
.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

/* Individual Gallery Items */
.gallery-masonry-item {
    position: relative;
    background: #f5f1e8;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 2px solid rgba(139, 69, 19, 0.1);
}

.gallery-masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(139, 69, 19, 0.2);
    border-color: rgba(139, 69, 19, 0.3);
}

/* Aspect Ratio Handling */
.gallery-masonry-item[data-orientation="portrait"] {
    aspect-ratio: 1 / 1.414;
    width: 100%;
    height: auto;
}

/* Default: Landscape spans 2 columns (Mike Mollman style) */
.gallery-masonry-item[data-orientation="landscape"] {
    grid-column: span 2;
    aspect-ratio: 1.414 / 1;
    width: 100%;
    height: auto;
}

/* Optional: Landscape spans FULL WIDTH (Caravel Games style) */
.gallery-masonry-item[data-orientation="landscape"][data-span="full"] {
    grid-column: 1 / -1; /* Spans all columns */
}

.gallery-masonry-item[data-orientation="square"] {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
}

/* Optional: Manual spacer for gaps in layout */
.gallery-spacer {
    visibility: hidden;
    pointer-events: none;
}

/* Images - Fill containers */
.gallery-masonry-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    background: #f5f1e8;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: sepia(0.05) contrast(1.05);
}

.gallery-masonry-item:hover img {
    filter: sepia(0) contrast(1.1);
}

/* ================================
   AMAZON-STYLE ZOOM (DESKTOP ONLY)
   ================================ */

/* Zoom Container */
.zoom-container {
    cursor: crosshair;
    position: relative;
    overflow: hidden;
}

/* Desktop Zoom Effect */
@media (min-width: 769px) {
    .zoom-container:hover img {
        transform: scale(1.15);
    }
}

/* Gallery Captions */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.85) 40%,
        rgba(0, 0, 0, 0.6) 70%,
        transparent 100%
    );
    color: white;
    padding: 2rem 1.5rem 1rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    pointer-events: none;
}

/* Desktop: Slide up on hover */
@media (min-width: 769px) {
    .zoom-container:hover .gallery-caption {
        transform: translateY(0);
    }
}

/* Mobile: Always visible */
@media (max-width: 768px) {
    .gallery-caption {
        position: relative;
        transform: translateY(0);
        padding: 1rem;
        background: rgba(0, 0, 0, 0.9);
        border-radius: 0 0 15px 15px;
        pointer-events: auto;
        display: block;
    }
}

.gallery-caption h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: white;
}

.gallery-caption p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* ================================
   TABLET LAYOUT - 2 Columns
   ================================ */
@media (max-width: 1023px) and (min-width: 769px) {
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Default: Landscape spans both columns */
    .gallery-masonry-item[data-orientation="landscape"] {
        grid-column: 1 / -1;
    }
    
    /* Full-width landscape also spans both columns on tablet */
    .gallery-masonry-item[data-orientation="landscape"][data-span="full"] {
        grid-column: 1 / -1;
    }
}

/* ================================
   MOBILE LAYOUT - 1 Column
   ================================ */
@media (max-width: 768px) {
    .project-gallery {
        padding: 60px 0;
    }
    
    .project-gallery h2 {
        font-size: 1.8rem;
    }

    .gallery-masonry {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .gallery-masonry-item {
        border-radius: 15px;
        overflow: hidden;
        aspect-ratio: auto;
        height: auto;
    }
    
    .gallery-masonry-item[data-orientation="portrait"],
    .gallery-masonry-item[data-orientation="landscape"],
    .gallery-masonry-item[data-orientation="square"] {
        aspect-ratio: auto;
        grid-column: span 1;
    }
    
    .gallery-masonry-item img {
        height: auto;
    }

    /* Remove zoom effect on mobile */
    .zoom-container {
        cursor: default;
        overflow: hidden;
        border-radius: 15px;
    }
    
    .gallery-masonry-item:hover {
        transform: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }
    
    .gallery-masonry-item:hover img {
        transform: none;
    }
    
    .gallery-caption {
        padding: 2rem 1rem 1rem;
    }
    
    .gallery-caption h4 {
        font-size: 1rem;
    }
    
    .gallery-caption p {
        font-size: 0.85rem;
    }
}