/* V4 page layer: склад, каталог ликвидации, карточка товара.
   Подключается после v4.css на всех страницах, кроме главной. */

/* ---------- служебное ---------- */
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- шапка страницы ---------- */
.page { padding: clamp(26px, 4.5vw, 60px) 0 72px; }
.page > .wrap { position: relative; }
.page > .wrap > .back { position: absolute; top: 0; right: 0; z-index: 2; }
.page-head { display: grid; gap: 14px; margin-bottom: clamp(20px, 3vw, 34px); }
.page-head h1 {
  margin: 0; padding-right: 168px; font-size: clamp(30px, 4.4vw, 64px); line-height: 1.04;
  text-transform: uppercase; letter-spacing: -0.01em;
}
.page-head[hidden] ~ #product,
#list[hidden] ~ #product { margin-top: 70px; }
.page-lead { margin: 0; max-width: 46em; font-size: 18px; font-weight: 700; }
.page-head .chip { justify-self: start; transform: rotate(-1.5deg); }
.crumbs { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; font-weight: 800; }
.crumbs a { text-decoration: none; border-bottom: 2px solid var(--terra); }
.crumbs span { opacity: .7; }

/* ---------- фильтры и инструменты ---------- */
.panel { display: grid; gap: 16px; margin-bottom: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.fchip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  border: var(--bw) solid var(--ink); background: var(--white); color: var(--ink);
  font-weight: 800; font-size: 15px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 160ms cubic-bezier(.34,1.9,.5,1), background 160ms, color 160ms;
}
.fchip:hover { transform: translateY(-2px) rotate(-1.5deg); }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.fchip .n { font-weight: 700; opacity: .7; }
.tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tools input[type="search"] { width: min(320px, 100%); border-radius: 999px; }
.sort { position: relative; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: 999px; padding: 12px 18px; font-weight: 800;
  line-height: 1.2; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
  transition: transform 160ms cubic-bezier(.34,1.9,.5,1), background 160ms, box-shadow 160ms;
}
.sort-btn:hover { transform: translateY(-2px) rotate(-1.5deg); }
.sort-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.sort-btn[aria-expanded="true"] { background: var(--yellow); }
.sort-btn[aria-expanded="true"]:hover { transform: translateY(-2px) rotate(1.5deg); }
.sort-chev { width: 16px; height: 16px; flex: 0 0 auto; transition: transform 160ms cubic-bezier(.34,1.9,.5,1); }
.sort-btn[aria-expanded="true"] .sort-chev { transform: rotate(180deg); }
.sort-menu {
  position: absolute; z-index: 5; top: calc(100% + 10px); left: 0;
  min-width: 100%; margin: 0; padding: 8px; list-style: none;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transform-origin: 20% 0;
  animation: v4-pop 180ms cubic-bezier(.34,1.8,.5,1);
}
.sort-menu.is-up { top: auto; bottom: calc(100% + 10px); transform-origin: 20% 100%; }
.sort-menu[hidden] { display: none; }
.sort-menu [role="option"] {
  padding: 10px 16px; border-radius: 999px; font-weight: 800;
  white-space: nowrap; cursor: pointer;
}
.sort-menu [role="option"].is-active { background: var(--yellow); color: var(--ink); }
.sort-menu [role="option"][aria-selected="true"] { background: var(--ink); color: var(--white); }
.sort-menu [role="option"][aria-selected="true"].is-active { box-shadow: inset 0 0 0 3px var(--yellow); }
.count-note { margin: 0 0 18px; }
.status-note { margin: 0 0 22px; font-weight: 800; }
.status-note.big { font-size: 20px; }

/* ---------- список позиций ---------- */
.goods.list { list-style: none; margin: 0; padding: 0; }
.list .pcard { animation: v4-pop 420ms cubic-bezier(.34,1.8,.5,1) both; }
.list .pcard:nth-child(2) { animation-delay: 40ms; }
.list .pcard:nth-child(3) { animation-delay: 80ms; }
.list .pcard:nth-child(4) { animation-delay: 120ms; }
.list .pcard:nth-child(5) { animation-delay: 160ms; }
.list .pcard:nth-child(6) { animation-delay: 200ms; }
.list .pcard:nth-child(7) { animation-delay: 240ms; }
.list .pcard:nth-child(8) { animation-delay: 280ms; }
@keyframes v4-pop {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
}
.ptags { display: flex; flex-wrap: wrap; gap: 6px; }
.ptag {
  font-size: 12px; font-weight: 800; padding: 3px 10px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--white);
}
.pcard-media .ptags { position: absolute; top: 10px; left: 10px; z-index: 2; max-width: 82%; }
.old { text-decoration: line-through; opacity: .65; font-weight: 800; }
.discount {
  background: var(--pink); border: 2.5px solid var(--ink); border-radius: 999px;
  padding: 4px 12px; font-weight: 900; box-shadow: 2px 2px 0 var(--ink);
}
.load-more { display: flex; justify-content: center; margin: 40px 0 0; }

/* ---------- карточка товара ---------- */
.detail {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 44px); align-items: start;
}
.detail-media {
  display: grid; gap: 14px;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: clamp(14px, 2.4vw, 26px);
}
.detail-media .main {
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--cream);
  border: 2.5px solid var(--ink); border-radius: var(--r-md);
}
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb {
  width: 76px; height: 76px; padding: 4px; cursor: pointer;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 18px;
  transition: transform 160ms cubic-bezier(.34,1.9,.5,1), background 160ms;
}
.thumb:hover { transform: translateY(-3px) rotate(-2deg); }
.thumb[aria-pressed="true"] { background: var(--yellow); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-info { display: grid; gap: 16px; align-content: start; }
.detail-title { margin: 0; font-size: clamp(24px, 3.2vw, 46px); line-height: 1.06; text-transform: uppercase; }
.detail-price { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 0; }
.spec { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.spec li {
  display: grid; grid-template-columns: minmax(7em, 11em) 1fr; gap: 12px;
  padding-bottom: 6px; border-bottom: 2px dotted rgba(46, 31, 20, .22); font-weight: 700;
}
.spec b { font-weight: 900; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }
.prose { max-width: 62em; }
.prose p { margin: 0 0 14px; }
.prose h3 { margin: 26px 0 10px; font-size: 21px; }
.reviews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.review {
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 16px 18px;
}
.review .who { font-weight: 900; }
.review .when { font-size: 13px; font-weight: 700; opacity: .7; }
.review p { margin: 8px 0 0; }
.buyers { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.buyers img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 18px;
}
.section-title { margin: 40px 0 18px; font-size: clamp(22px, 2.6vw, 34px); text-transform: uppercase; }

/* ---------- адаптив ---------- */
@media (max-width: 720px) {
  .page > .wrap > .back { position: static; margin: 0 0 14px; }
  .page-head h1 { padding-right: 0; }
  .page-head[hidden] ~ #product,
  #list[hidden] ~ #product { margin-top: 0; }
}
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .reviews { grid-template-columns: 1fr; }
  .page-lead { font-size: 16px; }
  .page { padding-top: 22px; }
}
@media (max-width: 460px) {
  .fchip { padding: 8px 14px; font-size: 14px; }
  .sort-btn { padding: 10px 14px; font-size: 15px; }
  .thumb { width: 60px; height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .fchip, .thumb, .sort-btn, .sort-chev { transition: none; }
  .sort-btn:hover, .sort-btn[aria-expanded="true"]:hover { transform: none; }
  .list .pcard, .sort-menu { animation: none; }
}
