:root {
  /* молочно-бежевая палитра; тёмной темы нет — сайт всегда светлый */
  --bg: #f5f0e9;
  --surface: #fcfaf6;
  --text: #2a2622;
  --muted: #7d756b;
  --line: #e7e0d6;
  --placeholder: #ede7de;
  --accent: #2a2622;
  --accent-text: #fcfaf6;
  --danger: #a8321f;
  --ok: #3f6b3a;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(50, 40, 30, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.lock { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top__inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo {
  font-weight: 800; font-size: 22px; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 8px 14px; font-weight: 600;
}
.cart-btn__count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-size: 13px; display: inline-grid; place-items: center;
}

/* ---------- категории ---------- */
.cats {
  max-width: 1200px; width: 100%; margin: 0 auto; padding: 14px 16px 4px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: transparent;
  border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 15px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---------- сетка товаров ---------- */
.page { max-width: 1200px; width: 100%; margin: 0 auto; padding: 8px 16px 48px; flex: 1; }
.page__title { font-size: 28px; font-weight: 800; margin: 14px 0 18px; letter-spacing: -0.01em; }
.grid {
  display: grid; gap: 22px 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 32px 20px; } }
.state { grid-column: 1 / -1; color: var(--muted); padding: 40px 0; text-align: center; }

.card {
  display: flex; flex-direction: column; text-align: left;
  border: 0; padding: 0; background: transparent; min-width: 0;
}
.card__img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block;
  border-radius: var(--radius); background: var(--placeholder);
  transition: transform .35s ease;
}
.card:hover .card__img { transform: scale(1.015); }
.card__body { padding: 10px 2px 0; }
.card__name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.card__price { margin-top: 4px; font-weight: 700; }
.card__badge { margin-top: 4px; font-size: 13px; color: var(--muted); }
.card--out .card__img { opacity: .55; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }

.ph {
  display: grid; place-items: center;
  font-size: 46px; font-weight: 800; color: var(--muted); letter-spacing: .04em;
}

/* ---------- подвал ---------- */
.footer {
  border-top: 1px solid var(--line);
  max-width: 1200px; width: 100%; margin: 0 auto; padding: 28px 16px 40px;
  display: grid; gap: 14px; color: var(--muted); font-size: 15px;
}
.footer__name { color: var(--text); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.footer__contacts { white-space: pre-line; }
.tg-link {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  color: var(--text); font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
}

/* ---------- боковая панель ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(20, 18, 15, .45);
  opacity: 0; transition: opacity .25s ease;
}
.overlay.open { opacity: 1; }
.panel {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0;
  width: min(480px, 100%); background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
.panel.open { transform: none; visibility: visible; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel__title { margin: 0; font-size: 18px; font-weight: 700; }
.panel__body { flex: 1; overflow-y: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--placeholder); }

/* ---------- карточка товара ---------- */
.product__img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block;
  border-radius: var(--radius); background: var(--placeholder);
}
.product__name { font-size: 22px; font-weight: 800; margin: 16px 0 4px; line-height: 1.25; }
.product__price { font-size: 20px; font-weight: 700; }
.product__desc { color: var(--muted); margin: 12px 0 0; white-space: pre-line; }
.label { font-weight: 700; margin: 20px 0 10px; font-size: 15px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size {
  min-width: 52px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; font-weight: 600;
}
.size[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.size:disabled { color: var(--muted); text-decoration: line-through; cursor: not-allowed; opacity: .6; }
.note { min-height: 22px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.note--warn { color: var(--danger); }

.btn {
  width: 100%; border-radius: 12px; padding: 15px 18px; font-weight: 700; font-size: 16px;
  border: 1px solid var(--accent); background: transparent;
}
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn + .btn { margin-top: 10px; }
.actions { margin-top: 18px; }

/* ---------- корзина ---------- */
.line { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line__img { width: 72px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; background: var(--placeholder); font-size: 22px; }
.line__name { font-weight: 600; line-height: 1.3; }
.line__meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.line__price { font-weight: 700; white-space: nowrap; }
.qty { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 50%; font-size: 18px; line-height: 1; }
.qty button:disabled { opacity: .35; cursor: not-allowed; }
.qty span { min-width: 22px; text-align: center; font-weight: 600; }
.remove { border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 4px 0; margin-top: 6px; text-decoration: underline; }
.total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; margin: 18px 0 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0 20px; }

/* ---------- оформление ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field span { font-weight: 600; font-size: 14px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  padding: 12px 14px; font-size: 16px; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.summary { background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.summary b { color: var(--text); }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

.done { text-align: center; padding: 30px 0; }
.done__icon { width: 64px; height: 64px; border-radius: 50%; background: var(--placeholder); display: grid; place-items: center; margin: 0 auto 16px; }
.done__icon svg { width: 30px; height: 30px; stroke: var(--ok); stroke-width: 2.4; }
.done h3 { font-size: 22px; margin: 0 0 8px; }
.done p { color: var(--muted); margin: 0 0 22px; }

/* ---------- уведомление ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--accent); color: var(--accent-text);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
