:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #777777;
  --line: #e6e6e6;
  --soft: #f5f5f5;
  --radius: 0;
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

/* ===== Шапка ===== */
.header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  height: 76px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--fg); }
.logo img { height: 40px; width: auto; max-width: 55vw; object-fit: contain; }
.logo-text { font-size: 18px; letter-spacing: .35em; text-transform: uppercase; font-weight: 500; padding-left: .35em; }
.social {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; display: grid; place-items: center;
}
.social img { width: 26px; height: 26px; object-fit: contain; }
.social:hover { opacity: .65; }
.header-actions {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center;
}
.icon-action {
  position: relative; width: 50px; height: 50px;
  display: grid; place-items: center;
}
.icon-action:hover { opacity: .65; }
.cart-count {
  position: absolute; top: 4px; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--fg); color: var(--bg);
  font-size: 11px; line-height: 18px; text-align: center; border-radius: 9px;
}
.cart-count:empty, .cart-count[data-n="0"] { display: none; }

/* ===== Контейнер / панель ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.toolbar { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; align-items: center; }
/* Поиск в шапке: раскрывается поверх логотипа */
.search-panel {
  position: absolute; inset: 0; z-index: 2;
  display: none; align-items: center; gap: 12px;
  padding: 0 8px 0 20px; background: var(--bg);
}
.header.searching .search-panel { display: flex; }
.search-panel svg { flex: none; }
#search {
  flex: 1; min-width: 0; height: 48px; padding: 0;
  border: 0; background: transparent; outline: none;
  font-size: 16px; -webkit-appearance: none; appearance: none;
}
#search::placeholder { color: var(--muted); }
#search::-webkit-search-cancel-button { display: none; }
.categories { display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center; }
.cat {
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 4px 0; border-bottom: 1px solid transparent;
}
.cat:hover { color: var(--fg); }
.cat.active { color: var(--fg); border-bottom-color: var(--fg); }

.status { text-align: center; color: var(--muted); padding: 60px 0; }
.status:empty { display: none; }

/* ===== Сетка товаров ===== */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 14px; }
@media (min-width: 700px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 36px 20px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card { display: flex; flex-direction: column; }
.card-img {
  aspect-ratio: 1 / 1; background: var(--soft); overflow: hidden; position: relative;
  cursor: zoom-in;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-img img { transform: scale(1.03); }
.card-img.noimg::after {
  content: "Нет фото"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}
.card.out .card-img img { opacity: .45; }
.badge {
  position: absolute; top: 10px; left: 10px; background: var(--fg); color: var(--bg);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px;
}
.card-info { padding-top: 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.card-sku { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.card-name { font-size: 15px; }
.card-desc { font-size: 13px; color: var(--muted); }
.card-price { margin-top: 4px; font-weight: 600; }
.card-actions { margin-top: 12px; }

/* ===== Кнопки ===== */
.btn {
  width: 100%; padding: 12px 16px; border: 1px solid var(--fg);
  text-transform: uppercase; letter-spacing: .1em; font-size: 12px;
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--fg); }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: #333; color: var(--bg); }
.btn-primary:disabled:hover { background: var(--fg); color: var(--bg); }

/* Кнопка «В корзину» */
.btn-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--fg); color: var(--bg);
}
.btn-add:hover { background: var(--bg); color: var(--fg); }
.btn-add svg { flex: none; }

.qty { display: flex; align-items: center; border: 1px solid var(--fg); }
.qty button { width: 42px; height: 42px; font-size: 18px; }
.qty button:hover { background: var(--soft); }
.qty span { flex: 1; text-align: center; font-size: 14px; }

/* ===== Корзина ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: 100%; max-width: 440px; background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s ease;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 76px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 14px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; }
.icon-btn { width: 40px; height: 40px; font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.line { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.line-img { width: 72px; aspect-ratio: 1 / 1; background: var(--soft); overflow: hidden; }
.line-img img { width: 100%; height: 100%; object-fit: cover; }
.line-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.line-name { font-size: 14px; }
.line-meta { font-size: 12px; color: var(--muted); }
.line-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.line .qty { width: 112px; }
.line .qty button { width: 32px; height: 32px; }
.line-sum { font-weight: 600; font-size: 14px; }
.line-remove { font-size: 11px; color: var(--muted); text-decoration: underline; text-align: left; margin-top: 4px; width: fit-content; }

.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); background: var(--bg); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; }
.total-row strong { font-size: 20px; }
.min-note { font-size: 12px; margin: 6px 0 14px; color: var(--muted); min-height: 18px; }
.pay-note { font-size: 12px; text-align: center; letter-spacing: .04em; padding: 8px 10px; border: 1px solid var(--line); margin: 0 0 14px; }
.footer #footerPay { color: var(--fg); text-transform: uppercase; }
.min-note.warn { color: var(--fg); font-weight: 600; }

#orderForm { display: flex; flex-direction: column; gap: 10px; }
#orderForm input, #orderForm textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); background: var(--bg);
  outline: none; border-radius: 0; resize: none;
}
#orderForm input:focus, #orderForm textarea:focus { border-color: var(--fg); }
#orderForm .btn { margin-top: 4px; }

/* ===== Просмотр фото ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(255,255,255,.97);
  display: grid; place-items: center; cursor: zoom-out; padding: 20px;
}
.lightbox img { max-height: 92vh; max-width: 100%; object-fit: contain; }

/* ===== Уведомление ===== */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--fg); color: var(--bg); padding: 12px 20px; font-size: 13px;
  transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.footer-link { color: var(--fg); text-transform: uppercase; text-decoration: none; border-bottom: 1px solid var(--fg); padding-bottom: 1px; }
.footer { border-top: 1px solid var(--line); padding: 28px 16px; text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
