﻿.home-categories {
    margin-top: 1.5rem;
}

.home-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
}

.home-category-card {
    display: flex;
    min-width: 0;
    min-height: 190px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
    color: var(--theme-brand-color, #1260aa);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    background: #f3f4f6;
    border-radius: 0.75rem;
    transition: transform 180ms ease, background-color 180ms ease,
        box-shadow 180ms ease;
}

.home-category-card:hover,
.home-category-card:focus-visible {
    color: var(--theme-brand-color-hover, #0e4981);
    text-decoration: none;
    background: color-mix(in srgb, var(--theme-brand-color, #1260aa) 10%, white);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-brand-color, #1260aa) 18%, transparent);
    transform: translateY(-2px);
}

.home-category-card:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--theme-brand-color, #1260aa) 32%, transparent);
    outline-offset: 2px;
}

.home-category-media {
    display: flex;
    width: 128px;
    height: 128px;
    align-items: center;
    justify-content: center;
    flex: 0 0 128px;
    margin-bottom: 0.9rem;
}

.home-category-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-category-media.is-svg img {
    padding: 12%;
    object-fit: contain;
}

.home-category-title {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.8;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

@media (min-width: 1024px) {
    .home-category-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Tablet / compact desktop: keep 4 columns, scale the whole component down. */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .home-category-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .home-category-card {
        min-height: clamp(142px, 17vw, 164px);
        padding: clamp(0.6rem, 1.15vw, 0.8rem);
        font-size: clamp(0.8125rem, 1.5vw, 0.9375rem);
    }

    .home-category-media {
        width: clamp(84px, 10.5vw, 104px);
        height: clamp(84px, 10.5vw, 104px);
        flex-basis: clamp(84px, 10.5vw, 104px);
        margin-bottom: clamp(0.45rem, 0.8vw, 0.65rem);
    }

    .home-category-title {
        line-height: 1.65;
    }
}

/* Phone: two compact columns with proportionally smaller media and type. */
@media (max-width: 767.98px) {
    .home-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .home-category-card {
        min-height: 144px;
        padding: 0.7rem;
        font-size: 0.875rem;
    }

    .home-category-media {
        width: 92px;
        height: 92px;
        flex-basis: 92px;
        margin-bottom: 0.55rem;
    }

    .home-category-title {
        line-height: 1.65;
    }
}

@media (max-width: 575.98px) {
    .home-category-grid {
        gap: 0.625rem;
    }

    .home-category-card {
        min-height: 128px;
        padding: 0.6rem;
        font-size: 0.8125rem;
    }

    .home-category-media {
        width: 78px;
        height: 78px;
        flex-basis: 78px;
        margin-bottom: 0.45rem;
    }

    .home-category-media.is-svg img {
        padding: 10%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-category-card {
        transition: none;
    }
}
