/* ========= Vars ========= */
:root {
    --gap: 22px;
    --label-h: 40px;
    --radius: 3px;
    --border-w: 1px;
}

/* ========= Grid wrapper ========= */
.free_cat_home_sections_wrapper,
.free_cat_home_sections {
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.free_cat_home_sections {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-flow: row dense;
    gap: var(--gap);
    align-items: stretch;
}

/* ========= Card ========= */
.cat_home_item {
    position: relative;
    display: grid;
    grid-template-rows: 1fr var(--label-h);
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: var(--radius);
    border: var(--border-w) solid #333;
    background: #333;
    direction: rtl;
    transition: transform .25s ease, box-shadow .25s ease;
}

/* ========= Large card ========= */
.free_cat_home_sections > .cat_home_item:nth-child(1) {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    aspect-ratio: 2 / 1;
}

/* ========= Image ========= */
.cat_home_img {
    position: relative;
    width: 100%;
    height: 100%;
}

.cat_home_img_container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.cat_home_img_container img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .9s ease, transform .35s ease;
}

/* ========= Image swap ========= */
.img-primary {
    opacity: 1;
    z-index: 1;
}

.img-secondary {
    opacity: 0;
    z-index: 0;
    pointer-events: none;
}

.cat_home_item.is-swapped .img-primary {
    opacity: 0;
}

.cat_home_item.is-swapped .img-secondary {
    opacity: 1;
}

/* ========= Content ========= */
.cat_home_content {
    height: var(--label-h);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

/* ========= Title swap ========= */
.cat_home_name {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    text-align: center;
}

.cat_home_name span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .6s ease;
}

.title-primary {
    opacity: 1;
}

.title-secondary {
    opacity: 0;
}

.cat_home_item.is-swapped .title-primary {
    opacity: 0;
}

.cat_home_item.is-swapped .title-secondary {
    opacity: 1;
}

/* ========= Hover ========= */
@media (hover: hover) {
    .cat_home_item:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(0,0,0,.18);
    }

    .cat_home_item:hover img {
        transform: scale(1.05);
    }
}

.free_cat_home_sections > .cat_home_item:nth-child(2) { grid-column: 3; grid-row: 1; }
.free_cat_home_sections > .cat_home_item:nth-child(3) { grid-column: 4; grid-row: 1; }
.free_cat_home_sections > .cat_home_item:nth-child(4) { grid-column: 5; grid-row: 1; }
.free_cat_home_sections > .cat_home_item:nth-child(5) { grid-column: 3; grid-row: 2; }
.free_cat_home_sections > .cat_home_item:nth-child(6) { grid-column: 4; grid-row: 2; }
.free_cat_home_sections > .cat_home_item:nth-child(7) { grid-column: 5; grid-row: 2; }

/* ========= Tablet ========= */
@media (max-width: 1023px) {
    .free_cat_home_sections {
        grid-template-columns: repeat(4, 1fr);
    }

    .cat_home_item {
        aspect-ratio: 1 / 1 !important;
        grid-column: auto !important;
        grid-row: auto !important;
    }
}

/* ========= Mobile ========= */
@media (max-width: 768px) {
    .free_cat_home_sections {
        grid-template-columns: repeat(2, 1fr);
        direction:rtl;
    }
.cat_home_item:last-child {
        display:none
    }
}
