.catalog-layout {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .85rem;
    align-items: start;
    padding-block: 1rem;
}

.catalog-search, .catalog-results { grid-column: 1 / -1; min-width: 0; }
.catalog-results { isolation: isolate; }
.catalog-search label { font-weight: 600; margin-bottom: .35rem; }
.catalog-search-row, .catalog-toolbar { display: flex; gap: .6rem; align-items: center; }
.catalog-search-input { position: relative; flex: 1; min-width: 0; }
.catalog-search input, .catalog-search button, .catalog-apply button { min-height: 44px; }
.catalog-search .btn, .catalog-apply .btn { border-radius: .65rem; }

.catalog-filters, .catalog-sort { position: relative; }
.catalog-filters > summary, .catalog-sort > summary {
    box-sizing: border-box;
    min-height: 44px;
    padding: .6rem .75rem;
    border: 1px solid #d6d6d6;
    border-radius: .65rem;
    cursor: pointer;
    font-weight: 600;
}

.catalog-toolbar { justify-content: flex-end; flex-wrap: wrap; }
.catalog-toolbar h2 { font-size: 1rem; margin: 0; scroll-margin-top: 90px; }
.catalog-filters-body { display: flex; flex-direction: column; }
.catalog-filter-options { padding: .65rem; }
.catalog-filters fieldset, .catalog-facet { margin-bottom: .75rem; }
.catalog-filters legend { font-size: 1rem; font-weight: 600; margin-bottom: .2rem; }
.catalog-options, .catalog-chips, .catalog-sort ul, .catalog-suggestions { list-style: none; margin: 0; padding: 0; }
.catalog-options > li { position: relative; }
.catalog-options .catalog-options {
    margin-left: .4rem;
    padding-left: .65rem;
    border-left: 1px solid #e2e2e2;
}
.catalog-options > li > label { display: flex; gap: .55rem; min-height: 40px; align-items: center; cursor: pointer; }
.catalog-options > li > label input { flex: none; }
.catalog-options > li > label small { color: #5f6368; font-size: .85em; white-space: nowrap; }
.catalog-option-parent { padding-right: 42px; }
.catalog-branch > summary, .catalog-facet > summary {
    border-radius: .4rem;
    cursor: pointer;
    list-style: none;
}
.catalog-facet > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding-right: 1rem;
    font-weight: 600;
}
.catalog-branch > summary {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
}
.catalog-branch > summary::-webkit-details-marker, .catalog-facet > summary::-webkit-details-marker { display: none; }
.catalog-branch > summary:hover, .catalog-facet > summary:hover { background: #f3f4f5; }
.catalog-chevron {
    width: .45rem;
    height: .45rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
}
.catalog-branch[open] > summary .catalog-chevron, .catalog-facet[open] > summary .catalog-chevron { transform: rotate(45deg); }
.catalog-swatch { width: 1rem; height: 1rem; border-radius: 50%; border: 1px solid #777; background: var(--swatch); flex: none; }
.catalog-apply {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .55rem .65rem;
    border-top: 1px solid #e2e2e2;
}
.catalog-apply a, .catalog-empty a { text-decoration: underline; }

.catalog-sort ul, .catalog-suggestion-popup {
    position: absolute;
    z-index: 5;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: .65rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    padding: .25rem;
}
.catalog-sort ul { right: 0; width: max-content; max-width: calc(100vw - 2rem); }
.catalog-suggestion-popup {
    inset: calc(100% + .25rem) 0 auto;
    z-index: 101;
    display: flex;
    flex-direction: column;
    max-height: 65vh;
}
.catalog-suggestion-popup[hidden] { display: none; }
.catalog-suggestion-popup.catalog-suggestions-above { inset: auto 0 calc(100% + .25rem); }
.catalog-suggestions { overflow-y: auto; overscroll-behavior-y: contain; }
.catalog-all-results {
    flex: none;
    padding: .4rem .75rem;
    border: 0;
    border-top: 1px solid #ddd;
    background: #fff;
    color: inherit;
    font-weight: 600;
    text-align: left;
}
.catalog-all-results:hover { background: #eee; }
.catalog-sort a, .catalog-suggestions li { display: block; padding: .6rem .75rem; border-radius: .4rem; overflow-wrap: anywhere; }
.catalog-sort a:hover, .catalog-sort [aria-current], .catalog-suggestions [aria-selected="true"] { background: #eee; }
.catalog-suggestions li { cursor: pointer; }
.catalog-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.catalog-chips a { display: block; padding: .42rem .75rem; background: #f3f4f5; border-radius: 2rem; overflow-wrap: anywhere; }

.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.catalog-grid .product-card { height: 100%; margin: 0; }
.catalog-grid .card-img-top.d-block { aspect-ratio: 1; background: #f5f5f5; }
.catalog-grid .product-img-hover-wrapper { height: 100%; }
.catalog-grid .product-img-hover-wrapper img { height: 100%; }
.catalog-grid h5 { overflow-wrap: anywhere; }
.catalog-heart { background: transparent; border: 0; min-width: 44px; min-height: 44px; }
.catalog-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin-top: 1.25rem; }
.catalog-pagination > * { min-width: 42px; padding: .55rem; border: 1px solid #ddd; text-align: center; border-radius: .45rem; }
.catalog-pagination [aria-current] { background: #151515; color: white; }
.catalog-empty { padding: 2rem 1rem; background: #f5f5f5; border-radius: .75rem; }
.catalog-empty a { margin-right: .65rem; }

#catalog-shell { position: relative; }
#catalog-shell::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: #151515; opacity: 0; }
#catalog-shell[aria-busy="true"]::before { opacity: 1; transition: opacity .15s .15s; }
#catalog-shell :focus-visible { outline: 2px solid #262626; outline-offset: 2px; }

.catalog-seasonal :is(.catalog-filters, .catalog-sort > summary) {
    background: #fff;
    border-radius: .65rem;
    color: #262626;
}
.catalog-seasonal :is(.catalog-apply a, .catalog-sort a, .catalog-chips a, .catalog-empty a) { color: #262626; }
.catalog-seasonal :is(.catalog-search label, .catalog-toolbar h2) { color: #f7f7f7; }
.catalog-seasonal #catalog-shell :is(.catalog-filters, .catalog-sort) > summary:focus-visible { outline-offset: -4px; }
.valentine-section .catalog-layout .btn-dark { color: #0a0a0a; }

@media (max-width: 359px) { .catalog-grid { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 768px) { .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 991px) {
    .catalog-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "search search"
            "filters sort"
            "count count"
            "results results";
    }
    .catalog-search { grid-area: search; }
    .catalog-filters { grid-area: filters; position: static; }
    .catalog-toolbar { display: contents; }
    .catalog-sort { grid-area: sort; }
    .catalog-toolbar h2 { grid-area: count; color: #5f6368; font-weight: 600; }
    .catalog-results { grid-area: results; }
    .catalog-filter-options {
        max-height: 50vh;
        max-height: min(50svh, 26rem);
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }
    .catalog-filters-body {
        position: absolute;
        inset-inline: 0;
        z-index: 100; /* Keep Apply above the footer when only a few products match. */
        margin-top: .4rem;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: .65rem;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    }
}
@media (min-width: 992px) {
    .catalog-layout {
        grid-template-columns: 14rem minmax(0, 1fr);
        grid-template-rows: auto auto 1fr;
        gap: 1rem 1.4rem;
    }
    .catalog-filters { grid-row: 2 / 4; grid-column: 1; }
    .catalog-toolbar, .catalog-results { grid-column: 2; }
    .catalog-toolbar { justify-content: space-between; }
}
@media (min-width: 1200px) { .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { #catalog-shell::before { transition: none !important; } }
