/* =========================================================================
   INNER PAGES (e.g. Kitchen Gallery)
========================================================================= */
.page-header {
    margin-top: 0;
    padding-top: 80px; /* Offset for solid navbar */
    height: 430px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page-title {
    color: var(--clean-white);
    font-size: 3rem;
    margin-bottom: 10px;
}

.page-breadcrumbs {
    color: var(--off-white);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.page-breadcrumbs a {
    color: var(--warm-oak);
    font-weight: 500;
}

.page-breadcrumbs a:hover {
    color: var(--clean-white);
}

/* Masonry Gallery Grid */
.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 250px;
    gap: 30px;
}

.masonry-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.masonry-item:nth-child(1) {
    grid-column: span 8;
    grid-row: span 2;
}

/* Large Hero Photo */
.masonry-item:nth-child(2) {
    grid-column: span 4;
    grid-row: span 1;
}

/* Smaller Square Right */
.masonry-item:nth-child(3) {
    grid-column: span 4;
    grid-row: span 1;
}

/* Smaller Square Bottom Right */

/* Portrait Item Variant */
.masonry-item.item-portrait {
    grid-column: span 5;
    grid-row: span 3;
}

@media screen and (max-width: 1024px) {

    .masonry-item:nth-child(1),
    .masonry-item:nth-child(2),
    .masonry-item:nth-child(3) {
        grid-column: span 12;
        grid-row: span 1;
    }
    
    .masonry-item.item-portrait {
        grid-column: span 12;
        grid-row: span 2; /* taller on mobile too */
    }
}

.masonry-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 27, 28, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.masonry-overlay i {
    color: var(--clean-white);
    font-size: 2.5rem;
    transform: scale(0.5);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.masonry-item:hover .masonry-overlay {
    opacity: 1;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

.masonry-item:hover .masonry-overlay i {
    transform: scale(1);
}

/* =========================================================================
   Lightbox Gallery UI
========================================================================= */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    display: inline-block;
    position: relative;
    max-width: 90%;
    max-height: 90vh; /* Changed to match image */
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox-content::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 30%;
    height: 13%;
    max-width: 400px;
    max-height: 135px;
    background-image: url('assets/watermark-cropped.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom right;
    z-index: 2500;
    opacity: 0.8;
    pointer-events: none;
    filter: invert(1) brightness(2);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0px 10px;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: var(--warm-oak, #c19a6b);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s, color 0.3s;
    z-index: 2600;
}

.lightbox-nav:hover {
    background: var(--warm-oak, #c19a6b);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

.lightbox-counter {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 2px;
}

/* =========================================================================
   MEDIA QUERIES (MOBILE RESPONSIVE GALLERY)
========================================================================= */
@media screen and (max-width: 768px) {
    .page-header {
        height: 300px;
        padding-top: 100px;
    }
    
    .page-title {
        font-size: 2.2rem;
        text-align: center;
    }

    .masonry-gallery {
        gap: 15px;
    }

    /* Increase minimum touch target for close button */
    .lightbox-close {
        top: -60px;
        font-size: 48px;
        padding: 10px 15px;
    }

    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-nav {
        background: rgba(0, 0, 0, 0.7);
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Ensure watermark is legible on smaller mobile screens */
    .masonry-item::after {
        width: 45%;
        height: 18%;
    }

    .lightbox-content::after {
        width: 45%;
        height: 18%;
    }
}