/* Общий движок каталога. Тема магазина задаётся переменными в его index.html */
:root {
  --bg: #fff; --surface: #f4f4f4; --text: #111; --muted: #777; --line: #e3e3e3;
  --accent: #111; --accent-ink: #fff; --radius: 14px;
  --font-body: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: var(--font-body); --display-weight: 700; --display-case: none; --display-spacing: 0;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font-body); }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.display { font-family: var(--font-display); font-weight: var(--display-weight);
  text-transform: var(--display-case); letter-spacing: var(--display-spacing); }

/* Шапка */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { font-size: 22px; line-height: 1; white-space: nowrap; }
.logo small { display: block; font: 10px/1.6 var(--font-body); letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.top .spacer { flex: 1; }
.logo { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top .btn { white-space: nowrap; flex: none; }
.only-narrow { display: none; }
@media (max-width: 480px) { .only-wide { display: none; } .only-narrow { display: inline; } .logo small { letter-spacing: .12em; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  border-radius: 999px; padding: 11px 20px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; text-decoration: none; transition: transform .15s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 8px 14px; font-size: 13px; }

/* Первый экран */
.hero { padding: 44px 0 26px; }
.hero h1 { font-size: clamp(34px, 7vw, 68px); line-height: 1; margin: 0 0 14px; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 0 18px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted); }

/* Категории и фильтры */
.bar { position: sticky; top: 60px; z-index: 15; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tools { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.tools .count { color: var(--muted); font-size: 13px; margin-right: auto; white-space: nowrap; }
select.sort { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 8px 12px; }

.filters { display: none; padding: 14px 0 4px; gap: 18px; flex-wrap: wrap; }
.filters.open { display: flex; }
.fgroup { min-width: 200px; }
.fgroup h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 6px;
  border: 1px solid rgba(128,128,128,.4); }
.price-row { display: flex; gap: 8px; }
.price-row input { width: 110px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 7px 10px; }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }

/* Сетка товаров */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 12px; padding: 22px 0 60px; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 20px; } }
.card { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.card .ph { position: relative; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover img { transform: scale(1.04); }
.badge { position: absolute; left: 10px; top: 10px; background: var(--bg); color: var(--text); border-radius: 999px;
  padding: 4px 10px; font-size: 11px; font-weight: 600; }
.badge.out { background: rgba(0,0,0,.72); color: #fff; }
.card h3 { font-size: 14px; font-weight: 500; margin: 10px 0 2px; }
.card .price { font-weight: 700; }
.card .meta { color: var(--muted); font-size: 12px; }
.card.is-out img { filter: grayscale(.7); opacity: .7; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 50px 0; }

/* Карточка товара */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; background: rgba(0,0,0,.55); }
.sheet.open { display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 760px) { .sheet.open { align-items: center; } }
.sheet .box { position: relative; background: var(--bg); width: 100%; max-width: 900px; max-height: 94vh; overflow: auto;
  border-radius: 20px 20px 0 0; display: grid; animation: up .25s ease-out; }
@media (min-width: 760px) { .sheet .box { grid-template-columns: 1fr 1fr; border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet .pic { background: var(--surface); }
.sheet .pic img { width: 100%; height: 100%; max-height: 48vh; object-fit: cover; }
@media (min-width: 760px) { .sheet .pic img { max-height: 80vh; } }
.sheet .info { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; font-size: 24px; line-height: 1.15; }
.sheet .price { font-size: 22px; font-weight: 700; }
.sheet .desc { color: var(--muted); margin: 0; }
.close { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--bg); color: var(--text); font-size: 22px; cursor: pointer; z-index: 2; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.order { display: grid; gap: 8px; margin-top: auto; position: sticky; bottom: 0; background: var(--bg);
  padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.hint { font-size: 12px; color: var(--muted); }

/* Подвал */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
footer .cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
footer b { color: var(--text); display: block; margin-bottom: 4px; }
footer a { color: var(--text); }
.demo-note { margin-top: 18px; font-size: 12px; }

/* Уведомление */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; z-index: 70; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; transition: .25s; max-width: 90vw; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Админка */
.admin-bar { background: #ffd84d; color: #111; font-size: 13px; }
.admin-bar .wrap { display: flex; gap: 10px; align-items: center; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.admin-bar .wrap > span { margin-right: auto; }
.admin-bar .btn { background: #111; color: #fff; }
.adm-edit { position: absolute; right: 8px; bottom: 8px; background: #ffd84d; color: #111; border-radius: 999px;
  padding: 5px 10px; font-size: 12px; font-weight: 700; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 11px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { background: #c0392b; color: #fff; }
