/* One product markup: compact cards by default, a comparison table on request. */
.catalog-section {
    margin-block: 14px 22px;
}
.catalog-work {
    min-width: 0;
}
.catalog-work.with-filters {
    display: grid;
    grid-template-columns: 212px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
.catalog-results {
    min-width: 0;
}
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 8px;
}
.result-count {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.view-switch {
    display: inline-flex;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.view-switch button {
    padding: 5px 10px;
    background: var(--surface);
    border: 0;
    font-size: 11px;
    font-weight: 700;
}
.view-switch button[aria-pressed="true"] {
    background: var(--primary);
    color: var(--on-fill);
}
.filter-toggle {
    display: none;
    padding: 5px 9px;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--on-fill);
    font-size: 11px;
    font-weight: 700;
}
.filter-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}
.filter-head button {
    display: none;
    border: 0;
    background: var(--clear);
    font-size: 22px;
    line-height: 1;
}
.filter-section {
    padding: 10px;
    border-bottom: 1px solid var(--line);
}
.filter-section:last-child {
    border: 0;
}
.filter-section h3 {
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sort-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}
.sort-buttons .chip {
    padding: 6px 3px;
    font-size: 10px;
}
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.filter-chips .chip {
    font-size: 10px;
    padding: 4px 6px;
    border-radius: 20px;
}
.price-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.price-range label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    color: var(--muted);
}
.price-range input {
    width: 100%;
    padding: 6px;
}
.price-range button {
    grid-column: 1/-1;
    padding: 6px;
    font-size: 11px;
}
.clear-filters {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
}
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 0 8px;
}
.active-filters .chip {
    font-size: 10px;
    padding: 3px 6px;
}
.active-filters .clear-filters {
    margin: 4px;
}
.table-scroll {
    position: relative;
    min-width: 0;
    max-width: 100%;
}
.product-list {
    border-collapse: collapse;
}
.product-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    font-weight: 650;
    line-height: 16px;
    overflow-wrap: anywhere;
}
.product-brand {
    display: block;
    min-height: 14px;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.product-brand a + a {
    margin-left: 4px;
}
.product-photo img {
    object-fit: contain;
    display: block;
}
.product-rank {
    color: var(--muted);
    font-size: 10px;
}
.rating-cell {
    font-size: 10px;
    white-space: nowrap;
}
.rating-cell > span[aria-hidden] {
    color: var(--accent);
}
.rating-cell small {
    color: var(--muted);
    font-size: 9px;
}
.sold-cell {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
}
.stock-tag {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 3px;
    background: var(--canvas);
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
    white-space: nowrap;
}
.stock-instock {
    background: var(--soft);
    color: var(--primary);
}
.stock-outofstock {
    background: var(--danger-soft);
    color: var(--danger);
}
.price-cell {
    font-weight: 750;
    font-size: 14px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.price-cell del {
    font-size: 10px;
    color: var(--muted);
    font-weight: 400;
    margin-right: 4px;
}
.price-cell ins {
    text-decoration: none;
}
.product-list .buy-cell .button {
    font-size: 10px;
    padding: 6px 8px;
    white-space: nowrap;
}
.product-list .added_to_cart {
    display: block;
    color: var(--accent);
    font-size: 10px;
    margin-top: 3px;
}
/* Cards retain exactly the same cells as the comparison table. */
.view-grid .product-list {
    display: block;
    width: 100%;
}
.view-grid thead {
    display: none;
}
.view-grid tbody {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}
.view-grid .product-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    gap: 6px;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.view-grid td {
    padding: 0;
    min-width: 0;
    border: 0;
}
.view-grid .identity-cell,
.view-grid .stock-cell,
.view-grid .price-cell,
.view-grid .buy-cell {
    grid-column: 1/-1;
}
.view-grid .spec-cell,
.view-grid .product-rank {
    display: none;
}
.view-grid .product-photo {
    display: block;
    margin-bottom: 7px;
}
.view-grid .product-photo img {
    width: 100%;
    height: 110px;
    border-radius: 3px;
    background: var(--canvas);
}
.view-grid .product-name {
    min-height: 32px;
}
.view-grid .sold-cell {
    text-align: right;
}
.view-grid .buy-cell .button {
    width: 100%;
}
/* Frozen identity column and frozen header inside the sideways scrolling sheet. */
.view-table .table-scroll {
    overflow: auto;
    max-height: calc(100dvh - 210px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.view-table .product-list {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}
.view-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--canvas);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    padding: 7px 9px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.view-table td {
    height: 44px;
    padding: 3px 7px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.view-table .identity-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 255px;
    min-width: 255px;
    max-width: 255px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}
.view-table th.identity-cell {
    z-index: 4;
    background: var(--canvas);
}
.view-table .product-ident {
    display: grid;
    grid-template-columns: 14px 24px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
}
.view-table .product-photo img {
    width: 24px;
    height: 26px;
}
.view-table .spec-cell {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.view-table .product-row:nth-child(even) td {
    background: var(--canvas);
}
.view-table .product-row:hover td {
    background: var(--soft);
}
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}
.pagination a,
.pagination span {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--surface);
    padding: 5px 9px;
    font-size: 12px;
}
.pagination .current {
    background: var(--primary);
    color: var(--on-fill);
}
/* Home strips reuse the cards, without archive controls or remembered table mode. */
.home-strip .table-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}
.home-strip tbody {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 40px) / 6);
}
.home-strip .product-row {
    scroll-snap-align: start;
}
@media (min-width: 701px) {
    .view-table .product-text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 16px;
    }
    .view-table .product-brand {
        display: inline;
        min-height: 0;
        margin-right: 5px;
    }
    .view-table .product-name {
        display: inline;
        font-size: 11px;
        line-height: 16px;
    }
}
@media (max-width: 1200px) {
    .catalog-work.with-filters {
        grid-template-columns: 190px minmax(0, 1fr);
        gap: 10px;
    }
    .view-grid tbody {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
    .home-strip tbody {
        grid-template-columns: none;
        grid-auto-columns: calc((100% - 32px) / 5);
    }
}
@media (max-width: 950px) {
    .view-grid tbody {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .home-strip tbody {
        grid-template-columns: none;
        grid-auto-columns: calc((100% - 24px) / 4);
    }
}
@media (max-width: 700px) {
    .catalog-work.with-filters {
        display: block;
    }
    .filter-panel {
        display: none;
    }
    .filter-panel.is-open {
        display: block;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(330px, 90vw);
        max-height: none;
        overflow: auto;
        z-index: 200;
        border-radius: 0;
        box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--ink) 40%, var(--clear));
    }
    .filter-head {
        position: sticky;
        top: 0;
        background: var(--surface);
        z-index: 2;
    }
    .filter-head button {
        display: block;
    }
    .filter-toggle {
        display: inline-flex;
    }
    .filter-section h3 {
        font-size: 11px;
    }
    .filter-chips .chip,
    .sort-buttons .chip {
        font-size: 12px;
        padding: 7px;
    }
    .view-grid tbody {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .home-strip tbody {
        grid-template-columns: none;
        grid-auto-columns: calc((100% - 8px) / 2);
    }
    .view-grid .product-row {
        padding: 8px;
        gap: 5px;
    }
    .view-grid .product-photo img {
        height: 100px;
    }
    .view-table .identity-cell {
        width: 205px;
        min-width: 205px;
        max-width: 205px;
    }
    .view-table .product-ident {
        grid-template-columns: 14px 26px minmax(0, 1fr);
        gap: 4px;
    }
    .view-table .product-photo img {
        width: 26px;
        height: 30px;
    }
    .view-table .product-name {
        font-size: 11px;
        line-height: 15px;
    }
    .view-table td {
        height: 53px;
        padding: 5px 7px;
    }
    .view-table .table-scroll {
        max-height: 70dvh;
    }
    .section-heading h2 {
        font-size: 17px;
    }
    :root:not(.js) .filter-panel {
        display: block;
        margin-bottom: 10px;
    }
}
