/* =========================================================
   Category Section
   ========================================================= */

.category-section {
    width: 100%;
    overflow: hidden;

    padding-top: 8px;
    padding-bottom: 8px;
}

.category-section.shell {
    width: min(100% - 20px, 1280px);
}


/* =========================================================
   Rail
   ========================================================= */

.category-rail {
    position: relative;

    width: 100%;
    overflow: hidden;
}

.category-rail__track {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;

    align-items: flex-start;

    gap: 9px;

    width: max-content;
    min-width: max-content;

    margin: 0;
    padding: 2px 0;

    will-change: transform;
}

/* =========================================================
   Category Card
   ========================================================= */

.category-section .category-card {
    flex: 0 0 86px !important;

    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;

    min-height: 0;

    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: flex-start;

    gap: 7px;

    padding: 8px 6px 7px;

    border: 1px solid #ebe8e1;
    border-radius: 9px;

    background: #ffffff;
    color: #33332f;

    box-sizing: border-box;

    text-align: center;
    text-decoration: none;

    transition:
        border-color 160ms ease,
        transform 160ms ease,
        box-shadow 160ms ease;
}

.category-section .category-card:hover {
    border-color: #d8d4cc;

    transform: translateY(-2px);

    box-shadow:
        0 5px 16px rgba(20, 20, 18, 0.06);
}


/* =========================================================
   Media
   ========================================================= */

.category-card__media {
    flex: 0 0 auto;

    width: 66px;
    height: 66px;

    display: grid;
    place-items: center;

    overflow: hidden;

    border-radius: 9px;

    background: #f4f3ef;
}

.category-card__image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* =========================================================
   Placeholder
   ========================================================= */

.category-card__placeholder {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    background: #f3f2ee;
    color: #77736d;

    font-size: 1rem;
    font-weight: 600;
}


/* =========================================================
   Label
   ========================================================= */

.category-card__label {
    width: 100%;

    display: -webkit-box;

    overflow: hidden;

    color: #343430;

    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.2;

    text-align: center;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    overflow-wrap: anywhere;
}


/* =========================================================
   Empty State
   ========================================================= */

.category-section__empty {
    margin: 0;

    color: #77736d;

    font-size: 0.875rem;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {
    .category-rail__track {
        gap: 7px;
    }

    .category-section .category-card {
        flex-basis: 80px !important;

        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;

        min-height: 0;
    }

    .category-card__media {
        width: 62px;
        height: 62px;
    }
}


/* =========================================================
   Mobile
   Exactly 5 cards visible
   ========================================================= */

@media (max-width: 720px) {
    .category-section {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .category-rail__track {
        gap: 5px;
    }

    .category-section .category-card {
        flex: 0 0 var(--category-card-width) !important;

        width: var(--category-card-width) !important;
        min-width: var(--category-card-width) !important;
        max-width: var(--category-card-width) !important;

        min-height: 0;

        gap: 3px;

        padding: 6px 4px 3px;

        border-radius: 8px;
    }

    .category-card__media {
        width: calc(var(--category-card-width) - 16px);
        height: calc(var(--category-card-width) - 16px);

        max-width: 58px;
        max-height: 58px;

        border-radius: 8px;
    }

    .category-card__label {
        font-size: 0.63rem;
        line-height: 1.15;
    }

    .category-card__placeholder {
        font-size: 0.8rem;
    }
}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .category-card,
    .category-rail__track {
        transition: none !important;
    }
}

.category-card--ghost {
    position: absolute;
    z-index: 1;

    margin: 0;
    pointer-events: none;
}
