/* РИТИЗ — категория и карточка товара. Общие стили — site.css */

.page { padding: 20px 0 8px; }
.nav a[aria-current="page"] { background: var(--brand-50); color: var(--accent); }

/* Навигационная цепочка */
.crumbs ol { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 8px; color: #B9AB9B; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }

/* Шапка спряталась при прокрутке вниз — липкие блоки поднимаются к верху окна */
.filters, .gal, .pd-tabs { transition: top .25s ease; }
body.hdr-hidden .filters, body.hdr-hidden .gal { top: 20px; }
body.hdr-hidden .filters { max-height: calc(100vh - 40px); }
body.hdr-hidden .pd-tabs { top: 0; }

/* ---------- Категория ---------- */
.cat-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.cat-head h1 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 600; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.cat-count { font-size: 15px; font-weight: 700; color: var(--muted); }
.cat-head .lead { color: var(--muted); margin-top: 8px; max-width: 680px; }

.subtabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px 18px; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 15px; cursor: pointer; color: var(--text); }
.subtabs button span { font-size: 13px; color: var(--muted); font-weight: 600; }
.subtabs button:hover { border-color: var(--accent); color: var(--accent); }
.subtabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--accent); color: #fff; }
.subtabs button[aria-pressed="true"] span { color: #F1DFC9; }
.subtabs button:active { transform: scale(.97); }

.cat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
.cat-layout > section { min-width: 0; }

/* Фильтры */
.filters { position: sticky; top: 148px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px 12px; max-height: calc(100vh - 168px); overflow: auto; }
.filters-head { display: none; }
.filters-foot { display: none; }
.filters fieldset { border: 0; margin: 0; padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.filters fieldset:last-child { border-bottom: 0; }
.filters legend { font-weight: 800; font-size: 15px; padding: 0; margin-bottom: 6px; }
.fopt { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 15px; border-radius: 8px; padding: 0 6px; margin: 0 -6px; }
.fopt:hover { background: var(--bg); }
.fopt input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex: none; }
.fopt span { flex: 1; }
.fopt small { color: var(--muted); font-size: 13px; font-weight: 600; }
.fopt.is-off { color: #A0948A; cursor: default; }
.fopt.is-off:hover { background: none; }

/* Панель над списком */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.found { font-size: 16px; font-weight: 700; margin-right: auto; }
.flt-btn { display: none; }
.flt-n[hidden] { display: none; }
.flt-n { background: var(--amber); color: var(--ink); border-radius: 10px; min-width: 20px; height: 20px; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; padding: 0 6px; }
.seg { display: flex; gap: 4px; background: var(--sand); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: none; min-height: 36px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg-ico button { width: 40px; justify-content: center; padding: 0; }

.chips-on { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips-on:empty { display: none; }
.chips-on button { border: 1px solid #E8D8C5; background: var(--brand-50); color: var(--accent); border-radius: 999px; min-height: 32px; padding: 0 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.chips-on button span { margin-left: 4px; }
.chips-on .chip-reset { background: none; border-color: transparent; color: var(--muted); text-decoration: underline; }

.cat-products { grid-template-columns: repeat(3, 1fr); }

/* Список — для быстрого заказа многих позиций */
.products.is-list { grid-template-columns: 1fr; gap: 8px; }
.is-list .card { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; }
.is-list .card .ph { --ph-x: 12px; --ph-y: 10px; aspect-ratio: auto; height: 84px; border-bottom: 0; border-right: 1px solid var(--line); }
.is-list .card .tag { display: none; }
.is-list .card .body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 16px; padding: 10px 16px; }
.is-list .card .sku { flex-basis: 100%; }
.is-list .card h3 { flex: 1; min-width: 200px; }
.is-list .card .price { margin: 0; padding: 0; }
.is-list .card .preset { display: none; }
.is-list .card .buy { margin: 0 14px 0 0; grid-column: 3; }
.is-list .card .buy .btn { flex: none; padding: 0 16px; }

.empty { background: var(--surface); border: 1px dashed #CDBFAE; border-radius: var(--radius); padding: 28px; text-align: center; display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.empty b { color: var(--text); }
.more-wrap { display: flex; justify-content: center; margin: 22px 0 6px; }
.more-wrap .btn { min-width: 260px; }

.custom { display: flex; align-items: center; gap: 18px; background: var(--brand-50); border: 1px solid #E8D8C5; border-radius: var(--radius); padding: 18px 22px; margin-top: 28px; }
.custom .qi { width: 48px; height: 48px; border-radius: 12px; background: #fff; color: var(--accent); display: grid; place-items: center; flex: none; }
.custom div { flex: 1; }
.custom b { font-size: 17px; }
.custom p { color: var(--muted); font-size: 14px; margin-top: 4px; }

.seo { max-width: 860px; margin: 48px 0 0; color: var(--muted); font-size: 15px; }
.seo h2 { font-size: 20px; color: var(--text); margin-bottom: 10px; }
.seo p + p { margin-top: 10px; }

/* ---------- Карточка товара ---------- */
.pd { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: start; }

.gal { position: sticky; top: 148px; min-inline-size: 0; }
.gal-main { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.gal-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-track figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; aspect-ratio: 3 / 2; display: grid; place-items: center; padding: 28px 36px; }
.gal-track img { width: 100%; height: 100%; object-fit: contain; }
.gal-count { position: absolute; right: 12px; bottom: 12px; background: rgba(28, 22, 17, .7); color: #fff; font-size: 13px; font-weight: 700; border-radius: 8px; padding: 3px 9px; }
.gal-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gal-thumbs button { width: 96px; aspect-ratio: 3 / 2; border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 8px; cursor: pointer; }
.gal-thumbs button img { width: 100%; height: 100%; object-fit: contain; }
.gal-thumbs button[aria-current="true"] { border-color: var(--accent); }
.gal-thumbs button:hover { border-color: #CDBFAE; }

.pd-info h1 { font-size: clamp(26px, 2.8vw, 36px); font-weight: 600; margin: 8px 0 14px; }
.pd-sku { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.pd-sku a { color: var(--muted); }
.pd-sku .pill { background: var(--brand-50); color: var(--accent); font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.pd-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.pd-facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pd-facts span { display: block; font-size: 12px; color: var(--muted); }
.pd-facts b { font-size: 15px; }

.forms { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.forms a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 700; text-decoration: none; }
.forms a:hover { border-color: var(--accent); color: var(--accent); }
.forms a[aria-current="page"] { border: 2px solid var(--brand); color: var(--accent); }

.order { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.order h2 { font-size: 18px; font-weight: 600; }
.order .hint { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.mx { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.mx th { font-size: 13px; color: var(--muted); font-weight: 700; text-align: center; padding: 0 4px; }
.mx th:first-child { text-align: left; }
.mx tbody th { font-size: 15px; color: var(--text); text-align: left; white-space: nowrap; padding-right: 10px; }
.mx td { padding: 0 4px; }
.mx input { width: 100%; min-width: 0; height: 44px; border: 1px solid #CFC3B5; border-radius: 10px; text-align: center; font-weight: 800; font-size: 16px; background: var(--bg); -moz-appearance: textfield; }
.mx input::-webkit-outer-spin-button, .mx input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mx input:focus-visible { outline: 3px solid var(--brand); outline-offset: 0; background: #fff; }
.mx input.has { background: var(--amber-100); border-color: #D9BE85; }
.mx .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); vertical-align: -1px; margin-right: 5px; }
.mx-fill { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.mx-fill button { border: 1px dashed #CDBFAE; background: none; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 10px; min-height: 32px; cursor: pointer; }
.mx-fill button:hover { border-color: var(--accent); color: var(--accent); }
.order-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.order-total b { font-size: 22px; font-weight: 800; }
.order-total span { color: var(--muted); font-size: 14px; }
.order .price { font-size: 14px; color: var(--muted); margin: 6px 0 14px; }
.order .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.order .err { color: #A3311B; font-size: 14px; font-weight: 600; margin-top: 8px; }
.order .err:empty { display: none; }

.svc { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.svc li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.svc .ico { color: var(--accent); margin-top: 1px; }
.svc b { color: var(--text); display: block; font-size: 15px; }

.pd-tabs { position: sticky; top: 124px; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); margin: 44px 0 0; }
.pd-tabs .in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.pd-tabs a { flex: none; padding: 14px 14px 12px; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.pd-tabs a:hover { color: var(--text); }
.pd-tabs a[aria-current="true"] { color: var(--accent); border-color: var(--accent); }
.pd-sec { padding: 32px 0 8px; scroll-margin-top: 190px; }
.pd-sec h2 { font-size: 24px; font-weight: 600; margin-bottom: 16px; }
.spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.spec { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 15px; }
.spec caption { text-align: left; font-weight: 800; font-size: 16px; padding: 0 0 8px; }
.spec th, .spec td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.spec th { font-weight: 500; color: var(--muted); width: 55%; }
.spec td { font-weight: 700; }
.spec thead th { font-weight: 800; color: var(--text); background: var(--sand); }
.spec .num { text-align: right; font-variant-numeric: tabular-nums; }
.scheme { background: #FBF7F0; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.scheme svg { display: block; width: 100%; height: auto; }
.scheme p { font-size: 13px; color: var(--muted); margin-top: 6px; }
.pd-desc { max-width: 760px; font-size: 16px; }
.pd-desc p + p { margin-top: 12px; }

.related { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.related .card { scroll-snap-align: start; }
.related .preset { display: none; }
.related .buy { flex-direction: column; }
.related .buy .qty { width: 100%; justify-content: space-between; }

/* Липкая панель заказа на телефоне */
.pd-bar { display: none; }

/* ---------- Ноутбук и планшет ---------- */
@media (max-width: 1180px) {
  .cat-products { grid-template-columns: repeat(2, 1fr); }
  .pd-facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1023px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-products { grid-template-columns: repeat(3, 1fr); }
  .flt-btn { display: inline-flex; }
  .filters { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; top: auto; max-height: 86vh; border-radius: 20px 20px 0 0; padding: 0; display: flex; flex-direction: column; transform: translateY(100%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; box-shadow: 0 -12px 40px rgba(28, 22, 17, .2); }
  .filters.open { transform: none; visibility: visible; transition: transform .25s ease; }
  .filters-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative; }
  .filters-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; border-radius: 2px; background: var(--line); transform: translateX(-50%); }
  .filters-head h2 { font-size: 20px; font-weight: 600; }
  .filters-body { overflow: auto; padding: 0 16px; }
  .fopt { min-height: 44px; }
  .filters-foot { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }

  .pd { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .gal { position: static; }
  .spec-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Телефон ---------- */
@media (max-width: 760px) {
  .page { padding-top: 14px; }
  .crumbs ol { font-size: 13px; margin-bottom: 10px; }
  .cat-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
  .cat-head .lead { font-size: 14px; }
  .cat-head .btn { display: none; }
  .subtabs { margin-right: -16px; padding-right: 16px; }
  .toolbar { gap: 8px; }
  .found { flex-basis: 100%; font-size: 15px; }
  .flt-btn { flex: 1; }
  .toolbar .seg:not(.seg-ico) { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar .seg:not(.seg-ico) button { flex: 1; padding: 0 8px; font-size: 13px; white-space: nowrap; }
  .cat-products { grid-template-columns: 1fr 1fr; }
  .is-list .card { grid-template-columns: 84px 1fr; }
  .is-list .card .ph { height: auto; min-height: 84px; grid-row: span 2; }
  .is-list .card .body { flex-direction: column; align-items: stretch; padding: 10px 12px 4px; }
  .is-list .card h3 { min-width: 0; flex: none; }
  .is-list .card .price { display: none; }
  .is-list .card .buy { grid-column: 2; margin: 0 12px 10px; flex-direction: row; }
  .is-list .card .buy .qty { width: auto; }
  .is-list .card .buy .btn { flex: 1; white-space: nowrap; padding: 0 12px; }
  .is-list .card .buy .qty input { width: 40px; }
  .custom { flex-direction: column; align-items: flex-start; padding: 16px; }
  .custom .btn { width: 100%; }
  .seo { margin-top: 32px; font-size: 14px; }

  .gal-main { border-radius: 14px; margin: 0 -4px; }
  .gal-track figure { padding: 18px 20px; }
  .gal-thumbs { display: none; }
  .pd-info h1 { margin: 6px 0 12px; }
  .pd-facts div { padding: 8px 10px; }
  .order { padding: 14px; box-shadow: none; }
  .mx tbody th { font-size: 14px; padding-right: 6px; }
  .mx th { font-size: 12px; }
  .mx input { height: 44px; font-size: 15px; }
  .order .row2 { grid-template-columns: 1fr; }
  .pd-tabs { top: 0; margin-top: 28px; margin-left: -16px; margin-right: -16px; padding: 0 12px; }
  .pd-sec { scroll-margin-top: 60px; padding-top: 24px; }
  .pd-sec h2 { font-size: 20px; }
  .related { grid-template-columns: repeat(5, 72%); margin-right: -16px; padding-right: 16px; }
  .related .buy { flex-direction: row; }
  .related .buy .qty { width: auto; }

  .pd-bar { display: flex; position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 39; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding: 8px 16px; gap: 12px; align-items: center; transform: translateY(110%); transition: transform .2s ease; }
  .pd-bar.show { transform: none; }
  .pd-bar span { font-size: 13px; color: var(--muted); line-height: 1.2; }
  .pd-bar b { display: block; font-size: 17px; color: var(--text); }
  .pd-bar .btn { margin-left: auto; min-height: 44px; }
  body.has-pdbar { padding-bottom: calc(var(--tabbar) + 64px + env(safe-area-inset-bottom)); }
  body.has-pdbar .toast { bottom: calc(var(--tabbar) + 76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .spec th, .spec td { padding-inline: 7px; overflow-wrap: anywhere; }
  .spec thead th { width: auto; }
}
@media (max-width: 360px) {
  .cat-products { grid-template-columns: 1fr; }
  .pd-facts { grid-template-columns: 1fr 1fr; }
  .seg-ico { display: none; }
}
