/* =========================================================
   CLOVER DISPLAYS - PRODUCT CATEGORY CAROUSEL
   Homepage / Shop: root categories
   Category archive: direct child categories
   ========================================================= */

.mhcc {
    --mhcc-columns: 8;
    --mhcc-gap: 28px;
    --mhcc-text: #1e1e1e;
    --mhcc-card-bg: #f4f6f6;

    position: relative;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    color: var(--mhcc-text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    box-sizing: border-box;
}

.mhcc *,
.mhcc *::before,
.mhcc *::after {
    box-sizing: border-box;
}

.mhcc__viewport {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
    outline: none;
}

.mhcc__viewport::-webkit-scrollbar {
    display: none;
}

.mhcc__viewport.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
    user-select: none;
}

.mhcc__track {
    display: flex;
    align-items: flex-start;
    gap: var(--mhcc-gap);
    width: 100%;
    min-width: 100%;
}

.mhcc__item {
    flex: 0 0 calc((100% - (var(--mhcc-gap) * (var(--mhcc-columns) - 1))) / var(--mhcc-columns));
    min-width: 0;
    display: block;
    color: var(--mhcc-text);
    text-align: center;
    text-decoration: none;
    scroll-snap-align: start;
}

.mhcc__item:hover,
.mhcc__item:focus,
.mhcc__item:visited {
    color: var(--mhcc-text);
    text-decoration: none;
}

.mhcc__item:focus-visible {
    outline: 2px solid var(--mhcc-text);
    outline-offset: 5px;
    border-radius: 16px;
}

.mhcc__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--mhcc-card-bg);
    border-radius: 16px;
}

.mhcc__image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    object-position: center;
    transition: transform 220ms ease;
}

.mhcc__item:hover .mhcc__image {
    transform: scale(1.025);
}

.mhcc__placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: var(--mhcc-card-bg);
    color: rgba(30, 30, 30, 0.25);
    font-size: clamp(34px, 3vw, 58px);
    font-weight: 600;
    line-height: 1;
}

.mhcc__name {
    display: block;
    min-height: 2.7em;
    margin-top: 14px;
    padding: 0 4px;
    color: var(--mhcc-text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0;
}

.mhcc__name small {
    display: inline;
    font: inherit;
    opacity: 0.6;
}

/* Navigation */
.mhcc__arrow {
    position: absolute;
    top: 42%;
    z-index: 4;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--mhcc-text);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.10);
    transform: translateY(-50%);
    cursor: pointer;
    transition: opacity 160ms ease, transform 160ms ease;
}

.mhcc__arrow:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.05);
}

.mhcc__arrow--prev {
    left: -24px;
}

.mhcc__arrow--next {
    right: -24px;
}

.mhcc__arrow span {
    display: block;
    font-size: 18px;
    line-height: 1;
}

.mhcc__arrow:disabled {
    opacity: 0.28;
    cursor: default;
}

.mhcc__arrow.is-hidden {
    display: none;
}

/* Large desktop: 8 */
@media (min-width: 1440px) {
    .mhcc {
        --mhcc-columns: 8;
        --mhcc-gap: 28px;
    }
}

/* Laptop: 6 */
@media (min-width: 1200px) and (max-width: 1439px) {
    .mhcc {
        --mhcc-columns: 6;
        --mhcc-gap: 24px;
    }
}

/* Small laptop: 5 */
@media (min-width: 992px) and (max-width: 1199px) {
    .mhcc {
        --mhcc-columns: 5;
        --mhcc-gap: 22px;
    }
}

/* Tablet: 4 */
@media (min-width: 768px) and (max-width: 991px) {
    .mhcc {
        --mhcc-columns: 4;
        --mhcc-gap: 18px;
    }

    .mhcc__arrow--prev {
        left: 8px;
    }

    .mhcc__arrow--next {
        right: 8px;
    }
}

/* Small tablet: 3 */
@media (min-width: 560px) and (max-width: 767px) {
    .mhcc {
        --mhcc-columns: 3;
        --mhcc-gap: 16px;
    }

    .mhcc__arrow {
        width: 42px;
        height: 42px;
    }

    .mhcc__arrow--prev {
        left: 6px;
    }

    .mhcc__arrow--next {
        right: 6px;
    }
}

/* Mobile: show two full cards plus a hint of the next card */
@media (max-width: 559px) {
    .mhcc {
        --mhcc-gap: 14px;
    }

    .mhcc__track {
        width: max-content;
        min-width: 100%;
    }

    .mhcc__item {
        flex-basis: calc((100vw - 52px) / 2.15);
        max-width: 190px;
    }

    .mhcc__media {
        border-radius: 12px;
    }

    .mhcc__name {
        min-height: 2.6em;
        margin-top: 10px;
        padding: 0 2px;
        font-size: 14px;
        line-height: 1.3;
    }

    .mhcc__arrow {
        width: 38px;
        height: 38px;
        top: 40%;
    }

    .mhcc__arrow--prev {
        left: 4px;
    }

    .mhcc__arrow--next {
        right: 4px;
    }

    .mhcc__arrow span {
        font-size: 15px;
    }
}


/* =========================================================
   HOMEPAGE GRID MODE
   No horizontal scrolling or carousel arrows on the homepage.
   All root categories wrap naturally into rows.
   ========================================================= */

.mhcc--grid .mhcc__viewport {
    overflow: visible;
    scroll-behavior: auto;
    scroll-snap-type: none;
    overscroll-behavior-x: auto;
    touch-action: auto;
}

.mhcc--grid .mhcc__track {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    gap: 28px;
    width: 100%;
    min-width: 0;
}

.mhcc--grid .mhcc__item {
    width: auto;
    min-width: 0;
    flex: none;
    scroll-snap-align: none;
}

.mhcc--grid .mhcc__arrow {
    display: none !important;
}

@media (min-width: 1200px) and (max-width: 1439px) {
    .mhcc--grid .mhcc__track {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 24px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .mhcc--grid .mhcc__track {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 22px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .mhcc--grid .mhcc__track {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (min-width: 560px) and (max-width: 767px) {
    .mhcc--grid .mhcc__track {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 559px) {
    .mhcc--grid .mhcc__track {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 14px;
        width: 100%;
        min-width: 0;
    }

    .mhcc--grid .mhcc__item {
        width: auto;
        max-width: none;
        flex-basis: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mhcc__viewport,
    .mhcc__image,
    .mhcc__arrow {
        scroll-behavior: auto;
        transition: none;
    }
}
