/* ============================================================
   ART-GSM 2026 — PAGES  (catalog · listing · cart · search · etc.)
   Shared components for the §7 page build. Skins inherit tokens.
   ============================================================ */

/* ---------- PAGE HEADER (title block) ---------- */
.page-head { padding: var(--s-8) 0 var(--s-20); }
.page-head h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 700; letter-spacing: -.025em; line-height: 1.08; }
.page-head .ph-sub { margin-top: var(--s-10); font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.page-head .ph-meta { margin-top: var(--s-10); display: flex; flex-wrap: wrap; gap: var(--s-14); align-items: center; font-size: 13px; color: var(--ink-3); }
.page-head .ph-meta .mono { font-family: var(--mono); color: var(--ink-2); }

/* ---------- SECTION TITLE for inner pages ---------- */
.sub-h { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin-bottom: var(--s-16); }

/* ---------- BRAND CHIPS (filter row) ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row .filter-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 600; font-size: 13.5px; color: var(--ink-2); transition: border-color .15s, color .15s, background .15s;
}
.chip-row .filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-row .filter-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-row .filter-chip .n { font-family: var(--mono); font-size: 11px; opacity: .7; }

/* ============================================================
   LISTING — sidebar filters + grid
   ============================================================ */
.listing { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: var(--s-28); align-items: start; }
.filters { position: sticky; top: 92px; display: flex; flex-direction: column; gap: var(--s-8); }
.fgroup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.fgroup > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: var(--s-14) var(--s-16); font-weight: 700; font-size: 14px; }
.fgroup > summary::-webkit-details-marker { display: none; }
.fgroup > summary .chev { width: 18px; height: 18px; color: var(--ink-3); transition: transform .25s; }
.fgroup[open] > summary .chev { transform: rotate(180deg); }
.fgroup .fbody { padding: 0 var(--s-16) var(--s-16); display: flex; flex-direction: column; gap: var(--s-10); }
.fopt { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.fopt input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line-2); border-radius: 5px; flex: none; position: relative; cursor: pointer; transition: border-color .15s, background .15s; }
.fopt input:checked { background: var(--accent); border-color: var(--accent); }
.fopt input:checked::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.fopt .fo-n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.fopt:hover { color: var(--ink); }
/* brand/model filter search + scroll list */
.fsearch { width: 100%; height: 38px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); padding: 0 12px; font: inherit; font-size: 13px; color: var(--ink); margin-bottom: var(--s-4); }
.fsearch::placeholder { color: var(--ink-3); }
.fsearch:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.fbody-scroll { display: flex; flex-direction: column; gap: var(--s-10); max-height: 184px; overflow-y: auto; padding-right: 4px; }
.fbody-scroll::-webkit-scrollbar { width: 6px; }
.fbody-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
/* price range */
.price-range { display: flex; align-items: center; gap: 8px; }
.price-range input[type="number"] { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); padding: 0 10px; font: inherit; font-family: var(--mono); font-size: 13px; color: var(--ink); }
.price-range input:focus { outline: none; border-color: var(--accent); }
.price-range .dash { color: var(--ink-3); }
.filters .fclear { margin-top: var(--s-4); text-align: center; padding: var(--s-12); font-weight: 600; font-size: 13px; color: var(--accent); border: 1px dashed var(--line-2); border-radius: var(--r-md); }

/* sort/toolbar */
.list-toolbar { display: flex; align-items: center; gap: var(--s-12); margin-bottom: var(--s-16); flex-wrap: wrap; }
.list-toolbar .lt-count { font-size: 13px; color: var(--ink-3); }
.list-toolbar .lt-count b { font-family: var(--mono); color: var(--ink); }
.list-toolbar .spacer { flex: 1; }
.sortsel { position: relative; }
.sortsel select { height: 40px; padding: 0 34px 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-weight: 600; font-size: 13px; color: var(--ink); appearance: none; -webkit-appearance: none; cursor: pointer; }
.sortsel::after { content: ''; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.filter-btn { display: none; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 13px; }
.filter-btn svg { width: 17px; height: 17px; }
.filter-btn .badge { font-family: var(--mono); font-size: 11px; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 6px; }

/* grid / list view toggle */
.viewtoggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.viewtoggle .vt { width: 36px; height: 34px; border-radius: 7px; display: grid; place-items: center; color: var(--ink-3); transition: background .15s, color .15s; }
.viewtoggle .vt svg { width: 19px; height: 19px; }
.viewtoggle .vt:hover { color: var(--ink); }
.viewtoggle .vt.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* list layout (desktop) */
@media (min-width: 769px) {
  .prod-grid.is-list { grid-template-columns: 1fr; gap: var(--s-12); }
  .prod-grid.is-list .prod { position: relative; flex-direction: row; align-items: stretch; }
  .prod-grid.is-list .prod-media { width: 150px; aspect-ratio: 1/1; flex: none; padding: var(--s-12); border-right: 1px solid var(--line); }
  /* heart pinned to row top-right */
  .prod-grid.is-list .prod-fav { top: var(--s-14); right: var(--s-16); left: auto; transform: none; }
  /* info column fills middle; reserve room on the right for the action column */
  .prod-grid.is-list .prod-body { flex: 1; min-width: 0; padding: var(--s-16) 210px var(--s-16) var(--s-20); justify-content: center; gap: var(--s-8); }
  .prod-grid.is-list .prod-name { font-size: 16px; min-height: 0; -webkit-line-clamp: 2; }
  .prod-grid.is-list .prod-specs { min-height: 0; }
  /* price sits inline at the bottom of the info column */
  .prod-grid.is-list .prod-foot { margin-top: var(--s-4); display: block; }
  .prod-grid.is-list .prod-price { flex-direction: row; align-items: baseline; gap: var(--s-12); }
  /* dedicated action column on the right, vertically centred */
  .prod-grid.is-list .prod-add {
    position: absolute; right: var(--s-20); top: 50%; margin-top: -24px;
    width: 168px; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  }
  .prod-grid.is-list .prod-add:hover { transform: translateY(-2px); }
  .prod-grid.is-list .prod-add::after { content: 'В корзину'; font-weight: 700; font-size: 14px; }
}

/* ph-sub expand/collapse toggle (mobile) */
.ph-more { display: none; align-items: center; gap: 6px; margin-top: var(--s-8); font-weight: 700; font-size: 13px; color: var(--accent); }
.ph-more svg { width: 15px; height: 15px; transition: transform .25s; }
.ph-sub-wrap.open .ph-more svg { transform: rotate(180deg); }

/* applied filter pills */
.applied { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--s-16); }
.applied .ap { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px 0 12px; border-radius: var(--r-pill); background: var(--blue-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.applied .ap button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); }
.applied .ap button svg { width: 12px; height: 12px; }
.applied .ap button:hover { background: rgba(37,99,235,.15); }

/* pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: var(--s-28); }
.pager a, .pager span { min-width: 40px; height: 40px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; font-family: var(--mono); }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .gap { border: none; background: none; }

/* mobile filter sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,17,21,.5); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.fsheet { position: fixed; inset: 0 0 0 0; z-index: 71; background: var(--bg); transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
.fsheet.open { transform: translateY(0); }
.fsheet .fsheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-16); border-bottom: 1px solid var(--line); }
.fsheet .fsheet-head h3 { font-size: 18px; font-weight: 700; }
.fsheet .fsheet-body { flex: 1; overflow-y: auto; padding: var(--s-16); display: flex; flex-direction: column; gap: var(--s-10); }
.fsheet .fsheet-foot { padding: var(--s-12) var(--s-16); border-top: 1px solid var(--line); display: flex; gap: var(--s-10); background: var(--surface); }
.fsheet .fsheet-foot .btn { flex: 1; }

/* ============================================================
   CART
   ============================================================ */
.cart-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: var(--s-28); align-items: start; }
.cart-items { display: flex; flex-direction: column; gap: var(--s-12); }
.cart-item { display: grid; grid-template-columns: 96px minmax(0,1fr) 248px; gap: var(--s-16); padding: var(--s-16); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); align-items: stretch; }
.cart-item .ci-media { width: 96px; height: 96px; border-radius: var(--r-sm); background: var(--photo-bg); position: relative; overflow: hidden; border: 1px solid var(--line); }
.cart-item .ci-media img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; mix-blend-mode: multiply; }
.cart-item .ci-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cart-item .ci-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cart-item .ci-name { font-weight: 600; font-size: 15px; line-height: 1.3; letter-spacing: -.01em; }
.cart-item .ci-name:hover { color: var(--accent); }
.cart-item .ci-sku { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.cart-item .ci-main .sku-badge { align-self: flex-start; }
.cart-item .ci-controls { display: flex; align-items: center; gap: var(--s-14); margin-top: 2px; }
.cart-item .ci-remove { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.cart-item .ci-remove:hover { color: #ef4444; }
.cart-item .ci-remove svg { width: 15px; height: 15px; }
.cart-item .ci-right { text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.cart-item .ci-right .ci-controls { margin-top: auto; padding-top: var(--s-14); text-align: left; }
.cart-item .ci-right .ci-controls .stepper { height: 42px; }
.cart-item .ci-right .ci-controls .stepper button { width: 38px; }
.cart-item .ci-right .ci-controls .stepper input { width: 38px; }
.cart-item .ci-price { font-family: var(--mono); font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.cart-item .ci-each { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.cart-summary { position: sticky; top: 92px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: var(--s-20); display: flex; flex-direction: column; gap: var(--s-14); }
.cart-summary h3 { font-size: 17px; font-weight: 700; }
.promo { display: flex; gap: 8px; }
.promo input { flex: 1; height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); padding: 0 12px; font: inherit; font-size: 13px; }
.promo input:focus { outline: none; border-color: var(--accent); }
.promo button { height: 44px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); font-weight: 700; font-size: 13px; }
.promo button:hover { border-color: var(--accent); color: var(--accent); }
.sum-rows { display: flex; flex-direction: column; gap: var(--s-10); padding: var(--s-14) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sum-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--ink-2); }
.sum-row .v { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.sum-row.disc .v { color: #16a34a; }
.sum-total { display: flex; align-items: baseline; justify-content: space-between; }
.sum-total .l { font-size: 15px; font-weight: 700; }
.sum-total .v { font-family: var(--mono); font-weight: 700; font-size: 26px; letter-spacing: -.02em; }
.cart-trust { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.cart-trust .ct { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.cart-trust .ct svg { width: 15px; height: 15px; color: var(--accent); flex: none; }

/* empty cart */
.cart-empty { text-align: center; padding: var(--s-40) var(--s-16); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.cart-empty .ce-ic { width: 72px; height: 72px; margin: 0 auto var(--s-16); border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.cart-empty .ce-ic svg { width: 34px; height: 34px; }
.cart-empty h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.cart-empty p { font-size: 14px; color: var(--ink-2); margin-bottom: var(--s-20); }

/* ============================================================
   SEARCH overlay
   ============================================================ */
.search-page { min-height: 100%; }
.search-bar-lg { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding: var(--s-16) 0; }
.search-bar-lg .wrap { display: flex; align-items: center; gap: var(--s-12); }
.search-bar-lg .sb-input { flex: 1; position: relative; }
.search-bar-lg .sb-input svg.ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-3); }
.search-bar-lg .sb-input input { width: 100%; height: 52px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-2); padding: 0 16px 0 46px; font: inherit; font-size: 16px; color: var(--ink); }
.search-bar-lg .sb-input input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.search-bar-lg .sb-cancel { font-weight: 600; font-size: 14px; color: var(--accent); flex: none; }
.search-sec { margin-top: var(--s-24); }
.search-sec h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: var(--s-12); }
.search-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.search-tags a { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line-2); font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.search-tags a:hover { border-color: var(--accent); color: var(--accent); }
.search-tags a svg { width: 15px; height: 15px; color: var(--ink-3); }
.search-recent a { justify-content: space-between; }
.suggest-list { display: flex; flex-direction: column; gap: 2px; }
.suggest-list a { display: flex; align-items: center; gap: 12px; padding: var(--s-12); border-radius: var(--r-sm); font-size: 15px; color: var(--ink); }
.suggest-list a:hover { background: var(--surface-2); }
.suggest-list a svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.suggest-list a .hl { color: var(--accent); font-weight: 600; }
.suggest-list a .cat { margin-left: auto; font-size: 12px; color: var(--ink-3); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) {
  .listing { grid-template-columns: 1fr; }
  .filters { display: none; }
  .filter-btn { display: inline-flex; }
  .cart-grid { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
  /* listing toolbar: filters + sort on one row, count below */
  .list-toolbar { gap: var(--s-8); }
  .list-toolbar .spacer { display: none; }
  .list-toolbar .filter-btn { order: 1; flex: 0 0 auto; padding: 0 14px; justify-content: center; }
  .list-toolbar .sortsel { order: 2; flex: 1 1 auto; }
  .list-toolbar .sortsel select { width: 100%; }
  .list-toolbar .lt-count { order: 3; width: 100%; }
}
@media (max-width: 768px) {
  /* tighten vertical rhythm so cards reach into view sooner */
  .crumbs { padding: var(--s-8) 0; }
  .page-head { padding: 2px 0 var(--s-12); }
  .page-head .ph-sub { margin-top: var(--s-6); }
  .ph-more { margin-top: var(--s-6); }
  .list-toolbar { margin-bottom: var(--s-10); margin-top: var(--s-10); }
  /* clamp category description to 2 lines + show toggle */
  .ph-sub--clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .ph-sub-wrap.open .ph-sub--clamp { -webkit-line-clamp: unset; overflow: visible; }
  .ph-more { display: inline-flex; }
  .viewtoggle { display: none; }
  /* hide applied filter pills on phone */
  .applied { display: none; }
  .cart-item { grid-template-columns: 76px minmax(0,1fr); }
  .cart-item .ci-media { width: 76px; height: 76px; }
  .cart-item .ci-right { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; border-top: 1px solid var(--line); padding-top: var(--s-12); margin-top: 2px; }
  .cart-item .ci-right .ci-price { order: 1; }
  .cart-item .ci-right .ci-each { order: 2; }
  .cart-item .ci-right .ci-controls { order: 3; width: 100%; justify-content: space-between; margin-top: var(--s-8); padding-top: 0; }
  .page-head h1 { font-size: clamp(22px, 6vw, 28px); }
}
@media (min-width: 1024px) { .filter-btn { display: none; } }
