/*
 * Directory Goo - Homepage Top Categories V1
 * Presentation only.
 * Category data, images, names and links remain CMS/backend managed.
 */

/* ==========================================================
   CATEGORY GRID
   ========================================================== */

.categories-row {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    row-gap: 22px;
}

.categories-row > a {
    display: flex;
}

/* ==========================================================
   CATEGORY CARD
   ========================================================== */

.categories-row .top-category {
    position: relative;
    width: 100%;
    min-height: 190px;

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

    padding: 26px 20px !important;

    background: #fff;
    border: 1px solid #e4ebe7;
    border-radius: 16px;

    box-shadow:
        0 4px 14px rgba(20, 55, 38, 0.05),
        0 1px 3px rgba(20, 55, 38, 0.04);

    overflow: hidden;

    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-color .22s ease,
        background-color .22s ease;
}

/* Small premium accent */
.categories-row .top-category::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 44px;
    height: 4px;
    transform: translateX(-50%);
    background: var(--color-leaf, #2f8f46);
    border-radius: 0 0 6px 6px;
    transition: width .22s ease;
}

/* ==========================================================
   CATEGORY IMAGE
   ========================================================== */

.categories-row .top-cat-img {
    display: block;

    width: 78px;
    height: 78px;

    margin-bottom: 18px !important;

    object-fit: contain;

    transition:
        transform .22s ease,
        filter .22s ease;
}

/* ==========================================================
   CATEGORY NAME
   ========================================================== */

.categories-row .top-category p {
    margin: 0 !important;

    color: #34433b !important;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;

    text-align: center;

    overflow-wrap: anywhere;

    transition: color .22s ease;
}

/* ==========================================================
   DESKTOP HOVER
   ========================================================== */

@media (hover: hover) and (pointer: fine) {

    .categories-row > a:hover .top-category {
        transform: translateY(-4px);

        border-color: rgba(47, 143, 70, .35);

        box-shadow:
            0 12px 28px rgba(20, 55, 38, .10),
            0 3px 8px rgba(20, 55, 38, .05);
    }

    .categories-row > a:hover .top-category::before {
        width: 70px;
    }

    .categories-row > a:hover .top-cat-img {
        transform: scale(1.06);
    }

    .categories-row > a:hover .top-category p {
        color: var(--color-leaf, #2f8f46) !important;
    }
}

/* Keyboard accessibility */
.categories-row > a:focus-visible {
    outline: 3px solid rgba(47, 143, 70, .28);
    outline-offset: 3px;
    border-radius: 16px;
}

/* ==========================================================
   DESKTOP
   4 columns
   ========================================================== */

@media (min-width: 1200px) {

    .categories-row > .col-xl-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* ==========================================================
   TABLET
   3 columns
   ========================================================== */

@media (min-width: 768px) and (max-width: 1199.98px) {

    .categories-row > .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .categories-row .top-category {
        min-height: 180px;
        padding: 23px 17px !important;
    }

    .categories-row .top-cat-img {
        width: 70px;
        height: 70px;
    }
}

/* ==========================================================
   MOBILE
   Override original nowrap/horizontal-scroll behavior.
   2-column grid.
   ========================================================== */

@media (max-width: 767.98px) {

    .row.categories-row {
        display: flex !important;
        flex-wrap: wrap !important;
        overflow: visible !important;

        margin-left: -7px;
        margin-right: -7px;

        row-gap: 14px;
    }

    .row.categories-row > a[class*="col-"] {
        flex: 0 0 50% !important;
        width: 50% !important;
        max-width: 50% !important;

        padding-left: 7px;
        padding-right: 7px;

        margin-bottom: 0 !important;
    }

    .categories-row .top-category {
        min-height: 154px;

        padding: 20px 10px !important;

        border-radius: 14px;
    }

    .categories-row .top-cat-img {
        width: 60px;
        height: 60px;

        margin-bottom: 13px !important;
    }

    .categories-row .top-category p {
        font-size: 13.5px;
        line-height: 1.3;
    }

    .categories-row .top-category::before {
        width: 34px;
        height: 3px;
    }
}

/* ==========================================================
   SMALL PHONES
   Keep two columns, but reduce card footprint.
   ========================================================== */

@media (max-width: 374.98px) {

    .categories-row .top-category {
        min-height: 142px;
        padding: 17px 8px !important;
    }

    .categories-row .top-cat-img {
        width: 54px;
        height: 54px;
        margin-bottom: 11px !important;
    }

    .categories-row .top-category p {
        font-size: 13px;
    }
}

/* =========================================================
   DIRECTORY GOO TOP CATEGORIES V1.1
   Compact premium refinement
   ========================================================= */

/* Tighter desktop grid */
.categories-row {
    row-gap: 18px;
}

/* More compact card proportions */
.categories-row .top-category {
    min-height: 168px;
    padding: 22px 18px !important;

    border-color: #e1e8e4;

    box-shadow:
        0 5px 16px rgba(20, 55, 38, .055),
        0 1px 3px rgba(20, 55, 38, .035);
}

/* Slightly smaller icons for better visual balance */
.categories-row .top-cat-img {
    width: 68px;
    height: 68px;
    margin-bottom: 15px !important;
}

/* Stronger category labels */
.categories-row .top-category p {
    color: #263b30 !important;
    font-size: 14.5px;
    font-weight: 650;
    line-height: 1.35;
}

/* Refined accent */
.categories-row .top-category::before {
    width: 40px;
}

/* Stronger desktop interaction */
@media (hover: hover) and (pointer: fine) {

    .categories-row > a:hover .top-category {
        transform: translateY(-3px);
        border-color: rgba(47, 143, 70, .28);

        box-shadow:
            0 10px 24px rgba(20, 55, 38, .09),
            0 2px 6px rgba(20, 55, 38, .04);
    }

    .categories-row > a:hover .top-category::before {
        width: 64px;
    }
}

/* Categories View All only */
.categories-row + .col-sm-12 .view-all-btn {
    min-width: 142px;
    padding: 11px 28px !important;

    background: var(--color-leaf, #2f8f46) !important;
    border: 1px solid var(--color-leaf, #2f8f46) !important;
    border-radius: 7px !important;

    color: #fff !important;
    font-weight: 600;

    box-shadow: 0 5px 14px rgba(47, 143, 70, .16);

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        opacity .2s ease;
}

.categories-row + .col-sm-12 .view-all-btn:hover {
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(47, 143, 70, .22);
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1199.98px) {

    .categories-row {
        row-gap: 16px;
    }

    .categories-row .top-category {
        min-height: 158px;
        padding: 20px 14px !important;
    }

    .categories-row .top-cat-img {
        width: 62px;
        height: 62px;
        margin-bottom: 13px !important;
    }

    .categories-row .top-category p {
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 767.98px) {

    .row.categories-row {
        row-gap: 12px;
    }

    .categories-row .top-category {
        min-height: 136px;
        padding: 17px 8px !important;
    }

    .categories-row .top-cat-img {
        width: 54px;
        height: 54px;
        margin-bottom: 11px !important;
    }

    .categories-row .top-category p {
        font-size: 13px;
        line-height: 1.3;
    }

    .categories-row + .col-sm-12 {
        padding-top: 18px !important;
    }

    .categories-row + .col-sm-12 .view-all-btn {
        min-width: 132px;
        padding: 10px 24px !important;
    }
}

/* =========================================================
   DIRECTORY GOO TOP CATEGORIES V1.2
   Preserve category icons on hover
   ========================================================= */

@media (hover: hover) and (pointer: fine) {

    .categories-row > a:hover .top-category {
        background: #fff !important;
    }

    .categories-row > a:hover .top-cat-img,
    .categories-row .top-category:hover .top-cat-img {
        filter: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .categories-row > a:hover .top-category p {
        color: var(--color-leaf, #2f8f46) !important;
    }
}
