.brands-container .brands {
    display: grid;
    gap: clamp(10px, 1.5vw, 16px);
    grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 18vw, 150px), 1fr));
    margin-bottom: 20px;

    a {
        border-radius: 10px;
        display: block;
    }

    .brand {
        align-items: center;
        aspect-ratio: 3 / 2;
        background-color: #fff;
        border-radius: 10px;
        border: 1px solid #ddd;
        box-shadow: var(--shadow-card);
        box-sizing: border-box;
        color: var(--accent);
        display: flex;
        filter: grayscale(1);
        justify-content: center;
        opacity: 0.6;
        overflow: hidden;
        position: relative;
        text-align: center;
        text-transform: uppercase;
        transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), filter var(--transition), border-color var(--transition);

        &:hover {
            box-shadow: var(--shadow-card-hover);
            filter: none;
            opacity: 1;
            transform: translateY(-4px);
        }

        .brand-logo {
            height: 100%;
            left: 10%;
            object-fit: contain;
            position: absolute;
            top: 0;
            width: 80%;
        }

        .brand-logo-background {
            height: 100%;
            object-fit: cover;
            width: 100%;
        }

        .brand-logo-text {
            font-weight: bold;
            position: absolute;
        }
    }

    .brand.active {
        filter: none;
        opacity: 1;
        outline: 2px solid #aaa;
        outline-offset: 3px;
    }
}

.products-heading {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: space-between;
    margin-bottom: clamp(16px, 3vw, 30px);

    h2 {
        font-size: clamp(1.3em, 3.5vw, 2em);
        margin: 0;
        text-transform: uppercase;
    }

    span {
        color: #666;
        font-size: 14px;
    }
}

.opacity {
    opacity: 50%;
}

.load-more {
    display: grid;
    padding-block: 2rem;
    place-content: center;
}

.loader {
    display: grid;
    padding-block: 2rem;
    place-content: center;
}

.spinner {
    animation: spin 0.8s linear infinite;
    border: 3px solid #ddd;
    border-radius: 50%;
    border-top-color: var(--accent);
    display: block;
    height: 32px;
    width: 32px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.products-container {
    display: grid;
    gap: clamp(12px, 2vw, 24px);
    grid-template-columns: repeat(auto-fill, minmax(clamp(200px, 25vw, 260px), 1fr));

    article {
        display: none;
    }

    .product {
        aspect-ratio: 4 / 3;
        border-radius: 10px;
        box-shadow: var(--shadow-card);
        display: block;
        overflow: hidden;
        position: relative;
        transition: transform var(--transition), box-shadow var(--transition);

        &:hover {
            box-shadow: var(--shadow-card-hover);
            transform: translateY(-4px);
        }

        .product-link {
            color: #fff;
            display: block;
            height: 100%;
            text-decoration: none;
        }

        img {
            display: block;
            height: 100%;
            object-fit: cover;
            transition: transform 0.6s ease;
            width: 100%;
        }

        &:hover img {
            transform: scale(1.08);
        }

        .text-overlay {
            background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4) 60%, transparent);
            bottom: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
            left: 0;
            padding: 40px 16px 14px;
            position: absolute;
            right: 0;
            user-select: none;
        }

        .product-title {
            font-size: clamp(14px, 1.4vw, 16px);
            font-weight: bold;
            letter-spacing: 0.03em;
            text-transform: uppercase;
        }

        .product-cta {
            color: rgba(255, 255, 255, 0.85);
            font-size: 13px;
            max-height: 0;
            opacity: 0;
            overflow: hidden;
            transition: max-height var(--transition), opacity var(--transition);
        }

        &:hover .product-cta,
        .product-link:focus-visible .product-cta {
            max-height: 2em;
            opacity: 1;
        }

        .product-link:focus-visible {
            outline-offset: -3px;
        }
    }
}

@media (hover: none) {
    .brands-container .brands .brand {
        filter: none;
        opacity: 1;
    }

    .products-container .product .product-cta {
        max-height: 2em;
        opacity: 1;
    }
}

.products-empty {
    border-radius: 10px;
    border: 1px solid #ddd;
    box-shadow: var(--shadow-card);
    color: var(--accent);
    display: flex;
    grid-column: 1 / -1;
    justify-content: center;
    padding: 20px;
}

.products-empty-form {
    display: none;
}
