/* ========================================
   HOME PAGE STYLES - REFACTORED 2026-01-24
   ======================================== */

/* ========== BANNER CAROUSEL - FULL WIDTH ========== */
.banner-carousel {
    width: 100%;
    height: 97vh;
    max-height: 97vh;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    user-select: none;
    cursor: grab;
    display: flex;
    flex-direction: column;
}

.banner-carousel:active {
    cursor: grabbing;
}

.banner-wrapper {
    width: 100%;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.banner-slide.active {
    opacity: 1;
}

.banner-image-wrapper {
    width: 100%;
    height: 80vh;
    max-height: 800px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    flex-shrink: 0;
}

.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-slide-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.banner-content-wrapper {
    width: 100%;
    background: #f8f6f3;
    padding: 20px 30px 60px 30px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    overflow-y: auto;
    min-height: 0;
}

.banner-content {
    max-width: 1600px;
    margin: 0 auto;
    text-align: center;
}

.banner-title {
    font-weight: 700;
    color: #2D1E17;
    margin-bottom: 10px;
    line-height: 1.3;
}

.banner-description {
    position: relative;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
    text-align: justify;
    padding-right: 120px;
    margin: 0;
}

.banner-description::before {
    position: absolute;
    right: 0;
    padding-left: 5px;
    bottom: 0;
    font-size: 18px;
    width: 140px;
    height: 1.6em;
    background: #f8f6f2;
    color: #8B0000;
    cursor: pointer;
    white-space: nowrap;
}

/* Banner Dots */
.banner-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 100;
    pointer-events: auto;
}

.banner-dot {
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 101;
    pointer-events: auto;
}

.banner-dot:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.15);
}

.banner-dot.active {
    background: #fbbf24;
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
    transform: scale(1.25);
}

.banner-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.6);
    transform: scale(0.5);
    opacity: 0;
    transition: all 0.4s ease;
}

.banner-dot:active::after {
    transform: scale(2);
    opacity: 1;
}

/* Banner Navigation Buttons */
.banner-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    color: #333;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.banner-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: #000;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.banner-prev {
    left: 30px;
}

.banner-next {
    right: 30px;
}

/* ========== SECTION TITLE ========== */
.section-title-wrapper {
    text-align: center;
    margin-top: 50px;
    margin-bottom: -45px;
    font-family: 'GanhType', sans-serif !important;
}

.section-title-wrapper.sticky .section-title {
    color: #ffffff !important;
}

.section-title {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #222;
    text-transform: uppercase;
    margin-bottom: -30px;
}

.section-divider {
    width: 100px;
    height: 4px;
    background-color: #b46a32;
    border-radius: 2px;
    display: none;
}

/* ========== MASONRY GRID ========== */
.masonry-grid-container {
    column-count: 5;
    column-gap: 14px;
    margin: 0;
    padding: 0;
    width: 100%;
}

.masonry-grid-item {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    transition-delay: 0.05s;
}

/* ========== PINTEREST PC LAYOUT (≥992px) ========== */
@media (min-width: 992px) {

    /* Container chuyển thành flex row, mỗi cột là .masonry-col (JS tạo) */
    .masonry-grid-container {
        display: flex;
        column-count: unset;
        column-gap: unset;
        gap: 14px;
        align-items: flex-start;
    }

    /* Cột masonry flex */
    .masonry-col {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .masonry-grid-item {
        display: block;
        width: 100%;
        border-radius: 12px;
        overflow: hidden;
        position: relative;
        cursor: pointer;
        break-inside: unset;
    }

    .portfolio {
        border-radius: 12px;
        overflow: hidden;
        background: #f5f5f5;
        position: relative;
    }

    .portfolio .thumbnail {
        position: relative;
        overflow: hidden;
        border-radius: 12px;
    }

    .portfolio .thumbnail img {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 12px;
        transition: transform 0.4s ease;
        background: #eee;
    }

    /* Hover overlay - gradient từ dưới lên */
    .portfolio .thumbnail::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to top,
                rgba(0, 0, 0, 0.55) 0%,
                rgba(0, 0, 0, 0.15) 40%,
                transparent 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 2;
        border-radius: 12px;
        pointer-events: none;
    }

    .portfolio:hover .thumbnail::before {
        opacity: 1;
    }

    .portfolio:hover .thumbnail img {
        transform: scale(1.03);
    }

    /* Content overlay - compact, chỉ hiện khi hover */
    .portfolio .content {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 3;
        padding: 10px 12px;
        opacity: 0;
        transform: translateY(6px);
        transition: opacity 0.25s ease, transform 0.25s ease;
        pointer-events: none;
        top: auto;
        width: 100%;
        max-width: 100%;
        text-align: left;
        line-height: 1.4;
    }

    .portfolio:hover .content {
        opacity: 1;
        transform: translateY(0);
    }

    .portfolio .content .desc p {
        display: none;
    }

    .portfolio .content .desc .title {
        color: #fff !important;
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        line-height: 1.4;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .portfolio .sku-tag {
        position: absolute;
        bottom: auto;
        top: 8px;
        right: 8px;
        left: auto;
        transform: none;
        font-size: 10px;
        font-weight: 600;
        padding: 3px 8px;
        background: rgba(255, 255, 255, 0.9) !important;
        color: #333 !important;
        border-radius: 6px;
        min-width: auto;
        opacity: 0;
        transition: opacity 0.25s ease;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
    }

    .portfolio:hover .sku-tag {
        opacity: 1;
        transform: none;
    }

    .portfolio .read-more-btn {
        display: none !important;
    }

    .portfolio .content .firstp {
        display: none !important;
    }
}



.masonry-grid-item img {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    touch-action: pan-y !important;
}

/* ========== PORTFOLIO CARD ========== */
.portfolio-link {
    display: block;
    width: 100%;
}

.portfolio {
    position: relative;
    overflow: hidden;
    background: #fff;
    width: 100%;
}

.portfolio .thumbnail picture {
    display: block;
    width: 100%;
}

.portfolio .content,
.portfolio .content h4,
.portfolio .content p,
.portfolio .content a {
    color: black !important;
    text-shadow: none !important;
}

.portfolio .thumbnail {
    position: relative;
    z-index: 1;
}

.portfolio .thumbnail img {
    width: 100%;
    display: block;
    transition: transform 0.5s ease, opacity 0.4s ease;
}

.portfolio .thumbnail::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.0);
    opacity: 0;
    transition: opacity 0.4s ease, background-color 0.4s ease;
    z-index: 2;
}

.portfolio:hover .thumbnail::before {
    background-color: rgba(255, 255, 255, 0.75);
    opacity: 1;
}

.portfolio:hover .thumbnail img {
    transform: scale(1.015);
    opacity: 0.92;
}

.portfolio .content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    text-align: center;
    width: 95% !important;
    max-width: 95%;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.portfolio:hover .content {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
}

.portfolio:hover .content .desc p {
    text-align: justify !important;
    padding-left: 10px;
    padding-right: 10px;
}

.portfolio .read-more-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 24px;
    color: black;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    transition: all 0.3s ease;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    cursor: default;
}

.portfolio:hover .read-more-btn {
    opacity: 1;
    transform: translateY(0);
}

.portfolio .sku-tag {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    color: black;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 0;
    min-width: 250px;
    text-align: center;
    border-radius: 0;
    background: none !important;
    box-shadow: none !important;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.4s ease 0.1s, transform 0.3s ease 0.1s;
}

.portfolio:hover .sku-tag {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    background: none !important;
}

.portfolio .content a:hover {
    color: #c40000 !important;
}

/* ========== FADE ANIMATIONS ========== */
.fade-item {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: opacity 0.6s cubic-bezier(.25, .46, .45, .94),
        transform 0.6s cubic-bezier(.25, .46, .45, .94);
    will-change: opacity, transform;
}

.fade-item.fade-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ========== SKELETON LOADING ========== */
.skeleton {
    background: #f2f2f2;
    border-radius: 6px;
    width: 100%;
    height: 380px;
    animation: skeleton-loading 1.2s infinite linear;
}

@media (min-width: 992px) {
    .skeleton {
        height: 180px;
        border-radius: 12px;
    }
}

@keyframes skeleton-loading {
    0% {
        opacity: .6;
    }

    50% {
        opacity: .3;
    }

    100% {
        opacity: .6;
    }
}

/* ========== LAZY LOAD ========== */
.lazy-fade {
    opacity: 0;
    transition: opacity .5s ease;
}

.lazy-loaded {
    opacity: 1;
}

.lazy-image {
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.lazy-image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* ========== MOBILE IMAGE MODAL ========== */
.mobile-image-modal {
    position: fixed;
    inset: 0;
    background: rgba(157, 138, 124, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#mobileModalDesc {
    color: #523F31;
}

.mobile-image-modal.show {
    display: flex;
    animation: modal-fade-in 0.3s ease;
}

.mobile-image-modal__backdrop {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px 20px;
}

.mobile-image-modal__image-wrapper {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-image-modal__image-wrapper img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
}

.mobile-image-modal__preview {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(234, 221, 211, 0.95) 0%, rgba(234, 221, 211, 0.85) 60%, rgba(234, 221, 211, 0.4) 90%, transparent 100%);
    padding: 80px 20px 30px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    max-height: 60vh;
    overflow-y: auto;
}

.mobile-image-modal__preview.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.mobile-image-modal__preview-title {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    font-family: 'GanhType', sans-serif !important;
}

.mobile-image-modal__preview-desc {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    max-height: 350px;
    padding: 0 5px;
    text-align: justify;
}

.mobile-image-modal__preview-btn {
    background: #796254;
    color: #fff;
    border: 2px solid #796254;
    padding: 10px 30px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(121, 98, 84, 0.3);
}

.mobile-image-modal__preview-btn:active {
    transform: scale(0.96);
}

.mobile-image-modal__close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100000;
    transition: transform 0.2s ease, background 0.2s ease;
}

.mobile-image-modal__close:active {
    transform: scale(0.93);
    background: rgba(0, 0, 0, 0.85);
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== RESPONSIVE - Desktop 1920px ========== */
@media (max-width: 1919px) {
    .banner-content {
        max-width: 1700px !important;
    }

    .banner-description {
        position: relative !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        overflow: hidden !important;
        line-height: 1.6 !important;
        text-align: justify !important;
        padding-right: 120px !important;
    }

    .banner-description::before {
        position: absolute;
        right: 0;
        padding-left: 5px;
        bottom: 0;
        font-size: 18px;
        width: 140px;
        height: 1.6em;
        background: #f8f6f2;
        color: #8B0000;
        cursor: pointer;
        white-space: nowrap;
    }
}

/* Column count cho PC được quản lý bởi JS masonry engine */

/* ========== RESPONSIVE - Desktop/Tablet ========== */
@media (min-width: 1024px) {
    .banner-title {
        font-size: 26px;
    }
}

/* ========== RESPONSIVE - Tablet (removed, handled by mobile ≤991px) ========== */

@media (max-width: 991px) {
    .masonry-grid-container {
        column-count: 2 !important;
        column-gap: 12px !important;
    }

    .masonry-grid-item {
        display: inline-block !important;
        width: 100% !important;
        break-inside: avoid;
        margin-bottom: -4px !important;
        background: white;
        border-radius: 8px;
        overflow: hidden;
    }

    /* Mobile: bỏ fade-item effect — hiện items ngay lập tức */
    .masonry-grid-item.fade-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* Mobile loadMore fade-in animation */
    .masonry-grid-item.mobile-new {
        animation: mobileFadeIn 0.5s ease forwards;
    }

    @keyframes mobileFadeIn {
        from {
            opacity: 0;
            transform: translateY(15px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .masonry-grid-item img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    .section-title-wrapper {
        margin-bottom: -35px !important;
    }

    .section-title-wrapper.sticky {
        background-color: #796254 !important;
    }

    /* Banner carousel mobile */
    .banner-carousel {
        position: relative;
        overflow: hidden;
    }

    .banner-slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .banner-content-wrapper {
        position: absolute !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 10;
        pointer-events: none;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        height: auto !important;
    }

    .banner-content {
        background: linear-gradient(to top, rgba(234, 221, 211, 0.95) 0%, rgba(234, 221, 211, 0.85) 60%, rgba(234, 221, 211, 0.4) 90%, transparent 100%) !important;
        padding: 80px 20px 30px !important;
        text-align: center !important;
        max-width: 100% !important;
        pointer-events: auto;
        margin: 0 !important;
        width: 100% !important;
    }

    .banner-title {
        font-family: 'GanhType', sans-serif !important;
        font-size: 18px !important;
        font-weight: bold !important;
        color: #523F31 !important;
        margin-bottom: 10px !important;
        text-align: center !important;
        text-shadow: none !important;
        white-space: normal !important;
    }

    .banner-description {
        height: 175px;
        max-height: 175px;
        color: #523F31 !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
        text-align: justify !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        padding-right: 0px !important;
        width: 100% !important;
        margin-bottom: 0 !important;
        text-shadow: none !important;
    }

    .banner-description::before {
        display: none !important;
        content: none !important;
    }

    /* Hide portfolio content on mobile */
    .portfolio .thumbnail::before {
        display: none !important;
        opacity: 0 !important;
    }

    .portfolio .thumbnail img {
        transform: none !important;
        opacity: 1 !important;
    }

    .portfolio .content,
    .portfolio .sku-tag,
    .portfolio .read-more-btn {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .portfolio:hover .thumbnail img {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ========== RESPONSIVE - Mobile ========== */
@media (max-width: 768px) {
    .banner-nav-btn {
        display: none;
    }

    .banner-title {
        font-size: 20px !important;
    }

    .banner-description {
        font-size: 16px !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        overflow: hidden !important;
        text-align: justify !important;
        text-overflow: ellipsis !important;
        white-space: normal !important;
        padding-right: 0px !important;
    }

    .section-title {
        font-size: 20px;
        padding-top: 0px !important;
        margin-top: -10px !important;
        padding-bottom: 10px !important;
    }

    .section-title-wrapper {
        height: 40px;
    }

    .section-padding {
        padding-top: 60px;
    }

    .masonry-grid-container {
        column-count: 2;
    }
}

/* ========== RESPONSIVE - Small Mobile ========== */
@media (max-width: 576px) {
    .section-title {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .masonry-grid-container {
        column-count: 2 !important;
        column-gap: 8px !important;
    }
}