/* HPS Bike Finder responsive layout */
.hps-bikefinder {
    margin: 20px 0;
    padding: 16px;
    border: 1px solid #d1d1d1;
    box-sizing: border-box;
}

.hps-bikefinder__title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.hps-bikefinder__form {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}

.hps-bikefinder__form select {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

.hps-bikefinder__form .action.primary {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Stack vertically once there is no longer comfortable room for four controls. */
@media only screen and (max-width: 767px) {
    .hps-bikefinder__form {
        flex-direction: column;
    }

    .hps-bikefinder__form select,
    .hps-bikefinder__form .action.primary {
        width: 100%;
        flex: 0 0 auto;
    }
}


/* Bike Finder results: four products per row on comfortably wide screens. */
@media only screen and (min-width: 1024px) {
    body.bikefinder-result-index .products-grid .product-items {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        column-gap: 80px;
        row-gap: 20px;
    }

    body.bikefinder-result-index .products-grid .product-item {
        width: auto !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
}


/* v26: match Magento's normal four-column search-result product-card proportions.
   Do not force a square wrapper to fill the whole grid cell: that caused the
   large blank area between portrait/smaller images and the product name. */
@media only screen and (min-width: 1024px) {
    body.bikefinder-result-index .products-grid .product-item-info {
        width: 100%;
    }

    body.bikefinder-result-index .products-grid .product-item-photo {
        display: block;
        width: 100%;
        margin-bottom: 14px;
    }

    body.bikefinder-result-index .products-grid .product-image-container {
        display: block;
        width: 100% !important;
        max-width: 100%;
    }

    body.bikefinder-result-index .products-grid .product-image-wrapper {
        display: block;
        height: 240px;
        padding-bottom: 0 !important;
        position: relative;
    }

    body.bikefinder-result-index .products-grid .product-image-photo {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        margin: auto;
        object-fit: contain;
    }
}

/* Keep Magento/Luma's natural responsive behaviour on tablets and phones. */
@media only screen and (max-width: 1023px) {
    body.bikefinder-result-index .products-grid .product-image-container {
        max-width: 100%;
    }
}
