/* ==================== ENTITY GROUP SECTION ==================== */

.entity-group-section {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 2rem;
    text-align: start;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* ==================== HEADER ==================== */

.entity-group-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.entity-group-section-header-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    align-items: start;
    gap: 1rem;
    padding-right: 2rem;
}

.entity-group-section-header-content-title {
    color: #262626;
    font-weight: bold;
    text-align: start;
    margin: 0;
}

.entity-group-section-header-content-description {
    text-align: start;
    color: #293D2C;
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0;
}

/* ==================== CAROUSEL CONTAINER (DESKTOP) ==================== */

.entity-group-section-carousel {
    width: 100%;
    overflow: hidden;
}

.entity-group-section-list-view {
    display: flex;
    gap: 2rem;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Fixed: Each item is 25% width + gap */
    transform: translateX(calc(-1 * var(--scroll-offset, 0) * (25% + 2rem)));
}

/* ==================== ENTITY TILE ==================== */

.entity-group-tile {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
    width: calc((100% - 6rem) / 4); /* 4 items with 3 gaps of 2rem = 6rem */
    flex-shrink: 0;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.entity-group-tile:hover {
    transform: translateY(-4px);
}

.entity-group-tile-image {
    border-radius: 20px;
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
}

.entity-group-tile:hover .entity-group-tile-image {
    transform: scale(1.03);
}

.entity-group-tile-title {
    font-size: 1.8rem;
    font-weight: 500;
    color: #0F343D;
    text-align: start;
    line-height: 1.7;
    margin: 0;
}

.entity-group-tile-description {
    text-align: start;
    color: #5D5D5D;
    line-height: 1.6;
    font-size: 1.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.entity-group-tile h6 {
    line-height: 1.4;
    margin: 0;
}

/* ==================== TABLET (max-width: 900px) ==================== */

@media (max-width: 900px) {
    .entity-group-section-header-btn {
        display: none;
    }

    /* ✅ ENABLE HORIZONTAL SCROLL */
    .entity-group-section-carousel {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }

    .entity-group-section-list-view {
        /* DISABLE transform on mobile - use natural scroll */
        transform: none !important;
        transition: none;
        width: max-content;
    }

    .entity-group-tile {
        width: calc((100vw - 5rem) / 3); /* 3 items per view */
        scroll-snap-align: start;
    }

    /* Hide scrollbar but keep functionality */
    .entity-group-section-carousel::-webkit-scrollbar {
        display: none;
    }

    .entity-group-section-carousel {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ==================== MOBILE (max-width: 768px) ==================== */

@media (max-width: 768px) {
    .entity-group-section-header-btn {
        display: none;
    }

    .entity-group-section-carousel {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }

    .entity-group-section-list-view {
        transform: none !important;
        transition: none;
        gap: 1.5rem;
        width: max-content;
    }

    .entity-group-tile {
        width: calc((100vw - 4rem) / 2); /* 2 items per view */
        scroll-snap-align: start;
    }

    .entity-group-section-carousel::-webkit-scrollbar {
        display: none;
    }

    .entity-group-section-carousel {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ==================== SMALL MOBILE (max-width: 480px) ==================== */

@media (max-width: 480px) {
    .entity-group-section {
        gap: 1.5rem;
    }

    .entity-group-section-header-content {
        padding-right: 0;
    }

    .entity-group-section-header-btn {
        display: none;
    }

    .entity-group-section-carousel {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }

    .entity-group-section-list-view {
        transform: none !important;
        transition: none;
        gap: 1rem;
        width: max-content;
    }

    /* .entity-group-tile {
        width: calc(100vw - 2rem); 
        max-width: calc(100vw - 2rem);
        scroll-snap-align: start;
    } */

    .entity-group-tile-image {
        width: 100%;
        height: 180px;
    }

    .entity-group-tile-title {
        font-size: 1.5rem;
        line-height: 1.5;
    }

    .entity-group-tile-description {
        font-size: 1rem;
        line-height: 1.5;
    }

    .entity-group-section-carousel::-webkit-scrollbar {
        display: none;
    }

    .entity-group-section-carousel {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}
