/* ============================================================
   hp-categories  —  Categories section
   ============================================================ */

/* ── Grid wrapper ─────────────────────────────────────────── */
.hp-categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: stretch;
    gap: 8px;
    background-color: #F6F8FC;
    padding: 0 12px;
}

/* ── Card base ────────────────────────────────────────────── */
.cat-card {
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: background 0.25s ease, color 0.25s ease;
    padding-bottom: 20px;
    color: #000;
}

/* ── Hover state (desktop / tablet) ──────────────────────── */
@media (hover: hover) {
    .cat-card:hover {
        background: #000;
        color: #fff;
    }

    .cat-card:hover .cat-card__title,
    .cat-card:hover .cat-card__desc {
        color: #fff;
    }
}

/* ── Head row  (icon | title + desc) ─────────────────────── */
.cat-card__head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 45px 35px;
    overflow-wrap: break-word;
}

/* Icon column — takes full height of the head row */
.cat-card__icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    margin-top: 8px;
}

.cat-card__icon-img {
    width: 40px;
    height: auto;
    display: block;
}

/* Text column */
.cat-card__text {
    flex: 1;
    min-width: 0;
}

.cat-card__title {
    margin: 0 0 29px;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    color: inherit;
    transition: color 0.25s ease;
}

.cat-card__desc {
    margin: 0;
    font-size: 19px;
    font-weight: 400;
    line-height: 1; /* 105.263% */
    letter-spacing: -0.2px;
    color: #78101A;
    transition: color 0.25s ease;
}

/* ── Bottom image ─────────────────────────────────────────── */
.cat-card__image-wrap {
    overflow: hidden;
    line-height: 0;
    margin-top: auto;
    margin-bottom: auto;
    max-width: 83%;
    max-height: 380px;
}

.cat-card__image-wrap img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: right center;
    display: block;
}
body:not(.rtl) .cat-card__image-wrap img {
    transform: scaleX(-1);
}

/* ── Mobile toggle (hidden on desktop) ───────────────────── */
.cat-card__toggle {
    display: none;
}
@media (max-width: 1704px) {
    .cat-card__title {
        font-size: 26px;
    }
}
@media (max-width: 1380px) {
    .cat-card__head {
        padding: 28px;
    }
    .cat-card__icon-wrap {
        margin-top: 2px;
    }
    .cat-card__title {
        font-size: 20px;
    }
}

/* ============================================================
   Tablet  —  2 columns
   ============================================================ */
@media (max-width: 991px) {
    .hp-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   Mobile  —  1 column, accordion
   ============================================================ */
@media (max-width: 575px) {
    .hp-categories {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Card is the positioning context for the absolute image */
    .cat-card {
        position: relative;
        flex-direction: column;
        overflow: hidden;
        min-height: 106px;
        padding: 0;
    }

    /* Head row: leave space on the right for the image */
    .cat-card__head {
        position: relative;
        padding-inline-start: calc(110px + 16px);
        /* Hide the normal icon; image replaces it */
        gap: 0;
        align-items: flex-start;
        padding-block: 16px;
        padding-inline-end: 12px;
    }

    /* Hide desktop icon on mobile */
    .cat-card__icon-wrap {
        display: none;
    }

    /* ── Image: absolute, anchored top-start, natural height capped at 300px ── */
    .cat-card__image-wrap {
        position: absolute;
        inset-inline-start: 0;
        top: 12px;
        width: 110px;
        height: auto;
        max-height: 300px;
        overflow: hidden;
        margin: 0;
    }

    .cat-card__image-wrap img {
        width: 100%;
        height: auto;
        max-height: 120px;
        display: block;
        object-fit: contain;
    }

    .cat-card__title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    /* ── Description: hidden by default — jQuery slideToggle handles animation ── */
    .cat-card__desc {
        display: none;
        font-size: 16px;
        line-height: 18px;
        color: black;
    }

    /* ── Toggle button ── */
    .cat-card__toggle {
        align-self: flex-end;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: none;
        border: none;
        padding: 4px;
        cursor: pointer;
        color: inherit;
        margin-inline-start: 16px;
        margin-inline-end: 0;
        margin-bottom: -4px;
    }

    .cat-card__toggle-icon {
        display: block;
        width: 22px;
        height: 30px;
        background: url('../../imgs/chevron-down-red.svg') no-repeat center bottom;
        background-size: contain !important;
    }

    .cat-card.is-open .cat-card__toggle-icon {
        width: 26px;
        background: url('../../imgs/hex-icon.svg') no-repeat center;
    }

    /* Hover effect disabled on mobile (touch devices) */
    .cat-card:hover {
        background: #fff;
        color: inherit;
    }
}
