/*
 * ISMAK - Category cards, small visual update 2.1
 * Load AFTER css/features.css.
 * Scope: the main category grid in products.php (not search-result cards).
 * No PHP, JavaScript, database, font, menu or filter changes.
 * Rollback: remove the stylesheet link.
 */
.references > .row.categoryPadding:not(.im-catalog-results) {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 24px 12px;
}

.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #dfe5e9;
    border-radius: 0;
    box-shadow: 0 2px 7px rgba(44, 62, 80, 0.025);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories > .categoryLink {
    display: block;
    color: #2c3e50;
    text-decoration: none;
    letter-spacing: normal;
    transition: none;
}

/* Expand the existing category link to the whole card. No nested controls
   exist in this grid. Search results with Compare/Get quote are excluded. */
.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories > .categoryLink::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories > .categoryLink > img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fff;
    border-bottom: 1px solid #edf0f2;
}

.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories .categoryTitle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 21px 22px 0;
    color: #2c3e50;
    font-family: inherit;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: normal;
    overflow-wrap: anywhere;
}

/* Decorative arrow; the existing title remains the accessible link name. */
.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories .categoryTitle::after {
    content: "";
    display: block;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 4px 0 0 auto;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300b1d0' stroke-width='1.7' stroke-linecap='square' stroke-linejoin='miter'%3E%3Cpath d='M4 12h15M13 5l7 7-7 7'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
    transition: transform 180ms ease;
}

.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories > .categoryDescription {
    margin: 9px 22px 23px;
    color: #566573;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: normal;
    overflow-wrap: anywhere;
}

/* Keyboard focus is visible on the whole card, without layout movement. */
.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories:focus-within {
    border-color: #00b1d0;
    box-shadow: 0 0 0 2px #2c3e50;
}
.references > .row.categoryPadding:not(.im-catalog-results) > .productCategories > .categoryLink:focus-visible {
    outline: 2px solid #2c3e50;
    outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
    .references > .row.categoryPadding:not(.im-catalog-results) > .productCategories:hover {
        border-color: #00b1d0;
        box-shadow: 0 10px 24px rgba(44, 62, 80, 0.09);
        transform: translateY(-3px);
    }
    .references > .row.categoryPadding:not(.im-catalog-results) > .productCategories:hover .categoryTitle::after {
        transform: translateX(3px);
    }
}

@media (max-width: 991.98px) {
    .references > .row.categoryPadding:not(.im-catalog-results) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        padding: 18px 0;
    }
}

@media (max-width: 575.98px) {
    .references > .row.categoryPadding:not(.im-catalog-results) {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .references > .row.categoryPadding:not(.im-catalog-results) > .productCategories,
    .references > .row.categoryPadding:not(.im-catalog-results) > .productCategories:hover,
    .references > .row.categoryPadding:not(.im-catalog-results) > .productCategories .categoryTitle::after,
    .references > .row.categoryPadding:not(.im-catalog-results) > .productCategories:hover .categoryTitle::after {
        transition: none;
        transform: none;
    }
}
