/* Project ZigZag Styles */
.project-zigzag-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Màu nền xen kẽ cho project-item */
.project-item {
    width: 100%;
    margin-bottom: 0px;
    overflow: hidden;
    /* box-shadow: 0 5px 20px rgba(0,0,0,0.05); */
    border-radius: 0px;
}

/* Item lẻ có màu trắng */
.project-item:nth-child(odd) {
    background-color: #fff;
}

/* Item chẵn có màu xám */
.project-item:nth-child(even) {
    background-color: #f3f4f6;
}

.project-header {
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.project-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    display: inline-block;
}

.project-title a {
    color: #222;
    text-decoration: none;
    transition: color 0.3s ease;
}

.project-title a:hover {
    color: #0066cc;
}

.project-title:after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: #0066cc;
    margin: 15px auto 0;
}

.project-excerpt {
    font-size: 16px;
    line-height: 1.7;
    color: #555;
    margin: 0 auto;
    max-width: 800px;
    text-align: center;
}

.project-gallery {
    width: 100%;
    padding: 0 20px 30px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr;
    grid-gap: 20px;
}

/* Gallery layout */
.featured-image {
    width: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
    position: relative;
    border-radius: 5px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    grid-column: 1;
    height: 100%;
    aspect-ratio: 4/3; /* Tỷ lệ cố định */
}

.featured-image img {
    width: 100%;
    height: 100%;
    max-height: 455px; /* Giảm chiều cao tối đa */
    display: block;
    transition: transform 0.5s ease;
    object-fit: cover;
}

.featured-image img:hover {
    transform: scale(1.02);
}

.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 266px);
    grid-gap: 10px;
    padding: 0;
    grid-column: 1;
    height: 100%;
}

.gallery-item {
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    position: relative;
    height: 100%;
    margin-bottom: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Cấu trúc đặc biệt cho gallery: dòng 1 có 2 cột, dòng 2 có 3 cột */
.gallery-item:nth-child(1) {
    grid-row: 1;
    grid-column: 1 / span 3; /* Chiếm 3/6 của grid (1.5 hình ở dòng 2) */
}

.gallery-item:nth-child(2) {
    grid-row: 1;
    grid-column: 4 / span 3; /* Chiếm 3/6 của grid (1.5 hình ở dòng 2) */
}

.gallery-item:nth-child(3) {
    grid-row: 2;
    grid-column: 1 / span 2; /* Chiếm 2/6 của grid */
}

.gallery-item:nth-child(4) {
    grid-row: 2;
    grid-column: 3 / span 2; /* Chiếm 2/6 của grid */
}

.gallery-item:nth-child(5) {
    grid-row: 2;
    grid-column: 5 / span 2; /* Chiếm 2/6 của grid */
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* Overlay cho hình thứ 5 nếu có nhiều hơn 5 hình */
.gallery-item.has-more-overlay {
    position: relative;
}

.gallery-item.has-more-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.gallery-item.has-more-overlay::after {
    content: attr(data-more-count);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    z-index: 2;
}

/* Ẩn các hình từ thứ 6 trở đi */
.gallery-item:nth-child(n+6) {
    display: none;
}

.gallery-item img:hover {
    transform: scale(1.03);
}

/* Tablet Layout */
@media (min-width: 768px) {
    .project-gallery {
        padding: 0 40px 40px;
        grid-template-columns: 1fr 1fr;
    }

    /* Mặc định featured-image bên phải cho tất cả */
    .featured-image {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .gallery-thumbnails {
        grid-column: 1;
        grid-template-columns: 1fr 1fr;
        grid-gap: 10px;
    }

    /* Đặc biệt cho layout giống hình mẫu */
    .gallery-thumbnails {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(2, 266px);
        grid-gap: 10px;
        height: 100%;
    }

    /* Item lẻ có featured-image bên trái */
    .project-item:nth-child(odd) .project-gallery .featured-image {
        grid-column: 1;
    }

    .project-item:nth-child(odd) .project-gallery .gallery-thumbnails {
        grid-column: 2;
    }

    /* Item chẵn có featured-image bên phải */
    .project-item:nth-child(even) .project-gallery .featured-image {
        grid-column: 2;
    }

    .project-item:nth-child(even) .project-gallery .gallery-thumbnails {
        grid-column: 1;
    }
}

/* Desktop Layout */
@media (min-width: 992px) {
    .project-header {
        padding: 50px 60px;
    }

    .project-title {
        font-size: 32px;
    }

    .project-gallery {
        grid-template-columns: 1fr 1fr;
        grid-gap: 10px;
        padding: 0 40px 50px;
    }

    /* Mặc định featured-image bên phải */
    .featured-image {
        grid-column: 2;
        grid-row: 1 / span 2;
        height: 538px;
    }

    .featured-image img {
        height: 100%;
        max-height: 538px;
        object-fit: cover;
    }

    .gallery-thumbnails {
        grid-column: 1;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(2, 266px);
        grid-gap: 10px;
        height: 100%;
    }

    .gallery-item {
        height: 100%;
    }

    /* Cấu trúc đặc biệt cho gallery: dòng 1 có 2 cột, dòng 2 có 3 cột */
    .gallery-item:nth-child(1) {
        grid-row: 1;
        grid-column: 1 / span 3; /* Chiếm 3/6 của grid (1.5 hình ở dòng 2) */
    }

    .gallery-item:nth-child(2) {
        grid-row: 1;
        grid-column: 4 / span 3; /* Chiếm 3/6 của grid (1.5 hình ở dòng 2) */
    }

    .gallery-item:nth-child(3) {
        grid-row: 2;
        grid-column: 1 / span 2; /* Chiếm 2/6 của grid */
    }

    .gallery-item:nth-child(4) {
        grid-row: 2;
        grid-column: 3 / span 2; /* Chiếm 2/6 của grid */
    }

    .gallery-item:nth-child(5) {
        grid-row: 2;
        grid-column: 5 / span 2; /* Chiếm 2/6 của grid */
    }

    /* Item lẻ có featured-image bên trái */
    .project-item:nth-child(odd) .project-gallery .featured-image {
        grid-column: 1;
    }

    .project-item:nth-child(odd) .project-gallery .gallery-thumbnails {
        grid-column: 2;
    }

    /* Item chẵn có featured-image bên phải */
    .project-item:nth-child(even) .project-gallery .featured-image {
        grid-column: 2;
    }

    .project-item:nth-child(even) .project-gallery .gallery-thumbnails {
        grid-column: 1;
    }
}

/* Large Desktop Layout */
@media (min-width: 1200px) {
    .project-zigzag-wrapper {
        max-width: 100%;
    }

    .project-header {
        padding: 60px 80px 50px;
    }

    .project-gallery {
        padding: 0 60px 60px;
        grid-gap: 10px;
    }

    .gallery-thumbnails {
        grid-gap: 10px;
    }

    .gallery-item {
        height: 100%;
    }
}

/* Scrollbar styling for gallery thumbnails */
.gallery-thumbnails::-webkit-scrollbar {
    width: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}