.shop {
    padding-block: clamp(40px, 6vw, 104px);

    h1 {
        margin: 18px 0 32px;
        font-family: 'Oswald', sans-serif;
        font-size: clamp(34px, 4.5vw, 76px);
        line-height: 1.08;
        text-transform: uppercase;
        overflow-wrap: anywhere;
    }

    .trail {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;

        a, span {
            font-size: 14px;
            overflow-wrap: anywhere;
        }

        a {
            color: var(--text-4);

            &::after {
                content: '/';
                margin-left: 8px;
            }
        }
    }

    .catalog {
        display: grid;
        grid-template-columns: minmax(188px, 1fr) minmax(0, 4.6fr);
        align-items: start;
        gap: clamp(16px, 2.1vw, 40px);
    }

    .head {
        grid-column: 1 / -1;
        display: flex;
        justify-content: space-between;
        align-items: end;
        flex-wrap: wrap;
        gap: 16px 24px;

        .title, .controls {
            display: flex;
            align-items: end;
            flex-wrap: wrap;
            gap: 8px 12px;
        }

        h1 {
            margin: 18px 0 0;
        }

        .count {
            margin-bottom: 4px;
            color: var(--text-4);
            font-size: 13px;
        }

        .controls {
            align-items: center;
            max-width: 100%;
        }

        input[type="search"] {
            width: clamp(150px, 16vw, 280px);
            min-width: 0;
        }
    }

    .controls :is(input, select, button), .filters .options input[type="number"], .filters .actions button {
        min-height: 38px;
        padding: 6px 12px;
        border: 1px solid var(--border-2);
        border-radius: 999px;
        background: var(--bg-7);
        font-size: 13px;
    }

    .filters {
        min-width: 0;

        summary {
            cursor: pointer;
            padding-block: 6px 12px;
            font-size: 15px;
            font-weight: 600;
        }

        .fields {
            display: grid;
            gap: 18px;
        }

        fieldset {
            min-width: 0;
            border: 0;
        }

        legend {
            margin-bottom: 9px;
            font-family: 'Wix Madefor Text', sans-serif;
            font-size: 16px;
            font-weight: 600;
        }

        .category label {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
            gap: 6px;
            min-height: 28px;

            small {
                font-size: 12px;
                color: var(--text-4);
            }
        }

        input:is([type="radio"], [type="checkbox"]) {
            position: absolute;
            width: 1px;
            height: 1px;
            opacity: 0;
        }

        .options, .actions {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 6px;
        }

        .options input[type="number"] {
            width: calc((100% - 6px) / 2);
        }

        .options label {
            display: flex;
            align-items: center;
            gap: 5px;
            border: 1px solid var(--border-2);
            padding: 4px 8px;
            border-radius: 999px;

            &:has(input:checked) {
                border-color: var(--border-8);
                background: var(--bg-19);
            }
        }

        label:has(input:checked) span {
            color: var(--text-2);
        }

        label:has(input:focus-visible) {
            outline: 2px solid var(--border-8);
            outline-offset: 2px;
        }

        .actions {
            gap: 10px;
        }

        .actions a {
            color: var(--text-4);
            text-decoration: underline;
        }

        span, a {
            font-size: 13px;
            overflow-wrap: anywhere;
        }
    }

    .cards {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: clamp(20px, 3vw, 56px) 16px;
    }

    .item {
        position: relative;

        .media {
            position: relative;
            aspect-ratio: 457 / 416;
            background: var(--bg-4);
        }

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .badge {
            position: absolute;
            top: 8px;
            left: 8px;
            max-width: calc(100% - 16px);
            padding: 4px 7px;
            background: var(--bg-13);
            font-size: 12px;
            overflow-wrap: anywhere;
        }

        h2 {
            margin-top: 10px;
            font-family: 'Wix Madefor Text', sans-serif;
            font-size: 18px;
            font-weight: 600;
            line-height: 1.35;
            overflow-wrap: anywhere;
        }

        .price {
            margin-top: 6px;
            font-weight: 600;

            del {
                font-size: inherit;
                color: var(--text-4);
            }
        }

        .caption {
            margin-top: 3px;
            color: var(--text-4);
            font-size: 14px;
            overflow-wrap: anywhere;
        }

        .open {
            position: absolute;
            inset: 0;
        }
    }

    .price {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .empty {
        padding: 24px;
        border: 1px solid var(--border-2);
        color: var(--text-4);
    }

    .product {
        display: grid;
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
        align-items: start;
        gap: clamp(20px, 4vw, 56px);
        padding-top: 24px;

        &:not(:has(> img)) {
            grid-template-columns: minmax(0, 700px);
        }

        > img {
            background: var(--bg-13);
            aspect-ratio: 1;
            object-fit: contain;
        }

        h1 {
            margin: 0 0 18px;
        }

        h2 {
            margin-bottom: 12px;
            font-weight: 600;
        }

        .variants, .description {
            margin-top: 24px;
            padding-top: 16px;
            border-top: 1px solid var(--border-2);
            overflow-wrap: anywhere;
        }

        .variants ul {
            display: grid;
            gap: 8px;
            list-style: none;
        }

        .variants li {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            gap: 6px 12px;
        }

        .stock {
            color: var(--text-4);
        }
    }

    :is(a, button, input, select, summary):focus-visible {
        outline: 2px solid var(--border-8);
        outline-offset: 2px;
    }
}

@media screen and (max-width: 1440px) {
    .shop .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 767px) {
    .shop {
        .catalog, .product {
            grid-template-columns: minmax(0, 1fr);
            gap: 18px;
        }

        .head .controls {
            flex: 1 0 100%;
            gap: 6px;

            input[type="search"] {
                flex: 1 1 110px;
            }

            select {
                max-width: 37%;
            }
        }

        .cards {
            gap: 20px 8px;
        }

        .item {
            h2, .price {
                font-size: 14px;
            }

            .caption, .badge {
                font-size: 11px;
            }
        }
    }
}

@media (hover: hover) and (pointer: fine) {
    .shop {
        .trail a:hover, .filters .actions a:hover {
            color: var(--text-1);
        }

        .item:has(.open:hover) h2 {
            color: var(--text-2);
        }
    }
}
