/* ═══════════════════════════════════════════════════════════════
   LUMÉ — общие компоненты: карточка товара, сетка, полка-карусель,
   сердечко, чипы, секции.
   ═══════════════════════════════════════════════════════════════ */

/* ── Секции страниц ────────────────────────────────────────────── */
.section { margin-top: 56px; }
.section:first-child { margin-top: 0; }
.section__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.section__head p { margin: 6px 0 0; color: var(--text-dim); }
.link-more {
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
  text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}

/* ── Сетка товаров ─────────────────────────────────────────────── */
.pgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px 16px;
}
.pgrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pgrid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ── Карточка товара ───────────────────────────────────────────── */
.pcard { position: relative; min-width: 0; display: flex; flex-direction: column; }

.pcard__media {
  position: relative; display: block;
  aspect-ratio: 3 / 4;
  background: var(--bg-plate);
  overflow: hidden;
}
.pcard__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity .35s var(--ease), transform .8s var(--pop);
}
.pcard__img.is-broken { visibility: hidden; }
.pcard__img--alt { opacity: 0; }
@media (hover: hover) {
  .pcard:hover .pcard__img--alt { opacity: 1; }
  .pcard:hover .pcard__img:not(.pcard__img--alt):only-of-type { transform: scale(1.03); }
}
.pcard__art { position: absolute; inset: 0; display: grid; place-items: center; }
.pcard__art .art { width: 78%; height: auto; }

.pcard__badges {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 4px;
  pointer-events: none;
}
.pcard__soldout {
  position: absolute; inset: auto 0 0 0; z-index: 3;
  background: rgba(28, 29, 33, .78); color: #fff;
  text-align: center; font-size: 12px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; padding: 9px;
}
.pcard.is-soldout .pcard__img { filter: grayscale(.35); opacity: .75; }

/* Сердечко в углу карточки и на странице товара */
/* Сердечко «в избранное»: красный контур без подложки; в избранном — сплошное розово-красное */
.save-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: #ff2d55;
  transition: transform .2s var(--pop);
}
.save-btn svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linejoin: round;
  transition: fill .2s var(--ease), stroke .2s var(--ease), transform .3s var(--pop);
}
.save-btn:hover svg { transform: scale(1.1); }
.save-btn:active { transform: scale(.92); }
.save-btn.is-saved svg { fill: #ff2d55; stroke: #ff2d55; }
.save-btn.is-saved { animation: savePop .35s var(--pop); }
@keyframes savePop { 40% { transform: scale(1.18); } }

/* Взлетающие сердечки (js/main.js → loveBurst, анимация через Web Animations API).
   max-width: none обязателен: общее правило svg { max-width: 100% } из base.css
   сжимало бы сердечки до нулевой ширины контейнера. */
.love-burst { position: fixed; z-index: 360; width: 0; height: 0; pointer-events: none; }
.love-burst svg { position: absolute; display: block; max-width: none; overflow: visible; opacity: 0; }

.pcard__save { position: absolute; top: 8px; right: 8px; z-index: 4; }

.pcard__body { padding: 10px 2px 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.pcard__purchase { margin-top: auto; padding-top: 12px; }
.pcard__purchase .pickup-link { margin-top: 0; }
.pcard__name {
  font-family: var(--font); font-size: 14px; font-weight: 400; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard__name a:hover { text-decoration: underline; }
/* Вся карточка кликабельна через имя, фото — дубль ссылки для мыши */
.pcard__type {
  margin: 0; font-size: 12.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard__price { margin: 2px 0 0; font-size: 14px; }
.price-line { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.pcard__comp { margin: 5px 0 0; min-width: 0; }
.pcard__comp .label-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.pcard__colors {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 4px; font-size: 12px; color: var(--text-dim);
}
.pcard__colors i {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid rgba(127, 127, 127, .45);
}
.pcard__colors span { margin-left: 4px; }

/* Появление карточек лесенкой (только при первом показе сетки) */
.pgrid.is-stagger .pcard { animation: cardIn .5s var(--pop) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } }

/* ── Полка-карусель ────────────────────────────────────────────── */
.shelf { margin-top: 56px; }
.shelf__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.shelf__note { margin: 6px 0 0; color: var(--text-dim); font-size: 14px; }
.shelf__all { font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.shelf__viewport { position: relative; max-width: var(--wrap); margin: 0 auto; }
.shelf__track {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 3 * 16px - 2 * var(--gutter)) / 4.3);
  gap: 16px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  padding: 0 var(--gutter) 6px;
  scrollbar-width: none;
}
.shelf__track::-webkit-scrollbar { display: none; }
.shelf__track > .pcard { scroll-snap-align: start; }
.shelf__track:focus-visible { outline-offset: -2px; }
.shelf__nav {
  position: absolute; top: calc(50% - 60px); z-index: 5;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: opacity .2s var(--ease);
}
.shelf__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.shelf__nav--prev { left: max(4px, calc(var(--gutter) - 22px)); }
.shelf__nav--next { right: max(4px, calc(var(--gutter) - 22px)); }
.shelf__nav:disabled { opacity: 0; pointer-events: none; }
.shelf__viewport.is-static .shelf__nav { display: none; }

/* ── Чипы (подкатегории, быстрые фильтры) ──────────────────────── */
.chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  list-style: none; margin: 0; padding: 0;
}
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg); color: var(--text);
  font-size: 13px; white-space: nowrap;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.chip:hover { border-color: var(--text); text-decoration: none; }
.chip.is-active, .chip[aria-current="page"], .chip[aria-pressed="true"] {
  background: var(--text); color: var(--bg); border-color: var(--text);
}
.chip small { color: inherit; opacity: .65; font-size: 12px; }
.chip--remove::after {
  content: ""; width: 9px; height: 9px;
  background:
    linear-gradient(45deg, transparent 45%, currentColor 45% 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, currentColor 45% 55%, transparent 55%);
}

/* ── Рейтинг звёздами ──────────────────────────────────────────── */
.stars { display: inline-flex; gap: 1px; vertical-align: -2px; }
.stars svg { width: 14px; height: 14px; fill: var(--line); stroke: none; }
.stars svg.is-on { fill: var(--text); }

/* ── Плитки-ссылки с фото (категории, ткани) ───────────────────── */
.tile-link {
  position: relative; display: block; overflow: hidden;
  background: var(--bg-plate);
}
.tile-link img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--pop); }
.tile-link:hover img { transform: scale(1.04); }
.tile-link:hover { text-decoration: none; }

/* ── Адаптив ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .pgrid, .pgrid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shelf__track { grid-auto-columns: calc((100% - 2 * 16px - 2 * var(--gutter)) / 3.3); }
}
@media (max-width: 760px) {
  .pgrid, .pgrid--3, .pgrid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 10px; }
  .shelf__track { grid-auto-columns: calc((100% - 10px - var(--gutter)) / 2.2); gap: 10px; }
  .shelf__nav { display: none; }
  .save-btn { width: 36px; height: 36px; }
  .pcard__save { top: 6px; right: 6px; }
  .pcard__comp { display: none; }
  .section, .shelf { margin-top: 40px; }
}

/* Окно быстрого выбора размера */
.qa__head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.qa__img { width: 72px; height: 96px; object-fit: cover; background: var(--bg-plate); }
.qa__name { font-weight: 500; margin: 0 0 4px; }
.qa__price { margin: 0 0 2px; }
.qa__label { font-size: 13px; font-weight: 600; margin: 0 0 12px; }
.qa__sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.qa__size {
  min-width: 58px; min-height: 44px; padding: 6px 14px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 0;
  background: var(--bg); color: var(--text); font-weight: 500; font-size: 14px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.qa__size small { font-weight: 400; font-size: 10.5px; color: var(--text-dim); }
.qa__size:hover:not(:disabled) { border-color: var(--text); }
.qa__size:disabled { opacity: .45; text-decoration: line-through; cursor: not-allowed; }
.qa__more { margin: 18px 0 0; font-size: 13px; }
.qa__more a { text-decoration: underline; text-underline-offset: 3px; }

/* Цены не в тенге — под итогом пишем сумму к оплате в тенге */
.pay-kzt { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-dim); }
.pay-kzt b { color: var(--text); font-weight: 600; white-space: nowrap; }

/* Shared add-to-bag/date button, matching the saved-items cards. */
.pickup-link, .savedpg .scard__add.pickup-link {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  width: 100%; min-height: 38px; margin-top: 12px; padding: 8px 10px; cursor: pointer;
  border: 1px solid #1a73e8; border-radius: 6px;
  background: #1a73e8; color: #fff;
  box-shadow: 0 2px 10px rgb(26 115 232 / .12);
  font-family: var(--font); font-size: 13.5px; font-weight: 500; letter-spacing: 0; line-height: 20px; text-decoration: none;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.pickup-link svg, .savedpg .scard__add.pickup-link svg { display: block; width: 18px; height: 18px; flex: none; fill: currentColor; stroke: none; }
.pickup-link strong { display: block; min-width: 0; font-weight: 500; line-height: 20px; text-align: center; }
.pickup-link:hover:not(:disabled), .savedpg .scard__add.pickup-link:hover:not(:disabled) { background: #3183ed; border-color: #3183ed; color: #fff; text-decoration: none; }
.pickup-link:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.pickup-link--unavailable { color: var(--text-dim); background: transparent; border-color: var(--line); box-shadow: none; cursor: default; }
.savedpg .scard__buy .pickup-link { margin-top: 0; }
.savedpg .scard__add.pickup-link { min-height: 38px; font-size: 13.5px; border-radius: 6px; }
@media (max-width: 380px) { .pickup-link { padding: 8px 5px; } }
