* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --page: #f7f5f0;
    --paper: #fffdf8;
    --ink: #181818;
    --muted: #6d6860;
    --line: #ded8ce;
    --soft: #ede7dc;
    --accent: #7b3038;
}

body {
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(247, 245, 240, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.header-inner {
    max-width: 1220px;
    min-height: 72px;
    margin: 0 auto;
    padding: 0 22px;
    display: grid;
    grid-template-columns: 180px minmax(220px, 1fr) 120px;
    gap: 18px;
    align-items: center;
}

.brand {
    font-size: 13px;
    font-weight: 650;
    letter-spacing: .18em;
    text-decoration: none;
}

.search-form {
    position: relative;
    width: min(100%, 560px);
    justify-self: center;
}

.search-form input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--paper);
    color: var(--ink);
    padding: 0 48px 0 14px;
    font-size: 14px;
    outline: 0;
}

.search-form input:focus {
    border-color: var(--ink);
}

.search-form button {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 42px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    display: none;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--line);
    background: var(--paper);
}

.search-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px;
    cursor: pointer;
}

.search-item + .search-item {
    border-top: 1px solid var(--line);
}

.search-item:hover {
    background: var(--soft);
}

.search-image {
    width: 48px;
    height: 58px;
    object-fit: cover;
    background: var(--soft);
}

.search-item .info {
    font-size: 13px;
    line-height: 1.4;
}

.header-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
}

.header-actions a {
    position: relative;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    text-decoration: none;
}

.cart-count {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
}

.search-results-section {
    padding: 38px 0 72px;
}

.search-results-container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 22px;
}

.search-top {
    display: grid;
    grid-template-columns: minmax(0, .88fr) minmax(360px, .72fr);
    gap: 28px;
    align-items: stretch;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(42px, 7vw, 78px);
    font-weight: 520;
    line-height: .95;
}

.search-copy p {
    max-width: 580px;
    margin-top: 14px;
    color: var(--muted);
    line-height: 1.7;
}

.search-studio {
    border: 1px solid var(--line);
    background: var(--paper);
    padding: 16px;
    align-self: end;
}

.studio-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.studio-search-row input,
.refine-row select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--ink);
    padding: 0 12px;
    font: inherit;
    outline: 0;
}

.studio-search-row input:focus,
.refine-row select:focus {
    border-color: var(--ink);
}

.studio-search-row button {
    min-height: 42px;
    border: 1px solid var(--ink);
    border-radius: 5px;
    background: var(--ink);
    color: #fff;
    padding: 0 16px;
    font-weight: 650;
    cursor: pointer;
}

.visual-search {
    margin-top: 10px;
}

.visual-search input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.visual-drop {
    min-height: 74px;
    border: 1px dashed #c9c1b6;
    border-radius: 5px;
    background: #fbfaf6;
    color: var(--ink);
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 12px;
    cursor: pointer;
}

.visual-drop i {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--soft);
    display: grid;
    place-items: center;
}

.visual-drop strong {
    display: block;
    font-size: 13px;
    font-weight: 650;
}

.visual-drop small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.refine-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.refine-row label span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.results-count {
    min-height: 42px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.search-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.active-query {
    margin-left: 10px;
    color: var(--muted);
    font-size: 13px;
}

.quick-terms {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-terms a {
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}

.quick-terms a:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.product-card {
    position: relative;
    background: var(--paper);
    border: 1px solid var(--line);
    overflow: hidden;
}

.product-link {
    color: inherit;
    text-decoration: none;
}

.product-image {
    aspect-ratio: 4 / 5;
    background: var(--soft);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.035);
}

.product-info {
    padding: 13px;
}

.subcategory {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.product-info h3 {
    min-height: 42px;
    margin: 7px 0 0;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 560;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 0 13px 13px;
}

.price {
    font-weight: 720;
    white-space: nowrap;
}

.grid-cart-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 5px;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.grid-cart-btn:hover {
    background: var(--accent);
}

.empty-results {
    padding: 66px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.empty-results h2 {
    margin: 0;
    font-size: clamp(34px, 6vw, 62px);
    font-weight: 520;
    line-height: 1;
}

.empty-results p {
    max-width: 520px;
    margin-top: 16px;
    color: var(--muted);
    line-height: 1.7;
}

.empty-results a {
    display: inline-flex;
    margin-top: 24px;
    color: var(--ink);
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.pagination {
    margin-top: 34px;
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination a,
.active-page {
    min-width: 42px;
    min-height: 42px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    font-weight: 650;
    text-decoration: none;
}

.pagination a:hover,
.active-page {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

@media (max-width: 1120px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 760px) {
    .header-inner {
        min-height: 118px;
        grid-template-columns: 1fr auto;
        gap: 10px;
    }

    .brand {
        grid-column: 1 / 2;
    }

    .header-actions {
        grid-column: 2 / 3;
    }

    .search-form {
        grid-column: 1 / -1;
        width: 100%;
    }

    .search-results-section {
        padding-top: 28px;
    }

    .search-top {
        display: block;
    }

    .search-studio {
        margin-top: 22px;
    }

    .studio-search-row,
    .refine-row {
        grid-template-columns: 1fr;
    }

    .search-meta {
        display: block;
    }

    .quick-terms {
        justify-content: flex-start;
        margin-top: 18px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .product-info,
    .product-card-footer {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 390px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}
