/* ==========================================================================
   Products page — toolbar, filter panel, catalogue grid, product card
   ========================================================================== */

/* ---------- toolbar ---------- */
.product-toolbar {
    position: sticky;
    top: var(--header-h);
    z-index: 60;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.product-toolbar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
    padding-block: var(--space-4);
}
.product-toolbar__form { display: flex; flex-wrap: wrap; gap: var(--space-3); flex: 1 1 520px; }
.product-toolbar__form .input-group { flex: 1 1 280px; }
.product-toolbar__form .select { flex: 0 1 200px; width: auto; }
.product-toolbar__meta { display: flex; align-items: center; gap: var(--space-4); margin-left: auto; }
.product-count { font-size: var(--text-sm); color: var(--ink-600); white-space: nowrap; }
.product-count b { color: var(--navy-900); }
.filter-toggle { display: none; }

@media (max-width: 1024px) {
    .product-toolbar__form .select { display: none; }
    .filter-toggle { display: inline-flex; }
    .product-toolbar__meta { width: 100%; margin-left: 0; justify-content: space-between; }
}
@media (max-width: 600px) {
    .product-toolbar { position: static; }
}

/* ---------- chip rows ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 760px) {
    /* below tablet the segment row scrolls sideways instead of stacking 13 rows deep */
    .chip-row--scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: var(--space-2);
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
}
.chip-row--letters .chip { font-size: var(--text-caption); }

.chip--segment { height: 44px; padding-inline: var(--space-4); gap: var(--space-2); }
.chip--segment img { width: 22px; height: 22px; object-fit: contain; }
.chip--segment[aria-pressed="true"] img, .chip--segment.is-active img { filter: brightness(0) invert(1); }
.chip.is-muted { color: var(--ink-400); border-color: var(--line); }
.chip.is-muted:hover { color: var(--brand-700); }

.filter-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.pill-clear {
    display: inline-flex; align-items: center; gap: var(--space-2);
    height: 32px; padding-inline: var(--space-3);
    border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
    background: #fff; color: var(--ink-600);
    font-size: var(--text-caption); font-weight: 700; cursor: pointer;
    transition: border-color .18s var(--ease), color .18s var(--ease);
}
.pill-clear:hover { border-color: var(--danger); color: var(--danger); }
.pill-clear svg { width: 12px; height: 12px; }

/* ---------- layout ---------- */
.products-layout {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    gap: clamp(1.5rem, 1rem + 2vw, 3rem);
    align-items: start;
}
@media (max-width: 1024px) {
    .products-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- filter panel ---------- */
.filter-panel {
    position: sticky;
    top: calc(var(--header-h) + 96px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.filter-panel__head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--line);
}
.filter-panel__title { font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm); color: var(--navy-900); }
.filter-group + .filter-group { border-top: 1px solid var(--line); }
.filter-group__trigger {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: none; border: 0; cursor: pointer; text-align: left;
    font-family: var(--font-heading); font-weight: 700; font-size: var(--text-caption);
    text-transform: uppercase; letter-spacing: .08em; color: var(--navy-800);
}
.filter-group__trigger:hover { background: var(--bg-subtle); }
.filter-group__trigger svg { width: 16px; height: 16px; color: var(--ink-500); transition: transform .2s var(--ease); flex: none; }
.filter-group__trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.filter-group__panel { padding: 0 var(--space-5) var(--space-5); display: grid; gap: var(--space-3); }
.filter-group__panel .check { font-size: var(--text-caption); line-height: 1.4; }
.filter-more {
    justify-self: start;
    background: none; border: 0; padding: 0; cursor: pointer;
    font-family: var(--font-heading); font-size: var(--text-caption); font-weight: 700; color: var(--brand-600);
}
.filter-more:hover { color: var(--brand-700); text-decoration: underline; }

/* Extra options stay collapsed only when JavaScript can reveal them again. */
.js .filter-group__panel .is-extra { display: none; }
.js .filter-group.is-expanded .filter-group__panel .is-extra { display: flex; }

.filter-group__panel .check input[type="radio"] { border-radius: 50%; }
.filter-panel__close { display: none; position: static; border-color: var(--line); }

@media (max-width: 1024px) {
    .filter-panel {
        position: fixed; inset: 0 0 0 auto; z-index: 130;
        width: min(360px, 88vw);
        border-radius: 0; border: 0;
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform .28s var(--ease);
    }
    .filter-panel.is-open { transform: none; }
    .filter-panel__head { position: sticky; top: 0; background: #fff; z-index: 1; }
    .filter-panel__close { display: grid; }
    .filter-scrim { position: fixed; inset: 0; z-index: 125; background: rgba(11, 31, 63, .5); }
}

/* ---------- product grid ---------- */
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
@media (max-width: 1240px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .product-grid { grid-template-columns: 1fr; } }

.product-card {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.product-card:hover { border-color: var(--brand-200); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.product-card__media {
    position: relative;
    display: grid; place-items: center;
    aspect-ratio: 4 / 3;
    padding: var(--space-5);
    background: linear-gradient(180deg, var(--bg-brand-subtle), #fff);
    border-bottom: 1px solid var(--line);
}
.product-card__media img { max-height: 100%; width: auto; object-fit: contain; }
.product-card__media .tag--new { position: absolute; top: var(--space-3); left: var(--space-3); }
.product-card__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.product-card__cat {
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--brand-600);
}
.product-card__name { font-family: var(--font-heading); font-weight: 700; font-size: var(--text-lg); color: var(--navy-900); line-height: 1.25; }
.product-card__comp { font-size: var(--text-sm); color: var(--ink-600); }
.product-card__meta {
    margin-top: auto; padding-top: var(--space-4);
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3);
    border-top: 1px solid var(--line);
}
.product-card__meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-400); }
.product-card__meta dd { margin: 2px 0 0; font-size: var(--text-caption); font-weight: 700; color: var(--navy-800); }
.product-card__foot { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-5) var(--space-5); }
.product-card__foot .btn { flex: 1; }

/* ---------- empty state ---------- */
.empty-state {
    display: grid; place-items: center; gap: var(--space-3);
    padding: var(--space-16) var(--space-6);
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
}
.empty-state h3 { font-size: var(--text-xl); }
.empty-state p { color: var(--ink-600); max-width: 46ch; }

/* ---------- details dialog ---------- */
.product-detail { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(1.5rem, 1rem + 2vw, 2.5rem); align-items: start; }
.product-detail__media {
    display: grid; place-items: center;
    padding: var(--space-6);
    background: linear-gradient(180deg, var(--bg-brand-subtle), #fff);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    aspect-ratio: 1 / 1;
}
.product-detail__media img { max-height: 320px; width: auto; object-fit: contain; }
.product-detail__specs { margin-top: var(--space-6); border-top: 1px solid var(--line); }
.product-detail__specs > div { display: flex; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.product-detail__specs dt { flex: 0 0 132px; font-size: var(--text-caption); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-500); }
.product-detail__specs dd { margin: 0; font-size: var(--text-sm); font-weight: 700; color: var(--navy-800); }
.product-detail__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
@media (max-width: 760px) {
    .product-detail { grid-template-columns: 1fr; }
    .product-detail__media { min-height: 200px; }
    .product-detail__media img { max-height: 220px; }
}
