/* The mobile picker keeps its filters in view while products scroll. */

.editor-page #editorProductSelectModal.show {
    visibility: visible;
    transition: opacity .2s ease;
}

@media (max-width: 768px) {
    .editor-page #editorProductSelectModal {
        --product-select-gutter: 16px;
        top: 0;
        right: 0;
        bottom: calc(var(--editor-mobile-dock) + 16px + env(safe-area-inset-bottom, 0px));
        left: 0;
        padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
        display: flex;
        align-items: flex-end;
        justify-content: center;
        background: #fff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .editor-page #editorProductSelectModal .editor-product-select-dialog {
        width: 100%;
        max-width: none;
        height: 100%;
        min-height: 0;
        max-height: 100%;
        border: 0;
        border-radius: 0;
        background: #f7f9fc;
        box-shadow: none;
    }
    .editor-page #editorProductSelectModal .editor-product-select-header {
        min-height: 0;
        padding: 16px 0 14px;
        border-bottom: 0;
        background: #fff;
        box-shadow: none;
    }
    .editor-page #editorProductSelectModal .editor-product-select-header-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        grid-template-rows: auto;
        align-items: center;
        column-gap: 10px;
    }
    .editor-page #editorProductSelectModal .editor-product-select-icon {
        display: none;
    }
    .editor-page #editorProductSelectModal .editor-product-select-heading {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }
    .editor-page #editorProductSelectModal .editor-product-select-heading strong {
        font-size: clamp(13px, 3.8vw, 16px);
        font-weight: 500;
        line-height: 22px;
        white-space: nowrap;
    }
    .editor-page #editorProductSelectModal .editor-product-select-heading span {
        display: none;
    }
    .editor-page #editorProductSelectModal .editor-product-selected-count {
        display: block;
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
        padding: 0;
        border: 0;
        background: transparent;
        color: #60718b;
        font-size: 11px;
        font-weight: 400;
        line-height: 16px;
    }
    .editor-page #editorProductSelectModal .editor-product-select-close {
        grid-column: 2;
        grid-row: 1;
        width: 44px;
        height: 44px;
        margin: 0;
        border-color: #e5eaf2;
        border-radius: 14px;
        background: #f7f9fc;
        box-shadow: none;
        transform: none;
    }
    .editor-page #editorProductSelectModal .editor-product-select-body {
        flex: 1 1 0;
        min-height: 0;
        padding: 0;
    }
    .editor-page #editorProductSelectModal #editorProductCatalog {
        flex: 1 1 0;
        min-height: 0;
        height: auto;
    }
    /* Retain the live result count for assistive technology without a second title. */
    .editor-page #editorProductSelectModal #editorProductCatalog>.panel-section-title {
        position: absolute;
        width: 1px;
        height: 1px;
        min-height: 0;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .editor-page #editorProductSelectModal .editor-category-chips {
        gap: 8px;
        margin: 0;
        padding: 0 var(--product-select-gutter) 14px;
        border-bottom: 1px solid #e8edf5;
        background: #fff;
        scrollbar-width: none;
        scroll-padding-inline: var(--product-select-gutter);
    }
    .editor-page #editorProductSelectModal .editor-category-chips::-webkit-scrollbar {
        display: none;
    }
    .editor-page #editorProductSelectModal .editor-category-chip {
        min-height: 34px;
        padding: 0 15px;
        border-color: #e2e8f1;
        background: #f8fafd;
        color: #1e1e1e;
        font-size: 11px;
        font-weight: 500;
        box-shadow: none;
    }
    .editor-page #editorProductSelectModal .editor-category-chip.active {
        border-color: #0051bb;
        background: #0051bb;
        color: #fff;
    }
    .editor-page #editorProductSelectModal .editor-product-list {
        flex: 1 1 0;
        min-height: 0;
        max-height: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: max-content;
        align-content: start;
        gap: 12px;
        padding: 16px var(--product-select-gutter) max(20px, env(safe-area-inset-bottom, 0px));
        scrollbar-gutter: auto;
        scrollbar-width: thin;
        scrollbar-color: #d5deeb transparent;
    }
    .editor-page #editorProductSelectModal .editor-product-card {
        min-height: min-content;
        grid-template-rows: clamp(112px, 34vw, 180px) auto;
        border: 1px solid #e0e7f1;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 2px 6px rgb(24 48 88 / 3%);
        transform: none;
        transition: border-color .15s ease, box-shadow .15s ease;
    }
    .editor-page #editorProductSelectModal .editor-product-card::before {
        display: none;
    }
    .editor-page #editorProductSelectModal .editor-product-card:is(.active, .multi-selected) {
        border-color: #0051bb;
        background: #fff;
        box-shadow: 0 0 0 1px #0051bb;
    }
    .editor-page #editorProductSelectModal .editor-product-card:is(.active, .multi-selected)::after {
        top: 9px;
        right: 9px;
        width: 24px;
        height: 24px;
        border: 2px solid #fff;
        border-radius: 50%;
        background-color: #0051bb;
        background-size: 19px;
        filter: none;
    }
    .editor-page #editorProductSelectModal .editor-product-card>.editor-product-media {
        width: 100%;
        height: 100%;
        border-bottom: 1px solid #f0f3f8;
        background: #f2f5fa;
    }
    .editor-page #editorProductSelectModal .editor-product-card>.editor-product-media>img {
        padding: 12px;
        object-fit: contain;
        transform: none;
        filter: none;
    }
    .editor-page #editorProductSelectModal .editor-product-info {
        padding: 11px 12px 13px;
    }
    .editor-page #editorProductSelectModal .editor-product-category {
        margin: 0 0 4px;
        padding: 0;
        color: #7b879b;
        font-size: 13px;
        font-weight: 300;
        line-height: 14px;
        letter-spacing: 0;
        text-transform: none;
    }
    .editor-page #editorProductSelectModal .editor-product-name {
        min-height: 0;
        padding: 0;
        font-size: 14px;
        font-weight: 500;
        line-height: 18px;
        white-space: normal;
    }
    .editor-page #editorProductSelectModal .editor-product-meta {
        padding: 0;
        color: #0051bb;
        font-size: 13px;
        font-weight: 500;
        line-height: 20px;
    }
    .editor-page #editorProductSelectModal :is(.editor-product-card, .editor-category-chip):focus-visible {
        outline: 3px solid #86b4f3;
        outline-offset: -3px;
    }
}

@media (max-width: 359px) {
    .editor-page #editorProductSelectModal {
        --product-select-gutter: 12px;
    }
    .editor-page #editorProductSelectModal .editor-product-list {
        gap: 10px;
    }
    .editor-page #editorProductSelectModal .editor-product-info {
        padding-inline: 10px;
    }
}

@media (max-width: 768px) and (max-height: 500px) {
    .editor-page #editorProductSelectModal {
        padding-top: 0;
    }
    .editor-page #editorProductSelectModal .editor-product-select-dialog {
        max-width: none;
        border-radius: 0;
    }
    .editor-page #editorProductSelectModal .editor-product-select-header {
        padding-block: 8px;
    }
    .editor-page #editorProductSelectModal .editor-category-chips {
        padding-bottom: 8px;
    }
    .editor-page #editorProductSelectModal .editor-product-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding-top: 12px;
    }
    .editor-page #editorProductSelectModal .editor-product-card {
        grid-template-rows: 112px auto;
    }
}