/* =========================================
   FEATURES CSS (SECTION 4)
   ========================================= */

.features-section {
    padding: 80px 0 100px;
    background-color: #f6f5f2; /* Light beige/off-white background matching the image */
}

.features-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.features-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    line-height: 1.1;
    text-transform: uppercase;
    max-width: 700px;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 1px solid var(--color-navy);
    border-radius: var(--border-radius-pill);
    color: var(--color-navy);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-outline:hover {
    background-color: var(--color-navy);
    color: var(--color-white);
}

/* INTERACTIVE BENTO GRID SYSTEM */
.features-interactive-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bento-flex-row {
    display: flex;
    gap: 20px;
    height: 380px; /* Cố định chiều cao để không bị nhảy khung khi hover */
}

.bento-item {
    position: relative;
    overflow: hidden;
    transition: flex 0.6s cubic-bezier(0.25, 1, 0.5, 1), filter 0.6s ease;
    display: flex;
    flex-direction: column;
}

/* Flex distribution */
.box-small {
    flex: 1; /* Cột hẹp */
}
.box-large {
    flex: 2; /* Cột rộng gấp đôi */
}
.box-medium {
    flex: 1; /* Cột trung bình cho hàng mở rộng */
}

/* Image blocks */
.img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Text blocks */
.text-box {
    background-color: var(--color-white);
    padding: 40px;
    justify-content: center;
}

.feature-title-small {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
    font-family: var(--font-body);
}

.feature-desc {
    color: var(--color-gray);
    line-height: 1.6;
    font-size: 1.05rem;
}

/* INTERACTIVE HOVER / EXPAND EFFECTS */
/* Khi rê chuột vào Container, làm mờ nhẹ các box khác */
.bento-flex-row:hover .bento-item:not(:hover) {
    filter: brightness(0.85) grayscale(20%);
}

/* Khi rê chuột vào 1 box hình ảnh, Box đó phình ra */
.bento-flex-row .img-box.box-small:hover {
    flex: 1.8; /* Phình to ra gần bằng cột lớn */
}

.bento-flex-row .img-box.box-large:hover {
    flex: 2.5; /* Cột lớn phình to hơn chút nữa */
}

/* Hiệu ứng zoom nhẹ ảnh bên trong */
.bento-flex-row .img-box:hover img {
    transform: scale(1.05);
}

/* Tắt hover expand cho box chứa chữ để tránh giật Text Layer */
.bento-flex-row .text-box:hover {
    flex: 1;
}

/* EXPANDED ROW - Animation */
.bento-expanded-row {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.bento-expanded-row.visible {
    display: flex !important;
    opacity: 1;
    max-height: 400px;
}


/* Media Queries for Tablets and Mobile */
@media (max-width: 1024px) {
    .bento-flex-row {
        height: 300px;
    }
    .text-box {
        padding: 30px 20px;
    }
    .feature-title-small {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .features-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .features-interactive-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .bento-flex-row {
        flex-direction: column;
        height: auto;
        gap: 20px;
    }
    
    .bento-item {
        height: 300px;
        flex: none !important; /* Hủy hiệu ứng expand trên Mobile */
    }
    
    .text-box {
        height: auto;
    }
    
    .bento-flex-row:hover .bento-item:not(:hover) {
        filter: none; /* Tắt hiệu ứng mờ trên mobile */
    }
}
