.ext-category-grid {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* ── each item ── */
.ext-category-grid__item {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 22px 16px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: color 0.25s ease;
    gap: 8px;
}

/* vertical divider between items */
.ext-category-grid__item + .ext-category-grid__item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18%;
    height: 64%;
    width: 1px;
    background: rgba(0, 0, 0, 0.12);
    pointer-events: none;
}

/* animated underline bar */
.ext-category-grid__item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.ext-category-grid__item:hover::after,
.ext-category-grid__item:focus-visible::after {
    transform: scaleX(1);
}

/* ── title ── */
.ext-category-grid__name {
    display: block !important;
    padding: 0 0 8px 10px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #003366 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1.3 !important;
    border-left: 3px solid var(--ce-occm-mp-active-accent);
    transition: color 0.18s ease;
    -webkit-font-smoothing: antialiased;
    position: relative;
    z-index: 1;
}

/* ── image (optional) ── */
.ext-category-grid__image-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.ext-category-grid__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ext-category-grid__img--placeholder {
    width: 100%;
    height: 100%;
    background-color: #e8e8e8;
}

/* ── count (optional) ── */
.ext-category-grid__count {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    opacity: 0.55;
    position: relative;
    z-index: 1;
}

/* ── mobile carousel ── */
.ext-category-grid-wrap {
    width: 100%;
    /* must not clip child scroll — do not set overflow:hidden here */
    overflow: visible;
}

@media (max-width: 767px) {
    .ext-category-grid--has-carousel {
        overflow-x: auto !important;
        overflow-y: visible !important;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        /* prevent Woodmart / Elementor padding from squishing the track */
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .ext-category-grid--has-carousel::-webkit-scrollbar {
        display: none;
    }

    .ext-category-grid--has-carousel .ext-category-grid__item {
        /* hard-coded 50% fallback first, then calc() with custom property */
        flex: 0 0 50% !important;
        flex: 0 0 calc(100% / var(--ext-cg-mobile-cols, 2)) !important;
        width: 50% !important;
        width: calc(100% / var(--ext-cg-mobile-cols, 2)) !important;
        max-width: none !important;
        min-width: 0 !important;
        scroll-snap-align: start;
        box-sizing: border-box;
    }

    /* hide vertical dividers inside the carousel — they look broken on scroll */
    .ext-category-grid--has-carousel .ext-category-grid__item + .ext-category-grid__item::before {
        display: none;
    }

    /* ── dots ── */
    .ext-category-grid__dots {
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 6px;
        padding: 10px 0 2px;
        width: 100%;
    }

    .ext-category-grid__dot {
        display: block;
        width: 8px !important;
        height: 8px !important;
        min-width: 0 !important;
        min-height: 0 !important;
        border-radius: 50% !important;
        background: rgba(0, 0, 0, 0.18);
        border: none !important;
        padding: 0 !important;
        margin: 0;
        cursor: pointer;
        flex-shrink: 0;
        align-self: center;
        line-height: 0;
        font-size: 0;
        box-shadow: none !important;
        outline: none;
        transition: background 0.2s ease, transform 0.2s ease;
        -webkit-appearance: none;
        appearance: none;
    }

    .ext-category-grid__dot--active {
        background: #F58220 !important;
        transform: scale(1.35);
    }
}

@media (min-width: 768px) {
    .ext-category-grid__dots {
        display: none;
    }
}
