/* =========================================================================
   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;
    grid-auto-flow: dense;
}

.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.item-portrait {
    grid-column: span 4;
    grid-row: span 2;
}

.masonry-item.item-landscape {
    grid-column: span 8;
    grid-row: span 2;
}

.masonry-item.item-square {
    grid-column: span 4;
    grid-row: span 1;
}

@media screen and (max-width: 1024px) {
    
    .masonry-item.item-portrait {
        grid-column: span 12;
        grid-row: span 2;
    }
    
    .masonry-item.item-landscape {
        grid-column: span 12;
        grid-row: span 1;
    }
    
    .masonry-item.item-square {
        grid-column: span 12;
        grid-row: span 1;
    }
}

.masonry-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 27, 28, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    opacity: 0;
    transition: var(--transition);
}

.overlay-details {
    margin-bottom: 12px;
    transform: translateY(15px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
}

.masonry-overlay i {
    color: var(--clean-white);
    font-size: 1.8rem;
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0.7;
}

.overlay-details h3 {
    font-family: var(--font-title);
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
}

.overlay-details p {
    font-family: var(--font-body);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 300;
    margin: 0;
}

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

.masonry-item:hover img {
    transform: scale(1.05);
}

.masonry-item:hover .overlay-details {
    transform: translateY(0);
    opacity: 1;
}

.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: block;
    position: relative;
    width: 95%;
    max-width: 1400px;
    max-height: 94vh;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    color: white;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0px 10px;
    transition: color 0.3s;
    z-index: 2700;
}

.lightbox-close:hover {
    color: var(--accent-color, #c5a880);
}

/* Lightbox Split Layout */
.lightbox-split {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    min-height: 480px;
    max-height: 90vh;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}

.lightbox-left {
    flex: 2; /* Make the image container significantly larger! */
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    justify-content: center;
    align-items: center;
    border-right: none;
    overflow: visible;
}

.lightbox-media-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-img-container {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    max-height: 82vh; /* Increased from 72vh */
    overflow: hidden;
    border-radius: 6px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    cursor: zoom-in;
    transform-origin: center center;
}

.lightbox-img:hover {
    transform: scale(2.0);
}

/* Watermark inside the image container */
/* DISABLED: Watermark is now baked into the image via canvas (generateWatermarkedImageUrl) */
/* The CSS overlay caused a double-watermark bug when canvas version was also active */
.lightbox-image-watermark {
    display: none !important;
}

/* Thumbnails Carousel */
.lightbox-thumbnails-carousel {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    background: transparent;
    width: 100%;
    overflow-x: auto;
    justify-content: center;
    border-top: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.lightbox-thumb {
    width: 52px;
    height: 52px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: var(--transition, 0.3s);
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.lightbox-thumb.active,
.lightbox-thumb:hover {
    opacity: 1;
    border-color: var(--accent-color, #c5a880);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Right Side details: narrower, pushed to the right, transparent background */
.lightbox-right {
    flex: 0.7; /* Make the description container smaller */
    padding: 40px 0 40px 60px; /* Pad left to push it further right */
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent;
    color: var(--text-color, #e0e0e0);
    overflow-y: auto;
}

.lightbox-title {
    font-family: 'Kozuka Mincho Pr6N R', 'Kozuka Mincho Pr6N', 'Kozuka Mincho', 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--clean-white, #ffffff);
    margin-top: 0;
    margin-bottom: 15px;
    line-height: 1.4;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.lightbox-divider {
    height: 2px;
    width: 50px;
    background: var(--accent-color, #c5a880);
    margin-bottom: 20px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.3);
}

.lightbox-desc {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-muted, #a0a0a0);
    margin: 0;
}

/* Navigation inside Left Pane */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 20px;
    width: 44px;
    height: 44px;
    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(--accent-color, #c5a880);
    color: #000;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    background: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 2600;
}

/* =========================================================================
   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;
    }

    /* Split layout stacked vertical on mobile */
    .lightbox-content {
        max-height: 90vh;
        width: 95%;
    }

    .lightbox-split {
        flex-direction: column;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .lightbox-left {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    }
    
    .lightbox-img {
        max-height: 40vh;
    }
    
    .lightbox-right {
        flex: none;
        width: 100%;
        padding: 20px;
    }
    
    .lightbox-title {
        font-size: 1.3rem;
    }

    /* DISABLED: masonry-item::after watermark overlay removed (double watermark bug) */
    /* .masonry-item::after { width: 45%; height: 18%; } */

    /* DISABLED: CSS watermark overlay is permanently hidden - canvas bakes it instead */
    /* .lightbox-image-watermark { width: 45%; height: 18%; } */
}