/* ============================================
   Gallery hero - same .hero-bg pattern as the Services page (blurred photo
   behind the text, not blurring the section itself), with an extra dark
   scrim layered between the photo and the text for a bit more contrast.
   ============================================ */
.gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(35, 31, 32, 0.35);
    z-index: 1;
}

/* ============================================
   Portfolio tabs section
   ============================================ */
.portfolio-tabs-section {
    position: relative;
    width: 95%;
    /* max-width: 2200px; */
    margin: 0 auto;
    padding: 6rem 0 4rem;
}

.portfolio-tabs-decor {
    position: absolute;
    top: -100px;
    left: 2rem;
    width: 180px;
    height: 210px;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(35, 31, 32, 0.25);
    z-index: 2;
}

    .portfolio-tabs-decor img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.portfolio-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    border-top: 1px solid var(--earth-border);
    padding-top: 2rem;
    margin-bottom: 3rem;
}

.portfolio-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: 'Literata', serif;
    font-weight: 300;
    font-size: 1.3rem;
    color: var(--earth-text-dark);
    opacity: 0.5;
    transition: opacity 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    padding: 0 0 0.5rem;
}

    .portfolio-tab:hover {
        opacity: 0.85;
    }

    .portfolio-tab.active {
        opacity: 1;
        color: var(--earth-brand);
        border-bottom-color: var(--earth-brand);
    }

.gallery-back-to-top {
    display: block;
    text-align: center;
    margin-top: 3rem;
    font-family: 'Lato', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.85rem;
    color: var(--earth-text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

    .gallery-back-to-top:hover {
        color: var(--earth-brand);
    }

/* ============================================
   Gallery grid (masonry)
   ============================================ */
.gallery-section {
    padding: 0;
    max-width: 100%;
    margin: 0;
}

/* True masonry via CSS columns - each image keeps its natural aspect ratio
   (no object-fit cropping), matching the template's justified/masonry
   portfolio grid instead of a fixed-cell grid that forces crops. */
.gallery-grid {
    column-count: 3;
    column-gap: 1.25rem;
    width: 100%;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 10px 28px rgba(35, 31, 32, 0.18);
    break-inside: avoid;
    margin-bottom: 1.25rem;
}

    .gallery-item::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, transparent 0%, rgba(35, 31, 32, 0.85) 75%);
        opacity: 0;
        transition: opacity 0.4s ease;
        z-index: 1;
    }

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

    .gallery-item img {
        width: 100%;
        height: auto;
        display: block;
        transition: transform 0.6s ease, filter 0.6s ease;
    }

    .gallery-item:hover img {
        transform: scale(1.04);
        filter: brightness(0.65) blur(1px);
    }

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.75rem;
    /* Solid-ish backdrop so the text sits on a clean panel instead of
       directly on the blurred/dimmed image, which read as fuzzy text. */
    background: linear-gradient(to top, rgba(35, 31, 32, 0.95) 0%, rgba(35, 31, 32, 0.75) 65%, rgba(35, 31, 32, 0) 100%);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: 2;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-overlay h3 {
    font-family: 'Literata', serif;
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--earth-lightest);
    margin-bottom: 0.4rem;
}

.gallery-overlay p {
    font-family: 'Lato', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: rgba(255, 255, 246, 0.75);
}

@media (max-width: 1024px) {
    .portfolio-tabs-section {
        width: 100%;
        padding: 5rem 2rem 3rem;
    }

    .portfolio-tabs {
        gap: 2rem;
    }

    .portfolio-tab {
        font-size: 1.1rem;
    }

    .portfolio-tabs-decor {
        display: none;
    }

    .gallery-grid {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .portfolio-tabs-section {
        padding: 3rem 1.25rem 2rem;
    }

    .portfolio-tabs {
        gap: 1.25rem;
    }

    .portfolio-tab {
        font-size: 0.95rem;
    }

    .gallery-grid {
        column-count: 1;
    }
}
