/* ===== WRAP ===== */

.duan-filter-wrap {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}


/* ===== FILTER BUTTON ===== */

.filter-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}


/* button */

.filter-buttons button {
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    background: #f1f1f1;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 500;
    font-size: 14px;
    color: #1f5f3f;
}


/* hover */

.filter-buttons button:hover {
    background: #2f7a57;
    /* xanh nhạt hơn active */
    color: #fff;
}


/* active */

.filter-buttons button.active {
    background: #1f5f3f;
    /* xanh đậm */
    color: #fff;
}


/* ===== GRID ===== */

.duan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}


/* ===== CARD ===== */

.duan-card {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.3s;
}

.duan-card:hover {
    transform: translateY(-5px);
}


/* IMAGE */

.duan-card img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    transition: 0.5s ease;
}


/* ===== OVERLAY (DESKTOP ẨN) ===== */

.overlay {
    position: absolute;
    inset: 0;
    padding: 20px;
    display: flex;
    align-items: flex-end;
    background: linear-gradient( to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2));
    opacity: 0;
    visibility: hidden;
    transition: 0.4s ease;
}


/* CONTENT */

.overlay .content {
    color: #fff;
    transform: translateY(20px);
    transition: 0.4s;
}


/* TITLE */

.overlay h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
}


/* DESCRIPTION (3 dòng) */

.overlay .desc {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* BUTTON */

.overlay .btn {
    display: inline-block;
    padding: 8px 16px;
    background: #1f5f3f;
    color: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
}

.overlay .btn:hover {
    background: #174a31;
}


/* ===== HOVER ===== */

.duan-card:hover img {
    transform: scale(1.08);
}

.duan-card:hover .overlay {
    opacity: 1;
    visibility: visible;
}

.duan-card:hover .content {
    transform: translateY(0);
}


/* ===== TABLET ===== */

@media (max-width: 1024px) {
    .duan-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .duan-card img {
        height: 280px;
    }
}


/* ===== MOBILE ===== */

@media (max-width: 767px) {
    /* grid */
    .duan-grid {
        grid-template-columns: 1fr;
    }
    .duan-card img {
        height: 240px;
    }
    /* ===== FILTER SCROLL NGANG ===== */
    .filter-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
    }
    .filter-buttons button {
        white-space: nowrap;
        flex: 0 0 auto;
        font-size: 13px;
        padding: 8px 14px;
    }
    /* scrollbar đẹp */
    .filter-buttons::-webkit-scrollbar {
        height: 4px;
    }
    .filter-buttons::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 10px;
    }
    /* ===== MOBILE KHÔNG HOVER → LUÔN HIỆN ===== */
    .overlay {
        opacity: 0;
        visibility: hidden;
    }
    /* khi active thì hiện */
    .duan-card.active .overlay {
        opacity: 1;
        visibility: visible;
    }
    .duan-card.active .content {
        transform: translateY(0);
    }
    .overlay .content {
        transform: translateY(0);
    }
    .overlay h3 {
        font-size: 18px;
    }
    .overlay .desc {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    .overlay .btn {
        font-size: 13px;
        padding: 6px 12px;
    }
}