/* shop.css — каталог, корзина, «спасибо» + значок корзины в шапке.
   Подключать ПОСЛЕ main.css и home.css (оттуда шапка и переменные --accent*, --cool*).
   На главной тоже нужен — ради значка корзины в шапке; всё остальное здесь
   привязано к классам страниц магазина и главную не задевает.
   Тёмная тема сайта: фон #11151B, карточки #141922, линии #1D2129. */

.shop {
  --s-bg:      #11151B;
  --s-card:    #141922;
  --s-card-2:  #181D27;
  --s-line:    #1D2129;
  --s-line-2:  #2C3038;
  --s-text:    #E9E9ED;
  --s-muted:   #9397AB;
  --s-dim:     #75798C;
  --s-ok:      #3CCB7F;
  min-height: 100vh;
  color: var(--s-text);
}

/* ---------- Шапка на внутренних страницах ---------- */
.site-header--solid {
  position: sticky;
  background: rgba(17, 21, 27, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--s-line, #1D2129);
}
.site-header--solid .brand__logo { height: 44px; }
.nav-link.is-current { color: #fff; }

.nav-cart {
  position: relative;
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  color: #B2B6CA;
  border: 1px solid #2C3038;
  transition: color 200ms, border-color 200ms;
}
.nav-cart:hover, .nav-cart.is-current { color: #fff; border-color: rgba(var(--accent-rgb), .6); }
.nav-cart__count {
  position: absolute; top: -8px; right: -8px;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--accent); color: #fff;
  font: 600 11px/1 'JetBrains Mono', monospace;
}
.nav-cart__count[hidden] { display: none; }
.nav-cart__count.is-bumped { animation: cart-bump 420ms cubic-bezier(.22, 1, .36, 1); }
@keyframes cart-bump { 40% { transform: scale(1.35); } }

/* ---------- Каркас страницы ---------- */
.shop-main {
  max-width: 1520px;
  margin: 0 auto;
  padding: clamp(32px, 5vh, 56px) clamp(20px, 4vw, 56px) 96px;
}
.shop-main--narrow { max-width: 760px; }
.shop-eyebrow {
  font: 500 10.5px/1 'JetBrains Mono', monospace;
  letter-spacing: .26em;
  color: var(--s-dim);
  margin-bottom: 16px;
}
.shop-title {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--s-text);
}
.shop-lead { margin: 14px 0 0; max-width: 640px; font-size: 15.5px; line-height: 1.6; color: var(--s-muted); }
.shop-back {
  display: inline-block; margin-bottom: 18px;
  font: 500 12px/1 'JetBrains Mono', monospace; letter-spacing: .12em; text-transform: uppercase;
  color: var(--s-muted);
}
.shop-back:hover { color: #fff; }
.shop .muted { color: var(--s-dim); }
.shop .nowrap { white-space: nowrap; }
.shop .visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.shop-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap;
  margin-bottom: 28px;
}

/* ---------- Поиск и категории ---------- */
.shop-search { display: flex; width: min(100%, 360px); border: 1px solid var(--s-line-2); background: var(--s-card); }
.shop-search:focus-within { border-color: var(--cool-light); }
.shop-search input {
  flex: 1; min-width: 0; padding: 12px 14px;
  background: transparent; border: 0; outline: 0;
  color: var(--s-text); font: inherit; font-size: 15px;
}
.shop-search input::placeholder { color: var(--s-dim); }
.shop-search button { width: 46px; border: 0; background: transparent; color: var(--s-muted); cursor: pointer; }
.shop-search button:hover { color: #fff; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--s-line-2);
  font: 500 11px/1.2 'JetBrains Mono', monospace; letter-spacing: .12em; text-transform: uppercase;
  color: var(--s-muted);
  transition: color 200ms, border-color 200ms, background 200ms;
}
.chip:hover { color: #fff; border-color: #4A4F5C; }
.chip.is-active { color: #fff; border-color: var(--accent); background: rgba(var(--accent-rgb), .12); }

.shop-msg { margin-bottom: 20px; padding: 12px 16px; border-left: 3px solid var(--s-ok); background: var(--s-card); font-size: 15px; }
.shop-msg--error { border-left-color: var(--accent); }

/* ---------- Сетка товаров ---------- */
.product-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 20px;
}
.product-card {
  display: flex; flex-direction: column;
  background: var(--s-card);
  border: 1px solid var(--s-line);
  transition: border-color 250ms, transform 250ms cubic-bezier(.22, 1, .36, 1);
}
.product-card:hover { border-color: #2E3442; }
.product-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background:
    radial-gradient(ellipse at 50% 55%, rgba(var(--accent-rgb), .07), transparent 65%),
    linear-gradient(rgba(147, 151, 171, .05) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(147, 151, 171, .05) 1px, transparent 1px) 0 0 / 32px 32px,
    #10141B;
  border-bottom: 1px solid var(--s-line);
  overflow: hidden;
}
.product-card__media img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  transition: transform 500ms cubic-bezier(.22, 1, .36, 1);
}
.product-card:hover .product-card__media img { transform: scale(1.04); }
.product-card__noimg { font: 500 11px 'JetBrains Mono', monospace; letter-spacing: .3em; color: #3A3F4B; }

.product-card__body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.product-card__meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.product-card__cat { font: 500 10.5px/1.3 'JetBrains Mono', monospace; letter-spacing: .18em; color: var(--accent-text); }
.product-card__sku { font: 400 11px/1.3 'JetBrains Mono', monospace; color: var(--s-dim); white-space: nowrap; }
.product-card__title { margin: 0; font-size: 19px; line-height: 1.25; font-weight: 500; color: var(--s-text); text-wrap: balance; }
.product-card__desc {
  margin: 10px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--s-muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.product-card__specs { margin: 14px 0 0; display: grid; gap: 0; }
.product-card__specs > div {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 7px 0; border-top: 1px dashed var(--s-line-2);
  font-size: 13.5px;
}
.product-card__specs dt { flex: none; max-width: 48%; color: var(--s-dim); }
.product-card__specs dd { margin: 0; color: #C9CDD8; text-align: right; }
.product-card__more summary {
  margin-top: 6px; padding: 6px 0;
  font: 500 11px 'JetBrains Mono', monospace; letter-spacing: .1em; text-transform: uppercase;
  color: var(--s-muted); cursor: pointer; list-style: none;
}
.product-card__more summary::-webkit-details-marker { display: none; }
.product-card__more summary::before { content: "+ "; color: var(--accent-text); }
.product-card__more[open] summary::before { content: "− "; }
.product-card__more summary:hover { color: #fff; }
.product-card__more .product-card__specs { margin-top: 0; }

.product-card__buy { margin-top: auto; padding-top: 18px; }
.product-card__price { display: flex; align-items: baseline; gap: 6px; margin-bottom: 12px; }
.product-card__price b { font-size: 21px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.product-card__price span { font-size: 13px; color: var(--s-dim); }
.product-card__price .is-request { font-size: 15px; font-weight: 500; color: var(--cool-light); }
.product-card__incart { margin-top: 10px; font-size: 13.5px; color: var(--s-ok); }
.product-card__incart[hidden] { display: none; }
.product-card__incart a { color: var(--s-ok); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Количество и кнопка ---------- */
.buy-form { display: flex; gap: 10px; }
.qty { display: inline-flex; flex: none; border: 1px solid var(--s-line-2); background: #10141B; }
.qty__btn {
  width: 36px; border: 0; background: transparent; color: var(--s-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.qty__btn:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.qty__input {
  width: 52px; padding: 10px 0; border: 0; outline: 0;
  background: transparent; color: #fff; text-align: center;
  font: 500 15px 'JetBrains Mono', monospace;
  -moz-appearance: textfield;
}
.qty__input::-webkit-outer-spin-button,
.qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty:focus-within { border-color: var(--cool-light); }

.btn-cart {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: 600 12px/1 'JetBrains Mono', monospace; letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer;
  transition: background 200ms, border-color 200ms;
}
.btn-cart:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-cart:disabled { opacity: .6; cursor: progress; }
.btn-cart.is-added { background: transparent; color: var(--s-ok); border-color: var(--s-ok); }
.btn-cart:focus-visible, .qty__btn:focus-visible, .chip:focus-visible, .btn-submit:focus-visible {
  outline: 2px solid var(--cool-light); outline-offset: 2px;
}

.pager { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 40px; color: var(--s-muted); font-size: 14px; }
.pager a { color: #fff; }

.shop-empty {
  padding: 56px 24px; text-align: center;
  border: 1px dashed var(--s-line-2); color: var(--s-muted); font-size: 16px;
}
.shop-empty a { text-decoration: underline; text-underline-offset: 3px; }
.shop-empty--cart { display: grid; justify-items: center; gap: 14px; margin-top: 20px; color: var(--s-muted); }
.shop-empty--cart svg { color: #3A3F4B; }
.shop-empty--cart p { margin: 0; }
.shop-empty--cart .btn-submit { text-decoration: none; }

/* ---------- Всплывашка ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translate(-50%, 20px); opacity: 0;
  display: flex; align-items: center; gap: 18px;
  max-width: calc(100vw - 32px);
  padding: 14px 18px;
  background: #1B212C; border: 1px solid #2E3442; border-left: 3px solid var(--s-ok);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  font-size: 14.5px;
  transition: opacity 250ms, transform 250ms cubic-bezier(.22, 1, .36, 1);
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-left-color: var(--accent); }
.toast[hidden] { display: none; }
.toast__link { flex: none; font: 600 11px 'JetBrains Mono', monospace; letter-spacing: .12em; text-transform: uppercase; color: #fff; }

/* ---------- Корзина ---------- */
.shop-main > .shop-title { margin-bottom: 28px; }
.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}
.cart-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--s-line); }
.cart-line {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto 120px 40px;
  align-items: center; gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--s-line);
  transition: opacity 250ms;
}
.cart-line.is-removing { opacity: 0; }
.cart-line__img {
  width: 88px; height: 72px; display: flex; align-items: center; justify-content: center;
  background: #10141B; border: 1px solid var(--s-line); padding: 6px;
}
.cart-line__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cart-line__info { display: grid; gap: 4px; min-width: 0; }
.cart-line__cat { font: 500 10px 'JetBrains Mono', monospace; letter-spacing: .18em; color: var(--accent-text); }
.cart-line__title { font-size: 16px; font-weight: 500; color: var(--s-text); }
.cart-line__unit { font-size: 13.5px; color: var(--s-dim); }
.cart-line__qty { margin: 0; }
.cart-line__total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-line__total .muted { font-weight: 400; font-size: 13.5px; }
.cart-line__remove { margin: 0; }
.cart-line__remove button {
  width: 36px; height: 36px; border: 1px solid transparent; background: transparent;
  color: var(--s-dim); cursor: pointer;
}
.cart-line__remove button:hover { color: var(--accent-text); border-color: rgba(var(--accent-rgb), .4); }
.link-btn { margin-top: 6px; border: 0; background: none; color: var(--cool-light); cursor: pointer; font: inherit; font-size: 13px; }

.cart-summary {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 20px 0 6px; font-size: 16px; color: var(--s-muted);
}
.cart-summary b { font-size: 26px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.cart-note { margin: 4px 0 0; font-size: 14px; line-height: 1.55; color: var(--cool-light); }
.cart-note[hidden] { display: none; }

/* ---------- Форма оформления ---------- */
.checkout {
  position: sticky; top: 96px;
  padding: clamp(22px, 2.5vw, 32px);
  background: var(--s-card);
  border: 1px solid var(--s-line);
  border-top: 2px solid var(--accent);
}
.checkout__title { margin: 0; font-size: 21px; font-weight: 500; color: #fff; }
.checkout__lead { margin: 8px 0 22px; font-size: 14.5px; line-height: 1.55; color: var(--s-muted); }
.checkout__form { display: grid; gap: 14px; }
.checkout .field { display: grid; gap: 6px; min-width: 0; margin-bottom: 0; }   /* .field есть и в main.css (модалка) — сбрасываем её отступ */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { font-size: 13px; color: var(--s-muted); }
.field label i { font-style: normal; color: var(--accent-text); }
.field input, .field textarea {
  width: 100%; padding: 11px 13px;
  background: #10141B; border: 1px solid var(--s-line-2); border-radius: 0;
  color: var(--s-text); font: inherit; font-size: 15px;
  transition: border-color 200ms;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #545969; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--cool-light); }
.field.has-error input, .field.has-error textarea { border-color: var(--accent); }
.field-error { font-size: 13px; color: var(--accent-text); }
.field--check label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #C9CDD8; cursor: pointer; }
.field--check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.btn-submit {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 6px; padding: 15px 28px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: 600 12.5px/1 'JetBrains Mono', monospace; letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer; transition: background 200ms;
}
.btn-submit:hover { background: var(--accent-hover); color: #fff; }
.checkout__hint { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--s-dim); }

/* ---------- «Спасибо» ---------- */
.done { padding: clamp(24px, 6vh, 64px) 0; }
.done__mark {
  width: 64px; height: 64px; margin-bottom: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(60, 203, 127, .5); color: var(--s-ok);
  background: rgba(60, 203, 127, .08);
}
.done .shop-lead b { color: #fff; font-weight: 500; }
.done__list { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--s-line); }
.done__list li { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--s-line); font-size: 15px; color: #C9CDD8; }
.done__list b { flex: none; font-weight: 500; color: #fff; font-variant-numeric: tabular-nums; }
.done__actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 32px; }
.done__actions .shop-back { margin: 0; }

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .cart-layout { grid-template-columns: 1fr; }
  .checkout { position: static; }
}
@media (max-width: 900px) {
  .site-header--solid .site-nav { display: none; }   /* на телефоне — логотип, корзина и CTA */
  .site-header--solid .site-header__inner { justify-content: space-between; gap: 14px; }
  .nav-cart { margin-left: auto; }
}
@media (max-width: 640px) {
  /* категории — в одну прокручиваемую строку, чтобы не занимали пол-экрана */
  .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: calc(-1 * clamp(20px, 4vw, 56px)); margin-right: calc(-1 * clamp(20px, 4vw, 56px));
    padding: 0 clamp(20px, 4vw, 56px) 2px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .cart-line {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    grid-template-areas: "img info rm" "img qty total";
    row-gap: 10px; column-gap: 14px;
  }
  .cart-line__img { grid-area: img; width: 64px; height: 56px; align-self: start; }
  .cart-line__info { grid-area: info; }
  .cart-line__qty { grid-area: qty; }
  .cart-line__total { grid-area: total; justify-self: end; }
  .cart-line__remove { grid-area: rm; align-self: start; justify-self: end; }
  .field-row { grid-template-columns: 1fr; }
  .site-header--solid .nav-cta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .product-card, .product-card__media img, .toast, .nav-cart__count.is-bumped { transition: none; animation: none; }
}
