:root {
    --ink: #121a2b;
    --ink-soft: #1d2740;
    --bg: #f2f3f5;
    --surface: #ffffff;
    --border: #d8dce2;
    --text: #1a1f2b;
    --muted: #596273;
    --cta: #0b7a75;
    --cta-hover: #086561;
    --sale: #c8102e;
    --link: #0b5cab;
    --radius: 6px;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; padding-block: 1.25rem 3rem; }
a { color: var(--link); }
h1, h2, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.container { width: min(1200px, 100% - 2rem); margin-inline: auto; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

/* Header */
.site-header { background: var(--ink); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding-block: .9rem; }
.logo { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; color: #fff; text-decoration: none; white-space: nowrap; }
.logo span { color: #5fd0c8; }

.header-search { flex: 1; display: flex; max-width: 640px; margin-left: auto; }
.header-search input {
    flex: 1;
    min-width: 0;
    padding: .65rem .9rem;
    font: inherit;
    border: 0;
    border-radius: var(--radius) 0 0 var(--radius);
}
.header-search button {
    padding: 0 1.25rem;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: var(--cta);
    border: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
}
.header-search button:hover { background: var(--cta-hover); }

/* Category nav */
.category-nav { background: var(--ink-soft); }
.category-nav ul { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.category-nav a {
    display: block;
    padding: .7rem .9rem;
    color: #d6dcea;
    font-weight: 600;
    font-size: .92rem;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.category-nav a:hover { color: #fff; }
.category-nav a.active { color: #fff; border-bottom-color: #5fd0c8; }

/* Page heading */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.01em; }
.count { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.sort { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.sort select {
    padding: .45rem .6rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Layout */
.layout { display: grid; gap: 1.25rem; grid-template-columns: 240px 1fr; align-items: start; }

.sidebar details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.sidebar summary { display: none; font-weight: 700; cursor: pointer; }
.sidebar fieldset { border: 0; margin: 0 0 .75rem; padding: 0; }
.sidebar legend { font-weight: 700; margin-bottom: .5rem; padding: 0; }
.price-range { display: flex; align-items: center; gap: .4rem; }
.price-range input {
    width: 100%;
    min-width: 0;
    padding: .5rem .6rem;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.reset { display: inline-block; margin-top: .6rem; font-size: .88rem; }

.side-block { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.side-block h2 { font-size: 1rem; margin-bottom: .4rem; }
.side-list a {
    display: flex;
    justify-content: space-between;
    padding: .4rem .5rem;
    margin-inline: -.5rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
}
.side-list a:hover { background: var(--bg); }
.side-list a.active { font-weight: 700; background: #e3f3f1; }
.side-list span { color: var(--muted); font-weight: 400; }

/* Buttons */
.btn {
    display: inline-block;
    padding: .65rem 1rem;
    font: inherit;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background: var(--cta);
    border: 0;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--cta-hover); }
.btn-block { display: block; width: 100%; }

/* Product grid */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.product {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.product:hover { border-color: #aab2bf; }

.thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: #eceef1;
    color: #a3abb8;
    border-bottom: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.flash {
    position: absolute;
    top: .6rem;
    left: .6rem;
    padding: .2rem .55rem;
    font-size: .8rem;
    font-weight: 800;
    color: #fff;
    background: var(--sale);
    border-radius: 3px;
}

.product-body { display: flex; flex-direction: column; flex: 1; padding: .9rem 1rem 1rem; }
.product-cat { font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.product-title { font-size: 1rem; line-height: 1.35; margin-top: .2rem; }
.product-title a { color: var(--text); text-decoration: none; }
.product-title a:hover { text-decoration: underline; }
.product-desc {
    margin-top: .3rem;
    color: var(--muted);
    font-size: .88rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-price { margin-top: auto; padding-block: .8rem .9rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; }
.now { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.now.none { font-size: 1.1rem; color: var(--muted); }
.was { color: var(--muted); font-size: .85rem; text-decoration: line-through; }
.save { width: 100%; color: var(--sale); font-weight: 700; font-size: .85rem; }

/* Empty + pager */
.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.empty h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.empty p { color: var(--muted); margin-bottom: 1rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.75rem; flex-wrap: wrap; }
.page-link {
    padding: .5rem 1rem;
    color: var(--link);
    font-weight: 600;
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.page-link:hover { border-color: var(--link); }
.page-link.disabled { color: #a3abb8; pointer-events: none; }
.pager-info { color: var(--muted); font-size: .9rem; }

/* Footer */
.site-footer { background: var(--ink); color: #aeb8cc; font-size: .85rem; padding-block: 1.5rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Smaller screens */
@media (max-width: 899px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar summary { display: block; }
    .sidebar details:not([open]) summary { margin: 0; }
    .sidebar details[open] summary { margin-bottom: .75rem; }
}

@media (max-width: 640px) {
    .header-inner { flex-wrap: wrap; gap: .6rem; padding-block: .75rem; }
    .header-search { flex-basis: 100%; max-width: none; margin-left: 0; }
}
