:root {
    color-scheme: light;
    --background: #f3f5f7;
    --surface: #ffffff;
    --surface-muted: #f7f8fa;
    --text: #17202a;
    --muted: #667085;
    --primary: #153a5b;
    --primary-hover: #0d2a43;
    --border: #e2e7ec;
    --success: #137a4b;
    --danger: #b42318;
    --radius: 14px;
    --shadow: 0 10px 30px rgb(23 32 42 / 8%);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.site-header,
.layout,
footer {
    width: min(1440px, calc(100% - 40px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 34px 24px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 4px;
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    line-height: 1.1;
}

.subtitle,
.status {
    margin-bottom: 0;
    color: var(--muted);
}

.demo-badge {
    padding: 7px 11px;
    border: 1px solid #c7d7e5;
    border-radius: 999px;
    background: #eaf2f8;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
}

.sidebar,
.toolbar,
.empty-state {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    padding: 18px;
}

.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar h2 {
    margin: 0;
    font-size: 1rem;
}

.text-button,
.category-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
}

.text-button {
    padding: 0;
    font-size: 0.78rem;
    font-weight: 650;
}

.category-button {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 9px;
    text-align: left;
}

.category-button:hover,
.category-button[aria-current="true"] {
    background: #eaf2f8;
}

.category-count {
    color: var(--muted);
    font-size: 0.78rem;
}

.category-children {
    padding-left: 13px;
}

.content {
    min-width: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 14px;
}

.search-field {
    flex: 1;
}

.search-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text);
}

.search-field input:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgb(21 58 91 / 30%);
    outline-offset: 2px;
}

.status {
    min-width: 110px;
    text-align: right;
    font-size: 0.88rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.product-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 5px 18px rgb(23 32 42 / 5%);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.product-open {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.product-image {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #e8edf1;
}

.product-copy {
    display: grid;
    gap: 7px;
    padding: 15px;
}

.product-meta,
.product-stock {
    color: var(--muted);
    font-size: 0.82rem;
}

.product-name {
    min-height: 3em;
    font-size: 1rem;
}

.product-stock[data-status="instock"] {
    color: var(--success);
}

.product-stock[data-status="outofstock"] {
    color: var(--danger);
}

.product-prices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding-top: 5px;
    border-top: 1px solid var(--border);
    font-size: 0.86rem;
}

.price-value {
    font-weight: 750;
}

.empty-state {
    padding: 54px 20px;
    text-align: center;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.load-more {
    display: block;
    margin: 24px auto 0;
    padding: 11px 20px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.load-more:hover {
    background: var(--primary-hover);
}

.product-dialog {
    width: min(760px, calc(100% - 28px));
    max-height: calc(100dvh - 28px);
    padding: 24px;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgb(0 0 0 / 30%);
}

.product-dialog::backdrop {
    background: rgb(8 20 31 / 72%);
}

.dialog-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-muted);
    cursor: pointer;
    font-size: 1.5rem;
}

.dialog-layout {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) 1.2fr;
    gap: 24px;
}

.dialog-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    object-fit: cover;
    background: #e8edf1;
}

.dialog-description {
    color: var(--muted);
    white-space: pre-line;
}

footer {
    padding-block: 36px;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: center;
}

footer a {
    color: var(--primary);
}

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

@media (max-width: 760px) {
    .site-header,
    .layout,
    footer {
        width: min(100% - 24px, 1440px);
    }

    .site-header {
        align-items: flex-start;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    #category-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .toolbar,
    .dialog-layout {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .status {
        text-align: left;
    }
}
